Commit 8829304c by 田超

Merge branch 'feature/1002913' into 'master'

feat: [1002913] 资讯管理优化平行分类标签问题

See merge request rays/pcloud-book!886
parents 9033e9dd 5794ca48
...@@ -23,6 +23,13 @@ import java.util.Map; ...@@ -23,6 +23,13 @@ import java.util.Map;
public interface AppletNewsBiz { public interface AppletNewsBiz {
/** /**
* 删除咨询标签
* @param id 咨询标签唯一标识
* @return
*/
void deleteCategoryById(Long id);
/**
* 新增资讯分类 * 新增资讯分类
* @param appletNewsClassify * @param appletNewsClassify
* @return * @return
......
...@@ -8,11 +8,13 @@ import com.pcloud.book.applet.biz.AppletUserBookcaseBiz; ...@@ -8,11 +8,13 @@ import com.pcloud.book.applet.biz.AppletUserBookcaseBiz;
import com.pcloud.book.applet.contants.AppletConstants; import com.pcloud.book.applet.contants.AppletConstants;
import com.pcloud.book.applet.dao.AppletBusinessCardDao; import com.pcloud.book.applet.dao.AppletBusinessCardDao;
import com.pcloud.book.applet.dao.AppletLinkClickDao; import com.pcloud.book.applet.dao.AppletLinkClickDao;
import com.pcloud.book.applet.dao.AppletNewsCategoryDao;
import com.pcloud.book.applet.dao.AppletNewsClassifyDao; import com.pcloud.book.applet.dao.AppletNewsClassifyDao;
import com.pcloud.book.applet.dao.AppletNewsCommentDao; import com.pcloud.book.applet.dao.AppletNewsCommentDao;
import com.pcloud.book.applet.dao.AppletNewsDao; import com.pcloud.book.applet.dao.AppletNewsDao;
import com.pcloud.book.applet.dao.AppletNewsServeDao; import com.pcloud.book.applet.dao.AppletNewsServeDao;
import com.pcloud.book.applet.dao.AppletUserBookcaseDao; import com.pcloud.book.applet.dao.AppletUserBookcaseDao;
import com.pcloud.book.applet.dto.AppletNewsCategoryDTO;
import com.pcloud.book.applet.dto.AppletNewsClassifyDTO; import com.pcloud.book.applet.dto.AppletNewsClassifyDTO;
import com.pcloud.book.applet.dto.AppletNewsCommentDTO; import com.pcloud.book.applet.dto.AppletNewsCommentDTO;
import com.pcloud.book.applet.dto.AppletNewsCustomTagDTO; import com.pcloud.book.applet.dto.AppletNewsCustomTagDTO;
...@@ -23,6 +25,7 @@ import com.pcloud.book.applet.dto.PvuvDTO; ...@@ -23,6 +25,7 @@ import com.pcloud.book.applet.dto.PvuvDTO;
import com.pcloud.book.applet.entity.AppletBusinessCard; import com.pcloud.book.applet.entity.AppletBusinessCard;
import com.pcloud.book.applet.entity.AppletLinkClick; import com.pcloud.book.applet.entity.AppletLinkClick;
import com.pcloud.book.applet.entity.AppletNews; import com.pcloud.book.applet.entity.AppletNews;
import com.pcloud.book.applet.entity.AppletNewsCategory;
import com.pcloud.book.applet.entity.AppletNewsClassify; import com.pcloud.book.applet.entity.AppletNewsClassify;
import com.pcloud.book.applet.entity.AppletNewsClassifyUser; import com.pcloud.book.applet.entity.AppletNewsClassifyUser;
import com.pcloud.book.applet.entity.AppletNewsComment; import com.pcloud.book.applet.entity.AppletNewsComment;
...@@ -61,6 +64,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -61,6 +64,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
...@@ -103,6 +107,13 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -103,6 +107,13 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
private AppletUserBookcaseDao appletUserBookcaseDao; private AppletUserBookcaseDao appletUserBookcaseDao;
@Autowired @Autowired
private AppletBusinessCardDao appletBusinessCardDao; private AppletBusinessCardDao appletBusinessCardDao;
@Autowired
private AppletNewsCategoryDao appletNewsCategoryDao;
@Override
public void deleteCategoryById(Long id) {
appletNewsCategoryDao.deleteById(id);
}
@Override @Override
public Long addAppletNewsClassify(AppletNewsClassify appletNewsClassify) { public Long addAppletNewsClassify(AppletNewsClassify appletNewsClassify) {
...@@ -157,14 +168,31 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -157,14 +168,31 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"新增时栏目不能为空"); throw new BookBizException(BookBizException.PARAM_IS_NULL,"新增时栏目不能为空");
} }
appletNews.setShowState(false); appletNews.setShowState(false);
rightsSettingBiz.setClassifyAndLabel(appletNews); // rightsSettingBiz.setClassifyAndLabel(appletNews);
appletNewsDao.insert(appletNews); appletNewsDao.insert(appletNews);
//保存咨询类别
this.saveAppletNewsCategory(appletNews.getAppletNewsCategoryList(), appletNews.getId());
// 保存选取的服务 // 保存选取的服务
this.saveAppletNewsServe(appletNews.getAppletNewsServeList(), appletNews.getId()); this.saveAppletNewsServe(appletNews.getAppletNewsServeList(), appletNews.getId());
this.updateSource(null,appletNews.getSource()); this.updateSource(null,appletNews.getSource());
return appletNews.getId(); return appletNews.getId();
} }
private void saveAppletNewsCategory(List<AppletNewsCategory> categoryList, Long newsId) {
if (ListUtils.isEmpty(categoryList)) {
return;
}
appletNewsCategoryDao.deletebyNewsId(newsId);
for (AppletNewsCategory category : categoryList) {
rightsSettingBiz.setClassifyAndLabel(category);
category.setAppletNewId(newsId);
}
appletNewsCategoryDao.batchCreate(categoryList);
}
/** /**
* 保存选取的服务 * 保存选取的服务
* @param appletNewsServeList * @param appletNewsServeList
...@@ -231,7 +259,10 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -231,7 +259,10 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
rightsSettingBiz.setClassifyAndLabel(appletNews); rightsSettingBiz.setClassifyAndLabel(appletNews);
appletNewsDao.update(appletNews); appletNewsDao.update(appletNews);
this.saveAppletNewsServe(appletNews.getAppletNewsServeList(), appletNews.getId()); this.saveAppletNewsServe(appletNews.getAppletNewsServeList(), appletNews.getId());
this.updateSource(beforeNews.getSource(),appletNews.getSource()); this.updateSource(beforeNews.getSource(), appletNews.getSource());
//保存咨询分类
this.saveAppletNewsCategory(appletNews.getAppletNewsCategoryList(), appletNews.getId());
JedisClusterUtils.del(AppletConstants.HOME_NEWS_LIST); JedisClusterUtils.del(AppletConstants.HOME_NEWS_LIST);
} }
...@@ -281,11 +312,14 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -281,11 +312,14 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
} }
fillLabel(pageBeanNew.getRecordList()); fillLabel(pageBeanNew.getRecordList());
setLabelContent(pageBeanNew.getRecordList()); setLabelContent(pageBeanNew.getRecordList());
//填充咨询分类
fillCategory(pageBeanNew.getRecordList());
return pageBeanNew; return pageBeanNew;
} }
private void fillLabel(List<AppletNewsDTO> recordList) { private void fillLabel(List<AppletNewsDTO> recordList) {
if (ListUtils.isEmpty(recordList)){ if (ListUtils.isEmpty(recordList)) {
return; return;
} }
List<Long> labelIds = new ArrayList<>(); List<Long> labelIds = new ArrayList<>();
...@@ -505,13 +539,54 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -505,13 +539,54 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
this.fillBrowseCount(Lists.newArrayList(appletNewsDTO)); this.fillBrowseCount(Lists.newArrayList(appletNewsDTO));
fillLabel(Arrays.asList(appletNewsDTO)); fillLabel(Arrays.asList(appletNewsDTO));
//填充类别集合
fillCategory(Arrays.asList(appletNewsDTO));
fillBusinessCard(appletNewsDTO); fillBusinessCard(appletNewsDTO);
return appletNewsDTO; return appletNewsDTO;
} }
private void fillBusinessCard(AppletNewsDTO appletNewsDTO){ private void fillCategory(List<AppletNewsDTO> appletNewsDTOList) {
if(null != appletNewsDTO.getBusinessCardId()){ if(ListUtils.isEmpty(appletNewsDTOList)){
return;
}
for (AppletNewsDTO newsDTO : appletNewsDTOList) {
Long newsId = newsDTO.getId();
List<AppletNewsCategoryDTO> newsCategoryDTOList = appletNewsCategoryDao.getByNewsId(newsId);
if (ListUtils.isEmpty(newsCategoryDTOList)) {
return;
}
List<Long> firstClassifyIds = newsCategoryDTOList.stream().map(AppletNewsCategoryDTO::getFirstClassify)
.collect(
Collectors.toList());
List<Long> secondClassifyIds = newsCategoryDTOList.stream().map(AppletNewsCategoryDTO::getSecondClassify)
.collect(
Collectors.toList());
List<Long> classifyIds = firstClassifyIds;
classifyIds.addAll(secondClassifyIds);
classifyIds.removeAll(Collections.singleton(null));
Map<Long, AssistTempletDTO> classifyMap = assistTempletConsr.mapByIds4Classify(classifyIds);
for (AppletNewsCategoryDTO categoryDTO : newsCategoryDTOList) {
AssistTempletDTO templetDTO = classifyMap.get(categoryDTO.getFirstClassify());
if (templetDTO != null) {
categoryDTO.setFirstClassifyName(templetDTO.getTempletName());
}
templetDTO = classifyMap.get(categoryDTO.getSecondClassify());
if (templetDTO != null) {
categoryDTO.setSecondClassifyName(templetDTO.getTempletName());
}
}
newsDTO.setCategoryList(newsCategoryDTOList);
}
}
private void fillBusinessCard(AppletNewsDTO appletNewsDTO) {
if (null != appletNewsDTO.getBusinessCardId()) {
AppletBusinessCard appletBusinessCard = appletBusinessCardDao.getById(appletNewsDTO.getBusinessCardId()); AppletBusinessCard appletBusinessCard = appletBusinessCardDao.getById(appletNewsDTO.getBusinessCardId());
if (appletBusinessCard == null){ if (appletBusinessCard == null){
appletNewsDTO.setBusinessCardId(null); appletNewsDTO.setBusinessCardId(null);
...@@ -611,10 +686,15 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -611,10 +686,15 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
if(appletNewsClassifyVO == null || ListUtils.isEmpty(appletNewsClassifyVO.getAppletNewsIds())){ if(appletNewsClassifyVO == null || ListUtils.isEmpty(appletNewsClassifyVO.getAppletNewsIds())){
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "参数为空"); throw new BizException(BizException.PARAM_IS_NULL.getCode(), "参数为空");
} }
if(!NumberUtil.isNumber(appletNewsClassifyVO.getFirstClassify()) ){ if (ListUtils.isEmpty(appletNewsClassifyVO.getCategoryDTOList())) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "请选择一级分类"); throw new BizException(BizException.PARAM_IS_NULL.getCode(), "请选择分类");
} }
rightsSettingBiz.setClassifyAndLabel(appletNewsClassifyVO); rightsSettingBiz.setClassifyAndLabel(appletNewsClassifyVO);
for (Long id : appletNewsClassifyVO.getAppletNewsIds()){
this.saveAppletNewsCategory(appletNewsClassifyVO.getCategoryDTOList(), id);
}
appletNewsDao.batchUpdateClassify(appletNewsClassifyVO); appletNewsDao.batchUpdateClassify(appletNewsClassifyVO);
} }
...@@ -734,10 +814,13 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -734,10 +814,13 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
paramMap.put("source", source); paramMap.put("source", source);
PageBeanNew<AppletNewsDTO> pageBeanNew = appletNewsDao.listPageNew( PageBeanNew<AppletNewsDTO> pageBeanNew = appletNewsDao.listPageNew(
new PageParam(currentPage,numPerPage) ,paramMap,"listAppletNews4Analysis"); new PageParam(currentPage, numPerPage), paramMap, "listAppletNews4Analysis");
if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())){
return new PageBeanNew<>(currentPage,numPerPage,0,new ArrayList<>()); if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
} }
fillCategory(pageBeanNew.getRecordList()); //填充咨询适用类别
setLabelContent(pageBeanNew.getRecordList()); setLabelContent(pageBeanNew.getRecordList());
fillStatistic(pageBeanNew.getRecordList(),browseQty,clickQty); fillStatistic(pageBeanNew.getRecordList(),browseQty,clickQty);
return pageBeanNew; return pageBeanNew;
......
package com.pcloud.book.applet.dao;
import java.util.List;
import com.pcloud.book.applet.dto.AppletNewsCategoryDTO;
import com.pcloud.book.applet.dto.AppletNewsClassifyDTO;
import com.pcloud.book.applet.entity.AppletNewsCategory;
import com.pcloud.book.applet.entity.AppletNewsClassify;
import com.pcloud.book.applet.entity.AppletNewsClassifyUser;
import com.pcloud.common.core.dao.BaseDao;
public interface AppletNewsCategoryDao extends BaseDao<AppletNewsCategory> {
void batchCreate(List<AppletNewsCategory> categoryList);
void deletebyNewsId(Long appletNewsId);
List<AppletNewsCategoryDTO> getByNewsId(Long appletNewsId);
}
package com.pcloud.book.applet.dao.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Component;
import com.pcloud.book.applet.dao.AppletNewsCategoryDao;
import com.pcloud.book.applet.dao.AppletNewsClassifyDao;
import com.pcloud.book.applet.dto.AppletNewsCategoryDTO;
import com.pcloud.book.applet.dto.AppletNewsClassifyDTO;
import com.pcloud.book.applet.entity.AppletNewsCategory;
import com.pcloud.book.applet.entity.AppletNewsClassify;
import com.pcloud.book.applet.entity.AppletNewsClassifyUser;
import com.pcloud.common.core.dao.BaseDaoImpl;
@Component
public class AppletNewsCategoryDaoImpl extends BaseDaoImpl<AppletNewsCategory> implements AppletNewsCategoryDao {
@Override
public void batchCreate(List<AppletNewsCategory> categoryList) {
getSessionTemplate().insert(getStatement("batchCreate"), categoryList);
}
@Override
public void deletebyNewsId(Long appletNewsId) {
getSessionTemplate().delete(getStatement("deletebyNewsId"), appletNewsId);
}
@Override
public List<AppletNewsCategoryDTO> getByNewsId(Long appletNewsId) {
return getSessionTemplate().selectList(getStatement("getByNewsId"),appletNewsId);
}
}
package com.pcloud.book.applet.dto;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel("小程序资讯类别")
public class AppletNewsCategoryDTO extends BaseDto {
@ApiModelProperty("主键")
private Long id;
@ApiModelProperty("第一级类型标识")
private Long firstClassify;
private String firstClassifyName;
@ApiModelProperty("第二级类型标识")
private Long secondClassify;
private String secondClassifyName;
@ApiModelProperty("年级标签id")
private Long gradeLabelId;
private String gradeLabelName;
@ApiModelProperty("科目标签id")
private Long subjectLabelId;
private String subjectLabelName;
}
...@@ -57,6 +57,12 @@ public class AppletNewsDTO extends BaseDto { ...@@ -57,6 +57,12 @@ public class AppletNewsDTO extends BaseDto {
) )
protected Date createTime; protected Date createTime;
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
protected Date updateTime;
@ApiModelProperty("第一级类型标识") @ApiModelProperty("第一级类型标识")
private Long firstClassify; private Long firstClassify;
@ApiModelProperty("第二级类型标识") @ApiModelProperty("第二级类型标识")
...@@ -123,4 +129,7 @@ public class AppletNewsDTO extends BaseDto { ...@@ -123,4 +129,7 @@ public class AppletNewsDTO extends BaseDto {
@ApiModelProperty("点击量pv") @ApiModelProperty("点击量pv")
private Integer clickCount; private Integer clickCount;
@ApiModelProperty("类别")
private List<AppletNewsCategoryDTO> categoryList;
} }
...@@ -101,4 +101,7 @@ public class AppletNews extends BaseTempletClassify { ...@@ -101,4 +101,7 @@ public class AppletNews extends BaseTempletClassify {
@ApiModelProperty("选取的服务") @ApiModelProperty("选取的服务")
List<AppletNewsServe> appletNewsServeList; List<AppletNewsServe> appletNewsServeList;
@ApiModelProperty("咨询类别")
List<AppletNewsCategory> appletNewsCategoryList;
} }
package com.pcloud.book.applet.entity;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
import org.hibernate.validator.constraints.Length;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("小程序资讯类别")
public class AppletNewsCategory extends BaseTempletClassify {
@ApiModelProperty("主键")
private Long id;
@ApiModelProperty("咨询标签")
private Long appletNewId;
@ApiModelProperty("创建人")
private Long creator;
@ApiModelProperty("创建时间")
private Date createTime;
}
...@@ -99,6 +99,15 @@ public class AppletHomeFacade { ...@@ -99,6 +99,15 @@ public class AppletHomeFacade {
} }
@ApiOperation("删除咨询标签")
@PostMapping("deleteCategoryById")
public ResponseDto<?> deleteCategoryById(@RequestHeader("token") String token, @RequestParam("id") @ApiParam("咨询id") Long id) {
SessionUtil.getInfoToken4Redis(token);
appletNewsBiz.deleteCategoryById(id);
return new ResponseDto<>();
}
@ApiOperation("新增书单栏目") @ApiOperation("新增书单栏目")
@PostMapping("addBooklistClassify") @PostMapping("addBooklistClassify")
public ResponseDto<Long> addBooklistClassify( public ResponseDto<Long> addBooklistClassify(
......
package com.pcloud.book.applet.vo; package com.pcloud.book.applet.vo;
import com.pcloud.book.applet.dto.AppletNewsCategoryDTO;
import com.pcloud.book.applet.entity.AppletNewsCategory;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify; import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable; import java.io.Serializable;
...@@ -25,4 +27,7 @@ public class AppletNewsClassifyVO extends BaseTempletClassify { ...@@ -25,4 +27,7 @@ public class AppletNewsClassifyVO extends BaseTempletClassify {
@ApiModelProperty("资讯栏目id") @ApiModelProperty("资讯栏目id")
private Long newsClassifyId; private Long newsClassifyId;
@ApiModelProperty("分类集合")
private List<AppletNewsCategory> categoryDTOList;
} }
...@@ -1710,7 +1710,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1710,7 +1710,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
} }
// 填充群 // 填充群
List<RightsNowItem> items = new ArrayList<>(); List<RightsNowItem> items = new ArrayList<>();
List<GroupActivity4AppletDTO> collageList = supplementGroup(rightsSettingId, wechatUserId, rightsSettingItem.getRightsClassifyId(), top,items, bookId,rightsType); List<GroupActivity4AppletDTO> collageList = supplementGroup(rightsSettingId, wechatUserId, rightsSettingItem.getRightsClassifyId(), top,items, bookId,rightsType,
readType);
if (!ListUtils.isEmpty(collageList)){ if (!ListUtils.isEmpty(collageList)){
for (GroupActivity4AppletDTO item :collageList){ for (GroupActivity4AppletDTO item :collageList){
rightsSettingItem.getGroupActivity4AppletList().add(item); rightsSettingItem.getGroupActivity4AppletList().add(item);
...@@ -1978,7 +1979,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1978,7 +1979,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
rightsSetting.setGroupServiceTitle(rightsSettingTitle); rightsSetting.setGroupServiceTitle(rightsSettingTitle);
} else { } else {
processNowItems4Group(rightsSettingTitle, nowItems, RightsNowItemTypeNew.GROUP_SERVICE, rightsSetting.getId(), wechatUserId, processNowItems4Group(rightsSettingTitle, nowItems, RightsNowItemTypeNew.GROUP_SERVICE, rightsSetting.getId(), wechatUserId,
Long.valueOf(RightsNowItemTypeNew.GROUP_SERVICE.value), BookConstant.MAX_NEWS_COUNT_GROUP, bookId); Long.valueOf(RightsNowItemTypeNew.GROUP_SERVICE.value), BookConstant.MAX_NEWS_COUNT_GROUP, bookId,readType);
rightsSetting.setGroupServiceTitle(rightsSettingTitle); rightsSetting.setGroupServiceTitle(rightsSettingTitle);
} }
...@@ -1988,7 +1989,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1988,7 +1989,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
private void processNowItems4Group(RightsSettingTitle rightsSettingTitle, List<RightsNowItem> nowItems, RightsNowItemTypeNew itemType, private void processNowItems4Group(RightsSettingTitle rightsSettingTitle, List<RightsNowItem> nowItems, RightsNowItemTypeNew itemType,
Long rightsSettingId, Long wechatUserId, Long rightsClassifyId, Long rightsSettingId, Long wechatUserId, Long rightsClassifyId,
Integer top, Long bookId) { Integer top, Long bookId, Integer readType) {
if (null == rightsSettingTitle || null == rightsSettingTitle.getRightsSettingId()) { if (null == rightsSettingTitle || null == rightsSettingTitle.getRightsSettingId()) {
return; return;
} }
...@@ -1998,7 +1999,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1998,7 +1999,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (CollectionUtils.isEmpty(nowItems) && rightsSettingTitle.getCollageState()!= null && rightsSettingTitle.getCollageState().intValue() == collage.intValue()) { if (CollectionUtils.isEmpty(nowItems) && rightsSettingTitle.getCollageState()!= null && rightsSettingTitle.getCollageState().intValue() == collage.intValue()) {
// 填充群 // 填充群
supplementGroup(rightsSettingId, wechatUserId, rightsClassifyId, top, items,bookId,null); supplementGroup(rightsSettingId, wechatUserId, rightsClassifyId, top, items,bookId,null,readType);
// 处理权益中的应用/作品 // 处理权益中的应用/作品
fillProductAndApp(items); fillProductAndApp(items);
rightsSettingTitle.setRightsSettingItemList(items); rightsSettingTitle.setRightsSettingItemList(items);
...@@ -2017,14 +2018,16 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -2017,14 +2018,16 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (items.size() < top && rightsSettingTitle.getCollageState()!= null && rightsSettingTitle.getCollageState().intValue() == collage.intValue()) { if (items.size() < top && rightsSettingTitle.getCollageState()!= null && rightsSettingTitle.getCollageState().intValue() == collage.intValue()) {
// 填充咨询 // 填充咨询
supplementGroup(rightsSettingId, wechatUserId, rightsClassifyId, top, items, bookId,null); supplementGroup(rightsSettingId, wechatUserId, rightsClassifyId, top, items, bookId,null, readType);
} }
// 处理权益中的应用/作品 // 处理权益中的应用/作品
fillProductAndApp(items); fillProductAndApp(items);
rightsSettingTitle.setRightsSettingItemList(items); rightsSettingTitle.setRightsSettingItemList(items);
} }
private List<GroupActivity4AppletDTO> supplementGroup(Long rightsSettingId, Long wechatUserId, Long rightsClassifyId, Integer top, List<RightsNowItem> items, Long bookId,String rightsType) { private List<GroupActivity4AppletDTO> supplementGroup(Long rightsSettingId, Long wechatUserId,
Long rightsClassifyId, Integer top, List<RightsNowItem> items, Long bookId, String rightsType,
Integer readType) {
// 书刊分类 // 书刊分类
List<GroupActivity4AppletDTO> groupActivity4AppletDTOList = null; List<GroupActivity4AppletDTO> groupActivity4AppletDTOList = null;
BookAdviserDto bookAdviserDto = bookAdviserBiz.getOneMainBook(bookId); BookAdviserDto bookAdviserDto = bookAdviserBiz.getOneMainBook(bookId);
...@@ -2062,7 +2065,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -2062,7 +2065,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
} }
} }
}else { //立享权益 }else { //立享权益
RightsSettingTitle rightsSettingTitle = rightsSettingTitleMapper.getByRightSettingIdAndType(rightsSettingId, 6,null); RightsSettingTitle rightsSettingTitle = rightsSettingTitleMapper.getByRightSettingIdAndType(rightsSettingId, RightsNowItemTypeNew.GROUP_SERVICE.value,readType);
// List<RightsSettingTitle> rightsSettingTitles = rightsSettingTitleMapper.getByRightSettingId(rightsSettingId, null); // List<RightsSettingTitle> rightsSettingTitles = rightsSettingTitleMapper.getByRightSettingId(rightsSettingId, null);
// Iterator<RightsSettingTitle> it = rightsSettingTitles.iterator(); // Iterator<RightsSettingTitle> it = rightsSettingTitles.iterator();
// while(it.hasNext()){ // while(it.hasNext()){
...@@ -2604,6 +2607,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -2604,6 +2607,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
map.put("rightsType", null); map.put("rightsType", null);
page = appletNewsDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getPageByNewsByTempletLabel"); page = appletNewsDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getPageByNewsByTempletLabel");
if (Objects.nonNull(page) && CollUtil.isNotEmpty(page.getRecordList())) { if (Objects.nonNull(page) && CollUtil.isNotEmpty(page.getRecordList())) {
appletNewsDTOS = page; appletNewsDTOS = page;
} }
} }
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.applet.dao.impl.AppletNewsCategoryDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.applet.entity.AppletNewsCategory">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="applet_news_id" property="appletNewId" jdbcType="BIGINT"/>
<result column="creator" property="creator" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="first_classify" property="firstClassify" jdbcType="BIGINT"/>
<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"/>
</resultMap>
<sql id="Base_Column_List">
id, applet_news_id, creator, create_time, first_classify,second_classify, grade_label_id, subject_label_id
</sql>
<insert id="insert" parameterType="com.pcloud.book.applet.entity.AppletNewsCategory" useGeneratedKeys="true"
keyProperty="id">
insert into applet_news_category (
applet_news_id, creator, create_time, first_classify,second_classify, grade_label_id, subject_label_id
)
values (
#{appletNewId}, #{creator}, NOW(), #{firstClassify}, #{secondClassify}, #{gradeLabelId}, #{subjectLabelId}
)
</insert>
<insert id="batchCreate" parameterType="list" keyProperty="id" useGeneratedKeys="true">
insert into applet_news_category (
applet_news_id, creator, create_time, first_classify,second_classify, grade_label_id, subject_label_id)
values
<foreach collection="list" item="item" index="index" separator=",">
( #{item.appletNewId}, #{item.creator}, NOW(), #{item.firstClassify}, #{item.secondClassify},
#{item.gradeLabelId}, #{item.subjectLabelId} )
</foreach>
</insert>
<update id="update" parameterType="com.pcloud.book.applet.entity.AppletNewsCategory">
update applet_news_category
<set>
<if test="firstClassify != null">
first_classify = #{firstClassify,jdbcType=BIGINT},
</if>
<if test="secondClassify != null">
second_classify = #{secondClassify,jdbcType=BIGINT},
</if>
<if test="gradeLabelId != null">
grade_label_id = #{gradeLabelId,jdbcType=BIGINT},
</if>
<if test="subjectLabelId != null">
subject_label_id = #{subjectLabelId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<select id="getByNewsId" parameterType="long" resultType="com.pcloud.book.applet.dto.AppletNewsCategoryDTO">
select
category.id,
category.applet_news_id,
category.first_classify firstClassify,
category.second_classify secondClassify,
category.grade_label_id gradeLabelId,
category.subject_label_id subjectLabelId,
label.name gradeLabelName,
label2.name subjectLabelName
from applet_news_category category
LEFT JOIN book_label label ON category.grade_label_id = label.id
LEFT JOIN book_label label2 ON category.subject_label_id = label2.id
where applet_news_id=#{appletNewId}
</select>
<delete id="deleteById" parameterType="long">
delete from applet_news_category
where id=#{id}
</delete>
<delete id="deletebyNewsId" parameterType="long">
DELETE FROM applet_news_category
WHERE applet_news_id = #{appletNewId}
</delete>
</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