Commit 9955a5b1 by 郑永强

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

parent 16c932de
......@@ -13,6 +13,7 @@ import com.pcloud.book.applet.vo.AppletNewsShowStateVO;
import com.pcloud.common.page.PageBeanNew;
import java.util.List;
import java.util.Map;
/**
* 小程序资讯
......@@ -74,7 +75,7 @@ public interface AppletNewsBiz {
*/
PageBeanNew<AppletNewsDTO> listAppletNews(Integer currentPage, Integer numPerPage, String name,
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 {
PageBeanNew<AppletNewsDTO> listAppletNews4Analysis(Integer currentPage, Integer numPerPage, String name,
Long firstClassify,Long secondClassify,Long gradeLabelId,
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 {
@Override
public PageBeanNew<AppletNewsDTO> listAppletNews(Integer currentPage, Integer numPerPage, String name,
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<>();
paramMap.put("name", name);
paramMap.put("rightsClassifyId", rightsClassifyId);
paramMap.put("source", source);
paramMap.put("showState", showState);
paramMap.put("newsClassifyId", newsClassifyId);
//处理分类
if (null!=firstClassify){
......@@ -525,6 +526,14 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
}
@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) {
if (null == wechatUserId){
return;
......
......@@ -6,6 +6,7 @@ import com.pcloud.book.applet.vo.AppletNewsClassifyVO;
import com.pcloud.book.applet.vo.AppletNewsShowStateVO;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
import java.util.Map;
/**
......@@ -81,4 +82,6 @@ public interface AppletNewsDao extends BaseDao<AppletNews> {
* * @param null
*/
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
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 {
@RequestParam(value = "subjectLabelId", required = false) @ApiParam("科目标签")Long subjectLabelId,
@RequestParam(value = "rightsClassifyId", required = false) @ApiParam("权益分类") Long rightsClassifyId,
@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
) throws PermissionException {
SessionUtil.getInfoToken4Redis(token);
......@@ -459,7 +460,7 @@ public class AppletHomeFacade {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少分页参数");
}
return new ResponseDto<>(appletNewsBiz.listAppletNews(currentPage, numPerPage, name, firstClassify,secondClassify,gradeLabelId,
subjectLabelId,rightsClassifyId,source,newsClassifyId));
subjectLabelId,rightsClassifyId,source,showState,newsClassifyId));
}
@ApiOperation("客户端资讯列表")
......
......@@ -52,4 +52,6 @@ public interface CustomPlanBiz {
List<PlanReadTypeDto> getPlanReadTypesByBookId(Long bookId);
List<CustomPlan> listByCustomPlanIds(List<Long> customPlanIds);
Map<Long, CustomPlan> getByIds(List<Long> planIds);
}
......@@ -72,6 +72,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.dcg.coolq.sdk.CoolQSDK.sendPrivateMsg;
......@@ -542,4 +543,13 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
public List<CustomPlan> listByCustomPlanIds(List<Long> 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;
import com.pcloud.book.rightsSetting.dao.RightsReadPlanDao;
import com.pcloud.book.rightsSetting.dao.RightsSettingDAO;
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.ReadTypeCountDTO;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
......@@ -59,9 +60,11 @@ import com.pcloud.book.rightsSetting.entity.RightsReadType;
import com.pcloud.book.rightsSetting.entity.RightsSetting;
import com.pcloud.book.rightsSetting.entity.RightsSettingClassify;
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.enums.RightsItemGroupType;
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.mapper.RightsReadTypeMapper;
import com.pcloud.book.rightsSetting.mapper.RightsSettingTitleMapper;
......@@ -99,6 +102,7 @@ import java.util.Optional;
import java.util.Random;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.extern.slf4j.Slf4j;
......@@ -162,6 +166,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
@Autowired
private AppletGroupSearchRecordBiz appletGroupSearchRecordBiz;
@Autowired
private RightsSettingItemDetailDao rightsSettingItemDetailDao;
@Autowired
private RightsReadTypeMapper rightsReadTypeMapper;
@Autowired
private AppletUserBookcaseBiz appletUserBookcaseBiz;
......@@ -266,55 +272,120 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
}
//更新即享权益
updateRightNowItemByRightId(rightsSetting);
//新增/修改每周或长期权益
if (!ListUtils.isEmpty(rightsSetting.getRightsSettingWeekItems())){
for (RightsSettingItem rightsSettingItem : rightsSetting.getRightsSettingWeekItems()) {
rightsSettingItem.setUuid(StringUtil.getUUID());
}
}
// 更新每周、长期权益
updateRightsWeekOrLongTerm(rightsSetting);
}
private void updateRightsWeekOrLongTerm(RightsSetting rightsSetting) {
// 设置uuid,批量更新使用
setRightsSettingItemUuid(rightsSetting);
// 周权益数据入库
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.setRightsSettingId(rightsSetting.getId());
rightsSettingItem.setRightsType(RightsTypeEnum.WEEK.value);
List<RightsSettingItem> list = rightsSettingItemDao.queryAll(rightsSettingItem);
//更新阅读计划
updateReadPlan(rightsSetting, list);
this.batchInsertRightsSettingItem(rightsSetting.getRightsSettingLongTermItems(), rightsSetting.getId(), RightsTypeEnum.LONG_TERM.value);
if (ListUtils.isEmpty(list)) {
return;
}
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<>();
if (!ListUtils.isEmpty(list)) {
HashMap<String, RightsSettingItem> map = Maps.newHashMap();
for (RightsSettingItem item : list) {
map.put(item.getUuid(), item);
/**
* 将资讯、社群、方案等各种对象列表转为统一数据
* @param rightsSettingItemList
* @param mapRightsSettingItem
*/
private List<RightsSettingItemDetail> buildRightsSettingItemDetailList(List<RightsSettingItem> rightsSettingItemList, Map<String, Long> mapRightsSettingItem) {
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 (Objects.isNull(vo) || !(RightsNowItemType.ONLINE_REMIND.value.equals(vo.getRightsClassifyId().intValue()) || RightsNowItemType.ONLINE_READING_ACTIVITY.value.equals(vo.getRightsClassifyId().intValue()))) {
continue;
}
RightsReadPlan rightsReadPlan = new RightsReadPlan();
rightsReadPlan.setRightsSettingItemId(vo.getId());
rightsReadPlan.setIsOpen(itemVO.getIsOpen());
rightsReadPlan.setServiceDesc(itemVO.getServiceDesc());
rightsReadPlans.add(rightsReadPlan);
if (ListUtils.isEmpty(itemVO.getCustomPlanList())){
continue;
}
for (CustomPlan plan : itemVO.getCustomPlanList()) {
RightsCustomRelation rightsCustomRelation = new RightsCustomRelation();
rightsCustomRelation.setCustomPlanId(Long.valueOf(plan.getId()));
rightsCustomRelation.setRightsSettingItemId(vo.getId());
rightsCustomRelations.add(rightsCustomRelation);
if(rightsItem.getServeType() != null) {
if(RightsServeTypeEnum.GROUP.name().equalsIgnoreCase(rightsItem.getServeType())){
if(ListUtils.isEmpty(groupActivity4AppletList)){
continue;
}
for (GroupActivity4AppletDTO group : groupActivity4AppletList){
rightsSettingItemDetail = new RightsSettingItemDetail();
rightsSettingItemDetail.setRightsSettingItemId(rightsSettingItemId);
rightsSettingItemDetail.setServeType(RightsServeTypeEnum.GROUP.name());
rightsSettingItemDetail.setServeId(group.getId());
rightsSettingItemDetailList.add(rightsSettingItemDetail);
}
} else if(RightsServeTypeEnum.NEWS.name().equalsIgnoreCase(rightsItem.getServeType())){
if(ListUtils.isEmpty(appletNewsDTOS)){
continue;
}
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
rightsReadPlanDao.insert(rightsReadPlans);
rightsCustomRelationDao.insert(rightsCustomRelations);
return rightsSettingItemDetailList;
}
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("更新权益的即享权益项集合")
......@@ -424,6 +495,18 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
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) {
......@@ -481,10 +564,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
fillRightsNowItems(rightsSetting);
rightsSetting.setRightsItemGroups(getRightsItemGroups(rightsSetting.getId(),null,null,null, false, null));
fillGiftCouponPack(rightsSetting,null);
//设置每周权益
setWeekRights(rightsSetting);
//设置长期权益
rightsSetting.setRightsSettingLongTermItems(getItemsByRightsSettingId(id, RightsTypeEnum.LONG_TERM.value,null));
fillRightsWeekAndLongTarm(rightsSetting);
//设置阅读方式
setReadType(rightsSetting);
return rightsSetting;
......@@ -495,50 +575,121 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
rightsSetting.setRightsReadTypes(ListUtils.isEmpty(rightsReadTypes) ? new ArrayList<>() : rightsReadTypes);
}
private void setWeekRights(RightsSetting rightsSetting) {
Long id = rightsSetting.getId();
List<RightsSettingItem> rightsItems = rightsSettingItemDao.getItemsByRightsSettingId4Read(id, RightsTypeEnum.WEEK.value);
List<Long> itemIdList = new ArrayList<>();
for (RightsSettingItem item : rightsItems) {
itemIdList.add(item.getId());
}
//获取集合对应的rightsCustomRelation
List<Long> customPlanIds = new ArrayList<>();
if (!ListUtils.isEmpty(itemIdList)) {
List<RightsCustomRelation> rightsCustomRelations = rightsCustomRelationDao.getCustomByItemIds(itemIdList);
for (RightsSettingItem item : rightsItems) {
List<CustomPlan> list = new ArrayList<>();
for (RightsCustomRelation rightsCustomRelation : rightsCustomRelations) {
if (item.getId().equals(rightsCustomRelation.getRightsSettingItemId())) {
CustomPlan customPlan = new CustomPlan();
customPlan.setId(Integer.valueOf(rightsCustomRelation.getCustomPlanId().toString()));
list.add(customPlan);
customPlanIds.add(rightsCustomRelation.getCustomPlanId());
}
}
item.setCustomPlanList(list);
private void fillRightsWeekAndLongTarm(RightsSetting rightsSetting){
// 默认值
rightsSetting.setRightsSettingWeekItems(Lists.newArrayList());
rightsSetting.setRightsSettingLongTermItems(Lists.newArrayList());
// 查询周、长期权益
RightsSettingItem paramItem = new RightsSettingItem();
paramItem.setRightsSettingId(rightsSetting.getId());
List<RightsSettingItem> rightsSettingItemList = rightsSettingItemDao.queryAll(paramItem);
// 加载子项数据
fillRightsSettingItemDetail(rightsSettingItemList);
for (RightsSettingItem rightsSettingItem : rightsSettingItemList){
if(RightsTypeEnum.WEEK.value.equalsIgnoreCase(rightsSettingItem.getRightsType())){
rightsSetting.getRightsSettingWeekItems().add(rightsSettingItem);
} else if(RightsTypeEnum.LONG_TERM.value.equalsIgnoreCase(rightsSettingItem.getRightsType())){
rightsSetting.getRightsSettingLongTermItems().add(rightsSettingItem);
}
}
}
/**
* 填充周、长期权益
* @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(customPlanIds)) {
customPlanList = customPlanMapper.getCustomPlanByIds(customPlanIds);
}
if (!ListUtils.isEmpty(customPlanList)) {
Map<Integer, CustomPlan> appleMap = Optional
.ofNullable(customPlanList.stream().collect(Collectors.toMap(CustomPlan::getId, a -> a, (k1, k2) -> k1)))
.orElse(new HashMap<>());
for (RightsSettingItem item : rightsItems) {
List<CustomPlan> customPlanList1 = item.getCustomPlanList();
List<CustomPlan> customPlanList2 = new ArrayList<>();
for (CustomPlan customPlan : customPlanList1) {
CustomPlan customPlan1 = appleMap.get(customPlan.getId());
customPlanList2.add(customPlan1);
if (!ListUtils.isEmpty(appletNewsId)) {
newsDtoMap = appletNewsBiz.getByIds(appletNewsId);
}
if (!ListUtils.isEmpty(planIds)) {
planDtoMap = customPlanBiz.getByIds(planIds);
}
List<RightsSettingItemDetail> itemDetailList;
GroupActivity4AppletDTO groupActivity4AppletDTO;
AppletNewsDTO appletNewsDTO;
CustomPlan plan;
for (RightsSettingItem rightsSettingItem : rightsSettingItemList){
// 默认值
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 {
types.add(RightsNowItemType.ONLINE_COURSE.value);
types.add(RightsNowItemType.LEARNING_TOOL.value);
types.add(RightsNowItemType.DRAW.value);
types.add(RightsNowItemType.GROUP_SERVICE.value);
List<RightsSettingTitle> rightsSettingTitles = rightsSettingTitleMapper.getByRightSettingId(rightsSetting.getId(),null);
RightsSettingTitle rightsSettingTitler4Online = new RightsSettingTitle();
RightsSettingTitle rightsSettingTitler4Learningtool = new RightsSettingTitle();
......@@ -683,6 +835,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
RightsSettingTitle rightsSettingTitler4Serves = new RightsSettingTitle();
rightsSettingTitler4Serves.setOpenState(Boolean.TRUE);
rightsSettingTitler4Serves.setRightsSettingNowType(RightsNowItemType.SERVES.value);
RightsSettingTitle rightsSettingTitler4Group = new RightsSettingTitle();
Map<Integer, RightsSettingTitle> rightsSettingTitleMap = new HashMap<>();
if (!ListUtils.isEmpty(rightsSettingTitles)) {
rightsSettingTitleMap =
......@@ -698,8 +851,12 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (null != 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);
if (!ListUtils.isEmpty(nowItems)) {
// 填充应用、作品、社群、资讯
fillProductAndApp(nowItems);
rightsSettingTitler4Online.setRightsSettingItemList(
nowItems.stream().filter(s -> RightsNowItemType.ONLINE_COURSE.value.equals(s.getType())).collect(Collectors.toList()));
......@@ -707,12 +864,13 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
nowItems.stream().filter(s -> RightsNowItemType.LEARNING_TOOL.value.equals(s.getType())).collect(Collectors.toList()));
rightsSettingTitler4Draw.setRightsSettingItemList(
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.setLearningToolTitle(rightsSettingTitler4Learningtool);
rightsSetting.setDrawSettingTitle(rightsSettingTitler4Draw);
rightsSetting.setGroupServiceTitle(null == rightsSettingTitleMap.get(RightsNowItemType.GROUP_SERVICE.value) ?
new RightsSettingTitle() : rightsSettingTitleMap.get(RightsNowItemType.GROUP_SERVICE.value));
rightsSetting.setGroupServiceTitle(rightsSettingTitler4Group);
rightsSetting.setGiftCouponPackageTitle(null == rightsSettingTitleMap.get(RightsNowItemType.GIFT_COUPON_PACKAGE.value) ?
new RightsSettingTitle() : rightsSettingTitleMap.get(RightsNowItemType.GIFT_COUPON_PACKAGE.value));
rightsSetting.setServesTitle(null == rightsSettingTitleMap.get(RightsNowItemType.SERVES.value) ?
......@@ -727,6 +885,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
}
List<Long> productIds = new ArrayList<>();
List<Long> appIds = new ArrayList<>();
List<Long> groupIds = new ArrayList<>();
List<Long> appletNewsId = new ArrayList<>();
for (RightsNowItem item : nowItems) {
if (item.getServeId() != null && AppAndProductTypeEnum.PRODUCT.value.equals(item.getServeType())
&& !productIds.contains(item.getServeId())) {
......@@ -736,21 +896,39 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
&& !productIds.contains(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, AppDto> appDtoMap = new HashMap<>();
Map<Long, GroupActivity4AppletDTO> groupDtoMap = new HashMap<>();
Map<Long, AppletNewsDTO> newsDtoMap = new HashMap<>();
if (!ListUtils.isEmpty(productIds)) {
productDtoMap = productConsr.getProBasesByIds(productIds);
}
if (!ListUtils.isEmpty(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) {
Integer type = item.getType();
if (RightsNowItemType.ONLINE_COURSE.value.equals(type)
|| RightsNowItemType.LEARNING_TOOL.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;
if (AppAndProductTypeEnum.PRODUCT.value.equals(item.getServeType())) {
ProductDto productDto = productDtoMap.get(item.getServeId());
......@@ -792,6 +970,31 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
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 {
}
@Override
@Transactional(rollbackFor = Exception.class)
public void batchInsertRightsSettingItem(List<RightsSettingItem> rightsSettingItemList, Long rightsSettingId, String rightsType) {
if (null == rightsSettingId || StringUtil.isEmpty(rightsType)) {
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);
if (!ListUtils.isEmpty(rightsSettingItemList)) {
for (RightsSettingItem rightsSettingItem : rightsSettingItemList) {
......@@ -989,7 +1201,17 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (ListUtils.isEmpty(list)) {
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.stream().filter(e -> YesOrNoEnums.YES.getValue().equals(e.getIsOpen())
&& RightsNowItemType.ONLINE_REMIND.value.equals(e.getRightsClassifyId().intValue()))
......@@ -1007,6 +1229,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (!ListUtils.isEmpty(rightsSettingItemIds)) {
setGroupActivity(list, rightsSettingItemIds);
}
*/
return list;
}
......@@ -1179,6 +1403,19 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (RightsNowItemType.GIFT_COUPON_PACKAGE.value.equals(type)) {
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;
}
......
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;
import com.pcloud.book.skill.dto.GroupActivity4AppletDTO;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -68,6 +69,17 @@ public class RightsNowItem extends BaseEntity {
private Integer useType;
@ApiModelProperty("兑换地址")
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 {
timezone = "GMT+8"
)
private Date createTime;
/**
* 开启
*/
private Integer openState;
/**
* 权益标题
......@@ -79,6 +83,8 @@ public class RightsSettingItem extends BaseEntity {
@ApiModelProperty("社群")
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;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import lombok.Data;
@Data
public class RightsSettingTitle {
public class RightsSettingTitle implements Serializable {
private Long id;
private Long rightsSettingId;
......@@ -31,6 +33,8 @@ public class RightsSettingTitle {
)
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;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
public interface PcloudGroupActivityBiz {
/**
......@@ -44,4 +47,10 @@ public interface PcloudGroupActivityBiz {
* @return
*/
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 {
groupActivity4AppletDTO.setStatementDTOList(statementDTOS);
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> {
GroupActivity4AppletDTO getGroupActivity4Applet(Long firstClassify,Long secondClassify,Long gradeLabelId,Long subjectLabelId);
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>
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 @@
ORDER BY n.create_time DESC
</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
......
<?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 @@
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="title" column="title" 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="efficientRead" column="efficient_read" jdbcType="TINYINT" />
<result property="deepRead" column="deep_read" jdbcType="TINYINT" />
......@@ -21,10 +24,9 @@
select
i.id, i.rights_setting_id rightsSettingId,
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
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
<where>
<if test="id != null">
......@@ -56,9 +58,9 @@
<!--新增所有列-->
<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)
values (#{rightsSettingId}, #{rightsType}, #{rightsClassifyId}, #{description}, NOW(), #{title},#{uuid},
values (#{rightsSettingId}, #{rightsType}, #{rightsClassifyId}, #{description}, NOW(), #{title},#{uuid},#{openState},#{serveType},
#{easyRead},#{efficientRead},#{deepRead})
</insert>
......@@ -74,7 +76,7 @@
<!--批量新增-->
<insert id="batchInsert" useGeneratedKeys="true" parameterType="java.util.List">
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
)
values
......@@ -87,6 +89,8 @@
NOW(),
#{item.title},
#{item.uuid},
#{item.openState},
#{item.serveType}
#{item.easyRead},#{item.efficientRead},#{item.deepRead}
)
</foreach>
......
......@@ -10,6 +10,7 @@
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<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="efficient_read" jdbcType="TINYINT" property="efficientRead" />
<result column="deep_read" jdbcType="TINYINT" property="deepRead" />
......@@ -18,15 +19,15 @@
<sql id="baseSql">
id, rights_setting_id, rights_setting_title,
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>
<insert id="insert" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingTitle">
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,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},
#{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 id="insertSelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingTitle">
insert into rights_setting_title
......@@ -52,6 +53,9 @@
<if test="updateTime != null">
update_time,
</if>
<if test="serveType != null">
serve_type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -75,6 +79,9 @@
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="serveType != null">
#{serve_type,jdbcType=VARCHAR},
</if>
</trim>
</insert>
......@@ -89,12 +96,12 @@
<insert id="batchInsert" parameterType="com.pcloud.book.rightsSetting.entity.RightsSettingTitle">
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)
values
<foreach collection="list" item="item" index="index" separator=",">
(#{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})
</foreach>
</insert>
......@@ -118,6 +125,11 @@
when id=#{item.id} then #{item.openState}
</foreach>
</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,">
<foreach collection="list" item="item" index="index">
when id=#{item.id} then #{item.easyRead}
......
......@@ -132,6 +132,36 @@
where a.id = #{id,jdbcType=INTEGER}
</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
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