Commit f8819cd1 by pansy

feat: [1003274] 书刊权益页面支持sop流程方案流程

parent 7c650652
...@@ -94,5 +94,5 @@ public interface AppletUserBookcaseBiz { ...@@ -94,5 +94,5 @@ public interface AppletUserBookcaseBiz {
*/ */
Map<String,Integer> mapBookUserCountList(List<Long> bookIds); Map<String,Integer> mapBookUserCountList(List<Long> bookIds);
AppletUserBookcaseDTO getUserBookInfoByWechatUserId(Long bookId,Long channelId,Long adviserId); AppletUserBookcaseDTO getUserBookInfoByWechatUserId(Long bookId,Long channelId,Long adviserId,Long rightsSettingId);
} }
package com.pcloud.book.applet.biz.impl; package com.pcloud.book.applet.biz.impl;
import com.pcloud.appcenter.assist.dto.AssistTempletDTO; import com.pcloud.appcenter.assist.dto.AssistTempletDTO;
import com.pcloud.book.applet.biz.AppletNewsBiz;
import com.pcloud.book.applet.biz.AppletUserBookcaseBiz; import com.pcloud.book.applet.biz.AppletUserBookcaseBiz;
import com.pcloud.book.applet.contants.AppletConstants; import com.pcloud.book.applet.contants.AppletConstants;
import com.pcloud.book.applet.dao.AppletUserBookcaseDao; import com.pcloud.book.applet.dao.AppletUserBookcaseDao;
import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.dto.AppletNewsServeDTO;
import com.pcloud.book.applet.dto.AppletUserBookcaseDTO; import com.pcloud.book.applet.dto.AppletUserBookcaseDTO;
import com.pcloud.book.applet.dto.UserLastBookReDTO; import com.pcloud.book.applet.dto.UserLastBookReDTO;
import com.pcloud.book.applet.entity.AppletUserBookcase; import com.pcloud.book.applet.entity.AppletUserBookcase;
import com.pcloud.book.applet.entity.AppletUserClickRecord; import com.pcloud.book.applet.entity.AppletUserClickRecord;
import com.pcloud.book.applet.enums.AppletNewsServeTypeEnum;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.dao.BookRaysClassifyDao; import com.pcloud.book.book.dao.BookRaysClassifyDao;
import com.pcloud.book.book.entity.BookRaysClassify; import com.pcloud.book.book.entity.BookRaysClassify;
...@@ -15,19 +19,28 @@ import com.pcloud.book.consumer.app.AssistTempletConsr; ...@@ -15,19 +19,28 @@ import com.pcloud.book.consumer.app.AssistTempletConsr;
import com.pcloud.book.es.biz.ESBookAndAdviserBiz; import com.pcloud.book.es.biz.ESBookAndAdviserBiz;
import com.pcloud.book.group.biz.BookGroupBiz; import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.dto.BookServeDTO; import com.pcloud.book.group.dto.BookServeDTO;
import com.pcloud.book.group.enums.AppAndProductTypeEnum;
import com.pcloud.book.group.enums.JoinGroupTypeEnum; import com.pcloud.book.group.enums.JoinGroupTypeEnum;
import com.pcloud.book.push.dao.PersonalAppletsDao;
import com.pcloud.book.push.entity.PersonalApplets;
import com.pcloud.book.rightsSetting.biz.RightsSettingBiz; import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.rightsSetting.dao.RightsSettingDAO;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto; import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.rightsSetting.entity.RightsNowItem;
import com.pcloud.book.rightsSetting.entity.RightsReadType; import com.pcloud.book.rightsSetting.entity.RightsReadType;
import com.pcloud.book.rightsSetting.entity.RightsSetting;
import com.pcloud.book.rightsSetting.enums.RightsServeTypeEnum;
import com.pcloud.book.util.common.ThreadPoolUtils; import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.BeanUtils;
import com.pcloud.common.utils.DateUtils; import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils; import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import java.util.Arrays;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -62,6 +75,12 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz { ...@@ -62,6 +75,12 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
private RightsSettingBiz rightsSettingBiz; private RightsSettingBiz rightsSettingBiz;
@Autowired @Autowired
private ESBookAndAdviserBiz esBookAndAdviserBiz; private ESBookAndAdviserBiz esBookAndAdviserBiz;
@Autowired
private PersonalAppletsDao personalAppletsDao;
@Autowired
private AppletNewsBiz appletNewsBiz;
@Autowired
private RightsSettingDAO rightsSettingDAO;
@Override @Override
public void addUserBook(AppletUserBookcase appletUserBookcase) { public void addUserBook(AppletUserBookcase appletUserBookcase) {
...@@ -315,15 +334,75 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz { ...@@ -315,15 +334,75 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
} }
@Override @Override
public AppletUserBookcaseDTO getUserBookInfoByWechatUserId(Long bookId, Long channelId, Long adviserId) { public AppletUserBookcaseDTO getUserBookInfoByWechatUserId(Long bookId, Long channelId, Long adviserId,Long rightsSettingId) {
AppletUserBookcaseDTO userBookInfoByWechatUserId = appletUserBookcaseDao.getUserBookInfoByWechatUserId(bookId,channelId,adviserId); AppletUserBookcaseDTO userBookInfoByWechatUserId = appletUserBookcaseDao.getUserBookInfoByWechatUserId(bookId,channelId,adviserId);
if (userBookInfoByWechatUserId == null){ if (userBookInfoByWechatUserId == null){
return new AppletUserBookcaseDTO(); return new AppletUserBookcaseDTO();
} }
List<AppletUserBookcaseDTO> appletUserBookcaseDTOS = Collections.singletonList(userBookInfoByWechatUserId); List<AppletUserBookcaseDTO> appletUserBookcaseDTOS = Collections.singletonList(userBookInfoByWechatUserId);
fillTempletName(appletUserBookcaseDTOS); fillTempletName(appletUserBookcaseDTOS);
fillRightsSettingAndResourceCount(appletUserBookcaseDTOS); fillRightsSettingAndResourceCount(appletUserBookcaseDTOS);
fillReadGuide(appletUserBookcaseDTOS.get(0),rightsSettingId);
return appletUserBookcaseDTOS.get(0); return appletUserBookcaseDTOS.get(0);
} }
private void fillReadGuide(AppletUserBookcaseDTO appletUserBookcaseDTO,Long rightsSettingId){
RightsSetting rightsSetting = rightsSettingDAO.selectByPrimaryKey(rightsSettingId);
if (rightsSetting != null){
appletUserBookcaseDTO.setGuideId(rightsSetting.getGuideId());
appletUserBookcaseDTO.setGuideIsOpen(rightsSetting.getGuideIsOpen());
appletUserBookcaseDTO.setGuidePic(rightsSetting.getGuidePic());
appletUserBookcaseDTO.setGuideTitle(rightsSetting.getGuideTitle());
appletUserBookcaseDTO.setGuideType(rightsSetting.getGuideType());
}
if (RightsServeTypeEnum.NEWS.name().equalsIgnoreCase(appletUserBookcaseDTO.getGuideType()) && appletUserBookcaseDTO.getGuideId()!=null){
Long newsId = appletUserBookcaseDTO.getGuideId();
AppletNewsDTO appletNewsDTO = appletNewsBiz.getNewsById(newsId);
RightsNowItem rightsNowItem = new RightsNowItem();
BeanUtils.copyProperties(appletNewsDTO,rightsNowItem);
rightsNowItem.setNewsSource(appletNewsDTO.getSource());
rightsNowItem.setRightsSettingId(appletUserBookcaseDTO.getRightsSettingId());
rightsNowItem.setServeName(appletNewsDTO.getNewsName());
rightsNowItem.setServePic(appletNewsDTO.getPic1());
rightsNowItem.setServeType(RightsServeTypeEnum.NEWS.name());
rightsNowItem.setServeName("资讯");
rightsNowItem.setSource(appletNewsDTO.getSource());
rightsNowItem.setJumpType(appletNewsDTO.getJumpType());
appletUserBookcaseDTO.setGuideNewsItem(rightsNowItem);
}else if (AppAndProductTypeEnum.APPLET.name().equalsIgnoreCase(appletUserBookcaseDTO.getGuideType()) && appletUserBookcaseDTO.getGuideId()!=null){
Long newsId =appletUserBookcaseDTO.getGuideId();
Map<Long, PersonalApplets> personalAppletsMap = personalAppletsDao.mapByIds(Arrays.asList(newsId));
PersonalApplets personalApplets = personalAppletsMap.get(newsId);
AppletNewsServeDTO appletNewsServe = new AppletNewsServeDTO();
if(personalApplets == null){
return;
}
appletNewsServe.setId(newsId);
appletNewsServe.setLinkUrl(personalApplets.getAppletsUrl());
appletNewsServe.setAppletsId(personalApplets.getAppletsId());
appletNewsServe.setSloganImgUrl(personalApplets.getSloganImgUrl());
appletNewsServe.setSlogan(personalApplets.getSlogan());
appletNewsServe.setRemark(personalApplets.getRemark());
appletNewsServe.setAppletsUrl(personalApplets.getAppletsUrl());
appletNewsServe.setServeId(appletUserBookcaseDTO.getRightsSettingId());
appletNewsServe.setServeType(AppletNewsServeTypeEnum.APPLET.code);
appletUserBookcaseDTO.setGuideAppletServe(appletNewsServe);
}
}
} }
package com.pcloud.book.applet.dto; package com.pcloud.book.applet.dto;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.book.rightsSetting.entity.RightsNowItem;
import com.pcloud.common.dto.BaseDto; import com.pcloud.common.dto.BaseDto;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
@Data @Data
...@@ -85,4 +85,25 @@ public class AppletUserBookcaseDTO extends BaseDto { ...@@ -85,4 +85,25 @@ public class AppletUserBookcaseDTO extends BaseDto {
@ApiModelProperty("关联bookGroupId") @ApiModelProperty("关联bookGroupId")
private Long relatedBookGroupId; private Long relatedBookGroupId;
@ApiModelProperty("阅读导航是否打开")
private Long guideIsOpen;
@ApiModelProperty("阅读导航标题")
private String guideTitle;
@ApiModelProperty("阅读导航类型: NEWS 咨询 APP 小程序")
private String guideType;
@ApiModelProperty("导航关联id")
private Long guideId;
@ApiModelProperty("导航图片")
private String guidePic;
@ApiModelProperty("咨询对象")
private RightsNowItem guideNewsItem;
@ApiModelProperty("小程序对象")
private AppletNewsServeDTO guideAppletServe;
} }
...@@ -541,9 +541,10 @@ public class AppletHomeFacade { ...@@ -541,9 +541,10 @@ public class AppletHomeFacade {
@CookieValue("userInfo") String userInfo, @CookieValue("userInfo") String userInfo,
@RequestParam(value = "bookId") @ApiParam("BookId") Long bookId, @RequestParam(value = "bookId") @ApiParam("BookId") Long bookId,
@RequestParam(value = "channelId") @ApiParam("channelId") Long channelId, @RequestParam(value = "channelId") @ApiParam("channelId") Long channelId,
@RequestParam(value = "rightsSettingId",required = false) @ApiParam("rightsSettingId") Long rightsSettingId,
@RequestParam(value = "adviserId") @ApiParam("adviserId") Long adviserId){ @RequestParam(value = "adviserId") @ApiParam("adviserId") Long adviserId){
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID); Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
return new ResponseDto<>(appletUserBookcaseBiz.getUserBookInfoByWechatUserId(bookId,channelId,adviserId)); return new ResponseDto<>(appletUserBookcaseBiz.getUserBookInfoByWechatUserId(bookId,channelId,adviserId,rightsSettingId));
} }
@ApiOperation("新增用户资源点击记录") @ApiOperation("新增用户资源点击记录")
......
...@@ -8,6 +8,11 @@ package com.pcloud.book.group.enums; ...@@ -8,6 +8,11 @@ package com.pcloud.book.group.enums;
public enum AppAndProductTypeEnum { public enum AppAndProductTypeEnum {
/** /**
* APPLET
*/
APPLET("APPLET"),
/**
* APP * APP
*/ */
APP("APP"), APP("APP"),
......
...@@ -12,8 +12,11 @@ import com.pcloud.book.applet.dao.AppletNewsDao; ...@@ -12,8 +12,11 @@ import com.pcloud.book.applet.dao.AppletNewsDao;
import com.pcloud.book.applet.dao.AppletUserBookcaseDao; import com.pcloud.book.applet.dao.AppletUserBookcaseDao;
import com.pcloud.book.applet.dto.AppletGroupStatementDTO; import com.pcloud.book.applet.dto.AppletGroupStatementDTO;
import com.pcloud.book.applet.dto.AppletNewsDTO; import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.dto.AppletNewsServeDTO;
import com.pcloud.book.applet.entity.AppletNews; import com.pcloud.book.applet.entity.AppletNews;
import com.pcloud.book.applet.entity.AppletNewsServe;
import com.pcloud.book.applet.entity.AppletUserBookcase; import com.pcloud.book.applet.entity.AppletUserBookcase;
import com.pcloud.book.applet.enums.AppletNewsServeTypeEnum;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookAdviserBiz; import com.pcloud.book.book.biz.BookAdviserBiz;
import com.pcloud.book.book.biz.BookBiz; import com.pcloud.book.book.biz.BookBiz;
...@@ -40,6 +43,8 @@ import com.pcloud.book.group.dto.BookServeDTO; ...@@ -40,6 +43,8 @@ import com.pcloud.book.group.dto.BookServeDTO;
import com.pcloud.book.group.enums.AppAndProductTypeEnum; import com.pcloud.book.group.enums.AppAndProductTypeEnum;
import com.pcloud.book.group.tools.SendWeixinRequestTools; import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.group.vo.ClassifyQrcodeVO; import com.pcloud.book.group.vo.ClassifyQrcodeVO;
import com.pcloud.book.push.dao.PersonalAppletsDao;
import com.pcloud.book.push.entity.PersonalApplets;
import com.pcloud.book.rightsSetting.biz.RightsSettingBiz; import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.rightsSetting.check.RightsSettingCheck; import com.pcloud.book.rightsSetting.check.RightsSettingCheck;
import com.pcloud.book.rightsSetting.constants.RightsSettingConstant; import com.pcloud.book.rightsSetting.constants.RightsSettingConstant;
...@@ -83,12 +88,15 @@ import com.pcloud.channelcenter.wechat.dto.AccountSettingDto; ...@@ -83,12 +88,15 @@ import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.BeanUtils;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.NumberUtil; import com.pcloud.common.utils.NumberUtil;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils; import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.common.utils.string.StringUtilParent; import com.pcloud.common.utils.string.StringUtilParent;
import com.pcloud.resourcecenter.product.dto.ProductDto; import com.pcloud.resourcecenter.product.dto.ProductDto;
import java.util.Arrays;
import java.util.Comparator;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
...@@ -189,6 +197,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -189,6 +197,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
private AppletUserBookcaseDao appletUserBookcaseDao; private AppletUserBookcaseDao appletUserBookcaseDao;
@Autowired @Autowired
private RightsSettingBiz rightsSettingBiz; private RightsSettingBiz rightsSettingBiz;
@Autowired
private PersonalAppletsDao personalAppletsDao;
@Override @Override
@ParamLog("新增权益设置") @ParamLog("新增权益设置")
...@@ -199,6 +209,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -199,6 +209,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (existCheck(rightsSetting) > 0) { if (existCheck(rightsSetting) > 0) {
throw new BookBizException(BookBizException.ERROR, "已存在相同的权益设置"); throw new BookBizException(BookBizException.ERROR, "已存在相同的权益设置");
} }
this.setReadGuide(rightsSetting);
rightsSettingDAO.insert(rightsSetting); rightsSettingDAO.insert(rightsSetting);
Long rightsSettingId = rightsSetting.getId(); Long rightsSettingId = rightsSetting.getId();
if (null == rightsSettingId) { if (null == rightsSettingId) {
...@@ -219,6 +230,22 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -219,6 +230,22 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
return rightsSetting.getId(); return rightsSetting.getId();
} }
private void setReadGuide(RightsSetting rightsSetting){
if (RightsServeTypeEnum.NEWS.name().equalsIgnoreCase(rightsSetting.getGuideType())){
if (rightsSetting.getGuideNewsItem()!=null){
rightsSetting.setGuideId(rightsSetting.getGuideNewsItem().getId());
}else {
rightsSetting.setGuideId(null);
}
}else if (AppAndProductTypeEnum.APPLET.name().equalsIgnoreCase(rightsSetting.getGuideType())){
if (rightsSetting.getGuideAppletServe()!=null){
rightsSetting.setGuideId(rightsSetting.getGuideAppletServe().getId());
}else {
rightsSetting.setGuideId(null);
}
}
}
@Override @Override
public void setClassifyAndLabel(BaseTempletClassify baseTempletClassify) { public void setClassifyAndLabel(BaseTempletClassify baseTempletClassify) {
log.info("对于某些特殊分类做处理"); log.info("对于某些特殊分类做处理");
...@@ -340,6 +367,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -340,6 +367,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (existCheck(rightsSetting) > 0) { if (existCheck(rightsSetting) > 0) {
throw new BookBizException(BookBizException.ERROR, "已存在相同的权益设置"); throw new BookBizException(BookBizException.ERROR, "已存在相同的权益设置");
} }
this.setReadGuide(rightsSetting);
rightsSettingDAO.updateByPrimaryKey(rightsSetting); rightsSettingDAO.updateByPrimaryKey(rightsSetting);
//更新阅读方式 //更新阅读方式
rightsReadTypeMapper.deleteByRightsSettingId(rightsSettingId); rightsReadTypeMapper.deleteByRightsSettingId(rightsSettingId);
...@@ -707,15 +735,64 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -707,15 +735,64 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
fillRightsWeekAndLongTarm(rightsSetting); fillRightsWeekAndLongTarm(rightsSetting);
//设置阅读方式 //设置阅读方式
setReadType(rightsSetting); setReadType(rightsSetting);
//设置阅读指引
fillReadGuide(rightsSetting);
return rightsSetting; return rightsSetting;
} }
private void fillReadGuide(RightsSetting rightsSetting){
if (RightsServeTypeEnum.NEWS.name().equalsIgnoreCase(rightsSetting.getGuideType()) && rightsSetting.getGuideId()!=null){
Long newsId = rightsSetting.getGuideId();
AppletNewsDTO appletNewsDTO = appletNewsBiz.getNewsById(newsId);
RightsNowItem rightsNowItem = new RightsNowItem();
BeanUtils.copyProperties(appletNewsDTO,rightsNowItem);
rightsNowItem.setNewsSource(appletNewsDTO.getSource());
rightsNowItem.setRightsSettingId(rightsSetting.getId());
rightsNowItem.setServeName(appletNewsDTO.getNewsName());
rightsNowItem.setServePic(appletNewsDTO.getPic1());
rightsNowItem.setServeType(RightsServeTypeEnum.NEWS.name());
rightsNowItem.setServeName("资讯");
rightsNowItem.setSource(appletNewsDTO.getSource());
rightsNowItem.setJumpType(appletNewsDTO.getJumpType());
rightsSetting.setGuideNewsItem(rightsNowItem);
}else if (AppAndProductTypeEnum.APPLET.name().equalsIgnoreCase(rightsSetting.getGuideType()) && rightsSetting.getGuideId()!=null){
Long newsId =rightsSetting.getGuideId();
Map<Long, PersonalApplets> personalAppletsMap = personalAppletsDao.mapByIds(Arrays.asList(newsId));
PersonalApplets personalApplets = personalAppletsMap.get(newsId);
AppletNewsServeDTO appletNewsServe = new AppletNewsServeDTO();
if(personalApplets == null){
return;
}
appletNewsServe.setId(newsId);
appletNewsServe.setLinkUrl(personalApplets.getAppletsUrl());
appletNewsServe.setAppletsId(personalApplets.getAppletsId());
appletNewsServe.setSloganImgUrl(personalApplets.getSloganImgUrl());
appletNewsServe.setSlogan(personalApplets.getSlogan());
appletNewsServe.setServeId(1l);
appletNewsServe.setRemark(personalApplets.getRemark());
appletNewsServe.setAppletsUrl(personalApplets.getAppletsUrl());
appletNewsServe.setServeId(rightsSetting.getId());
appletNewsServe.setServeType(AppletNewsServeTypeEnum.APPLET.code);
rightsSetting.setGuideAppletServe(appletNewsServe);
}
}
private void fillRightsNowItems4New(RightsSetting rightsSetting) { private void fillRightsNowItems4New(RightsSetting rightsSetting) {
log.info("即享权益填充详情"); log.info("即享权益填充详情");
List<Integer> types = new ArrayList<>(); List<Integer> types = new ArrayList<>();
RightsSettingNow rightsSettingNow = new RightsSettingNow(); RightsSettingNow rightsSettingNow = new RightsSettingNow();
types.addAll(Lists.newArrayList(RightsNowItemTypeNew.ONLINE_COURSE.value, RightsNowItemTypeNew.LEARNING_TOOL.value, types.addAll(Lists.newArrayList(RightsNowItemTypeNew.ONLINE_COURSE.value, RightsNowItemTypeNew.LEARNING_TOOL.value,
RightsNowItemTypeNew.GIFT_COUPON_PACKAGE.value, RightsNowItemTypeNew.DRAW.value, RightsNowItemTypeNew.GROUP_SERVICE.value)); RightsNowItemTypeNew.GIFT_COUPON_PACKAGE.value, RightsNowItemTypeNew.DRAW.value, RightsNowItemTypeNew.GROUP_SERVICE.value,RightsNowItemTypeNew.ONLINE_EXCL_COURSE.value,RightsNowItemTypeNew.COACH.value));
List<RightsSettingTitle> rightsSettingTitles = rightsSettingTitleMapper.getByRightSettingId(rightsSetting.getId(), null); List<RightsSettingTitle> rightsSettingTitles = rightsSettingTitleMapper.getByRightSettingId(rightsSetting.getId(), null);
if (ListUtils.isEmpty(rightsSettingTitles)) { if (ListUtils.isEmpty(rightsSettingTitles)) {
return; return;
...@@ -952,6 +1029,26 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -952,6 +1029,26 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
* @Date 2020/4/24 16:59 * @Date 2020/4/24 16:59
* @Param [rightsSetting, wechatUserId] * @Param [rightsSetting, wechatUserId]
**/ **/
@ParamLog(value = "填充线上专课", isAfterReturn = false)
private RightsSetting setOnlineExclCourse(RightsSetting rightsSetting, Long wechatUserId, Integer readType, Long bookId) {
RightsSettingTitle rightsSettingTitle = getRightsSettingTitle(rightsSetting, RightsNowItemTypeNew.ONLINE_EXCL_COURSE, readType);
if (null != rightsSettingTitle){
List<RightsNowItem> nowItems = rightsNowItemDao
.getListByRightsSettingTitleId(rightsSettingTitle.getId(), Collections.singletonList(RightsNowItemTypeNew.ONLINE_EXCL_COURSE.value));
processNowItems(rightsSettingTitle, nowItems, RightsNowItemTypeNew.ONLINE_EXCL_COURSE, rightsSetting.getId(), wechatUserId,
Long.valueOf(RightsNowItemTypeNew.ONLINE_EXCL_COURSE.value), BookConstant.MAX_NEWS_COUNT, bookId);
rightsSetting.setOnlineRightsSettingTitle(rightsSettingTitle);
}
return rightsSetting;
}
/**
* @return void
* @Author David
* @Description 设置线上网课
* @Date 2020/4/24 16:59
* @Param [rightsSetting, wechatUserId]
**/
@ParamLog(value = "填充线上网课", isAfterReturn = false) @ParamLog(value = "填充线上网课", isAfterReturn = false)
private RightsSetting setOnlineCourse(RightsSetting rightsSetting, Long wechatUserId, Integer readType, Long bookId) { private RightsSetting setOnlineCourse(RightsSetting rightsSetting, Long wechatUserId, Integer readType, Long bookId) {
RightsSettingTitle rightsSettingTitle = getRightsSettingTitle(rightsSetting, RightsNowItemTypeNew.ONLINE_COURSE, readType); RightsSettingTitle rightsSettingTitle = getRightsSettingTitle(rightsSetting, RightsNowItemTypeNew.ONLINE_COURSE, readType);
...@@ -974,6 +1071,28 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -974,6 +1071,28 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
* @Param [rightsSetting, wechatUserId] * @Param [rightsSetting, wechatUserId]
**/ **/
@ParamLog(value = "填充学习工具", isAfterReturn = false) @ParamLog(value = "填充学习工具", isAfterReturn = false)
private RightsSetting setCoach1V1(RightsSetting rightsSetting, Long wechatUserId, Integer readType, Long bookId) {
RightsSettingTitle rightsSettingTitle = getRightsSettingTitle(rightsSetting, RightsNowItemTypeNew.COACH, readType);
if (null != rightsSettingTitle) {
List<RightsNowItem> nowItems = rightsNowItemDao
.getListByRightsSettingTitleId(rightsSettingTitle.getId(), Collections.singletonList(RightsNowItemTypeNew.COACH.value));
processNowItems(rightsSettingTitle, nowItems, RightsNowItemTypeNew.COACH, rightsSetting.getId(), wechatUserId,
Long.valueOf(RightsNowItemTypeNew.COACH.value), BookConstant.MAX_NEWS_COUNT, bookId);
rightsSetting.setLearningToolTitle(rightsSettingTitle);
}
return rightsSetting;
}
/**
* @return void
* @Author David
* @Description 填充学习工具
* @Date 2020/4/24 20:10
* @Param [rightsSetting, wechatUserId]
**/
@ParamLog(value = "填充学习工具", isAfterReturn = false)
private RightsSetting setLearningTool(RightsSetting rightsSetting, Long wechatUserId, Integer readType, Long bookId) { private RightsSetting setLearningTool(RightsSetting rightsSetting, Long wechatUserId, Integer readType, Long bookId) {
RightsSettingTitle rightsSettingTitle = getRightsSettingTitle(rightsSetting, RightsNowItemTypeNew.LEARNING_TOOL, readType); RightsSettingTitle rightsSettingTitle = getRightsSettingTitle(rightsSetting, RightsNowItemTypeNew.LEARNING_TOOL, readType);
if (null != rightsSettingTitle) { if (null != rightsSettingTitle) {
...@@ -1209,7 +1328,9 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1209,7 +1328,9 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
|| RightsNowItemTypeNew.LEARNING_TOOL.value.equals(type) || RightsNowItemTypeNew.LEARNING_TOOL.value.equals(type)
|| RightsNowItemTypeNew.DRAW.value.equals(type) || RightsNowItemTypeNew.DRAW.value.equals(type)
|| RightsNowItemTypeNew.SERVES.value.equals(type) || RightsNowItemTypeNew.SERVES.value.equals(type)
|| RightsNowItemTypeNew.GROUP_SERVICE.value.equals(type)) { || RightsNowItemTypeNew.GROUP_SERVICE.value.equals(type)
|| RightsNowItemTypeNew.COACH.value.equals(type)
|| RightsNowItemTypeNew.ONLINE_EXCL_COURSE.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());
...@@ -1798,6 +1919,14 @@ public class RightsSettingBizImpl implements RightsSettingBiz { ...@@ -1798,6 +1919,14 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (RightsNowItemTypeNew.GROUP_SERVICE.value.equals(type)) { if (RightsNowItemTypeNew.GROUP_SERVICE.value.equals(type)) {
return setGroupService(rightsSetting, wechatUserId, readType, bookId); return setGroupService(rightsSetting, wechatUserId, readType, bookId);
} }
// 老师1V1
if (RightsNowItemTypeNew.COACH.value.equals(type)) {
return setCoach1V1(rightsSetting, wechatUserId, readType, bookId);
}
// 获取线上专课
if (RightsNowItemTypeNew.ONLINE_EXCL_COURSE.value.equals(type)) {
return setOnlineExclCourse(rightsSetting, wechatUserId, readType, bookId);
}
return rightsSetting; return rightsSetting;
} }
......
...@@ -20,6 +20,9 @@ public class RightsReadType { ...@@ -20,6 +20,9 @@ public class RightsReadType {
@Range(min = 1,max = 3,message = "阅读类型只能是轻松、高效和深度") @Range(min = 1,max = 3,message = "阅读类型只能是轻松、高效和深度")
private Integer readType; private Integer readType;
@ApiModelProperty("阅读类型名称")
private String readTypeName;
@ApiModelProperty("描述") @ApiModelProperty("描述")
@Size(max = 30,message="描述最多30个字") @Size(max = 30,message="描述最多30个字")
private String description; private String description;
......
package com.pcloud.book.rightsSetting.entity; package com.pcloud.book.rightsSetting.entity;
import com.pcloud.book.applet.dto.AppletNewsServeDTO;
import com.pcloud.book.applet.entity.AppletNewsServe;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.util.List; import java.util.List;
import javax.validation.Valid; import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import lombok.Data; import lombok.Data;
import lombok.NonNull; import lombok.NonNull;
...@@ -115,6 +118,29 @@ public class RightsSetting extends BaseTempletClassify { ...@@ -115,6 +118,29 @@ public class RightsSetting extends BaseTempletClassify {
*/ */
private Long volLabelId; private Long volLabelId;
@NotNull(message = "本书阅读指引不能为空")
@ApiModelProperty("是否打开阅读指引 1:开 0:关")
private Long guideIsOpen;
private Long guideId;
@NonNull
@ApiModelProperty("阅读指引图片")
private String guidePic;
@ApiModelProperty("阅读指引标题")
private String guideTitle;
@NonNull
@ApiModelProperty("阅读指引类型")
private String guideType;
@ApiModelProperty("咨询对象")
private RightsNowItem guideNewsItem;
@ApiModelProperty("小程序对象")
private AppletNewsServeDTO guideAppletServe;
public RightsSetting() { public RightsSetting() {
} }
......
...@@ -38,7 +38,19 @@ public enum RightsNowItemTypeNew { ...@@ -38,7 +38,19 @@ public enum RightsNowItemTypeNew {
/** /**
* 线上读书活动 * 线上读书活动
*/ */
ONLINE_READING_ACTIVITY(8); ONLINE_READING_ACTIVITY(8),
/**
* 老师1V1
*/
COACH(15),
/**
* 线上专享课
*/
ONLINE_EXCL_COURSE(16);
public final Integer value; public final Integer value;
......
...@@ -9,9 +9,10 @@ ...@@ -9,9 +9,10 @@
<result column="learning_length" property="learningLength" jdbcType="INTEGER" /> <result column="learning_length" property="learningLength" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="read_type_name" property="readTypeName" jdbcType="VARCHAR" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
id, rights_setting_id, read_type, description, learning_length, create_time, update_time id, rights_setting_id, read_type, description, learning_length, create_time, update_time,read_type_name
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select select
...@@ -96,11 +97,11 @@ ...@@ -96,11 +97,11 @@
</insert> </insert>
<insert id="batchInsert" parameterType="com.pcloud.book.rightsSetting.entity.RightsReadType"> <insert id="batchInsert" parameterType="com.pcloud.book.rightsSetting.entity.RightsReadType">
insert into rights_read_type (rights_setting_id, read_type, insert into rights_read_type (rights_setting_id, read_type,
description, learning_length, create_time, update_time) description, learning_length, create_time, update_time,read_type_name)
values values
<foreach collection="list" item="item" index="index" separator=","> <foreach collection="list" item="item" index="index" separator=",">
( #{item.rightsSettingId,jdbcType=BIGINT}, #{item.readType,jdbcType=INTEGER}, ( #{item.rightsSettingId,jdbcType=BIGINT}, #{item.readType,jdbcType=INTEGER},
#{item.description,jdbcType=VARCHAR}, #{item.learningLength,jdbcType=INTEGER},now(), now()) #{item.description,jdbcType=VARCHAR}, #{item.learningLength,jdbcType=INTEGER},now(), now(), #{item.readTypeName,jdbcType=VARCHAR})
</foreach> </foreach>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsReadType" > <update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsReadType" >
......
...@@ -20,6 +20,11 @@ ...@@ -20,6 +20,11 @@
<result column="draw_open" property="drawNowOpen" jdbcType="BOOLEAN" /> <result column="draw_open" property="drawNowOpen" jdbcType="BOOLEAN" />
<result column="read_type_title" property="readTypeTitle" jdbcType="VARCHAR" /> <result column="read_type_title" property="readTypeTitle" jdbcType="VARCHAR" />
<result column="vol_label_id" property="volLabelId" jdbcType="BIGINT" /> <result column="vol_label_id" property="volLabelId" jdbcType="BIGINT" />
<result column="reading_guide" property="guideIsOpen" jdbcType="BOOLEAN" />
<result column="guide_title" property="guideTitle" jdbcType="VARCHAR" />
<result column="guide_type" property="guideType" jdbcType="VARCHAR" />
<result column="guide_id" property="guideId" jdbcType="BIGINT" />
<result column="guide_pic" property="guidePic" jdbcType="VARCHAR" />
</resultMap> </resultMap>
<resultMap id="DtoResultMap" type="com.pcloud.book.rightsSetting.dto.RightsSettingDto"> <resultMap id="DtoResultMap" type="com.pcloud.book.rightsSetting.dto.RightsSettingDto">
...@@ -52,13 +57,14 @@ ...@@ -52,13 +57,14 @@
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
id, introduce, detail, count, first_classify, second_classify, grade_label_id, subject_label_id, id, introduce, detail, count, first_classify, second_classify, grade_label_id, subject_label_id,
create_time, update_time, enable_group_service, rights_setting_type, book_id create_time, update_time, enable_group_service, rights_setting_type, book_id
,online_course_open,learning_tool_open,draw_open,read_type_title, vol_label_id ,online_course_open,learning_tool_open,draw_open,read_type_title, vol_label_id,
reading_guide,guide_title,guide_type,guide_id,guide_pic
</sql> </sql>
<sql id="Base_Column_List_own" > <sql id="Base_Column_List_own" >
r.id, r.introduce, r.detail, r.count, r.first_classify, r.second_classify, r.grade_label_id, r.subject_label_id, r.id, r.introduce, r.detail, r.count, r.first_classify, r.second_classify, r.grade_label_id, r.subject_label_id,
r.create_time, r.update_time, r.enable_group_service, r.rights_setting_type, r.book_id r.create_time, r.update_time, r.enable_group_service, r.rights_setting_type, r.book_id
,r.online_course_open,r.learning_tool_open,r.draw_open,r.read_type_title, r.vol_label_id ,r.online_course_open,r.learning_tool_open,r.draw_open,r.read_type_title,r.vol_label_id
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
...@@ -76,12 +82,14 @@ ...@@ -76,12 +82,14 @@
count, first_classify, second_classify, count, first_classify, second_classify,
grade_label_id, subject_label_id, create_time, grade_label_id, subject_label_id, create_time,
update_time, enable_group_service, rights_setting_type, book_id, update_time, enable_group_service, rights_setting_type, book_id,
online_course_open,learning_tool_open,draw_open,read_type_title, vol_label_id) online_course_open,learning_tool_open,draw_open,read_type_title, vol_label_id,
reading_guide,guide_title,guide_type,guide_id,guide_pic)
values ( #{introduce,jdbcType=VARCHAR}, #{detail,jdbcType=VARCHAR}, values ( #{introduce,jdbcType=VARCHAR}, #{detail,jdbcType=VARCHAR},
#{count,jdbcType=INTEGER}, #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT}, #{count,jdbcType=INTEGER}, #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT},
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, now(), #{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, now(),
#{updateTime,jdbcType=TIMESTAMP}, #{enableGroupService}, #{rightsSettingType}, #{bookId}, #{updateTime,jdbcType=TIMESTAMP}, #{enableGroupService}, #{rightsSettingType}, #{bookId},
#{onlineCourseOpen},#{learningToolOpen},#{drawNowOpen},#{readTypeTitle}, #{volLabelId}) #{onlineCourseOpen},#{learningToolOpen},#{drawNowOpen},#{readTypeTitle}, #{volLabelId},
#{guideIsOpen},#{guideTitle},#{guideType},#{guideId},#{guidePic})
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsSetting" > <update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsSetting" >
update rights_setting update rights_setting
...@@ -129,11 +137,26 @@ ...@@ -129,11 +137,26 @@
learning_tool_open = #{learningToolOpen}, learning_tool_open = #{learningToolOpen},
</if> </if>
<if test="drawNowOpen != null" > <if test="drawNowOpen != null" >
draw_open = #{drawNowOpen} draw_open = #{drawNowOpen},
</if> </if>
<if test="volLabelId != null" > <if test="volLabelId != null" >
vol_label_id = #{volLabelId,jdbcType=BIGINT}, vol_label_id = #{volLabelId,jdbcType=BIGINT},
</if> </if>
<if test="guideIsOpen != null" >
reading_guide = #{guideIsOpen},
</if>
<if test="guideTitle != null" >
guide_title = #{guideTitle,jdbcType=VARCHAR},
</if>
<if test="guideType != null" >
guide_type = #{guideType,jdbcType=VARCHAR},
</if>
<if test="guideId != null" >
guide_id = #{guideId,jdbcType=BIGINT},
</if>
<if test="guidePic != null" >
guide_pic = #{guidePic,jdbcType=VARCHAR}
</if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
...@@ -153,7 +176,12 @@ ...@@ -153,7 +176,12 @@
learning_tool_open = #{learningToolOpen}, learning_tool_open = #{learningToolOpen},
draw_open = #{drawNowOpen}, draw_open = #{drawNowOpen},
read_type_title = #{readTypeTitle}, read_type_title = #{readTypeTitle},
vol_label_id = #{volLabelId,jdbcType=BIGINT} vol_label_id = #{volLabelId,jdbcType=BIGINT},
reading_guide = #{guideIsOpen},
guide_title = #{guideTitle,jdbcType=VARCHAR},
guide_type = #{guideType,jdbcType=VARCHAR},
guide_id = #{guideId,jdbcType=BIGINT},
guide_pic = #{guidePic,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
......
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