Commit 3fb27df5 by 吴博

feat: [1004417] 本书服务页banner

parent 64d3239d
......@@ -21,7 +21,10 @@ public enum AppletRecordTypeEnum {
//精选书单
BOOK_LIST(9, "精选书单"),
//企业微信客服
WX_WORK_TEACHER(10, "微信客服");
WX_WORK_TEACHER(10, "微信客服"),
//第三方资源
ThIRD_RESOURCE(11, "第三方资源");
public Integer value;
......
......@@ -6,6 +6,7 @@ import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.dto.AppletNewsVO;
import com.pcloud.book.applet.dto.AppletOuterBookDTO;
import com.pcloud.book.applet.dto.AppletOuterBooklistDTO;
import com.pcloud.book.applet.dto.AppletThirdResourcesDTO;
import com.pcloud.book.applet.dto.PcloudGroupActivityDTO;
import com.pcloud.book.applet.dto.ServeCollectDTO;
import com.pcloud.common.dto.ResponseDto;
......@@ -128,4 +129,9 @@ public interface AppletService {
@ApiOperation("定时任务从redis中删掉超时的本书服务记录")
@GetMapping("autoDeleteReadBook")
void autoDeleteReadBook();
@ApiOperation("查询第三方资源")
@GetMapping("getThirdResourceById")
ResponseEntity<ResponseDto<AppletThirdResourcesDTO>> getThirdResourceById(@RequestParam("thirdResourcesId") Long thirdResourcesId);
}
......@@ -55,7 +55,7 @@ public interface AppletBannerBiz {
*/
PageBeanNew<AppletBannerDTO> listBanner4Wechat(Integer currentPage, Integer numPerPage, Boolean showState, Long officialAccountsId, Long wechatUserId);
void bannerClickRecord(Long wechatUserId, Long bannerId);
void bannerClickRecord(Long wechatUserId, Long bannerId, Integer locationType);
/**
*
......
......@@ -5,6 +5,7 @@ import com.pcloud.book.applet.dto.AppletNewsCommentDTO;
import com.pcloud.book.applet.dto.AppletNewsCustomTagDTO;
import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.dto.AppletNewsVO;
import com.pcloud.book.applet.dto.AppletThirdResourcesDTO;
import com.pcloud.book.applet.entity.AppletLinkClick;
import com.pcloud.book.applet.entity.AppletNews;
import com.pcloud.book.applet.entity.AppletNewsClassify;
......@@ -312,4 +313,11 @@ public interface AppletNewsBiz {
Map<Long, AppletNewsDTO> getByIds4Record(List<Long> newsIds);
void fillBrowseCount(List<AppletNewsDTO> recordList);
/**
* 查询第三方资源
* @param thirdResourcesId
* @return
*/
AppletThirdResourcesDTO getThirdResourceById(Long thirdResourcesId);
}
......@@ -7,6 +7,7 @@ import com.pcloud.book.applet.entity.AppletThirdResourcesClick;
import com.pcloud.common.page.PageBeanNew;
import java.util.List;
import java.util.Map;
public interface AppletThirdResourcesBiz {
......@@ -33,4 +34,6 @@ public interface AppletThirdResourcesBiz {
void createThirdResources(AppletThirdResourcesDTO thirdResourcesDTO);
PageBeanNew<ThirdResourceRecordDTO> listThirdResourceRecord(String queryName, Integer currentPage, Integer numPerPage, String wechatUser, Long thirdResourceId, Integer recordType);
Map<Long, AppletThirdResources> getAppletMapByIds(List<Long> list);
}
......@@ -24,19 +24,22 @@ import com.pcloud.book.consumer.app.AppConsr;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.rightsSetting.biz.RightsSettingBannerBiz;
import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.rightsSetting.entity.RightsSettingBanner;
import com.pcloud.book.util.common.YesOrNoEnums;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ParamChecker;
import com.pcloud.common.utils.ServeLinkUtils;
import com.pcloud.facade.quartz.entity.CallBackParam;
import com.pcloud.facade.quartz.entity.ScheduleJob;
import com.pcloud.facade.quartz.service.ScheduleService;
import com.pcloud.readercenter.common.enums.YesOrNoNumEnum;
import com.pcloud.resourcecenter.product.dto.ProductDto;
import com.pcloud.usercenter.common.enums.YesOrNoEnum;
import com.pcloud.wechatgroup.base.exception.WechatGroupBizException;
import lombok.extern.slf4j.Slf4j;
import org.codehaus.jackson.JsonParseException;
......@@ -87,6 +90,8 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
private QrcodeSceneConsr qrcodeSceneConsr;
@Autowired
private ScheduleService scheduleService;
@Autowired
private RightsSettingBannerBiz rightsSettingBannerBiz;
@Override
......@@ -362,20 +367,46 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
}
@Override
public void bannerClickRecord(Long wechatUserId, Long bannerId) {
AppletBanner banner = appletBannerDao.getById(bannerId);
public void bannerClickRecord(Long wechatUserId, Long bannerId, Integer locationType) {
if (Objects.isNull(banner)) {
appletBannerRecordMapper.insert(AppletBannerRecord.builder()
.bannerId(bannerId).createTime(new Date()).wechatUserId(wechatUserId).createHour(DateUtil.thisHour(Boolean.TRUE)).createDate(DateUtil.today()).build());
if (null == locationType) {
locationType = YesOrNoNumEnum.YES.getValue();
}
if (YesOrNoNumEnum.YES.getValue().equals(locationType)) {
AppletBanner banner = appletBannerDao.getById(bannerId);
if (Objects.isNull(banner)) {
appletBannerRecordMapper.insert(AppletBannerRecord.builder()
.bannerId(bannerId).createTime(new Date()).wechatUserId(wechatUserId).createHour(DateUtil.thisHour(Boolean.TRUE)).
createDate(DateUtil.today()).locationType(locationType).build());
} else {
AppletBannerRecord record = AppletBannerRecord.builder()
.createTime(new Date()).wechatUserId(wechatUserId)
.bannerId(bannerId).jumpType(banner.getJumpType())
.serveId(banner.getServeId()).serveType(banner.getServeType()).
createHour(DateUtil.thisHour(Boolean.TRUE)).
createDate(DateUtil.today())
.locationType(locationType).
build();
appletBannerRecordMapper.insert(record);
}
} else {
AppletBannerRecord record = AppletBannerRecord.builder()
.createTime(new Date()).wechatUserId(wechatUserId)
.bannerId(bannerId).jumpType(banner.getJumpType())
.serveId(banner.getServeId()).serveType(banner.getServeType()).
createHour(DateUtil.thisHour(Boolean.TRUE)).
createDate(DateUtil.today()).build();
appletBannerRecordMapper.insert(record);
RightsSettingBanner banner = rightsSettingBannerBiz.getById(bannerId);
if (Objects.isNull(banner)) {
appletBannerRecordMapper.insert(AppletBannerRecord.builder()
.bannerId(bannerId).createTime(new Date()).wechatUserId(wechatUserId).createHour(DateUtil.thisHour(Boolean.TRUE)).
createDate(DateUtil.today()).locationType(locationType).build());
} else {
AppletBannerRecord record = AppletBannerRecord.builder()
.createTime(new Date()).wechatUserId(wechatUserId)
.bannerId(bannerId).jumpType(banner.getJumpType())
.serveId(banner.getServeId()).serveType(banner.getServeType()).
createHour(DateUtil.thisHour(Boolean.TRUE)).
createDate(DateUtil.today())
.locationType(locationType).
build();
appletBannerRecordMapper.insert(record);
}
}
}
......@@ -387,7 +418,7 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
Integer startHour = DateUtil.hour(new Date(), Boolean.TRUE);
String startTime = DateUtil.yesterday().toStringDefaultTimeZone() + " " + startHour + ":00:00";
String endTime = DateUtil.today() + " " + startHour + ":00:00";
trendDTOList = appletBannerRecordMapper.getBannerRecordTrendByHour(startTime,endTime, id);
trendDTOList = appletBannerRecordMapper.getBannerRecordTrendByHour(startTime,endTime, id, YesOrNoNumEnum.YES.getValue());
List<Integer> hours = trendDTOList.stream().filter(s -> s.getHour() != null).map(AppletBannerTrendDTO::getHour).collect(Collectors.toList());
List<Integer> hourAll = new ArrayList<>();
for (int i = 0; i <= 23; i++) {
......@@ -409,7 +440,7 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
trendDTOList = list4YesterDay;
} else {
//日发送趋势
trendDTOList = appletBannerRecordMapper.getBannerRecordTrendByDay(startDate, endDate, id);
trendDTOList = appletBannerRecordMapper.getBannerRecordTrendByDay(startDate, endDate, id, YesOrNoNumEnum.YES.getValue());
List<String> dates = trendDTOList.stream().filter(s -> s.getDate() != null).map(AppletBannerTrendDTO::getDate).collect(Collectors.toList());
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
//填充数据为0的日期
......
......@@ -772,6 +772,21 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
}
}
@Override
public AppletThirdResourcesDTO getThirdResourceById(Long thirdResourcesId) {
if (null == thirdResourcesId) {
return new AppletThirdResourcesDTO();
}
AppletThirdResources byResourcesId = thirdResourcesDao.getByResourcesId(thirdResourcesId);
AppletThirdResourcesDTO appletThirdResourcesDTO = new AppletThirdResourcesDTO();
BeanUtils.copyProperties(byResourcesId, appletThirdResourcesDTO);
if (appletThirdResourcesDTO.getType()==2) {
List<String> pics = appletThirdResourcesPicMapper.getPicList(appletThirdResourcesDTO.getId());
appletThirdResourcesDTO.setPicUrlList(pics);
}
return appletThirdResourcesDTO;
}
/**
* 填充第三方服务
* @param appletNewsDTO
......
......@@ -39,6 +39,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
@Slf4j
......@@ -354,4 +355,34 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
return pageBeanNew;
}
@Override
public Map<Long, AppletThirdResources> getAppletMapByIds(List<Long> list) {
if (ListUtils.isEmpty(list)) {
return new HashMap<>();
}
List<AppletThirdResources> appletsByIds = thirdResourcesDao.getAppletsByIds(list);
if (ListUtils.isEmpty(appletsByIds)) {
return new HashMap<>();
}
//推送图片类型
List<Long> thirdResourceIds = appletsByIds.stream().filter(s -> s.getType() == 2)
.map(AppletThirdResources::getId).collect(Collectors.toList());
if (!ListUtils.isEmpty(thirdResourceIds)) {
List<AppletThirdResourcesPic> picList = appletThirdResourcesPicMapper.getPicListByResourceIds(thirdResourceIds);
Map<Long, List<String>> picMap = picList.stream().collect(Collectors.groupingBy(AppletThirdResourcesPic::getThirdResourcesId,
Collectors.mapping(AppletThirdResourcesPic::getPicUrl, Collectors.toList())));
if (!MapUtils.isEmpty(picMap)) {
for (AppletThirdResources resources : appletsByIds) {
if (picMap.containsKey(resources.getId())) {
List<String> picUrlList = picMap.get(resources.getId());
resources.setPicUrlList(picUrlList);
}
}
}
}
Map<Long, AppletThirdResources> appletThirdResourcesMap =
appletsByIds.stream().collect(Collectors.toMap(e ->e.getId(), Function.identity(),(key1,key2) -> key2));
return appletThirdResourcesMap;
}
}
......@@ -718,54 +718,14 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
return;
}
if (rightsSetting != null){
appletUserBookcaseDTO.setGuideId(rightsSetting.getGuideId());
appletUserBookcaseDTO.setBannerType(rightsSetting.getBannerType());
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 =rightsSetting.getGuideId();
if (null == newsId) {
return;
}
AppletThirdResources appletThirdResources= appletThirdResourcesDao.getByResourcesId(newsId);
if(appletThirdResources == null){
return;
}
appletUserBookcaseDTO.setGuideAppletServe(appletThirdResources);
}else if ((RightsServeTypeEnum.PRODUCT.name().equalsIgnoreCase(rightsSetting.getGuideType()) ||
RightsServeTypeEnum.APP.name().equalsIgnoreCase(rightsSetting.getGuideType())) &&
rightsSetting.getGuideId()!=null ) {
RightsNowItem rightsNowItem = new RightsNowItem();
rightsNowItem.setServeId(rightsSetting.getGuideId());
rightsNowItem.setServeType(rightsSetting.getGuideType());
rightsNowItem.setType(RightsNowItemTypeNew.ONLINE_COURSE.value);
rightsNowItem.setLinkUrl(rightsSetting.getGuideLinkUrl());
rightsSettingBiz.fillProductAndApp(Lists.newArrayList(rightsNowItem));
appletUserBookcaseDTO.setGuideAppItem(rightsNowItem);
if (ListUtils.isEmpty(rightsSetting.getRightsSettingBanners())) {
return;
}
rightsSettingBiz.fillReadGuide(rightsSetting.getRightsSettingBanners());
appletUserBookcaseDTO.setRightsSettingBanners(rightsSetting.getRightsSettingBanners());
}
}
......@@ -3,11 +3,13 @@ package com.pcloud.book.applet.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.book.applet.entity.AppletThirdResources;
import com.pcloud.book.rightsSetting.entity.RightsNowItem;
import com.pcloud.book.rightsSetting.entity.RightsSettingBanner;
import com.pcloud.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
@ApiModel("小程序用户书架栏目")
......@@ -150,4 +152,11 @@ public class AppletUserBookcaseDTO extends BaseDto {
* 上下册标签
*/
private String volLabelName;
//权益的banner类型 1 大图 2 小图
private Integer bannerType;
//权益页面banner
private List<RightsSettingBanner> rightsSettingBanners;
}
......@@ -68,4 +68,6 @@ public class AppletBannerRecord implements Serializable {
* 创建日期
*/
private String createDate;
private Integer locationType;
}
\ No newline at end of file
......@@ -1227,10 +1227,12 @@ public class AppletHomeFacade {
@ApiOperation("小程序首页banner点击埋点")
@RequestMapping(value = "/bannerClickRecord", method = RequestMethod.GET)
public ResponseDto<Void> bannerClickRecord(@CookieValue("userInfo") String userInfo, @RequestParam("bannerId") Long bannerId) {
public ResponseDto<Void> bannerClickRecord(@CookieValue("userInfo") String userInfo,
@RequestParam("bannerId") Long bannerId,
@RequestParam(value = "locationType", required = false) Integer locationType) {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
ParamChecker.checkNumberIsNull(bannerId, "参数缺失!");
appletBannerBiz.bannerClickRecord(wechatUserId, bannerId);
appletBannerBiz.bannerClickRecord(wechatUserId, bannerId , locationType);
return new ResponseDto<>();
}
......
......@@ -26,7 +26,13 @@ public interface AppletBannerRecordMapper {
List<AppletBannerStats> getBannerPVUV(@Param("bannerIds") List<Long> bannerIds);
List<AppletBannerTrendDTO> getBannerRecordTrendByHour(@Param("startTime") String startTime, @Param("endTime")String endTime, @Param("id") Long id);
List<AppletBannerTrendDTO> getBannerRecordTrendByDay(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("id")Long id);
List<AppletBannerTrendDTO> getBannerRecordTrendByHour(@Param("startTime") String startTime,
@Param("endTime")String endTime,
@Param("id") Long id,
@Param("locationType") Integer locationType);
List<AppletBannerTrendDTO> getBannerRecordTrendByDay(@Param("startDate")String startDate,
@Param("endDate")String endDate,
@Param("id")Long id,
@Param("locationType") Integer locationType);
}
\ No newline at end of file
......@@ -235,4 +235,11 @@ public class AppletServiceImpl implements AppletService {
public void autoDeleteReadBook() {
readBookRecordBiz.autoDeleteReadBook();
}
@Override
@GetMapping("getThirdResourceById")
public ResponseEntity<ResponseDto<AppletThirdResourcesDTO>> getThirdResourceById(@RequestParam("thirdResourcesId") Long thirdResourcesId) {
AppletThirdResourcesDTO appletThirdResourcesDTO = appletNewsBiz.getThirdResourceById(thirdResourcesId);
return ResponseHandleUtil.toResponse(appletThirdResourcesDTO);
}
}
package com.pcloud.book.rightsSetting.biz;
import com.pcloud.book.rightsSetting.entity.RightsSettingBanner;
import com.pcloud.common.page.PageBeanNew;
import java.util.List;
/**
* 权益banner(RightsSettingBanner)表服务接口
*
* @author makejava
* @since 2021-03-17 14:15:25
*/
public interface RightsSettingBannerBiz {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
RightsSettingBanner getById(Long id);
/**
* 分页查询
*/
PageBeanNew getList(Integer currentPage, Integer numPerPage);
/**
* 新增数据
*
* @param rightsSettingBanner 实例对象
* @return 主键
*/
Long insert(RightsSettingBanner rightsSettingBanner);
/**
* 修改数据
*
* @param rightsSettingBanner 实例对象
*/
void update(RightsSettingBanner rightsSettingBanner);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
void deleteById(Long id);
/**
* 批量新增
* @param rightsSettingBanners
*/
void batchInsert(List<RightsSettingBanner> rightsSettingBanners);
/**
* 根据权益id删除
* @param rightsSettingId
*/
void deleteByRightsSettingId(Long rightsSettingId);
}
\ No newline at end of file
......@@ -15,6 +15,7 @@ import com.pcloud.book.rightsSetting.entity.RightsNowItem;
import com.pcloud.book.rightsSetting.entity.RightsNowPic;
import com.pcloud.book.rightsSetting.entity.RightsNowPopup;
import com.pcloud.book.rightsSetting.entity.RightsSetting;
import com.pcloud.book.rightsSetting.entity.RightsSettingBanner;
import com.pcloud.book.rightsSetting.entity.RightsSettingClassify;
import com.pcloud.book.rightsSetting.entity.RightsSettingItem;
import com.pcloud.book.rightsSetting.vo.QrcodeMessage4WechatVO;
......@@ -256,5 +257,11 @@ public interface RightsSettingBiz {
* @date:2021/2/19 17:42
* * @param null
*/
List<BookServeDTO> getRightsSettingAppProduct(Long bookId, Long channelId, Long adviserId, Integer limit);
List<BookServeDTO> getRightsSettingAppProduct(Long bookId, Long channelId, Long adviserId, Integer limit);
/**
* 填充权益banner
* @param rightsSettingBanners
*/
void fillReadGuide(List<RightsSettingBanner> rightsSettingBanners);
}
package com.pcloud.book.rightsSetting.biz.impl;
import com.pcloud.book.rightsSetting.biz.RightsSettingBannerBiz;
import com.pcloud.book.rightsSetting.dao.RightsSettingBannerDao;
import com.pcloud.book.rightsSetting.entity.RightsSettingBanner;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.NumberUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 权益banner(RightsSettingBanner)表服务实现类
*
* @author makejava
* @since 2021-03-16 16:17:58
*/
@Service("rightsSettingBannerBiz")
public class RightsSettingBannerBizImpl implements RightsSettingBannerBiz {
private static final Logger LOGGER = LoggerFactory.getLogger(RightsSettingBannerBizImpl.class);
@Autowired
private RightsSettingBannerDao rightsSettingBannerDao;
@Override
@ParamLog("通过ID查询单条数据")
public RightsSettingBanner getById(Long id) {
return rightsSettingBannerDao.getById(id);
}
@Override
@ParamLog("查询多条数据")
public PageBeanNew getList(Integer currentPage, Integer numPerPage) {
PageBeanNew pageBeanNew = rightsSettingBannerDao.listPageNew(new PageParam(currentPage, numPerPage), null, "getList");
List recordList = pageBeanNew.getRecordList();
if (ListUtils.isEmpty(recordList)) {
return pageBeanNew;
}
// 加载其它数据
return pageBeanNew;
}
@Override
@ParamLog("新增")
public Long insert(RightsSettingBanner rightsSettingBanner) {
rightsSettingBannerDao.insert(rightsSettingBanner);
return rightsSettingBanner.getId();
}
@Override
@ParamLog("修改")
public void update(RightsSettingBanner rightsSettingBanner) {
if (rightsSettingBanner == null || !NumberUtil.isNumber(rightsSettingBanner.getId())) {
throw BizException.PARAM_IS_NULL;
}
rightsSettingBannerDao.update(rightsSettingBanner);
}
@Override
@ParamLog("删除")
public void deleteById(Long id) {
rightsSettingBannerDao.deleteById(id);
}
@Override
public void batchInsert(List<RightsSettingBanner> rightsSettingBanners) {
if (ListUtils.isEmpty(rightsSettingBanners)) {
return;
}
rightsSettingBannerDao.insert(rightsSettingBanners);
}
@Override
public void deleteByRightsSettingId(Long rightsSettingId) {
rightsSettingBannerDao.deleteByRightsSettingId(rightsSettingId);
}
}
\ No newline at end of file
package com.pcloud.book.rightsSetting.dao;
import com.pcloud.book.rightsSetting.entity.RightsSettingBanner;
import com.pcloud.common.core.dao.BaseDao;
/**
* 权益banner(RightsSettingBanner)表数据库访问层
*
* @author makejava
* @since 2021-03-17 14:15:12
*/
public interface RightsSettingBannerDao extends BaseDao<RightsSettingBanner> {
void deleteByRightsSettingId(Long rightsSettingId);
}
\ No newline at end of file
package com.pcloud.book.rightsSetting.dao.impl;
import com.pcloud.book.rightsSetting.dao.RightsSettingBannerDao;
import com.pcloud.book.rightsSetting.entity.RightsSettingBanner;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
/**
* 权益banner(RightsSettingBanner)表数据库访问层
*
* @author makejava
* @since 2021-03-16 16:17:58
*/
@Repository("rightsSettingBannerDaoImpl")
public class RightsSettingBannerDaoImpl extends BaseDaoImpl<RightsSettingBanner> implements RightsSettingBannerDao {
@Override
public void deleteByRightsSettingId(Long rightsSettingId) {
getSessionTemplate().delete(getStatement("deleteByRightsSettingId"), rightsSettingId);
}
}
\ No newline at end of file
......@@ -232,6 +232,15 @@ public class RightsSetting extends BaseTempletClassify {
private String updateUserName;
//本书服务页banner图
private List<RightsSettingBanner> rightsSettingBanners;
//1 配图大 2 配图小
private Integer bannerType;
//第三方资源
private AppletThirdResources thirdResource;
public RightsSetting() {
}
......
package com.pcloud.book.rightsSetting.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.book.applet.entity.AppletThirdResources;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* 权益banner(RightsSettingBanner)实体类
*
* @author makejava
* @since 2021-03-17 14:15:05
*/
@Data
public class RightsSettingBanner extends BaseEntity {
private static final long serialVersionUID = -14857612347642124L;
@ApiModelProperty("主键id")
private Long id;
@ApiModelProperty("权益id")
private Long rightsSettingId;
@ApiModelProperty("1 大图 2 小图")
private Integer bannerType;
@ApiModelProperty("banner标题")
private String bannerTitle;
@ApiModelProperty("跳转类型(1指定页面2web页面3应用作品4资讯资源)")
private String bannerPic;
@ApiModelProperty("`jump_type` int(2) DEFAULT NULL COMMENT '跳转类型(1指定页面2web页面3应用作品4资讯资源5小程序6第三方资源)',")
private Integer jumpType;
@ApiModelProperty("跳转地址")
private String jumpUrl;
@ApiModelProperty("应用作品id")
private Long serveId;
@ApiModelProperty("资讯1 | 作品6 | 应用5")
private Integer serveType;
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@ApiModelProperty("修改时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
@ApiModelProperty("应用或作品对象")
private RightsNowItem guideAppItem;
@ApiModelProperty("咨询对象")
private RightsNowItem guideNewsItem;
@ApiModelProperty("第三方资源")
private AppletThirdResources thirdResource;
}
\ No newline at end of file
......@@ -22,7 +22,10 @@ public enum RightsServeTypeEnum {
PRODUCT(5),
//应用
APP(6);
APP(6),
//第三方资源
ThIRD_RESOURCE(7);
public final Integer value;
......
package com.pcloud.book.rightsSetting.enums;
public enum RightsSettingJumpType {
//第三方资源
ThIRD_RESOURCE(6, "第三方资源");
public final String value;
public final Integer code;
RightsSettingJumpType(Integer code, String value) {
this.value = value;
this.code = code;
}
}
package com.pcloud.book.rightsSetting.facade;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.rightsSetting.biz.RightsSettingBannerBiz;
import com.pcloud.book.rightsSetting.entity.RightsSettingBanner;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* 权益banner(RightsSettingBanner)表控制层
*
* @author makejava
* @since 2021-03-17 14:15:43
*/
@RestController("rightsSettingBannerFacade")
@RequestMapping("rightsSettingBanner")
public class RightsSettingBannerFacade {
@Autowired
private RightsSettingBannerBiz rightsSettingBannerBiz;
@ApiOperation("通过主键查询单条数据")
@GetMapping("getById")
public ResponseDto<?> getById(@RequestHeader("token") String token, @RequestParam Long id) throws BizException, PermissionException {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(rightsSettingBannerBiz.getById(id));
}
@ApiOperation("分页查询")
@GetMapping("getList")
public ResponseDto<?> getList(@RequestHeader("token") String token,
@RequestParam(value = "currentPage", defaultValue = "0") Integer currentPage,
@RequestParam(value = "numPerPage", defaultValue = "10") Integer numPerPage)
throws BizException, PermissionException {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(rightsSettingBannerBiz.getList(currentPage, numPerPage));
}
@ApiOperation("新增")
@PostMapping("insert")
public ResponseDto<?> insert(@RequestHeader("token") String token, @RequestBody RightsSettingBanner rightsSettingBanner)
throws BizException, PermissionException {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(rightsSettingBannerBiz.insert(rightsSettingBanner));
}
@ApiOperation("更新")
@PostMapping("update")
public ResponseDto<?> update(@RequestHeader("token") String token, @RequestBody RightsSettingBanner rightsSettingBanner) throws BizException, PermissionException {
SessionUtil.getToken4Redis(token);
rightsSettingBannerBiz.update(rightsSettingBanner);
return new ResponseDto<>();
}
@ApiOperation("删除")
@GetMapping("deleteById")
public ResponseDto<?> deleteById(@RequestHeader("token") String token, @RequestParam Long id) throws BizException, PermissionException {
SessionUtil.getToken4Redis(token);
if (null == id) {
throw BookBizException.PARAM_DELETION;
}
rightsSettingBannerBiz.deleteById(id);
return new ResponseDto<>();
}
}
\ No newline at end of file
......@@ -28,10 +28,10 @@
useGeneratedKeys="true">
insert into applet_banner_record (banner_id, create_time, update_time,
wechat_user_id, serve_id, serve_type,
jump_type, create_hour, create_date)
jump_type, create_hour, create_date, location_type)
values (#{bannerId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{wechatUserId,jdbcType=BIGINT}, #{serveId,jdbcType=BIGINT}, #{serveType,jdbcType=TINYINT},
#{jumpType,jdbcType=BOOLEAN}, #{createHour}, #{createDate})
#{jumpType,jdbcType=BOOLEAN}, #{createHour}, #{createDate}, #{locationType})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id"
parameterType="com.pcloud.book.applet.entity.AppletBannerRecord" useGeneratedKeys="true">
......@@ -152,6 +152,8 @@
<if test="id != null">
and banner_id = #{id}
</if>
and
location_type = #{locationType}
GROUP BY
create_hour
</select>
......@@ -170,6 +172,8 @@
<if test="id != null">
and banner_id = #{id}
</if>
and
location_type = #{locationType}
GROUP BY
create_date
</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.RightsSettingBannerDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.rightsSetting.entity.RightsSettingBanner">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="rights_setting_id" property="rightsSettingId" jdbcType="BIGINT"/>
<result column="banner_type" property="bannerType" jdbcType="INTEGER"/>
<result column="banner_title" property="bannerTitle" jdbcType="VARCHAR"/>
<result column="banner_pic" property="bannerPic" jdbcType="VARCHAR"/>
<result column="jump_type" property="jumpType" jdbcType="INTEGER"/>
<result column="jump_url" property="jumpUrl" jdbcType="VARCHAR"/>
<result column="serve_id" property="serveId" jdbcType="BIGINT"/>
<result column="serve_type" property="serveType" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, rights_setting_id, banner_type, banner_title, banner_pic, jump_type, jump_url, serve_id, serve_type, create_time, update_time
</sql>
<select id="getById" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM rights_setting_banner
WHERE id = #{id}
</select>
<select id="getList" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM rights_setting_banner
</select>
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
INSERT INTO rights_setting_banner(
rights_setting_id,
banner_type,
banner_title,
banner_pic,
jump_type,
jump_url,
serve_id,
serve_type,
create_time,
update_time
) VALUES (
#{rightsSettingId, jdbcType=BIGINT},
#{bannerType, jdbcType=INTEGER},
#{bannerTitle, jdbcType=VARCHAR},
#{bannerPic, jdbcType=VARCHAR},
#{jumpType, jdbcType=INTEGER},
#{jumpUrl, jdbcType=VARCHAR},
#{serveId, jdbcType=BIGINT},
#{serveType, jdbcType=INTEGER},
#{createTime, jdbcType=TIMESTAMP},
#{updateTime, jdbcType=TIMESTAMP}
)
</insert>
<insert id="batchInsert">
INSERT INTO rights_setting_banner (
rights_setting_id,
banner_type,
banner_title,
banner_pic,
jump_type,
jump_url,
serve_id,
serve_type,
create_time,
update_time
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.rightsSettingId, jdbcType=BIGINT},
#{item.bannerType, jdbcType=INTEGER},
#{item.bannerTitle, jdbcType=VARCHAR},
#{item.bannerPic, jdbcType=VARCHAR},
#{item.jumpType, jdbcType=INTEGER},
#{item.jumpUrl, jdbcType=VARCHAR},
#{item.serveId, jdbcType=BIGINT},
#{item.serveType, jdbcType=INTEGER},
now(),
now()
)
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
UPDATE rights_setting_banner
<set>
<if test="rightsSettingId != null">
rights_setting_id = #{rightsSettingId},
</if>
<if test="bannerType != null">
banner_type = #{bannerType},
</if>
<if test="bannerTitle != null and bannerTitle != ''">
banner_title = #{bannerTitle},
</if>
<if test="bannerPic != null and bannerPic != ''">
banner_pic = #{bannerPic},
</if>
<if test="jumpType != null">
jump_type = #{jumpType},
</if>
<if test="jumpUrl != null and jumpUrl != ''">
jump_url = #{jumpUrl},
</if>
<if test="serveId != null">
serve_id = #{serveId},
</if>
<if test="serveType != null">
serve_type = #{serveType},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
</set>
WHERE id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
DELETE FROM rights_setting_banner where id = #{id}
</delete>
<delete id="deleteByRightsSettingId">
DELETE FROM rights_setting_banner where rights_setting_id = #{rightsSettingId}
</delete>
<select id="getByRightsSettingId" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM rights_setting_banner
where
rights_setting_id = #{id}
</select>
</mapper>
\ No newline at end of file
......@@ -33,6 +33,9 @@
<result column="guide_link_url" property="guideLinkUrl" jdbcType="VARCHAR" />
<result column="create_user_id" property="createUserId" jdbcType="BIGINT" />
<result column="update_user_id" property="updateUserId" jdbcType="BIGINT" />
<result column="banner_type" property="bannerType" jdbcType="TINYINT" />
<collection property="rightsSettingBanners" ofType="com.pcloud.book.rightsSetting.entity.RightsSettingBanner"
column="id" select="com.pcloud.book.rightsSetting.dao.impl.RightsSettingBannerDaoImpl.getByRightsSettingId"/>
</resultMap>
<resultMap id="DtoResultMap" type="com.pcloud.book.rightsSetting.dto.RightsSettingDto">
......@@ -63,6 +66,9 @@
<result column="create_user_id" property="createUserId" jdbcType="BIGINT" />
<result column="update_user_id" property="updateUserId" jdbcType="BIGINT" />
<result column="group_qrcode_url" property="groupQrcodeUrl" jdbcType="VARCHAR" />
<result column="banner_type" property="bannerType" jdbcType="TINYINT" />
<collection property="rightsSettingBanners" ofType="com.pcloud.book.rightsSetting.entity.RightsSettingBanner"
column="id" select="com.pcloud.book.rightsSetting.dao.impl.RightsSettingBannerDaoImpl.getByRightsSettingId"/>
</resultMap>
<resultMap id="DtoResultMap4Book" type="com.pcloud.book.rightsSetting.dto.RightsSettingDto" extends="DtoResultMap">
......@@ -75,7 +81,7 @@
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,
reading_guide,guide_title,guide_type,guide_id,guide_pic,ver_label_id, show_state, agent_id, guide_link_url,
create_user_id, update_user_id
create_user_id, update_user_id, banner_type
</sql>
<sql id="Base_Column_List_own" >
......@@ -227,7 +233,8 @@
guide_pic = #{guidePic,jdbcType=VARCHAR},
ver_label_id = #{verLabelId,jdbcType=BIGINT},
guide_link_url = #{guideLinkUrl},
update_user_id = #{updateUserId}
update_user_id = #{updateUserId},
banner_type = #{bannerType}
where id = #{id,jdbcType=BIGINT}
</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