Commit 9955a5b1 by 郑永强

【1002925】书刊权益配置支持独立选择配置资讯功能

parent 16c932de
...@@ -13,6 +13,7 @@ import com.pcloud.book.applet.vo.AppletNewsShowStateVO; ...@@ -13,6 +13,7 @@ import com.pcloud.book.applet.vo.AppletNewsShowStateVO;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 小程序资讯 * 小程序资讯
...@@ -74,7 +75,7 @@ public interface AppletNewsBiz { ...@@ -74,7 +75,7 @@ public interface AppletNewsBiz {
*/ */
PageBeanNew<AppletNewsDTO> listAppletNews(Integer currentPage, Integer numPerPage, String name, PageBeanNew<AppletNewsDTO> listAppletNews(Integer currentPage, Integer numPerPage, String name,
Long firstClassify,Long secondClassify,Long gradeLabelId, Long firstClassify,Long secondClassify,Long gradeLabelId,
Long subjectLabelId,Long rightsClassifyId,String source, Long newsClassifyId); Long subjectLabelId,Long rightsClassifyId,String source,Integer showState, Long newsClassifyId);
/** /**
* 获取所有资讯栏目 * 获取所有资讯栏目
...@@ -202,4 +203,11 @@ public interface AppletNewsBiz { ...@@ -202,4 +203,11 @@ public interface AppletNewsBiz {
PageBeanNew<AppletNewsDTO> listAppletNews4Analysis(Integer currentPage, Integer numPerPage, String name, PageBeanNew<AppletNewsDTO> listAppletNews4Analysis(Integer currentPage, Integer numPerPage, String name,
Long firstClassify,Long secondClassify,Long gradeLabelId, Long firstClassify,Long secondClassify,Long gradeLabelId,
Long subjectLabelId,Integer linkOnly,Long rightsClassifyId); Long subjectLabelId,Integer linkOnly,Long rightsClassifyId);
/**
*
* @param appletNewsId
* @return
*/
Map<Long, AppletNewsDTO> getByIds(List<Long> appletNewsId);
} }
...@@ -148,11 +148,12 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -148,11 +148,12 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
@Override @Override
public PageBeanNew<AppletNewsDTO> listAppletNews(Integer currentPage, Integer numPerPage, String name, public PageBeanNew<AppletNewsDTO> listAppletNews(Integer currentPage, Integer numPerPage, String name,
Long firstClassify,Long secondClassify,Long gradeLabelId, Long firstClassify,Long secondClassify,Long gradeLabelId,
Long subjectLabelId,Long rightsClassifyId,String source, Long newsClassifyId) { Long subjectLabelId,Long rightsClassifyId,String source,Integer showState, Long newsClassifyId) {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("name", name); paramMap.put("name", name);
paramMap.put("rightsClassifyId", rightsClassifyId); paramMap.put("rightsClassifyId", rightsClassifyId);
paramMap.put("source", source); paramMap.put("source", source);
paramMap.put("showState", showState);
paramMap.put("newsClassifyId", newsClassifyId); paramMap.put("newsClassifyId", newsClassifyId);
//处理分类 //处理分类
if (null!=firstClassify){ if (null!=firstClassify){
...@@ -525,6 +526,14 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -525,6 +526,14 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
} }
@Override @Override
public Map<Long, AppletNewsDTO> getByIds(List<Long> appletNewsIds) {
if(ListUtils.isEmpty(appletNewsIds)){
new HashMap<>();
}
return appletNewsDao.getByIds(appletNewsIds);
}
@Override
public void addUserNewsClassify(List<Long> newsClassifyIds, Long wechatUserId) { public void addUserNewsClassify(List<Long> newsClassifyIds, Long wechatUserId) {
if (null == wechatUserId){ if (null == wechatUserId){
return; return;
......
...@@ -6,6 +6,7 @@ import com.pcloud.book.applet.vo.AppletNewsClassifyVO; ...@@ -6,6 +6,7 @@ import com.pcloud.book.applet.vo.AppletNewsClassifyVO;
import com.pcloud.book.applet.vo.AppletNewsShowStateVO; import com.pcloud.book.applet.vo.AppletNewsShowStateVO;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
...@@ -81,4 +82,6 @@ public interface AppletNewsDao extends BaseDao<AppletNews> { ...@@ -81,4 +82,6 @@ public interface AppletNewsDao extends BaseDao<AppletNews> {
* * @param null * * @param null
*/ */
Boolean urlNumberExist(String jumpUrl, String urlNumber, Long id); Boolean urlNumberExist(String jumpUrl, String urlNumber, Long id);
Map<Long, AppletNewsDTO> getByIds(List<Long> appletNewsIds);
} }
...@@ -117,4 +117,9 @@ public class AppletNewsDaoImpl extends BaseDaoImpl<AppletNews> implements Applet ...@@ -117,4 +117,9 @@ public class AppletNewsDaoImpl extends BaseDaoImpl<AppletNews> implements Applet
return getSessionTemplate().selectOne(getStatement("urlNumberExist"), map); return getSessionTemplate().selectOne(getStatement("urlNumberExist"), map);
} }
@Override
public Map<Long, AppletNewsDTO> getByIds(List<Long> list) {
return this.getSqlSession().selectMap(getStatement("getByIds"), list, "id");
}
} }
...@@ -452,6 +452,7 @@ public class AppletHomeFacade { ...@@ -452,6 +452,7 @@ public class AppletHomeFacade {
@RequestParam(value = "subjectLabelId", required = false) @ApiParam("科目标签")Long subjectLabelId, @RequestParam(value = "subjectLabelId", required = false) @ApiParam("科目标签")Long subjectLabelId,
@RequestParam(value = "rightsClassifyId", required = false) @ApiParam("权益分类") Long rightsClassifyId, @RequestParam(value = "rightsClassifyId", required = false) @ApiParam("权益分类") Long rightsClassifyId,
@RequestParam(value = "source", required = false) @ApiParam("来源") String source, @RequestParam(value = "source", required = false) @ApiParam("来源") String source,
@RequestParam(value = "showState", required = false) @ApiParam("上架") Integer showState,
@RequestParam(value = "newsClassifyId", required = false) @ApiParam("资讯栏目id") Long newsClassifyId @RequestParam(value = "newsClassifyId", required = false) @ApiParam("资讯栏目id") Long newsClassifyId
) throws PermissionException { ) throws PermissionException {
SessionUtil.getInfoToken4Redis(token); SessionUtil.getInfoToken4Redis(token);
...@@ -459,7 +460,7 @@ public class AppletHomeFacade { ...@@ -459,7 +460,7 @@ public class AppletHomeFacade {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少分页参数"); throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少分页参数");
} }
return new ResponseDto<>(appletNewsBiz.listAppletNews(currentPage, numPerPage, name, firstClassify,secondClassify,gradeLabelId, return new ResponseDto<>(appletNewsBiz.listAppletNews(currentPage, numPerPage, name, firstClassify,secondClassify,gradeLabelId,
subjectLabelId,rightsClassifyId,source,newsClassifyId)); subjectLabelId,rightsClassifyId,source,showState,newsClassifyId));
} }
@ApiOperation("客户端资讯列表") @ApiOperation("客户端资讯列表")
......
...@@ -52,4 +52,6 @@ public interface CustomPlanBiz { ...@@ -52,4 +52,6 @@ public interface CustomPlanBiz {
List<PlanReadTypeDto> getPlanReadTypesByBookId(Long bookId); List<PlanReadTypeDto> getPlanReadTypesByBookId(Long bookId);
List<CustomPlan> listByCustomPlanIds(List<Long> customPlanIds); List<CustomPlan> listByCustomPlanIds(List<Long> customPlanIds);
Map<Long, CustomPlan> getByIds(List<Long> planIds);
} }
...@@ -72,6 +72,7 @@ import java.util.Arrays; ...@@ -72,6 +72,7 @@ import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.dcg.coolq.sdk.CoolQSDK.sendPrivateMsg; import static com.dcg.coolq.sdk.CoolQSDK.sendPrivateMsg;
...@@ -542,4 +543,13 @@ public class CustomPlanBizImpl implements CustomPlanBiz { ...@@ -542,4 +543,13 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
public List<CustomPlan> listByCustomPlanIds(List<Long> customPlanIds) { public List<CustomPlan> listByCustomPlanIds(List<Long> customPlanIds) {
return customPlanMapper.getCustomPlanByIds(customPlanIds); return customPlanMapper.getCustomPlanByIds(customPlanIds);
} }
@Override
public Map<Long, CustomPlan> getByIds(List<Long> planIds) {
List<CustomPlan> customPlan = customPlanMapper.getCustomPlanByIds(planIds);
if(ListUtils.isEmpty(customPlan)){
return new HashMap<>();
}
return customPlan.stream().collect(Collectors.toMap(x -> x.getId().longValue(), Function.identity()));
}
} }
...@@ -46,6 +46,7 @@ import com.pcloud.book.rightsSetting.dao.RightsNowPicDao; ...@@ -46,6 +46,7 @@ import com.pcloud.book.rightsSetting.dao.RightsNowPicDao;
import com.pcloud.book.rightsSetting.dao.RightsReadPlanDao; import com.pcloud.book.rightsSetting.dao.RightsReadPlanDao;
import com.pcloud.book.rightsSetting.dao.RightsSettingDAO; import com.pcloud.book.rightsSetting.dao.RightsSettingDAO;
import com.pcloud.book.rightsSetting.dao.RightsSettingItemDao; import com.pcloud.book.rightsSetting.dao.RightsSettingItemDao;
import com.pcloud.book.rightsSetting.dao.RightsSettingItemDetailDao;
import com.pcloud.book.rightsSetting.dto.FillRightsSettingAppletsDTO; import com.pcloud.book.rightsSetting.dto.FillRightsSettingAppletsDTO;
import com.pcloud.book.rightsSetting.dto.ReadTypeCountDTO; import com.pcloud.book.rightsSetting.dto.ReadTypeCountDTO;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto; import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
...@@ -59,9 +60,11 @@ import com.pcloud.book.rightsSetting.entity.RightsReadType; ...@@ -59,9 +60,11 @@ 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.RightsSettingClassify; import com.pcloud.book.rightsSetting.entity.RightsSettingClassify;
import com.pcloud.book.rightsSetting.entity.RightsSettingItem; import com.pcloud.book.rightsSetting.entity.RightsSettingItem;
import com.pcloud.book.rightsSetting.entity.RightsSettingItemDetail;
import com.pcloud.book.rightsSetting.entity.RightsSettingTitle; import com.pcloud.book.rightsSetting.entity.RightsSettingTitle;
import com.pcloud.book.rightsSetting.enums.RightsItemGroupType; import com.pcloud.book.rightsSetting.enums.RightsItemGroupType;
import com.pcloud.book.rightsSetting.enums.RightsNowItemType; import com.pcloud.book.rightsSetting.enums.RightsNowItemType;
import com.pcloud.book.rightsSetting.enums.RightsServeTypeEnum;
import com.pcloud.book.rightsSetting.enums.RightsTypeEnum; import com.pcloud.book.rightsSetting.enums.RightsTypeEnum;
import com.pcloud.book.rightsSetting.mapper.RightsReadTypeMapper; import com.pcloud.book.rightsSetting.mapper.RightsReadTypeMapper;
import com.pcloud.book.rightsSetting.mapper.RightsSettingTitleMapper; import com.pcloud.book.rightsSetting.mapper.RightsSettingTitleMapper;
...@@ -99,6 +102,7 @@ import java.util.Optional; ...@@ -99,6 +102,7 @@ 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;
...@@ -162,6 +166,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -162,6 +166,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
@Autowired @Autowired
private AppletGroupSearchRecordBiz appletGroupSearchRecordBiz; private AppletGroupSearchRecordBiz appletGroupSearchRecordBiz;
@Autowired @Autowired
private RightsSettingItemDetailDao rightsSettingItemDetailDao;
@Autowired
private RightsReadTypeMapper rightsReadTypeMapper; private RightsReadTypeMapper rightsReadTypeMapper;
@Autowired @Autowired
private AppletUserBookcaseBiz appletUserBookcaseBiz; private AppletUserBookcaseBiz appletUserBookcaseBiz;
...@@ -266,55 +272,120 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -266,55 +272,120 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
} }
//更新即享权益 //更新即享权益
updateRightNowItemByRightId(rightsSetting); updateRightNowItemByRightId(rightsSetting);
//新增/修改每周或长期权益 // 更新每周、长期权益
if (!ListUtils.isEmpty(rightsSetting.getRightsSettingWeekItems())){ updateRightsWeekOrLongTerm(rightsSetting);
for (RightsSettingItem rightsSettingItem : rightsSetting.getRightsSettingWeekItems()) { }
rightsSettingItem.setUuid(StringUtil.getUUID());
} private void updateRightsWeekOrLongTerm(RightsSetting rightsSetting) {
} // 设置uuid,批量更新使用
setRightsSettingItemUuid(rightsSetting);
// 周权益数据入库
this.batchInsertRightsSettingItem(rightsSetting.getRightsSettingWeekItems(), rightsSetting.getId(), RightsTypeEnum.WEEK.value); this.batchInsertRightsSettingItem(rightsSetting.getRightsSettingWeekItems(), rightsSetting.getId(), RightsTypeEnum.WEEK.value);
//根据rightsSetting.getId(),RightsTypeEnum.WEEK.value 查询rightSettingItem // 长期权益数据入库
this.batchInsertRightsSettingItem(rightsSetting.getRightsSettingLongTermItems(), rightsSetting.getId(), RightsTypeEnum.LONG_TERM.value);
// 获取已经生成id的 周/长期 权益数据
RightsSettingItem rightsSettingItem = new RightsSettingItem(); RightsSettingItem rightsSettingItem = new RightsSettingItem();
rightsSettingItem.setRightsSettingId(rightsSetting.getId()); rightsSettingItem.setRightsSettingId(rightsSetting.getId());
rightsSettingItem.setRightsType(RightsTypeEnum.WEEK.value);
List<RightsSettingItem> list = rightsSettingItemDao.queryAll(rightsSettingItem); List<RightsSettingItem> list = rightsSettingItemDao.queryAll(rightsSettingItem);
//更新阅读计划 if (ListUtils.isEmpty(list)) {
updateReadPlan(rightsSetting, list); return;
this.batchInsertRightsSettingItem(rightsSetting.getRightsSettingLongTermItems(), rightsSetting.getId(), RightsTypeEnum.LONG_TERM.value); }
Map<String, Long> mapRightsSettingItem = list.stream().collect(Collectors.toMap(x -> x.getUuid(), x -> x.getId()));
// 处理周权益子对象列表数据
List<RightsSettingItemDetail> weekItemDetails = this.buildRightsSettingItemDetailList(rightsSetting.getRightsSettingWeekItems(), mapRightsSettingItem);
// 处理长期权益子对象列表数据
List<RightsSettingItemDetail> longTermItemDetails = this.buildRightsSettingItemDetailList(rightsSetting.getRightsSettingLongTermItems(), mapRightsSettingItem);
// 整合 周/长期 权益的子项列表数据
List<RightsSettingItemDetail> saveItemDetails = Lists.newArrayList();
if(!ListUtils.isEmpty(weekItemDetails)){
saveItemDetails.addAll(weekItemDetails);
}
if(!ListUtils.isEmpty(longTermItemDetails)){
saveItemDetails.addAll(longTermItemDetails);
}
// 存储子项列表数据
rightsSettingItemDetailDao.insert(saveItemDetails);
} }
private void updateReadPlan(RightsSetting rightsSetting, List<RightsSettingItem> list) { /**
List<RightsReadPlan> rightsReadPlans = new ArrayList<>(); * 将资讯、社群、方案等各种对象列表转为统一数据
List<RightsCustomRelation> rightsCustomRelations = new ArrayList<>(); * @param rightsSettingItemList
if (!ListUtils.isEmpty(list)) { * @param mapRightsSettingItem
HashMap<String, RightsSettingItem> map = Maps.newHashMap(); */
for (RightsSettingItem item : list) { private List<RightsSettingItemDetail> buildRightsSettingItemDetailList(List<RightsSettingItem> rightsSettingItemList, Map<String, Long> mapRightsSettingItem) {
map.put(item.getUuid(), item); if(ListUtils.isEmpty(rightsSettingItemList) || mapRightsSettingItem.isEmpty()){
return Lists.newArrayList();
}
List<RightsSettingItemDetail> rightsSettingItemDetailList = Lists.newArrayList();
RightsSettingItemDetail rightsSettingItemDetail;
List<GroupActivity4AppletDTO> groupActivity4AppletList;
List<AppletNewsDTO> appletNewsDTOS;
List<CustomPlan> customPlanList;
// 处理资讯、社群等子项列表数据
for(RightsSettingItem rightsItem : rightsSettingItemList){
groupActivity4AppletList = rightsItem.getGroupActivity4AppletList();
appletNewsDTOS = rightsItem.getAppletNewsDTOS();
customPlanList = rightsItem.getCustomPlanList();
Long rightsSettingItemId = mapRightsSettingItem.get(rightsItem.getUuid());
if(!NumberUtil.isNumber(rightsSettingItemId)){
continue;
} }
for (RightsSettingItem itemVO : rightsSetting.getRightsSettingWeekItems()) {
RightsSettingItem vo = map.get(itemVO.getUuid()); if(rightsItem.getServeType() != null) {
if (Objects.isNull(vo) || !(RightsNowItemType.ONLINE_REMIND.value.equals(vo.getRightsClassifyId().intValue()) || RightsNowItemType.ONLINE_READING_ACTIVITY.value.equals(vo.getRightsClassifyId().intValue()))) { if(RightsServeTypeEnum.GROUP.name().equalsIgnoreCase(rightsItem.getServeType())){
continue; if(ListUtils.isEmpty(groupActivity4AppletList)){
} continue;
RightsReadPlan rightsReadPlan = new RightsReadPlan(); }
rightsReadPlan.setRightsSettingItemId(vo.getId()); for (GroupActivity4AppletDTO group : groupActivity4AppletList){
rightsReadPlan.setIsOpen(itemVO.getIsOpen()); rightsSettingItemDetail = new RightsSettingItemDetail();
rightsReadPlan.setServiceDesc(itemVO.getServiceDesc()); rightsSettingItemDetail.setRightsSettingItemId(rightsSettingItemId);
rightsReadPlans.add(rightsReadPlan); rightsSettingItemDetail.setServeType(RightsServeTypeEnum.GROUP.name());
if (ListUtils.isEmpty(itemVO.getCustomPlanList())){ rightsSettingItemDetail.setServeId(group.getId());
continue; rightsSettingItemDetailList.add(rightsSettingItemDetail);
} }
for (CustomPlan plan : itemVO.getCustomPlanList()) { } else if(RightsServeTypeEnum.NEWS.name().equalsIgnoreCase(rightsItem.getServeType())){
RightsCustomRelation rightsCustomRelation = new RightsCustomRelation(); if(ListUtils.isEmpty(appletNewsDTOS)){
rightsCustomRelation.setCustomPlanId(Long.valueOf(plan.getId())); continue;
rightsCustomRelation.setRightsSettingItemId(vo.getId()); }
rightsCustomRelations.add(rightsCustomRelation); for (AppletNewsDTO news : appletNewsDTOS){
rightsSettingItemDetail = new RightsSettingItemDetail();
rightsSettingItemDetail.setRightsSettingItemId(rightsSettingItemId);
rightsSettingItemDetail.setServeType(RightsServeTypeEnum.NEWS.name());
rightsSettingItemDetail.setServeId(news.getId());
rightsSettingItemDetailList.add(rightsSettingItemDetail);
}
} else if(RightsServeTypeEnum.PLAN.name().equalsIgnoreCase(rightsItem.getServeType())){
if(ListUtils.isEmpty(customPlanList)){
continue;
}
for (CustomPlan plan : customPlanList){
rightsSettingItemDetail = new RightsSettingItemDetail();
rightsSettingItemDetail.setRightsSettingItemId(rightsSettingItemId);
rightsSettingItemDetail.setServeType(RightsServeTypeEnum.PLAN.name());
rightsSettingItemDetail.setServeId(plan.getId().longValue());
rightsSettingItemDetailList.add(rightsSettingItemDetail);
}
} }
} }
} }
//批量插入rightsReadPlans和rightsCustomRelations return rightsSettingItemDetailList;
rightsReadPlanDao.insert(rightsReadPlans); }
rightsCustomRelationDao.insert(rightsCustomRelations);
private void setRightsSettingItemUuid(RightsSetting rightsSetting) {
if (!ListUtils.isEmpty(rightsSetting.getRightsSettingWeekItems())) {
for (RightsSettingItem rightsSettingItem : rightsSetting.getRightsSettingWeekItems()) {
rightsSettingItem.setUuid(StringUtil.getUUID());
}
}
if (!ListUtils.isEmpty(rightsSetting.getRightsSettingLongTermItems())) {
for (RightsSettingItem rightsSettingItem : rightsSetting.getRightsSettingLongTermItems()) {
rightsSettingItem.setUuid(StringUtil.getUUID());
}
}
} }
@ParamLog("更新权益的即享权益项集合") @ParamLog("更新权益的即享权益项集合")
...@@ -424,6 +495,18 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -424,6 +495,18 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
items.add(item); items.add(item);
} }
} }
if(null != rightsSetting.getGroupServiceTitle() && !ListUtils
.isEmpty(rightsSetting.getGroupServiceTitle().getRightsSettingItemList())){
for (RightsNowItem item : rightsSetting.getGroupServiceTitle().getRightsSettingItemList()) {
// 只存选中的社群或者资讯
if(rightsSetting.getGroupServiceTitle().getServeType() == null || !rightsSetting.getGroupServiceTitle().getServeType().equalsIgnoreCase(item.getServeType())){
continue;
}
item.setType(RightsNowItemType.GROUP_SERVICE.value);
item.setRightsSettingId(rightsSettingId);
items.add(item);
}
}
} }
private void setRightsSettingId(RightsSetting rightsSetting, Long rightsSettingId, List<RightsSettingTitle> rightsSettingTitles) { private void setRightsSettingId(RightsSetting rightsSetting, Long rightsSettingId, List<RightsSettingTitle> rightsSettingTitles) {
...@@ -481,10 +564,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -481,10 +564,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
fillRightsNowItems(rightsSetting); fillRightsNowItems(rightsSetting);
rightsSetting.setRightsItemGroups(getRightsItemGroups(rightsSetting.getId(),null,null,null, false, null)); rightsSetting.setRightsItemGroups(getRightsItemGroups(rightsSetting.getId(),null,null,null, false, null));
fillGiftCouponPack(rightsSetting,null); fillGiftCouponPack(rightsSetting,null);
//设置每周权益 fillRightsWeekAndLongTarm(rightsSetting);
setWeekRights(rightsSetting);
//设置长期权益
rightsSetting.setRightsSettingLongTermItems(getItemsByRightsSettingId(id, RightsTypeEnum.LONG_TERM.value,null));
//设置阅读方式 //设置阅读方式
setReadType(rightsSetting); setReadType(rightsSetting);
return rightsSetting; return rightsSetting;
...@@ -495,50 +575,121 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -495,50 +575,121 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
rightsSetting.setRightsReadTypes(ListUtils.isEmpty(rightsReadTypes) ? new ArrayList<>() : rightsReadTypes); rightsSetting.setRightsReadTypes(ListUtils.isEmpty(rightsReadTypes) ? new ArrayList<>() : rightsReadTypes);
} }
private void setWeekRights(RightsSetting rightsSetting) { private void fillRightsWeekAndLongTarm(RightsSetting rightsSetting){
Long id = rightsSetting.getId(); // 默认值
List<RightsSettingItem> rightsItems = rightsSettingItemDao.getItemsByRightsSettingId4Read(id, RightsTypeEnum.WEEK.value); rightsSetting.setRightsSettingWeekItems(Lists.newArrayList());
List<Long> itemIdList = new ArrayList<>(); rightsSetting.setRightsSettingLongTermItems(Lists.newArrayList());
for (RightsSettingItem item : rightsItems) { // 查询周、长期权益
itemIdList.add(item.getId()); RightsSettingItem paramItem = new RightsSettingItem();
} paramItem.setRightsSettingId(rightsSetting.getId());
//获取集合对应的rightsCustomRelation List<RightsSettingItem> rightsSettingItemList = rightsSettingItemDao.queryAll(paramItem);
List<Long> customPlanIds = new ArrayList<>(); // 加载子项数据
if (!ListUtils.isEmpty(itemIdList)) { fillRightsSettingItemDetail(rightsSettingItemList);
List<RightsCustomRelation> rightsCustomRelations = rightsCustomRelationDao.getCustomByItemIds(itemIdList); for (RightsSettingItem rightsSettingItem : rightsSettingItemList){
for (RightsSettingItem item : rightsItems) { if(RightsTypeEnum.WEEK.value.equalsIgnoreCase(rightsSettingItem.getRightsType())){
List<CustomPlan> list = new ArrayList<>(); rightsSetting.getRightsSettingWeekItems().add(rightsSettingItem);
for (RightsCustomRelation rightsCustomRelation : rightsCustomRelations) { } else if(RightsTypeEnum.LONG_TERM.value.equalsIgnoreCase(rightsSettingItem.getRightsType())){
if (item.getId().equals(rightsCustomRelation.getRightsSettingItemId())) { rightsSetting.getRightsSettingLongTermItems().add(rightsSettingItem);
CustomPlan customPlan = new CustomPlan(); }
customPlan.setId(Integer.valueOf(rightsCustomRelation.getCustomPlanId().toString())); }
list.add(customPlan); }
customPlanIds.add(rightsCustomRelation.getCustomPlanId());
} /**
} * 填充周、长期权益
item.setCustomPlanList(list); * @param rightsSettingItemList
*/
private void fillRightsSettingItemDetail(List<RightsSettingItem> rightsSettingItemList) {
if(ListUtils.isEmpty(rightsSettingItemList)){
return;
}
List<Long> itemIds = rightsSettingItemList.stream().map(x -> x.getId()).collect(Collectors.toList());
// 查询周、长期权益的列表子项
List<RightsSettingItemDetail> allItemDetailList = rightsSettingItemDetailDao.getByItemIds(itemIds);
// 按 rightsSettingItemId 分组
Map<Long, List<RightsSettingItemDetail>> itemDetailMap = allItemDetailList.stream().collect(Collectors.groupingBy(x -> x.getRightsSettingItemId()));
List<Long> groupIds = new ArrayList<>();
List<Long> appletNewsId = new ArrayList<>();
List<Long> planIds = new ArrayList<>();
for (RightsSettingItemDetail item : allItemDetailList) {
if (item.getServeId() != null && RightsServeTypeEnum.GROUP.name().equals(item.getServeType()) && !groupIds.contains(item.getServeId())) {
groupIds.add(item.getServeId());
}
if (item.getServeId() != null && RightsServeTypeEnum.NEWS.name().equals(item.getServeType()) && !appletNewsId.contains(item.getServeId())) {
appletNewsId.add(item.getServeId());
} }
if (item.getServeId() != null && RightsServeTypeEnum.PLAN.name().equals(item.getServeType()) && !appletNewsId.contains(item.getServeId())) {
planIds.add(item.getServeId());
}
}
Map<Long, GroupActivity4AppletDTO> groupDtoMap = new HashMap<>();
Map<Long, AppletNewsDTO> newsDtoMap = new HashMap<>();
Map<Long, CustomPlan> planDtoMap = new HashMap<>();
if (!ListUtils.isEmpty(groupIds)) {
groupDtoMap = pcloudGroupActivityBiz.getByIds(groupIds);
} }
List<CustomPlan> customPlanList = new ArrayList<>(); if (!ListUtils.isEmpty(appletNewsId)) {
if (!ListUtils.isEmpty(customPlanIds)) { newsDtoMap = appletNewsBiz.getByIds(appletNewsId);
customPlanList = customPlanMapper.getCustomPlanByIds(customPlanIds); }
} if (!ListUtils.isEmpty(planIds)) {
if (!ListUtils.isEmpty(customPlanList)) { planDtoMap = customPlanBiz.getByIds(planIds);
Map<Integer, CustomPlan> appleMap = Optional }
.ofNullable(customPlanList.stream().collect(Collectors.toMap(CustomPlan::getId, a -> a, (k1, k2) -> k1)))
.orElse(new HashMap<>()); List<RightsSettingItemDetail> itemDetailList;
for (RightsSettingItem item : rightsItems) { GroupActivity4AppletDTO groupActivity4AppletDTO;
List<CustomPlan> customPlanList1 = item.getCustomPlanList(); AppletNewsDTO appletNewsDTO;
List<CustomPlan> customPlanList2 = new ArrayList<>(); CustomPlan plan;
for (CustomPlan customPlan : customPlanList1) { for (RightsSettingItem rightsSettingItem : rightsSettingItemList){
CustomPlan customPlan1 = appleMap.get(customPlan.getId()); // 默认值
customPlanList2.add(customPlan1); rightsSettingItem.setGroupActivity4AppletList(Lists.newArrayList());
rightsSettingItem.setAppletNewsDTOS(Lists.newArrayList());
rightsSettingItem.setCustomPlanList(Lists.newArrayList());
itemDetailList = itemDetailMap.get(rightsSettingItem.getId());
if(!ListUtils.isEmpty(itemDetailList) && RightsServeTypeEnum.GROUP.name().equalsIgnoreCase(itemDetailList.get(0).getServeType())){
for(RightsSettingItemDetail itemDetail : itemDetailList){
groupActivity4AppletDTO = groupDtoMap.get(itemDetail.getServeId());
if(groupActivity4AppletDTO == null){
continue;
}
rightsSettingItem.getGroupActivity4AppletList().add(groupActivity4AppletDTO);
}
// 填充头像
fillGroupActivityHead(rightsSettingItem.getGroupActivity4AppletList());
} else if(!ListUtils.isEmpty(itemDetailList) && RightsServeTypeEnum.NEWS.name().equalsIgnoreCase(itemDetailList.get(0).getServeType())){
for(RightsSettingItemDetail itemDetail : itemDetailList){
appletNewsDTO = newsDtoMap.get(itemDetail.getServeId());
if(appletNewsDTO == null){
continue;
}
rightsSettingItem.getAppletNewsDTOS().add(appletNewsDTO);
}
} else if(!ListUtils.isEmpty(itemDetailList) && RightsServeTypeEnum.PLAN.name().equalsIgnoreCase(itemDetailList.get(0).getServeType())){
for(RightsSettingItemDetail itemDetail : itemDetailList){
plan = planDtoMap.get(itemDetail.getServeId());
if(plan == null){
continue;
}
rightsSettingItem.getCustomPlanList().add(plan);
} }
item.setCustomPlanList(customPlanList2);
} }
} }
}
rightsSetting.setRightsSettingWeekItems(rightsItems); private void fillGroupActivityHead(List<GroupActivity4AppletDTO> groupActivity4AppletList) {
if(!ListUtils.isEmpty(groupActivity4AppletList)){
for (GroupActivity4AppletDTO groupActivity4AppletDTO : groupActivity4AppletList){
String filterStr = StringUtilParent.replaceHtml(groupActivity4AppletDTO.getDesc());
String subStr = filterStr.length() > 60 ? filterStr.substring(0, 60) + "..." : filterStr;
groupActivity4AppletDTO.setCutDesc(subStr);
//头像列表从缓存里取
List<String> headUrlList = appletGroupSearchRecordBiz.getHeadUrlList(groupActivity4AppletDTO.getUserNumber(),groupActivity4AppletDTO.getBookGroupQrcodeId());
groupActivity4AppletDTO.setHeadUrlList(headUrlList);
List<AppletGroupStatementDTO> statementDTOS = appletGroupSearchRecordBiz.getStatementList(groupActivity4AppletDTO.getUserNumber(),headUrlList,groupActivity4AppletDTO.getBookGroupQrcodeId());
groupActivity4AppletDTO.setStatementDTOList(statementDTOS);
}
}
} }
/** /**
...@@ -676,6 +827,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -676,6 +827,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
types.add(RightsNowItemType.ONLINE_COURSE.value); types.add(RightsNowItemType.ONLINE_COURSE.value);
types.add(RightsNowItemType.LEARNING_TOOL.value); types.add(RightsNowItemType.LEARNING_TOOL.value);
types.add(RightsNowItemType.DRAW.value); types.add(RightsNowItemType.DRAW.value);
types.add(RightsNowItemType.GROUP_SERVICE.value);
List<RightsSettingTitle> rightsSettingTitles = rightsSettingTitleMapper.getByRightSettingId(rightsSetting.getId(),null); List<RightsSettingTitle> rightsSettingTitles = rightsSettingTitleMapper.getByRightSettingId(rightsSetting.getId(),null);
RightsSettingTitle rightsSettingTitler4Online = new RightsSettingTitle(); RightsSettingTitle rightsSettingTitler4Online = new RightsSettingTitle();
RightsSettingTitle rightsSettingTitler4Learningtool = new RightsSettingTitle(); RightsSettingTitle rightsSettingTitler4Learningtool = new RightsSettingTitle();
...@@ -683,6 +835,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -683,6 +835,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
RightsSettingTitle rightsSettingTitler4Serves = new RightsSettingTitle(); RightsSettingTitle rightsSettingTitler4Serves = new RightsSettingTitle();
rightsSettingTitler4Serves.setOpenState(Boolean.TRUE); rightsSettingTitler4Serves.setOpenState(Boolean.TRUE);
rightsSettingTitler4Serves.setRightsSettingNowType(RightsNowItemType.SERVES.value); rightsSettingTitler4Serves.setRightsSettingNowType(RightsNowItemType.SERVES.value);
RightsSettingTitle rightsSettingTitler4Group = new RightsSettingTitle();
Map<Integer, RightsSettingTitle> rightsSettingTitleMap = new HashMap<>(); Map<Integer, RightsSettingTitle> rightsSettingTitleMap = new HashMap<>();
if (!ListUtils.isEmpty(rightsSettingTitles)) { if (!ListUtils.isEmpty(rightsSettingTitles)) {
rightsSettingTitleMap = rightsSettingTitleMap =
...@@ -698,8 +851,12 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -698,8 +851,12 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (null != rightsSettingTitleMap.get(RightsNowItemType.DRAW.value)) { if (null != rightsSettingTitleMap.get(RightsNowItemType.DRAW.value)) {
rightsSettingTitler4Draw = rightsSettingTitleMap.get(RightsNowItemType.DRAW.value); rightsSettingTitler4Draw = rightsSettingTitleMap.get(RightsNowItemType.DRAW.value);
} }
if (null != rightsSettingTitleMap.get(RightsNowItemType.GROUP_SERVICE.value)) {
rightsSettingTitler4Group = rightsSettingTitleMap.get(RightsNowItemType.GROUP_SERVICE.value);
}
List<RightsNowItem> nowItems = rightsNowItemDao.getListByRightsSettingId(rightsSetting.getId(), types); List<RightsNowItem> nowItems = rightsNowItemDao.getListByRightsSettingId(rightsSetting.getId(), types);
if (!ListUtils.isEmpty(nowItems)) { if (!ListUtils.isEmpty(nowItems)) {
// 填充应用、作品、社群、资讯
fillProductAndApp(nowItems); fillProductAndApp(nowItems);
rightsSettingTitler4Online.setRightsSettingItemList( rightsSettingTitler4Online.setRightsSettingItemList(
nowItems.stream().filter(s -> RightsNowItemType.ONLINE_COURSE.value.equals(s.getType())).collect(Collectors.toList())); nowItems.stream().filter(s -> RightsNowItemType.ONLINE_COURSE.value.equals(s.getType())).collect(Collectors.toList()));
...@@ -707,12 +864,13 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -707,12 +864,13 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
nowItems.stream().filter(s -> RightsNowItemType.LEARNING_TOOL.value.equals(s.getType())).collect(Collectors.toList())); nowItems.stream().filter(s -> RightsNowItemType.LEARNING_TOOL.value.equals(s.getType())).collect(Collectors.toList()));
rightsSettingTitler4Draw.setRightsSettingItemList( rightsSettingTitler4Draw.setRightsSettingItemList(
nowItems.stream().filter(s -> RightsNowItemType.DRAW.value.equals(s.getType())).collect(Collectors.toList())); nowItems.stream().filter(s -> RightsNowItemType.DRAW.value.equals(s.getType())).collect(Collectors.toList()));
rightsSettingTitler4Group.setRightsSettingItemList(
nowItems.stream().filter(s -> RightsNowItemType.GROUP_SERVICE.value.equals(s.getType()) && s.getServeType() != null).collect(Collectors.toList()));
} }
rightsSetting.setOnlineRightsSettingTitle(rightsSettingTitler4Online); rightsSetting.setOnlineRightsSettingTitle(rightsSettingTitler4Online);
rightsSetting.setLearningToolTitle(rightsSettingTitler4Learningtool); rightsSetting.setLearningToolTitle(rightsSettingTitler4Learningtool);
rightsSetting.setDrawSettingTitle(rightsSettingTitler4Draw); rightsSetting.setDrawSettingTitle(rightsSettingTitler4Draw);
rightsSetting.setGroupServiceTitle(null == rightsSettingTitleMap.get(RightsNowItemType.GROUP_SERVICE.value) ? rightsSetting.setGroupServiceTitle(rightsSettingTitler4Group);
new RightsSettingTitle() : rightsSettingTitleMap.get(RightsNowItemType.GROUP_SERVICE.value));
rightsSetting.setGiftCouponPackageTitle(null == rightsSettingTitleMap.get(RightsNowItemType.GIFT_COUPON_PACKAGE.value) ? rightsSetting.setGiftCouponPackageTitle(null == rightsSettingTitleMap.get(RightsNowItemType.GIFT_COUPON_PACKAGE.value) ?
new RightsSettingTitle() : rightsSettingTitleMap.get(RightsNowItemType.GIFT_COUPON_PACKAGE.value)); new RightsSettingTitle() : rightsSettingTitleMap.get(RightsNowItemType.GIFT_COUPON_PACKAGE.value));
rightsSetting.setServesTitle(null == rightsSettingTitleMap.get(RightsNowItemType.SERVES.value) ? rightsSetting.setServesTitle(null == rightsSettingTitleMap.get(RightsNowItemType.SERVES.value) ?
...@@ -727,6 +885,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -727,6 +885,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
} }
List<Long> productIds = new ArrayList<>(); List<Long> productIds = new ArrayList<>();
List<Long> appIds = new ArrayList<>(); List<Long> appIds = new ArrayList<>();
List<Long> groupIds = new ArrayList<>();
List<Long> appletNewsId = new ArrayList<>();
for (RightsNowItem item : nowItems) { for (RightsNowItem item : nowItems) {
if (item.getServeId() != null && AppAndProductTypeEnum.PRODUCT.value.equals(item.getServeType()) if (item.getServeId() != null && AppAndProductTypeEnum.PRODUCT.value.equals(item.getServeType())
&& !productIds.contains(item.getServeId())) { && !productIds.contains(item.getServeId())) {
...@@ -736,21 +896,39 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -736,21 +896,39 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
&& !productIds.contains(item.getServeId())) { && !productIds.contains(item.getServeId())) {
appIds.add(item.getServeId()); appIds.add(item.getServeId());
} }
if (item.getServeId() != null && RightsServeTypeEnum.GROUP.name().equals(item.getServeType())
&& !groupIds.contains(item.getServeId())) {
groupIds.add(item.getServeId());
}
if (item.getServeId() != null && RightsServeTypeEnum.NEWS.name().equals(item.getServeType())
&& !appletNewsId.contains(item.getServeId())) {
appletNewsId.add(item.getServeId());
}
} }
Map<Long, ProductDto> productDtoMap = new HashMap<>(); Map<Long, ProductDto> productDtoMap = new HashMap<>();
Map<Long, AppDto> appDtoMap = new HashMap<>(); Map<Long, AppDto> appDtoMap = new HashMap<>();
Map<Long, GroupActivity4AppletDTO> groupDtoMap = new HashMap<>();
Map<Long, AppletNewsDTO> newsDtoMap = new HashMap<>();
if (!ListUtils.isEmpty(productIds)) { if (!ListUtils.isEmpty(productIds)) {
productDtoMap = productConsr.getProBasesByIds(productIds); productDtoMap = productConsr.getProBasesByIds(productIds);
} }
if (!ListUtils.isEmpty(appIds)) { if (!ListUtils.isEmpty(appIds)) {
appDtoMap = appConsr.mapByIds(appIds); appDtoMap = appConsr.mapByIds(appIds);
} }
if (!ListUtils.isEmpty(groupIds)) {
groupDtoMap = pcloudGroupActivityBiz.getByIds(groupIds);
}
if (!ListUtils.isEmpty(appletNewsId)) {
newsDtoMap = appletNewsBiz.getByIds(appletNewsId);
}
for (RightsNowItem item : nowItems) { for (RightsNowItem item : nowItems) {
Integer type = item.getType(); Integer type = item.getType();
if (RightsNowItemType.ONLINE_COURSE.value.equals(type) if (RightsNowItemType.ONLINE_COURSE.value.equals(type)
|| RightsNowItemType.LEARNING_TOOL.value.equals(type) || RightsNowItemType.LEARNING_TOOL.value.equals(type)
|| RightsNowItemType.DRAW.value.equals(type) || RightsNowItemType.DRAW.value.equals(type)
|| RightsNowItemType.SERVES.value.equals(type)) { || RightsNowItemType.SERVES.value.equals(type)
|| RightsNowItemType.GROUP_SERVICE.value.equals(type)) {
AccountSettingDto accountSettingDto; AccountSettingDto accountSettingDto;
if (AppAndProductTypeEnum.PRODUCT.value.equals(item.getServeType())) { if (AppAndProductTypeEnum.PRODUCT.value.equals(item.getServeType())) {
ProductDto productDto = productDtoMap.get(item.getServeId()); ProductDto productDto = productDtoMap.get(item.getServeId());
...@@ -792,6 +970,31 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -792,6 +970,31 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
item.setResultUrl(resultLinkUrl); item.setResultUrl(resultLinkUrl);
} }
} }
if(RightsServeTypeEnum.GROUP.name().equals(item.getServeType())){
GroupActivity4AppletDTO groupActivity4AppletDTO = groupDtoMap.get(item.getServeId());
if(groupActivity4AppletDTO != null){
item.setGroupName(groupActivity4AppletDTO.getName());
item.setGroupDesc(groupActivity4AppletDTO.getCutDesc());
item.setGroupQrCode(groupActivity4AppletDTO.getGroupPic());
// 填充头像
fillGroupActivityHead(Collections.singletonList(groupActivity4AppletDTO));
item.setGroupActivity4AppletDTO(groupActivity4AppletDTO);
}
}
if(RightsServeTypeEnum.NEWS.name().equals(item.getServeType())){
AppletNewsDTO appletNewsDTO = newsDtoMap.get(item.getServeId());
if(appletNewsDTO != null){
item.setNewsName(appletNewsDTO.getNewsName());
item.setNewsSource(appletNewsDTO.getSource());
item.setServeId(appletNewsDTO.getId());
item.setServePic(appletNewsDTO.getPic1());
item.setServeName(appletNewsDTO.getNewsName());
item.setServeTypeName("资讯");
item.setJumpType(appletNewsDTO.getJumpType());
item.setJumpUrl(appletNewsDTO.getJumpUrl());
}
}
} }
} }
} }
...@@ -927,10 +1130,19 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -927,10 +1130,19 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void batchInsertRightsSettingItem(List<RightsSettingItem> rightsSettingItemList, Long rightsSettingId, String rightsType) { public void batchInsertRightsSettingItem(List<RightsSettingItem> rightsSettingItemList, Long rightsSettingId, String rightsType) {
if (null == rightsSettingId || StringUtil.isEmpty(rightsType)) { if (null == rightsSettingId || StringUtil.isEmpty(rightsType)) {
return; return;
} }
// 删除子数据
RightsSettingItem paramItem = new RightsSettingItem();
paramItem.setRightsSettingId(rightsSettingId);
paramItem.setRightsType(rightsType);
List<RightsSettingItem> list = rightsSettingItemDao.queryAll(paramItem);
if (!ListUtils.isEmpty(list)) {
rightsSettingItemDetailDao.deleteByItemIds(list.stream().map(x->x.getId()).collect(Collectors.toList()));
}
rightsSettingItemDao.deleteByRightsSettingId(rightsSettingId, rightsType); rightsSettingItemDao.deleteByRightsSettingId(rightsSettingId, rightsType);
if (!ListUtils.isEmpty(rightsSettingItemList)) { if (!ListUtils.isEmpty(rightsSettingItemList)) {
for (RightsSettingItem rightsSettingItem : rightsSettingItemList) { for (RightsSettingItem rightsSettingItem : rightsSettingItemList) {
...@@ -989,7 +1201,17 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -989,7 +1201,17 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (ListUtils.isEmpty(list)) { if (ListUtils.isEmpty(list)) {
return new ArrayList<>(); return new ArrayList<>();
} }
list = setAppletNews4Week(rightsSettingId, rightsType, wechatUserId, list); // 加载平台端自己选择的社群、方案、资讯等数据
fillRightsSettingItemDetail(list);
// 筛选出没有选择 社群、方案、资讯 的数据
List<RightsSettingItem> needFillAppletNews = list.stream().filter(x -> x.getServeType() == null).collect(Collectors.toList());
if(ListUtils.isEmpty(needFillAppletNews)){
return list;
}
// 将未选择服务的数据补充资讯
setAppletNews4Week(rightsSettingId, rightsType, wechatUserId, needFillAppletNews);
/*
List<Long> rightsSettingItemIds = List<Long> rightsSettingItemIds =
list.stream().filter(e -> YesOrNoEnums.YES.getValue().equals(e.getIsOpen()) list.stream().filter(e -> YesOrNoEnums.YES.getValue().equals(e.getIsOpen())
&& RightsNowItemType.ONLINE_REMIND.value.equals(e.getRightsClassifyId().intValue())) && RightsNowItemType.ONLINE_REMIND.value.equals(e.getRightsClassifyId().intValue()))
...@@ -1007,6 +1229,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1007,6 +1229,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (!ListUtils.isEmpty(rightsSettingItemIds)) { if (!ListUtils.isEmpty(rightsSettingItemIds)) {
setGroupActivity(list, rightsSettingItemIds); setGroupActivity(list, rightsSettingItemIds);
} }
*/
return list; return list;
} }
...@@ -1179,6 +1403,19 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1179,6 +1403,19 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (RightsNowItemType.GIFT_COUPON_PACKAGE.value.equals(type)) { if (RightsNowItemType.GIFT_COUPON_PACKAGE.value.equals(type)) {
return setGiftCouponPackage(rightsSetting, wechatUserId, readType); return setGiftCouponPackage(rightsSetting, wechatUserId, readType);
} }
// 获取专享社群
if(RightsNowItemType.GROUP_SERVICE.value.equals(type)){
return setGroupService(rightsSetting, wechatUserId, readType);
}
return rightsSetting;
}
@ParamLog(value = "填充专享社群", isAfterReturn = false)
private RightsSetting setGroupService(RightsSetting rightsSetting, Long wechatUserId, Integer readType) {
RightsSettingTitle rightsSettingTitle = getRightsSettingTitle(rightsSetting, RightsNowItemType.GROUP_SERVICE, readType);
List<RightsNowItem> nowItems = rightsNowItemDao.getListByRightsSettingId(rightsSetting.getId(), Collections.singletonList(RightsNowItemType.GROUP_SERVICE.value));
processNowItems(rightsSettingTitle, nowItems, RightsNowItemType.GROUP_SERVICE, rightsSetting.getId(), wechatUserId, 6L, 3);
rightsSetting.setGroupServiceTitle(rightsSettingTitle);
return rightsSetting; return rightsSetting;
} }
......
package com.pcloud.book.rightsSetting.dao;
import com.pcloud.book.rightsSetting.entity.RightsSettingItemDetail;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* (RightsSettingItemDetail)表数据库访问层
*
* @author makejava
* @since 2020-05-18 22:28:12
*/
public interface RightsSettingItemDetailDao extends BaseDao<RightsSettingItemDetail> {
void deleteByItemIds(List<Long> rightsSettingItemIds);
List<RightsSettingItemDetail> getByItemIds(List<Long> itemIds);
}
\ No newline at end of file
package com.pcloud.book.rightsSetting.dao.impl;
import com.pcloud.book.rightsSetting.entity.RightsSettingItemDetail;
import com.pcloud.book.rightsSetting.dao.RightsSettingItemDetailDao;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* (RightsSettingItemDetail)表数据库访问层
*
* @author makejava
* @since 2020-05-18 22:28:12
*/
@Repository("rightsSettingItemDetailDaoImpl")
public class RightsSettingItemDetailDaoImpl extends BaseDaoImpl<RightsSettingItemDetail> implements RightsSettingItemDetailDao {
@Override
public void deleteByItemIds(List<Long> list) {
this.getSqlSession().delete(getStatement("deleteByItemIds"), list);
}
@Override
public List<RightsSettingItemDetail> getByItemIds(List<Long> list) {
return this.getSqlSession().selectList(getStatement("getByItemIds"), list);
}
}
\ No newline at end of file
package com.pcloud.book.rightsSetting.entity; package com.pcloud.book.rightsSetting.entity;
import com.pcloud.book.skill.dto.GroupActivity4AppletDTO;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -68,6 +69,17 @@ public class RightsNowItem extends BaseEntity { ...@@ -68,6 +69,17 @@ public class RightsNowItem extends BaseEntity {
private Integer useType; private Integer useType;
@ApiModelProperty("兑换地址") @ApiModelProperty("兑换地址")
private String exchangeAddress; private String exchangeAddress;
@ApiModelProperty("社群名称")
private String groupName;
@ApiModelProperty("社群简介")
private String groupDesc;
@ApiModelProperty("社群二维码")
private String groupQrCode;
@ApiModelProperty("社群信息")
private GroupActivity4AppletDTO groupActivity4AppletDTO;
@ApiModelProperty("资讯名称")
private String newsName;
@ApiModelProperty("资讯图")
private String newsSource;
} }
...@@ -48,6 +48,10 @@ public class RightsSettingItem extends BaseEntity { ...@@ -48,6 +48,10 @@ public class RightsSettingItem extends BaseEntity {
timezone = "GMT+8" timezone = "GMT+8"
) )
private Date createTime; private Date createTime;
/**
* 开启
*/
private Integer openState;
/** /**
* 权益标题 * 权益标题
...@@ -79,6 +83,8 @@ public class RightsSettingItem extends BaseEntity { ...@@ -79,6 +83,8 @@ public class RightsSettingItem extends BaseEntity {
@ApiModelProperty("社群") @ApiModelProperty("社群")
private List<GroupActivity4AppletDTO> groupActivity4AppletList; private List<GroupActivity4AppletDTO> groupActivity4AppletList;
@ApiModelProperty("服务类型;GROUP、NEWS、PLAN")
private String serveType;
/** /**
* 轻松阅读 * 轻松阅读
*/ */
......
package com.pcloud.book.rightsSetting.entity;
import java.util.Date;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* (RightsSettingItemDetail)实体类
*
* @author makejava
* @since 2020-05-18 22:28:12
*/
@Data
public class RightsSettingItemDetail extends BaseEntity {
private static final long serialVersionUID = 861375509249616760L;
@ApiModelProperty("即享权益项id")
private Long id;
@ApiModelProperty("权益子项id")
private Long rightsSettingItemId;
@ApiModelProperty("社群或资讯id")
private Long serveId;
@ApiModelProperty("社群、资讯")
private String serveType;
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
}
\ No newline at end of file
package com.pcloud.book.rightsSetting.entity; package com.pcloud.book.rightsSetting.entity;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import lombok.Data; import lombok.Data;
@Data @Data
public class RightsSettingTitle { public class RightsSettingTitle implements Serializable {
private Long id; private Long id;
private Long rightsSettingId; private Long rightsSettingId;
...@@ -31,6 +33,8 @@ public class RightsSettingTitle { ...@@ -31,6 +33,8 @@ public class RightsSettingTitle {
) )
private Date updateTime; private Date updateTime;
private String serveType;
/** /**
* 列表 * 列表
*/ */
......
package com.pcloud.book.rightsSetting.enums;
public enum RightsServeTypeEnum {
/**
* 共读社群
*/
GROUP(1),
/**
* 小程序资讯
*/
NEWS(2),
/**
* 方案
*/
PLAN(3);
public final Integer value;
RightsServeTypeEnum(Integer value) {
this.value = value;
}
}
...@@ -9,6 +9,9 @@ import com.pcloud.common.page.PageBeanNew; ...@@ -9,6 +9,9 @@ import com.pcloud.common.page.PageBeanNew;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
public interface PcloudGroupActivityBiz { public interface PcloudGroupActivityBiz {
/** /**
...@@ -44,4 +47,10 @@ public interface PcloudGroupActivityBiz { ...@@ -44,4 +47,10 @@ public interface PcloudGroupActivityBiz {
* @return * @return
*/ */
GroupActivity4AppletDTO getGroupActivity4Applet(Long rightSettingId, Long adviserId, Long bookId, Long channelId, Integer readType); GroupActivity4AppletDTO getGroupActivity4Applet(Long rightSettingId, Long adviserId, Long bookId, Long channelId, Integer readType);
/**
* 根据id获取社群共读
* @param ids
* @return
*/
Map<Long, GroupActivity4AppletDTO> getByIds(List<Long> ids);
} }
...@@ -323,4 +323,21 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz { ...@@ -323,4 +323,21 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
groupActivity4AppletDTO.setStatementDTOList(statementDTOS); groupActivity4AppletDTO.setStatementDTOList(statementDTOS);
return groupActivity4AppletDTO; return groupActivity4AppletDTO;
} }
@Override
public Map<Long, GroupActivity4AppletDTO> getByIds(List<Long> ids) {
if(ListUtils.isEmpty(ids)){
return new HashMap<>();
}
Map<Long, GroupActivity4AppletDTO> mapDto = pcloudGroupActivityDao.getByIds(ids);
if(mapDto.isEmpty()){
return new HashMap<>();
}
for(GroupActivity4AppletDTO groupActivity4AppletDTO: mapDto.values()){
String filterStr = StringUtilParent.replaceHtml(groupActivity4AppletDTO.getDesc());
String subStr = filterStr.length() > 60 ? filterStr.substring(0, 60) + "..." : filterStr;
groupActivity4AppletDTO.setCutDesc(subStr);
}
return mapDto;
}
} }
...@@ -18,4 +18,6 @@ public interface PcloudGroupActivityDao extends BaseDao<PcloudGroupActivity> { ...@@ -18,4 +18,6 @@ public interface PcloudGroupActivityDao extends BaseDao<PcloudGroupActivity> {
GroupActivity4AppletDTO getGroupActivity4Applet(Long firstClassify,Long secondClassify,Long gradeLabelId,Long subjectLabelId); GroupActivity4AppletDTO getGroupActivity4Applet(Long firstClassify,Long secondClassify,Long gradeLabelId,Long subjectLabelId);
List<GroupActivity4AppletDTO> getTishBookSchoolList(BaseTempletClassify baseTempletClassify, Integer limit); List<GroupActivity4AppletDTO> getTishBookSchoolList(BaseTempletClassify baseTempletClassify, Integer limit);
Map<Long, GroupActivity4AppletDTO> getByIds(List<Long> ids);
} }
\ No newline at end of file
...@@ -47,4 +47,8 @@ public class PcloudGroupActivityDaoImpl extends BaseDaoImpl<PcloudGroupActivity> ...@@ -47,4 +47,8 @@ public class PcloudGroupActivityDaoImpl extends BaseDaoImpl<PcloudGroupActivity>
return super.getSqlSession().selectList(getStatement("getTishBookSchoolList"), map); return super.getSqlSession().selectList(getStatement("getTishBookSchoolList"), map);
} }
@Override
public Map<Long, GroupActivity4AppletDTO> getByIds(List<Long> list) {
return super.getSqlSession().selectMap(getStatement("getByIds"), list,"id");
}
} }
...@@ -384,6 +384,39 @@ ...@@ -384,6 +384,39 @@
ORDER BY n.create_time DESC ORDER BY n.create_time DESC
</select> </select>
<select id="getByIds" resultType="com.pcloud.book.applet.dto.AppletNewsDTO">
SELECT
n.id,
n.news_name newsName,
n.source,
n.news_classify_id newsClassifyId,
n.pro_label_id proLabelId,
n.dep_label_id depLabelId,
n.pur_label_id purLabelId,
n.type,
n.digest,
n.pic1,
n.pic2,
n.pic3,
n.show_state showState,
n.create_time createTime,
n.first_classify firstClassify,
n.second_classify secondClassify,
n.grade_label_id gradeLabelId,
n.subject_label_id subjectLabelId,
n.rights_classify_id rightsClassifyId,
n.jump_type jumpType,
n.jump_url jumpUrl,
n.url_number urlNumber
FROM applet_news n
WHERE n.show_state = 1
AND n.id IN
<foreach collection="list" item="item" separator="," open="(" close=")" >
${item}
</foreach>
ORDER BY n.create_time DESC
</select>
<select id="listAppletNews4Wechat" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletNewsDTO"> <select id="listAppletNews4Wechat" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletNewsDTO">
SELECT SELECT
......
<?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.rightsSetting.dao.impl.RightsSettingItemDetailDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.rightsSetting.entity.RightsSettingItemDetail">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="rights_setting_item_id" property="rightsSettingItemId" jdbcType="BIGINT"/>
<result column="serve_id" property="serveId" jdbcType="BIGINT"/>
<result column="serve_type" property="serveType" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, rights_setting_item_id, serve_id, serve_type, create_time
</sql>
<select id="getById" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM rights_setting_item_detail
WHERE id = #{id}
</select>
<select id="getByItemIds" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM rights_setting_item_detail
WHERE rights_setting_item_id IN
<foreach collection="list" item="item" open="(" separator="," close=")">
${item}
</foreach>
</select>
<select id="getList" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM rights_setting_item_detail
</select>
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
INSERT INTO rights_setting_item_detail(
rights_setting_item_id,
serve_id,
serve_type,
create_time
) VALUES (
#{rightsSettingItemId, jdbcType=BIGINT},
#{serveId, jdbcType=BIGINT},
#{serveType, jdbcType=VARCHAR},
NOW()
)
</insert>
<insert id="batchInsert" keyProperty="id" useGeneratedKeys="true">
INSERT INTO rights_setting_item_detail (
rights_setting_item_id,
serve_id,
serve_type,
create_time
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.rightsSettingItemId, jdbcType=BIGINT},
#{item.serveId, jdbcType=BIGINT},
#{item.serveType, jdbcType=VARCHAR},
NOW()
)
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
UPDATE rights_setting_item_detail
<set>
<if test="rightsSettingItemId != null">
rights_setting_item_id = #{rightsSettingItemId},
</if>
<if test="serveId != null">
serve_id = #{serveId},
</if>
<if test="serveType != null and serveType != ''">
serve_type = #{serveType},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
</set>
WHERE id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
DELETE FROM rights_setting_item_detail where id = #{id}
</delete>
<delete id="deleteByItemIds">
DELETE FROM rights_setting_item_detail where
rights_setting_item_id IN
<foreach collection="list" item="item" open="(" separator="," close=")">
${item}
</foreach>
</delete>
</mapper>
\ No newline at end of file
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="title" column="title" jdbcType="VARCHAR"/> <result property="title" column="title" jdbcType="VARCHAR"/>
<result property="uuid" column="uuid" jdbcType="VARCHAR"/> <result property="uuid" column="uuid" jdbcType="VARCHAR"/>
<result property="openState" column="open_state" jdbcType="INTEGER" />
<result property="serviceDesc" column="service_desc" jdbcType="VARCHAR"/>
<result property="serveType" column="serve_type" jdbcType="VARCHAR"/>
<result property="easyRead" column="easy_read" jdbcType="TINYINT" /> <result property="easyRead" column="easy_read" jdbcType="TINYINT" />
<result property="efficientRead" column="efficient_read" jdbcType="TINYINT" /> <result property="efficientRead" column="efficient_read" jdbcType="TINYINT" />
<result property="deepRead" column="deep_read" jdbcType="TINYINT" /> <result property="deepRead" column="deep_read" jdbcType="TINYINT" />
...@@ -21,10 +24,9 @@ ...@@ -21,10 +24,9 @@
select select
i.id, i.rights_setting_id rightsSettingId, i.id, i.rights_setting_id rightsSettingId,
i.rights_type rightsType, i.rights_classify_id rightsClassifyId, i.rights_type rightsType, i.rights_classify_id rightsClassifyId,
i.description, i.create_time createTime, i.title,i.uuid,IFNULL(p.is_open,0) isOpen,p.service_desc serviceDesc, i.description, i.create_time createTime, i.title,i.uuid,i.open_state openState,i.service_desc serviceDesc,i.serve_type serveType,
c.book_id bookId, i.easy_read easyRead,i.efficient_read efficientRead,i.deep_read deepRead c.book_id bookId, i.easy_read easyRead,i.efficient_read efficientRead,i.deep_read deepRead
from book.rights_setting_item i from book.rights_setting_item i
left join book.rights_read_plan p on i.id=p.rights_setting_item_id
LEFT JOIN rights_setting c ON c.id=i.rights_setting_id LEFT JOIN rights_setting c ON c.id=i.rights_setting_id
<where> <where>
<if test="id != null"> <if test="id != null">
...@@ -56,9 +58,9 @@ ...@@ -56,9 +58,9 @@
<!--新增所有列--> <!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true"> <insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into book.rights_setting_item(rights_setting_id, rights_type, rights_classify_id, description, create_time,title,uuid, insert into book.rights_setting_item(rights_setting_id, rights_type, rights_classify_id, description, create_time,title,uuid,open_state,serve_type,
easy_read,efficient_read,deep_read) easy_read,efficient_read,deep_read)
values (#{rightsSettingId}, #{rightsType}, #{rightsClassifyId}, #{description}, NOW(), #{title},#{uuid}, values (#{rightsSettingId}, #{rightsType}, #{rightsClassifyId}, #{description}, NOW(), #{title},#{uuid},#{openState},#{serveType},
#{easyRead},#{efficientRead},#{deepRead}) #{easyRead},#{efficientRead},#{deepRead})
</insert> </insert>
...@@ -74,7 +76,7 @@ ...@@ -74,7 +76,7 @@
<!--批量新增--> <!--批量新增-->
<insert id="batchInsert" useGeneratedKeys="true" parameterType="java.util.List"> <insert id="batchInsert" useGeneratedKeys="true" parameterType="java.util.List">
insert into book.rights_setting_item ( insert into book.rights_setting_item (
rights_setting_id, rights_type, rights_classify_id, description, create_time,title,uuid, rights_setting_id, rights_type, rights_classify_id, description, create_time,title,uuid,open_state,serve_type,
easy_read,efficient_read,deep_read easy_read,efficient_read,deep_read
) )
values values
...@@ -87,6 +89,8 @@ ...@@ -87,6 +89,8 @@
NOW(), NOW(),
#{item.title}, #{item.title},
#{item.uuid}, #{item.uuid},
#{item.openState},
#{item.serveType}
#{item.easyRead},#{item.efficientRead},#{item.deepRead} #{item.easyRead},#{item.efficientRead},#{item.deepRead}
) )
</foreach> </foreach>
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="rights_setting_now_type" jdbcType="TINYINT" property="rightsSettingNowType" /> <result column="rights_setting_now_type" jdbcType="TINYINT" property="rightsSettingNowType" />
<result column="serve_type" jdbcType="VARCHAR" property="serveType" />
<result column="easy_read" jdbcType="TINYINT" property="easyRead" /> <result column="easy_read" jdbcType="TINYINT" property="easyRead" />
<result column="efficient_read" jdbcType="TINYINT" property="efficientRead" /> <result column="efficient_read" jdbcType="TINYINT" property="efficientRead" />
<result column="deep_read" jdbcType="TINYINT" property="deepRead" /> <result column="deep_read" jdbcType="TINYINT" property="deepRead" />
...@@ -18,15 +19,15 @@ ...@@ -18,15 +19,15 @@
<sql id="baseSql"> <sql id="baseSql">
id, rights_setting_id, rights_setting_title, id, rights_setting_id, rights_setting_title,
rights_setting_desc, open_state, create_time, rights_setting_desc, open_state, create_time,
update_time,rights_setting_now_type,easy_read,efficient_read,deep_read update_time,rights_setting_now_type,serve_type,easy_read,efficient_read,deep_read
</sql> </sql>
<insert id="insert" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingTitle"> <insert id="insert" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingTitle">
insert into rights_setting_title (id, rights_setting_id, rights_setting_title, insert into rights_setting_title (id, rights_setting_id, rights_setting_title,
rights_setting_desc, open_state, create_time, rights_setting_desc, open_state, create_time,
update_time,rights_setting_now_type,easy_read,efficient_read,deep_read) update_time,rights_setting_now_type,serve_type,easy_read,efficient_read,deep_read)
values (#{id,jdbcType=BIGINT}, #{rightsSettingId,jdbcType=BIGINT}, #{rightsSettingTitle,jdbcType=VARCHAR}, values (#{id,jdbcType=BIGINT}, #{rightsSettingId,jdbcType=BIGINT}, #{rightsSettingTitle,jdbcType=VARCHAR},
#{rightsSettingDesc,jdbcType=VARCHAR}, #{openState,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, #{rightsSettingDesc,jdbcType=VARCHAR}, #{openState,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP},#{rightsSettingNowType},#{easyRead},#{efficientRead},#{deepRead}) #{updateTime,jdbcType=TIMESTAMP},#{rightsSettingNowType},#{serveType},#{easyRead},#{efficientRead},#{deepRead})
</insert> </insert>
<insert id="insertSelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingTitle"> <insert id="insertSelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingTitle">
insert into rights_setting_title insert into rights_setting_title
...@@ -52,6 +53,9 @@ ...@@ -52,6 +53,9 @@
<if test="updateTime != null"> <if test="updateTime != null">
update_time, update_time,
</if> </if>
<if test="serveType != null">
serve_type,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
...@@ -75,6 +79,9 @@ ...@@ -75,6 +79,9 @@
<if test="updateTime != null"> <if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="serveType != null">
#{serve_type,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
...@@ -89,12 +96,12 @@ ...@@ -89,12 +96,12 @@
<insert id="batchInsert" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingTitle"> <insert id="batchInsert" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingTitle">
insert into rights_setting_title (id, rights_setting_id, rights_setting_title, insert into rights_setting_title (id, rights_setting_id, rights_setting_title,
rights_setting_desc, open_state, create_time, update_time,rights_setting_now_type, rights_setting_desc, open_state, create_time, update_time,rights_setting_now_type,serve_type,
easy_read,efficient_read,deep_read) easy_read,efficient_read,deep_read)
values values
<foreach collection="list" item="item" index="index" separator=","> <foreach collection="list" item="item" index="index" separator=",">
(#{item.id,jdbcType=BIGINT}, #{item.rightsSettingId,jdbcType=BIGINT}, #{item.rightsSettingTitle,jdbcType=VARCHAR}, (#{item.id,jdbcType=BIGINT}, #{item.rightsSettingId,jdbcType=BIGINT}, #{item.rightsSettingTitle,jdbcType=VARCHAR},
#{item.rightsSettingDesc,jdbcType=VARCHAR}, #{item.openState,jdbcType=TINYINT}, now(), now(),#{item.rightsSettingNowType}, #{item.rightsSettingDesc,jdbcType=VARCHAR}, #{item.openState,jdbcType=TINYINT}, now(), now(),#{item.rightsSettingNowType},#{item.serveType},
#{item.easyRead},#{item.efficientRead},#{item.deepRead}) #{item.easyRead},#{item.efficientRead},#{item.deepRead})
</foreach> </foreach>
</insert> </insert>
...@@ -118,6 +125,11 @@ ...@@ -118,6 +125,11 @@
when id=#{item.id} then #{item.openState} when id=#{item.id} then #{item.openState}
</foreach> </foreach>
</trim> </trim>
<trim prefix="serve_type =case" suffix="end,">
<foreach collection="list" item="item" index="index">
when id=#{item.id} then #{item.serveType}
</foreach>
</trim>
<trim prefix="easy_read =case" suffix="end,"> <trim prefix="easy_read =case" suffix="end,">
<foreach collection="list" item="item" index="index"> <foreach collection="list" item="item" index="index">
when id=#{item.id} then #{item.easyRead} when id=#{item.id} then #{item.easyRead}
......
...@@ -132,6 +132,36 @@ ...@@ -132,6 +132,36 @@
where a.id = #{id,jdbcType=INTEGER} where a.id = #{id,jdbcType=INTEGER}
</select> </select>
<select id="getByIds" resultType="com.pcloud.book.skill.dto.GroupActivity4AppletDTO">
SELECT
a.id,
a.id groupActivityId,
a.`name`,
a.description as `desc`,
a.join_type AS joinType,
a.group_pic AS groupPic,
a.book_group_qrcode_id AS bookGroupQrcodeId,
b.group_name AS groupName,
b.user_number userNumber,
b.classify_id classifyId,
c.book_group_id bookGroupId,
a.first_classify AS firstClassify,
a.second_classify AS secondClassify,
a.grade_label_id AS gradeLabelId,
a.subject_label_id AS subjectLabelId
FROM
pcloud_group_activity a
INNER JOIN book_group_qrcode b on a.book_group_qrcode_id = b.id AND b.is_delete = 0
INNER JOIN book_group_classify c ON b.classify_id = c.id AND c.is_delete = 0
WHERE
a.is_delete = 0
AND a.id IN
<foreach collection="list" item="item" open="(" close=")" separator=",">
${item}
</foreach>
ORDER BY id DESC
</select>
<select id="getGroupActivity4Applet" resultType="com.pcloud.book.skill.dto.GroupActivity4AppletDTO" parameterType="map"> <select id="getGroupActivity4Applet" resultType="com.pcloud.book.skill.dto.GroupActivity4AppletDTO" parameterType="map">
SELECT SELECT
a.id, a.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