Commit 335080d4 by 朱亚洁

1002943管理端资讯权益分类作为二级菜单交互优化

parent cd78a1da
......@@ -210,4 +210,12 @@ public interface AppletNewsBiz {
* @return
*/
Map<Long, AppletNewsDTO> getByIds(List<Long> appletNewsId);
/**
* 批量修改资讯栏目
* @author:zhuyajie
* @date:2020/5/26
* * @param null
*/
void batchUpdateNewsClassify(AppletNewsClassifyVO appletNewsClassifyVO);
}
......@@ -608,4 +608,15 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
return list;
}
@Override
public void batchUpdateNewsClassify(AppletNewsClassifyVO appletNewsClassifyVO) {
if (appletNewsClassifyVO == null || ListUtils.isEmpty(appletNewsClassifyVO.getAppletNewsIds())) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "参数为空");
}
if (null == appletNewsClassifyVO.getNewsClassifyId()) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "请选择资讯栏目");
}
appletNewsDao.batchUpdateNewsClassify(appletNewsClassifyVO);
}
}
......@@ -84,4 +84,12 @@ public interface AppletNewsDao extends BaseDao<AppletNews> {
Boolean urlNumberExist(String jumpUrl, String urlNumber, Long id);
Map<Long, AppletNewsDTO> getByIds(List<Long> appletNewsIds);
/**
* 批量修改资讯栏目
* @author:zhuyajie
* @date:2020/5/26 19:07
* * @param null
*/
void batchUpdateNewsClassify(AppletNewsClassifyVO appletNewsClassifyVO);
}
......@@ -87,6 +87,7 @@ public class AppletNewsDaoImpl extends BaseDaoImpl<AppletNews> implements Applet
map.put("gradeLabelId", appletNewsClassifyVO.getGradeLabelId());
map.put("subjectLabelId", appletNewsClassifyVO.getSubjectLabelId());
map.put("rightsClassifyId", appletNewsClassifyVO.getRightsClassifyId());
map.put("newsClassifyId", appletNewsClassifyVO.getNewsClassifyId());
getSessionTemplate().update(getStatement("batchUpdateClassify"), map);
}
......@@ -122,4 +123,12 @@ public class AppletNewsDaoImpl extends BaseDaoImpl<AppletNews> implements Applet
return this.getSqlSession().selectMap(getStatement("getByIds"), list, "id");
}
@Override
public void batchUpdateNewsClassify(AppletNewsClassifyVO appletNewsClassifyVO) {
Map<String,Object> map = new HashMap<>();
map.put("ids", appletNewsClassifyVO.getAppletNewsIds());
map.put("newsClassifyId", appletNewsClassifyVO.getNewsClassifyId());
getSessionTemplate().update(getStatement("batchUpdateNewsClassify"), map);
}
}
......@@ -798,6 +798,17 @@ public class AppletHomeFacade {
AppletUserBookcase appletUserBookcase = appletUserBookcaseBiz.getUserReadType(wechatUserId,bookId,adviserId,channelId);
return new ResponseDto<>(appletUserBookcase);
}
@ApiOperation("批量修改资讯所属栏目")
@PostMapping("batchUpdateNewsClassify")
public ResponseDto<?> batchUpdateNewsClassify(
@RequestHeader("token") String token,
@RequestBody AppletNewsClassifyVO appletNewsClassifyVO
) throws PermissionException {
SessionUtil.getInfoToken4Redis(token);
appletNewsBiz.batchUpdateNewsClassify(appletNewsClassifyVO);
return new ResponseDto<>();
}
}
......
......@@ -22,4 +22,7 @@ public class AppletNewsClassifyVO extends BaseTempletClassify {
@ApiModelProperty("权益分类id")
private Long rightsClassifyId;
@ApiModelProperty("资讯栏目id")
private Long newsClassifyId;
}
......@@ -2,7 +2,6 @@ package com.pcloud.book.rightsSetting.biz.impl;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.appcenter.assist.dto.AssistTempletDTO;
......@@ -55,7 +54,6 @@ import com.pcloud.book.rightsSetting.entity.RightsCustomRelation;
import com.pcloud.book.rightsSetting.entity.RightsItemGroup;
import com.pcloud.book.rightsSetting.entity.RightsNowItem;
import com.pcloud.book.rightsSetting.entity.RightsNowPic;
import com.pcloud.book.rightsSetting.entity.RightsReadPlan;
import com.pcloud.book.rightsSetting.entity.RightsReadType;
import com.pcloud.book.rightsSetting.entity.RightsSetting;
import com.pcloud.book.rightsSetting.entity.RightsSettingBookRelation;
......@@ -73,7 +71,6 @@ import com.pcloud.book.rightsSetting.mapper.RightsSettingTitleMapper;
import com.pcloud.book.skill.biz.PcloudGroupActivityBiz;
import com.pcloud.book.skill.dao.PcloudGroupActivityDao;
import com.pcloud.book.skill.dto.GroupActivity4AppletDTO;
import com.pcloud.book.util.common.YesOrNoEnums;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.page.PageBeanNew;
......@@ -88,7 +85,6 @@ import com.pcloud.resourcecenter.product.dto.ProductDto;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -101,11 +97,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Random;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.extern.slf4j.Slf4j;
......@@ -221,6 +215,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (!contain4K12) {
baseTempletClassify.setGradeLabelId(null);
baseTempletClassify.setSubjectLabelId(null);
}
if (!ArrayUtils.contains(RightsSettingConstant.K12_VOLUME_ID, baseTempletClassify.getFirstClassify())){
baseTempletClassify.setVolLabelId(null);
}
}
......@@ -1132,27 +1128,24 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (ListUtils.isEmpty(rightsSettingDtos)) {
return;
}
List<Long> firstClassifyIds;
List<Long> secondClassifyIds;
List<Long> classifyIds = new ArrayList<>();
List<Long> gradeLabelIds;
List<Long> subjectLabelIds;
List<Long> labelIds = new ArrayList<>();
firstClassifyIds = rightsSettingDtos.stream().map(RightsSetting::getFirstClassify).collect(Collectors.toList());
secondClassifyIds = rightsSettingDtos.stream().map(RightsSetting::getSecondClassify).collect(Collectors.toList());
gradeLabelIds = rightsSettingDtos.stream().map(RightsSetting::getGradeLabelId).collect(Collectors.toList());
subjectLabelIds = rightsSettingDtos.stream().map(RightsSetting::getSubjectLabelId).collect(Collectors.toList());
if (!ListUtils.isEmpty(firstClassifyIds)) {
classifyIds.addAll(firstClassifyIds);
}
if (!ListUtils.isEmpty(secondClassifyIds)) {
classifyIds.addAll(secondClassifyIds);
}
if (!ListUtils.isEmpty(gradeLabelIds)) {
labelIds.addAll(gradeLabelIds);
}
if (!ListUtils.isEmpty(subjectLabelIds)) {
labelIds.addAll(subjectLabelIds);
for (RightsSettingDto rightsSettingDto : rightsSettingDtos) {
if (null != rightsSettingDto.getFirstClassify()) {
classifyIds.add(rightsSettingDto.getFirstClassify());
}
if (null != rightsSettingDto.getSecondClassify()) {
classifyIds.add(rightsSettingDto.getSecondClassify());
}
if (null != rightsSettingDto.getGradeLabelId()) {
labelIds.add(rightsSettingDto.getGradeLabelId());
}
if (null != rightsSettingDto.getSubjectLabelId()) {
labelIds.add(rightsSettingDto.getSubjectLabelId());
}
if (null != rightsSettingDto.getVolLabelId()) {
labelIds.add(rightsSettingDto.getVolLabelId());
}
}
Map<Long, AssistTempletDTO> classifyMap = new HashMap<>();
Map<Long, BookLabel> labelMap = new HashMap<>();
......@@ -1175,6 +1168,9 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (!MapUtils.isEmpty(labelMap) && labelMap.containsKey(rightsSettingDto.getSubjectLabelId())) {
rightsSettingDto.setSubjectLabelIdContent(labelMap.get(rightsSettingDto.getSubjectLabelId()).getName());
}
if (!MapUtils.isEmpty(labelMap) && labelMap.containsKey(rightsSettingDto.getVolLabelId())) {
rightsSettingDto.setVolLabelContent(labelMap.get(rightsSettingDto.getVolLabelId()).getName());
}
}
}
......@@ -1194,6 +1190,9 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
secondClassify = null;
subjectLabelId = null;
gradeLabelId = null;
}
//上下册分类校验
if (!ArrayUtils.contains(RightsSettingConstant.K12_VOLUME_ID, firstClassify)){
volLabelId = null;
}
RightsSettingDto dto = rightsSettingDAO.getByLabel(firstClassify, secondClassify, gradeLabelId, subjectLabelId, volLabelId);
......
......@@ -14,6 +14,10 @@ public class RightsSettingConstant {
*/
public static final Long[] K12_TEMPLET_ID_TEST = {48L, 59L, 46L, 40L, 65L, 60L, 136L, 73L};
/**
* 所属k12教育的书刊分类id---有上下册分类
*/
public static final Long[] K12_VOLUME_ID = {48L, 59L, 46L, 40L, 65L};
/**
* 医疗保健编辑书刊分类id
*/
public static final Long[] MEDICAL_INSURANCE_TEMPLET_ID = {63L};
......
......@@ -26,4 +26,6 @@ public class RightsSettingDto extends RightsSetting {
* 当前选择的读书类型
*/
private Integer chooseReadType;
private String volLabelContent;
}
......@@ -258,6 +258,9 @@
grade_label_id = #{gradeLabelId,jdbcType=BIGINT},
subject_label_id = #{subjectLabelId,jdbcType=BIGINT},
rights_classify_id = #{rightsClassifyId,jdbcType=BIGINT},
<if test="newsClassifyId != null">
news_classify_id = #{newsClassifyId},
</if>
update_time=NOW()
WHERE id IN
<foreach collection="ids" item="item" separator="," open="(" close=")" >
......@@ -465,4 +468,16 @@
</choose>
</select>
<update id="batchUpdateNewsClassify" parameterType="map">
UPDATE applet_news
SET
news_classify_id = #{newsClassifyId},
update_time=NOW()
WHERE id IN
<foreach collection="ids" item="item" separator="," open="(" close=")" >
${item}
</foreach>
</update>
</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