Commit 0c8f8d6d by 裴大威

Merge branch 'feat-zyj-1002943' into 'master'

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

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