Commit ac20bae8 by 朱亚洁

feat:[1004709]小睿H5完整版

parent 931ba96a
package com.pcloud.book.applet.dto;
import com.pcloud.common.dto.BaseDto;
import lombok.Data;
/**
* @ClassName com.pcloud.book.applet.dto.AnswerSubscribeUserDTO
* @Author zhuyajie
* @Description 用户书刊订阅信息
* @Date 2021/5/14 16:36
* @Version 1.0
**/
@Data
public class AnswerSubscribeUserDTO extends BaseDto {
/**
* 书刊id
*/
private Long bookId;
/**
* 渠道id
*/
private Long channelId;
/**
* 编辑id
*/
private Long adviserId;
/**
* 图书名称
*/
private String bookName;
/**
* H5页面链接
*/
private String url;
}
......@@ -7,6 +7,7 @@ import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
......@@ -66,4 +67,8 @@ public class AppletOuterBooklistDTO extends BaseDto {
* 书单推荐是否在小程序首页展示
*/
private Integer isShowHome;
@ApiModelProperty("适用人群类型")
private List<Integer> crowdTypeList;
}
\ No newline at end of file
......@@ -69,4 +69,10 @@ public class AppletThirdResources extends BaseEntity {
@ApiModelProperty("小程序原始id")
private String baseAppId;
@ApiModelProperty("适用人群类型")
private List<Integer> crowdTypeList;
@ApiModelProperty("内容类型")
private List<Integer> contentTypeList;
}
\ No newline at end of file
package com.pcloud.book.applet.service;
import com.pcloud.book.applet.dto.AnswerSubscribeUserDTO;
import com.pcloud.book.applet.dto.AppletAppOrProductDTO;
import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.dto.AppletNewsVO;
......@@ -144,4 +145,8 @@ public interface AppletService {
@RequestMapping("getSameClassifyUserIds")
ResponseEntity<ResponseDto<List<Long>>> getSameClassifyUserIds(@RequestBody List<Long> wechatUserIds);
@ApiOperation("查询用户书刊订阅信息")
@GetMapping("getUserSubscribeInfo")
ResponseEntity<ResponseDto<AnswerSubscribeUserDTO>> getUserSubscribeInfo(@RequestParam("wechatUserId") Long wechatUserId);
}
......@@ -277,4 +277,9 @@ public interface BookGroupService {
@ApiOperation("获取所有编辑书籍")
ResponseEntity<ResponseDto<PageBeanNew<BookGroupDTO>>> getAllRaysScene(@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage);
@ApiOperation("二维码是否开启小睿")
@GetMapping("isOpenRaysScene")
ResponseEntity<ResponseDto<Boolean>> isOpenRaysScene(@RequestParam(value = "sceneId", required = false) Long sceneId,
@RequestParam(value = "bookGroupId", required = false) Long bookGroupId);
}
package com.pcloud.book.applet.biz;
import com.pcloud.book.applet.dto.AnswerSubscribeDTO;
import com.pcloud.book.applet.dto.AnswerSubscribeUserDTO;
import java.util.Map;
......@@ -12,7 +13,7 @@ public interface AnswerSubscribeBiz {
* @date:2020/9/16 16:24
* * @param null
*/
void answerSubscribe(AnswerSubscribeDTO answerSubscribeDTO);
AnswerSubscribeDTO answerSubscribe(AnswerSubscribeDTO answerSubscribeDTO);
/**
* 查询是否订阅
......@@ -42,4 +43,13 @@ public interface AnswerSubscribeBiz {
* @param answerSubscribeDTO
*/
void cancelAnswerSubscribe(AnswerSubscribeDTO answerSubscribeDTO);
/**
* 查用户订阅信息
* @author:zhuyajie
* @date:2021/5/14 16:41
* * @param null
*/
AnswerSubscribeUserDTO getUserSubscribeInfo(Long wechatUserId);
}
......@@ -75,4 +75,12 @@ public interface AppletBannerBiz {
* @param showState
*/
void autoChageBannerState(Long id, Integer showState);
/**
* H5首页-banner列表
* @author:zhuyajie
* @date:2021/5/11 16:05
* * @param null
*/
PageBeanNew<AppletBannerDTO> getBannerByGradeLabel4ResourcePage(Long gradeLabelId, Integer currentPage, Integer numPerPage);
}
......@@ -311,4 +311,12 @@ public interface AppletBooklistBiz {
* * @param null
*/
Map<Long,AppletOuterBooklistDTO> getBooklistInfoByIds(List<Long> booklistIds);
/**
* H5首页-精选书单
* @author:zhuyajie
* @date:2021/5/11 15:33
* * @param null
*/
PageBeanNew<AppletOuterBooklistDTO> getBooklistByGradeLabel4ResourcePage(Long gradeLabelId, Integer currentPage, Integer numPerPage);
}
......@@ -21,4 +21,20 @@ public interface AppletRecordAggrStatisBiz {
* 同步数据并更新缓存
*/
void syncDataAndUpdateCache(String date);
/**
* 更新H5资源广场
* @author:zhuyajie
* @date:2021/5/13 15:31
* * @param null
*/
void updateH5Resource();
/**
* H5资源页
* @author:zhuyajie
* @date:2021/5/13 15:33
* * @param null
*/
PageBeanNew getResource4H5(Long wechatUserId, Long officialAccountsId, String keyword, Integer sourceType, Integer currentPage, Integer numPerPage);
}
......@@ -65,7 +65,7 @@ public interface AppletRecordBiz {
* @param typeName
* @return
*/
PageBeanNew<AppletRecordDTO> listAppletRecord(Long wechatUserId, String date, List<Integer> recordTypes, String queryName, Integer currentPage, Integer numPerPage, String typeName);
PageBeanNew<AppletRecordDTO> listAppletRecord(Long wechatUserId, String date, List<Integer> recordTypes, String queryName, Integer currentPage, Integer numPerPage, String typeName, Long officialAccountsId);
List<String> listUnreachableDate(Long wechatUserId);
......@@ -89,7 +89,7 @@ public interface AppletRecordBiz {
* @param date
* @return
*/
List<AppletRecordDTO> getAppletRecordCatalogue(Long wechatUserId, String date);
List<AppletRecordDTO> getAppletRecordCatalogue(Long wechatUserId, String date, Long officialAccountsId);
/**
* 手动处理应用作品和资讯的typeCode
......
package com.pcloud.book.applet.biz;
import com.pcloud.book.applet.dto.AddResourceApplyDTO;
import java.util.List;
public interface AppletResourceApplyBiz {
/**
* 添加适用范围
* @author:zhuyajie
* @date:2021/5/8 15:13
* * @param null
*/
void addResourceApply(AddResourceApplyDTO addResourceApplyDTO);
/**
* 查适用人群
* @author:zhuyajie
* @date:2021/5/8 15:47
* * @param null
*/
List<Integer> getCrowdTypeList(Long targetId, String targetType);
/**
* 查内容类型
* @author:zhuyajie
* @date:2021/5/8 15:47
* * @param null
*/
List<Integer> getContentTypeList(Long targetId, String targetType);
}
......@@ -38,4 +38,13 @@ public interface AppletThirdResourcesBiz {
Map<Long, AppletThirdResources> getAppletMapByIds(List<Long> list);
List<AppletThirdResources> getThirdResourcesByNewsId(Long newsId);
/**
* H5资源页-我的-为你推荐
* @author:zhuyajie
* @date:2021/5/11 11:02
* * @param null
*/
PageBeanNew<AppletThirdResources> getThirdResourcesByGradeLabel4ResourcePage(Long gradeLabelId, Integer currentPage,
Integer numPerPage);
}
......@@ -30,7 +30,7 @@ public interface AppletUserBookcaseBiz {
* @param numPerPage
* @return
*/
PageBeanNew<AppletUserBookcaseDTO> listByWechatUserId(Long wechatUserId, Integer currentPage, Integer numPerPage);
PageBeanNew<AppletUserBookcaseDTO> listByWechatUserId(Long wechatUserId, Integer currentPage, Integer numPerPage,Long officialAccountsId);
/**
* 新增用户资源点击记录
......@@ -47,7 +47,7 @@ public interface AppletUserBookcaseBiz {
Map<String,Object> getUserClickStatistic(Long wechatUserId, Long bookId, Long channelId, Long adviserId);
UserLastBookReDTO getUserLastBookRe(Long wechatUserId);
UserLastBookReDTO getUserLastBookRe(Long wechatUserId, Long officialAccountsId);
/**
* 批量删除
......@@ -55,7 +55,7 @@ public interface AppletUserBookcaseBiz {
* @date:2020/5/11 16:06
* * @param null
*/
void deleteByIds(List<Long> ids, Long wechatUserId);
void deleteByIds(List<Long> ids, Long wechatUserId, Long officialAccountsId);
/**
* 更新读者关于本书的阅读方式
......@@ -87,7 +87,7 @@ public interface AppletUserBookcaseBiz {
* @date:2020/5/29 13:11
* * @param null
*/
List<Long> getBookcaseIdListByUser(Long wechatUserId);
List<Long> getBookcaseIdListByUser(Long wechatUserId, Long officialAccountsId);
/**
* 书刊访问量
......
......@@ -28,7 +28,7 @@ public interface ServeCollectBiz {
/**
* 分页查询
*/
PageBeanNew getList(Long wechatUserId, Integer currentPage, Integer numPerPage, String typeCode);
PageBeanNew getList(Long wechatUserId, Integer currentPage, Integer numPerPage, String typeCode, Long officialAccountsId);
/**
* 新增数据
......@@ -77,7 +77,7 @@ public interface ServeCollectBiz {
* @param wechatUserId
* @return
*/
List<Long> getAllCollect(Long wechatUserId,String typeCode);
List<Long> getAllCollect(Long wechatUserId,String typeCode, Long officialAccountsId);
/**
* 查询收藏情况
......@@ -93,7 +93,7 @@ public interface ServeCollectBiz {
* @param wechatUserId
* @return
*/
List<CollectionTypeNameAndCountDTO> getTypeNameAndCountByWechatId(Long wechatUserId);
List<CollectionTypeNameAndCountDTO> getTypeNameAndCountByWechatId(Long wechatUserId, Long officialAccountsId);
/**
* 分类分页查询
......
......@@ -3,18 +3,25 @@ package com.pcloud.book.applet.biz.impl;
import com.pcloud.book.applet.biz.AnswerSubscribeBiz;
import com.pcloud.book.applet.dao.AnswerSubscribeAdviserDao;
import com.pcloud.book.applet.dao.AnswerSubscribeDao;
import com.pcloud.book.applet.dao.AnswerSubscribePopupDao;
import com.pcloud.book.applet.dto.AnswerSubscribeCountDto;
import com.pcloud.book.applet.dto.AnswerSubscribeDTO;
import com.pcloud.book.applet.dto.AnswerSubscribeUserDTO;
import com.pcloud.book.applet.entity.AnswerSubscribe;
import com.pcloud.book.applet.entity.AnswerSubscribeAdviser;
import com.pcloud.book.applet.entity.AnswerSubscribePopup;
import com.pcloud.book.applet.enums.AnswerSendStateEnum;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookBiz;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.message.TemplateConsr;
import com.pcloud.book.consumer.reader.ReaderConsr;
import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.group.biz.ResourcePageBiz;
import com.pcloud.book.group.vo.ResourcePageVO;
import com.pcloud.book.util.properties.BookProps;
import com.pcloud.channelcenter.qrcode.dto.GroupQrcodeVO;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.constant.SceneCode;
import com.pcloud.common.core.constant.SendType;
......@@ -23,6 +30,7 @@ import com.pcloud.common.core.dto.AppletTemplateMessageDto;
import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.readercenter.wechat.entity.WechatUserOfficialAccounts;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -58,21 +66,62 @@ public class AnswerSubscribeBizImpl implements AnswerSubscribeBiz {
private AnswerSubscribeAdviserDao answerSubscribeAdviserDao;
@Autowired
private ResourcePageBiz resourcePageBiz;
@Autowired
private AnswerSubscribePopupDao answerSubscribePopupDao;
@Autowired
private QrcodeSceneConsr qrcodeSceneConsr;
@Autowired
private ReaderConsr readerConsr;
@Override
public void answerSubscribe(AnswerSubscribeDTO answerSubscribeDTO) {
public AnswerSubscribeDTO answerSubscribe(AnswerSubscribeDTO answerSubscribeDTO) {
if (null == answerSubscribeDTO.getBookId() || null == answerSubscribeDTO.getAdviserId() ||
null == answerSubscribeDTO.getChannelId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少书刊参数");
}
if (null == answerSubscribeDTO.getSubscribeType()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少订阅类型");
}
AnswerSubscribe answerSubscribe = new AnswerSubscribe();
BeanUtils.copyProperties(answerSubscribeDTO, answerSubscribe);
List<AnswerSubscribe> list = answerSubscribeDao.getRecordByUserBook(answerSubscribe);
if (!ListUtils.isEmpty(list)) {
return;
return new AnswerSubscribeDTO();
}
answerSubscribe.setResourceCount(resourcePageBiz.getResourceCounts(answerSubscribeDTO.getBookId(),answerSubscribeDTO.getAdviserId(),answerSubscribeDTO.getChannelId()));
answerSubscribeDao.insert(answerSubscribe);
return getSubscribeQrcode(answerSubscribeDTO);
}
/**
* 查询公众号关注情况
* @author:zhuyajie
* @date:2021/5/14 16:34
* * @param null
*/
private AnswerSubscribeDTO getSubscribeQrcode(AnswerSubscribeDTO answerSubscribeDTO) {
AnswerSubscribeDTO dto = new AnswerSubscribeDTO();
Long wechatUserId = answerSubscribeDTO.getWechatUserId();
Long accountSettingId = answerSubscribeDTO.getAccountSettingId();
//是否关注
String openId = readerConsr.getOpenIdByWechatUserIdAndOfficialAccountsId(wechatUserId, accountSettingId);
WechatUserOfficialAccounts accounts = readerConsr.getOfficialAccounts(accountSettingId, openId, wechatUserId);
Boolean isSubscribe = false;
if (null != accounts) {
isSubscribe = accounts.getIsSubscribe() == 1 ? true : false;
}
AnswerSubscribePopup popup = new AnswerSubscribePopup();
popup.setWechatUserId(wechatUserId);
popup.setAccountSettingId(accountSettingId);
popup.setBookId(answerSubscribeDTO.getBookId());
popup.setChannelId(answerSubscribeDTO.getChannelId());
popup.setAdviserId(answerSubscribeDTO.getAdviserId());
popup.setSubscribeType(answerSubscribeDTO.getSubscribeType());
answerSubscribePopupDao.insert(popup);
GroupQrcodeVO groupQrcodeVO = qrcodeSceneConsr.getSubscribeQrcode(accountSettingId);
dto.setQrcodeUrl(groupQrcodeVO.getQrcodeUrl());
dto.setIsSubscribe(isSubscribe);
return dto;
}
@Override
......@@ -223,6 +272,44 @@ public class AnswerSubscribeBizImpl implements AnswerSubscribeBiz {
answerSubscribeDao.cancelAnswerSubscribe(answerSubscribeDTO);
}
@Override
public AnswerSubscribeUserDTO getUserSubscribeInfo(Long wechatUserId) {
AnswerSubscribeUserDTO answerSubscribeUserDTO = new AnswerSubscribeUserDTO();
AnswerSubscribePopup popup = answerSubscribePopupDao.getLastRecord(wechatUserId);
if (null == popup) {
return answerSubscribeUserDTO;
}
answerSubscribeUserDTO.setBookId(popup.getBookId());
answerSubscribeUserDTO.setChannelId(popup.getChannelId());
answerSubscribeUserDTO.setAdviserId(popup.getAdviserId());
if (popup.getSubscribeType() == 1) {
//书刊订阅
ResourcePageVO resourcePageVO = resourcePageBiz.getResourcePageByBookId(popup.getBookId(), popup.getChannelId(), popup.getAdviserId(), wechatUserId);
answerSubscribeUserDTO.setBookName(null == resourcePageVO ? null : resourcePageVO.getBookName());
//小睿书流程有推送链接
if (null != resourcePageVO && resourcePageVO.getOpenRays() == 1) {
String host = BookProps.getWechatDomain();
if ("uat".equals(BookProps.getSystemEnv())) {
host = host.replace("wechat666", "weixin35515");
} else {
host = host.replace("wechat666", "weixin23");
}
String url = "";
if (null != resourcePageVO.getSceneId()) {
url = host + "/rayh5/book?sceneId=" + resourcePageVO.getSceneId();
} else if (null != resourcePageVO.getBookGroupId()) {
url = host + "/rayh5/book?bookGroupId=" + resourcePageVO.getId();
}
answerSubscribeUserDTO.setUrl(url);
}
}
if (StringUtil.isEmpty(answerSubscribeUserDTO.getBookName())) {
BookDto bookDto = bookBiz.getBaseById(popup.getBookId());
answerSubscribeUserDTO.setBookName(null == bookDto ? null : bookDto.getBookName());
}
return answerSubscribeUserDTO;
}
private void sendAppletTemplateMsg(Long wechatUserId, Long accountSettingId, String bookName) {
bookName = bookName.length() > 13 ? bookName.substring(0, 13) + "..." : bookName;
AppletTemplateMessageDto appletTemplateMessage;
......
......@@ -9,8 +9,11 @@ import com.pcloud.advertising.advertising.dto.AdvertisingSpaceItemDTO;
import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.book.applet.biz.AppletBannerBiz;
import com.pcloud.book.applet.biz.AppletNewsBiz;
import com.pcloud.book.applet.biz.AppletResourceApplyBiz;
import com.pcloud.book.applet.contants.AppletResourceApplyConstants;
import com.pcloud.book.applet.dao.AppletBannerDao;
import com.pcloud.book.applet.dao.AppletUserBookcaseDao;
import com.pcloud.book.applet.dto.AddResourceApplyDTO;
import com.pcloud.book.applet.dto.AppletBannerDTO;
import com.pcloud.book.applet.dto.AppletBannerStats;
import com.pcloud.book.applet.dto.AppletBannerTrendDTO;
......@@ -42,9 +45,8 @@ 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;
import org.quartz.SchedulerException;
import org.springframework.beans.BeanUtils;
......@@ -65,6 +67,12 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import static com.pcloud.book.book.constant.BookConstant.JOB_NAME_BANNER_PUT_OFF;
import static com.pcloud.book.book.constant.BookConstant.JOB_NAME_BANNER_PUT_ON;
......@@ -97,6 +105,8 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
private RightsSettingBannerBiz rightsSettingBannerBiz;
@Autowired
private AdvertisingConsr advertisingConsr;
@Autowired
private AppletResourceApplyBiz appletResourceApplyBiz;
@Override
......@@ -119,9 +129,24 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
addSimpleJob4Banner(id, JOB_NAME_BANNER_PUT_OFF + id,appletBanner.getEndTime(), YesOrNoEnums.NO.getValue());
}
this.updateResourceApply(id, appletBanner.getCrowdTypeList());
return id;
}
/**
* 更新适用人群
* @author:zhuyajie
* @date:2021/5/8 16:02
* * @param null
*/
private void updateResourceApply(Long id, List<Integer> crowdTypeList) {
AddResourceApplyDTO addResourceApplyDTO = new AddResourceApplyDTO();
addResourceApplyDTO.setTargetId(id);
addResourceApplyDTO.setTargetType(AppletResourceApplyConstants.TargetTypeEnum.BANNER.getValue());
addResourceApplyDTO.setCrowdTypeList(crowdTypeList);
appletResourceApplyBiz.addResourceApply(addResourceApplyDTO);
}
private void addSimpleJob4Banner(Long id, String jobName, Date startTime, Integer showState) {
Long second = (startTime.getTime() - System.currentTimeMillis()) / 1000;
ScheduleJob scheduleJob = new ScheduleJob();
......@@ -178,6 +203,10 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
}
}
if (null == appletBanner.getShowState()) {
//非上下架修改
this.updateResourceApply(id, appletBanner.getCrowdTypeList());
}
}
@Override
......@@ -207,6 +236,7 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
String uv = Objects.nonNull(appletBannerStats.getUv()) ? String.valueOf(appletBannerStats.getUv()) : "0";
appletBannerDTO.setClickPVUV(pv + "/" + uv);
}
appletBannerDTO.setCrowdTypeList(appletResourceApplyBiz.getCrowdTypeList(id, AppletResourceApplyConstants.TargetTypeEnum.BANNER.getValue()));
}
return appletBannerDTO;
}
......@@ -554,4 +584,17 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
appletBannerDao.update(appletBanner);
}
@Override
public PageBeanNew<AppletBannerDTO> getBannerByGradeLabel4ResourcePage(Long gradeLabelId, Integer currentPage, Integer numPerPage) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("crowdType", gradeLabelId.intValue());
PageBeanNew<AppletBannerDTO> pageBeanNew = appletBannerDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listBannerByGrade");
if (ListUtils.isEmpty(pageBeanNew.getRecordList())) {
return new PageBeanNew<>(currentPage, numPerPage, pageBeanNew.getTotalCount(), new ArrayList<>());
}
// 填充 资讯 | 作品 | 应用 信息
fillServeInfo(pageBeanNew.getRecordList());
return pageBeanNew;
}
}
......@@ -3,12 +3,15 @@ package com.pcloud.book.applet.biz.impl;
import com.pcloud.appcenter.assist.dto.AssistTempletDTO;
import com.pcloud.book.applet.biz.AppletBooklistBiz;
import com.pcloud.book.applet.biz.AppletNewsBiz;
import com.pcloud.book.applet.biz.AppletResourceApplyBiz;
import com.pcloud.book.applet.contants.AppletConstants;
import com.pcloud.book.applet.contants.AppletResourceApplyConstants;
import com.pcloud.book.applet.dao.AppletBooklistClassifyDao;
import com.pcloud.book.applet.dao.AppletBooklistDao;
import com.pcloud.book.applet.dao.AppletOuterBookDao;
import com.pcloud.book.applet.dao.AppletOuterBooklistDao;
import com.pcloud.book.applet.dto.AddBookParamDTO;
import com.pcloud.book.applet.dto.AddResourceApplyDTO;
import com.pcloud.book.applet.dto.AppletBooklistClassifyDTO;
import com.pcloud.book.applet.dto.AppletBooklistDTO;
import com.pcloud.book.applet.dto.AppletOuterBookDTO;
......@@ -39,6 +42,7 @@ import com.pcloud.book.util.properties.BookProps;
import com.pcloud.common.core.aspect.ParamLog;
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.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.httpclient.UrlUtils;
......@@ -54,6 +58,7 @@ import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -92,6 +97,8 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
private ESBookAndAdviserBiz esBookAndAdviserBiz;
@Autowired
private AgentConsr agentConsr;
@Autowired
private AppletResourceApplyBiz appletResourceApplyBiz;
@Override
......@@ -578,9 +585,24 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
}
appletOuterBooklistDao.addOuterBooklistConfig(addDTOS);
}
this.updateResourceApply(appletOuterBooklist.getId(), appletOuterBooklistDTO.getCrowdTypeList());
return appletOuterBooklist.getId();
}
/**
* 更新适用人群
* @author:zhuyajie
* @date:2021/5/8 16:02
* * @param null
*/
private void updateResourceApply(Long id, List<Integer> crowdTypeList) {
AddResourceApplyDTO addResourceApplyDTO = new AddResourceApplyDTO();
addResourceApplyDTO.setTargetId(id);
addResourceApplyDTO.setTargetType(AppletResourceApplyConstants.TargetTypeEnum.BOOKLIST.getValue());
addResourceApplyDTO.setCrowdTypeList(crowdTypeList);
appletResourceApplyBiz.addResourceApply(addResourceApplyDTO);
}
private void checkBooklistParam(AppletOuterBooklistDTO appletOuterBooklistDTO){
if (StringUtil.isEmpty(appletOuterBooklistDTO.getBooklistName())){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少书单主题名称");
......@@ -606,6 +628,7 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
BeanUtils.copyProperties(appletOuterBooklist,appletOuterBooklistDTO);
List<Long> bookIds = appletOuterBooklistDao.getBookIdsByBooklistId(booklistId);
appletOuterBooklistDTO.setOuterBookIdList(bookIds);
appletOuterBooklistDTO.setCrowdTypeList(appletResourceApplyBiz.getCrowdTypeList(booklistId,AppletResourceApplyConstants.TargetTypeEnum.BOOKLIST.getValue()));
return appletOuterBooklistDTO;
}
......@@ -822,4 +845,22 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
public Map<Long, AppletOuterBooklistDTO> getBooklistInfoByIds(List<Long> booklistIds) {
return appletOuterBooklistDao.getByIds(booklistIds);
}
@Override
public PageBeanNew<AppletOuterBooklistDTO> getBooklistByGradeLabel4ResourcePage(Long gradeLabelId, Integer currentPage, Integer numPerPage) {
String startDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -7), DateUtils.DATE_FORMAT_DATEONLY);
//根据标签查询,按照近7天浏览量排序
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("startDate", startDate);
paramMap.put("crowdType", gradeLabelId.intValue());
PageBeanNew<Long> idPageBean = appletOuterBooklistDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listBooklistIdByGradeLabelAndClickCount");
if (ListUtils.isEmpty(idPageBean.getRecordList())) {
return new PageBeanNew<>(currentPage, numPerPage, idPageBean.getTotalCount(), new ArrayList<>());
}
//书单内容
Map<Long, AppletOuterBooklistDTO> booklistDTOMap = this.getByIds(idPageBean.getRecordList());
List<AppletOuterBooklistDTO> list = new ArrayList<>();
list.addAll(booklistDTOMap.values());
return new PageBeanNew<>(currentPage, numPerPage, idPageBean.getTotalCount(), list);
}
}
......@@ -34,6 +34,7 @@ import com.pcloud.book.skill.biz.PcloudGroupActivityBiz;
import com.pcloud.book.skill.dao.PcloudGroupActivityDao;
import com.pcloud.book.applet.dto.GroupActivity4AppletDTO;
import com.pcloud.book.util.common.YesOrNoEnums;
import com.pcloud.book.util.properties.BookProps;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
......@@ -349,7 +350,7 @@ public class AppletGroupSearchRecordBizImpl implements AppletGroupSearchRecordBi
@Override
public PageBeanNew<AppletGroupManageDTO> getGroupList4AppletHome(Long wechatUserId, Integer currentPage, Integer numPerPage, Long officialAccountsId) {
//用户最近读的书
PageBeanNew<AppletUserBookcaseDTO> bookcaseDTOPageBeanNew = appletUserBookcaseBiz.listByWechatUserId(wechatUserId, currentPage, 1);
PageBeanNew<AppletUserBookcaseDTO> bookcaseDTOPageBeanNew = appletUserBookcaseBiz.listByWechatUserId(wechatUserId, currentPage, 1, BookProps.getMiniOfficialAccountsId());
if (null == bookcaseDTOPageBeanNew || ListUtils.isEmpty(bookcaseDTOPageBeanNew.getRecordList())) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
}
......
package com.pcloud.book.applet.biz.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.google.common.collect.Lists;
import com.pcloud.book.applet.biz.AppletRecordAggrStatisBiz;
import com.pcloud.book.applet.biz.AppletRecordBiz;
import com.pcloud.book.applet.biz.ServeCollectBiz;
import com.pcloud.book.applet.contants.AppletConstants;
import com.pcloud.book.applet.dao.AppletRecordDao;
import com.pcloud.book.applet.dao.AppletRecordSevenDayDao;
import com.pcloud.book.applet.dto.AppletRecordDTO;
import com.pcloud.book.applet.entity.AppletRecord;
import com.pcloud.book.applet.entity.AppletRecordSevenDay;
import com.pcloud.book.applet.entity.ServeCollect;
import com.pcloud.book.applet.enums.AppletRankTypeEnum;
import com.pcloud.book.applet.enums.AppletRecordTypeEnum;
import com.pcloud.book.applet.enums.AppletSourceTypeEnum;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.reader.ReaderConsr;
import com.pcloud.book.group.biz.ResourcePageBiz;
import com.pcloud.book.group.constant.ResourcePageConstants;
import com.pcloud.book.group.dao.WeworkTeacherFriendRecordDao;
import com.pcloud.book.mapper.clickhouse.AppletRecordCHMapper;
import com.pcloud.book.util.common.YesOrNoEnums;
import com.pcloud.book.util.properties.BookProps;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.utils.BeanUtils;
import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.readercenter.common.enums.YesOrNoNumEnum;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.ResultContext;
......@@ -33,7 +41,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.MessageFormat;
import java.util.Date;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
......@@ -41,6 +50,9 @@ import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
@Service("appletRecordAggrStatisBiz")
public class AppletRecordAggrStatisBizImpl implements AppletRecordAggrStatisBiz {
......@@ -56,6 +68,12 @@ public class AppletRecordAggrStatisBizImpl implements AppletRecordAggrStatisBiz
private WeworkTeacherFriendRecordDao weworkTeacherFriendRecordDao;
@Autowired
private ServeCollectBiz serveCollectBiz;
@Autowired
private ResourcePageBiz resourcePageBiz;
@Autowired
private AppletRecordSevenDayDao appletRecordSevenDayDao;
@Autowired
private ReaderConsr readerConsr;
@Override
public PageBeanNew getAggrStatis(Long wechatUserId, String keyword, Integer sourceType, Integer rankType, Integer currentPage, Integer numPerPage) {
......@@ -284,4 +302,83 @@ public class AppletRecordAggrStatisBizImpl implements AppletRecordAggrStatisBiz
}
}
}
/**
* 将 clickHouse 的资源排行加入到 数据库
*/
@Override
public void updateH5Resource() {
//资源广场模块
for (ResourcePageConstants.ResourceSourceTypeEnum sourceTypeEnum : ResourcePageConstants.ResourceSourceTypeEnum.values()) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("offset", 0);
paramMap.put("limit", 1000);
if ("pro".equals(BookProps.getSystemEnv())) {
paramMap.put("beginDate", DateUtils.formatDate(DateUtils.addDay(DateUtils.getDayBegin(), -7)));
}
paramMap.put("endDate", DateUtils.formatDate(DateUtils.addDay(DateUtils.getDayEnd(), -1)));
paramMap.put("sourceKeywords", Arrays.asList(sourceTypeEnum.getKeywords()));
//资源广场模块搜索-7天内扫码量高的资源
List<AppletRecordDTO> sevenDaysourceAggrStatis = appletRecordCHMapper.getAggrStatis4H5(paramMap);
if (ListUtils.isEmpty(sevenDaysourceAggrStatis)) {
continue;
}
List<Long> fromIdList = sevenDaysourceAggrStatis.stream().filter(s->s!=null && s.getFromId()>0).map(AppletRecordDTO::getFromId).collect(Collectors.toList());
Map<String,Object> map = new HashMap<>();
map.put("endDate", DateUtils.formatDate(DateUtils.addDay(DateUtils.getDayEnd(), -1)));
map.put("fromIdList", fromIdList);
//7天内扫码量高的资源的总扫码量
List<AppletRecordDTO> sourceAggrStatis = appletRecordCHMapper.getAggrStatis4H5(map);
appletRecordBiz.fillAppletRecord(sourceAggrStatis, YesOrNoNumEnum.NO.getValue());
sourceAggrStatis = sourceAggrStatis.stream().filter(x -> x.getSourceDelete() == 0).collect(Collectors.toList());
if (ListUtils.isEmpty(sourceAggrStatis)) {
continue;
}
appletRecordSevenDayDao.deleteBySourceType(sourceTypeEnum.getCode());
List<AppletRecordSevenDay> serveList = new ArrayList<>();
BeanUtils.copyListProperties(sourceAggrStatis, serveList,AppletRecordSevenDay.class);
serveList.forEach(s->s.setSourceType(sourceTypeEnum.getCode()));
appletRecordSevenDayDao.insert(serveList);
}
}
@Override
public PageBeanNew getResource4H5(Long wechatUserId, Long officialAccountsId, String keyword, Integer sourceType, Integer currentPage, Integer numPerPage) {
if (null == sourceType && StringUtil.isEmpty(keyword)) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少参数");
}
//最多查询50个
Integer maxCount = 50;
List<AppletRecordDTO> countList;
if (StringUtils.isNotEmpty(keyword)) {
//关键词搜索
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("sourceKeywords", Arrays.asList(keyword));
paramMap.put("offset", 0);
paramMap.put("limit", maxCount);
paramMap.put("endDate", DateUtils.formatDate(DateUtils.addDay(DateUtils.getDayEnd(), -1)));
countList = appletRecordCHMapper.getAggrStatis4H5(paramMap);
} else {
//无关键词-根据学龄段搜索
Long gradeLabel = resourcePageBiz.getUserGrade(wechatUserId, officialAccountsId);
List<Long> gradeLabelIds = readerConsr.getUserGradeIdByParentId(gradeLabel);
countList = appletRecordSevenDayDao.getResourceByGrade4H5(sourceType, gradeLabelIds, maxCount);
}
if (ListUtils.isEmpty(countList)) {
return new PageBeanNew(currentPage, numPerPage, 0, Lists.newArrayList());
}
appletRecordBiz.fillAppletRecord(countList, YesOrNoNumEnum.NO.getValue());
countList = countList.stream().filter(x -> x.getSourceDelete() == 0).collect(Collectors.toList());
if (ListUtils.isEmpty(countList)) {
return new PageBeanNew(currentPage, numPerPage, 0, Lists.newArrayList());
}
List<AppletRecordDTO> recordDTOS = countList.stream().skip(currentPage * numPerPage).limit(numPerPage).collect(Collectors.toList());
PageBeanNew pageBeanNew = new PageBeanNew<>(currentPage, numPerPage, countList.size(), recordDTOS);
return pageBeanNew;
}
}
......@@ -41,6 +41,7 @@ import com.pcloud.book.book.dao.BookDao;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.consumer.app.AppConsr;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.reader.ReaderConsr;
import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.group.biz.WeworkTeacherBiz;
import com.pcloud.book.group.dto.WxWorkTeacherDTO;
......@@ -65,6 +66,8 @@ import com.pcloud.common.utils.cache.redis.RedisSessionUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.readercenter.common.enums.YesOrNoNumEnum;
import com.pcloud.resourcecenter.product.dto.ProductDto;
import com.pcloud.resourcecenter.product.dto.ProductLabelDto;
import org.apache.commons.collections.MapUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -131,6 +134,8 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
private BookDao bookDao;
@Autowired
private AppletTrackMapper appletTrackMapper;
@Autowired
private ReaderConsr readerConsr;
@Override
@ParamLog("通过ID查询单条数据")
......@@ -227,13 +232,14 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
@Override
@ParamLog(value = "我的足迹", isAfterReturn = false)
public PageBeanNew<AppletRecordDTO> listAppletRecord(Long wechatUserId, String date, List<Integer> recordTypes, String queryName,
Integer currentPage, Integer numPerPage, String typeName) {
Integer currentPage, Integer numPerPage, String typeName, Long officialAccountsId) {
List<Long> wechatUserIds = readerConsr.getRelateUserIdList(wechatUserId, officialAccountsId);
Map<String, Object> paramMap = new HashMap<>();
if (!ListUtils.isEmpty(recordTypes) && !recordTypes.contains(AppletRecordTypeEnum.NEWS.value) && !recordTypes.contains(AppletRecordTypeEnum.PRODUCT.value)) {
typeName = null;
}
paramMap.put("wechatUserId", wechatUserId);
paramMap.put("wechatUserIds", wechatUserIds);
if (!ListUtils.isEmpty(recordTypes)) {
paramMap.put("recordTypes", recordTypes);
}
......@@ -285,9 +291,10 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
@Override
@ParamLog("获取足迹目录")
public List<AppletRecordDTO> getAppletRecordCatalogue(Long wechatUserId, String date) {
public List<AppletRecordDTO> getAppletRecordCatalogue(Long wechatUserId, String date, Long officialAccountsId) {
List<Long> wechatUserIds = readerConsr.getRelateUserIdList(wechatUserId, officialAccountsId);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("wechatUserId", wechatUserId);
paramMap.put("wechatUserIds", wechatUserIds);
List<AppletRecordDTO> appletRecordDTOS = null;
if (StringUtil.isEmpty(date)) {
//从总表中查
......@@ -739,6 +746,9 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
appletAppOrProductDTO.setServePic(appDto.getSquareImg());
appletAppOrProductDTO.setServeTypeCode(appDto.getTypeCode());
appletAppOrProductDTO.setServeTypeName(appDto.getTypeName());
appletRecordDTO.setPurLabelId(appDto.getPurLabelId());
appletRecordDTO.setProLabelId(appDto.getProLabelId());
appletRecordDTO.setDepLabelId(appDto.getDepLabelId());
accountSettingDto = qrcodeSceneConsr.getWechatInfo(appDto.getChannelId());
if (null == accountSettingDto) {
appletRecordDTO.setSourceDelete(YesOrNoNumEnum.YES.getValue());
......@@ -779,6 +789,12 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
appletAppOrProductDTO.setServeTypeCode(productDto.getProductTypeDto().getTypeCode());
appletAppOrProductDTO.setServeTypeName(productDto.getProductTypeDto().getTypeName());
}
if (!ListUtils.isEmpty(productDto.getProductLabels())) {
ProductLabelDto labelDto = productDto.getProductLabels().get(0);
appletRecordDTO.setProLabelId(labelDto.getProLabelId());
appletRecordDTO.setPurLabelId(labelDto.getPurLabelId());
appletRecordDTO.setDepLabelId(labelDto.getDepLabelId());
}
//获取channelId,/C1404/product/display/10234028?adviserId=1001587&proType=MEMBER&source_type=QRCODE
Long channelId = null;
String url = appletRecordDTO.getLinkUrl();
......
package com.pcloud.book.applet.biz.impl;
import com.pcloud.book.applet.biz.AppletResourceApplyBiz;
import com.pcloud.book.applet.contants.AppletResourceApplyConstants;
import com.pcloud.book.applet.dao.AppletResourceApplyDao;
import com.pcloud.book.applet.dto.AddResourceApplyDTO;
import com.pcloud.book.applet.entity.AppletResourceApply;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.string.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
/**
* @ClassName com.pcloud.book.applet.biz.impl.AppletResourceApplyBizImpl
* @Author zhuyajie
* @Description 资源适用范围
* @Date 2021/5/8 15:12
* @Version 1.0
**/
@Component
public class AppletResourceApplyBizImpl implements AppletResourceApplyBiz {
@Autowired
private AppletResourceApplyDao appletResourceApplyDao;
@Override
public void addResourceApply(AddResourceApplyDTO addResourceApplyDTO) {
if (null == addResourceApplyDTO || null == addResourceApplyDTO.getTargetId() || StringUtil.isEmpty(addResourceApplyDTO.getTargetType())) {
return;
}
Long targetId = addResourceApplyDTO.getTargetId();
String targetType = addResourceApplyDTO.getTargetType();
appletResourceApplyDao.deleteCrowdType(targetId, targetType);
appletResourceApplyDao.deleteContentType(targetId, targetType);
if (!ListUtils.isEmpty(addResourceApplyDTO.getCrowdTypeList())) {
List<AppletResourceApply> crowdList = new ArrayList<>();
for (Integer crowdType : addResourceApplyDTO.getCrowdTypeList()) {
AppletResourceApply apply = new AppletResourceApply();
apply.setTargetId(targetId);
apply.setTargetType(targetType);
apply.setCrowdType(crowdType);
crowdList.add(apply);
}
appletResourceApplyDao.insert(crowdList);
}
if (!ListUtils.isEmpty(addResourceApplyDTO.getContentTypeList())) {
List<AppletResourceApply> contentList = new ArrayList<>();
for (Integer contentType : addResourceApplyDTO.getContentTypeList()) {
AppletResourceApply apply = new AppletResourceApply();
apply.setTargetId(targetId);
apply.setTargetType(targetType);
apply.setContentType(contentType);
contentList.add(apply);
}
appletResourceApplyDao.insert(contentList);
}
}
@Override
public List<Integer> getCrowdTypeList(Long targetId, String targetType) {
return appletResourceApplyDao.getCrowdTypeList(targetId, targetType);
}
@Override
public List<Integer> getContentTypeList(Long targetId, String targetType) {
return appletResourceApplyDao.getContentTypeList(targetId, targetType);
}
}
package com.pcloud.book.applet.biz.impl;
import cn.hutool.core.util.StrUtil;
import com.pcloud.book.applet.biz.AppletResourceApplyBiz;
import com.pcloud.book.applet.biz.AppletThirdResourcesBiz;
import com.pcloud.book.applet.contants.AppletResourceApplyConstants;
import com.pcloud.book.applet.dao.AppletLinkClickDao;
import com.pcloud.book.applet.dao.AppletNewsDao;
import com.pcloud.book.applet.dao.AppletThirdResourcesClickDao;
import com.pcloud.book.applet.dao.AppletThirdResourcesDao;
import com.pcloud.book.applet.dto.AddResourceApplyDTO;
import com.pcloud.book.applet.dto.AppletChartDateDTO;
import com.pcloud.book.applet.dto.AppletThirdResourcesDTO;
import com.pcloud.book.applet.dto.PvuvDTO;
......@@ -24,10 +26,11 @@ import com.pcloud.book.group.enums.UseTypeEnum;
import com.pcloud.common.core.aspect.ParamLog;
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.string.StringUtil;
import com.pcloud.readercenter.wechat.entity.WechatUser;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -35,6 +38,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -42,6 +46,9 @@ import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Service("appletThirdResourcesBiz")
public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
......@@ -62,6 +69,8 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
private AdviserConsr adviserConsr;
@Autowired
private AppletThirdResourcesPicMapper appletThirdResourcesPicMapper;
@Autowired
private AppletResourceApplyBiz appletResourceApplyBiz;
@Override
public PageBeanNew<AppletThirdResourcesDTO> getListThirdResourcesAnalysis(String keyValue, String source,
......@@ -243,6 +252,7 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
if (thirdResourcesDTO.getType() == 2) {
addPicResources(thirdResourcesDTO.getId(), thirdResourcesDTO.getPicUrlList());
}
this.updateResourceApply(thirdResources.getId(), thirdResourcesDTO.getCrowdTypeList(), thirdResourcesDTO.getContentTypeList());
}
/**
......@@ -268,7 +278,15 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
@Override
public AppletThirdResources getAppletsById(Long id) {
return thirdResourcesDao.getById(id);
AppletThirdResources appletThirdResources = thirdResourcesDao.getById(id);
if (null == appletThirdResources) {
return new AppletThirdResources();
}
appletThirdResources.setCrowdTypeList(appletResourceApplyBiz.getCrowdTypeList(id,
AppletResourceApplyConstants.TargetTypeEnum.THIRD_RESOURCE.getValue()));
appletThirdResources.setContentTypeList(appletResourceApplyBiz.getContentTypeList(id,
AppletResourceApplyConstants.TargetTypeEnum.THIRD_RESOURCE.getValue()));
return appletThirdResources;
}
@Override
......@@ -305,6 +323,22 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
if (thirdResourcesDTO.getType() == 2) {
addPicResources(thirdResources.getId(), thirdResourcesDTO.getPicUrlList());
}
this.updateResourceApply(thirdResources.getId(), thirdResourcesDTO.getCrowdTypeList(), thirdResourcesDTO.getContentTypeList());
}
/**
* 更新适用人群
* @author:zhuyajie
* @date:2021/5/8 16:02
* * @param null
*/
private void updateResourceApply(Long id, List<Integer> crowdTypeList, List<Integer> contentTypeList) {
AddResourceApplyDTO addResourceApplyDTO = new AddResourceApplyDTO();
addResourceApplyDTO.setTargetId(id);
addResourceApplyDTO.setTargetType(AppletResourceApplyConstants.TargetTypeEnum.THIRD_RESOURCE.getValue());
addResourceApplyDTO.setCrowdTypeList(crowdTypeList);
addResourceApplyDTO.setContentTypeList(contentTypeList);
appletResourceApplyBiz.addResourceApply(addResourceApplyDTO);
}
@Override
......@@ -365,14 +399,25 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
return new HashMap<>();
}
//推送图片类型
List<Long> thirdResourceIds = appletsByIds.stream().filter(s -> s.getType() == 2)
setResourcesPic(appletsByIds);
Map<Long, AppletThirdResources> appletThirdResourcesMap =
appletsByIds.stream().collect(Collectors.toMap(e ->e.getId(), Function.identity(),(key1,key2) -> key2));
return appletThirdResourcesMap;
}
private void setResourcesPic(List<AppletThirdResources> thirdResourcesList) {
if (ListUtils.isEmpty(thirdResourcesList)) {
return;
}
//推送图片类型
List<Long> thirdResourceIds = thirdResourcesList.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) {
for (AppletThirdResources resources : thirdResourcesList) {
if (picMap.containsKey(resources.getId())) {
List<String> picUrlList = picMap.get(resources.getId());
resources.setPicUrlList(picUrlList);
......@@ -380,14 +425,28 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
}
}
}
Map<Long, AppletThirdResources> appletThirdResourcesMap =
appletsByIds.stream().collect(Collectors.toMap(e ->e.getId(), Function.identity(),(key1,key2) -> key2));
return appletThirdResourcesMap;
}
@Override
public List<AppletThirdResources> getThirdResourcesByNewsId(Long newsId) {
return thirdResourcesDao.getThirdResourcesByNewsId(newsId);
}
@Override
public PageBeanNew<AppletThirdResources> getThirdResourcesByGradeLabel4ResourcePage(Long gradeLabelId, Integer currentPage, Integer numPerPage) {
String startDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -7), DateUtils.DATE_FORMAT_DATEONLY);
//根据标签查询,按照近7天浏览量排序
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("startDate", startDate);
paramMap.put("crowdType", gradeLabelId.intValue());
PageBeanNew<Long> idPageBean = thirdResourcesDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listResourceIdByGradeLabelAndClickCount");
if (ListUtils.isEmpty(idPageBean.getRecordList())) {
return new PageBeanNew<>(currentPage, numPerPage, idPageBean.getTotalCount(), new ArrayList<>());
}
//资源详情
List<AppletThirdResources> thirdResources = thirdResourcesDao.getAppletsByIds(idPageBean.getRecordList());
//推送图片类型
setResourcesPic(thirdResources);
return new PageBeanNew<>(currentPage, numPerPage, idPageBean.getTotalCount(), thirdResources);
}
}
......@@ -98,9 +98,11 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
@Override
@ParamLog("查询多条数据")
public PageBeanNew getList(Long wechatUserId, Integer currentPage, Integer numPerPage, String typeCode) {
public PageBeanNew getList(Long wechatUserId, Integer currentPage, Integer numPerPage, String typeCode,
Long officialAccountsId) {
List<Long> wechatUserIds = readerConsr.getRelateUserIdList(wechatUserId, officialAccountsId);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("wechatUserId", wechatUserId);
paramMap.put("wechatUserIds", wechatUserIds);
paramMap.put("typeCode",typeCode);
PageBeanNew pageBeanNew = serveCollectDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "getList");
List recordList = pageBeanNew.getRecordList();
......@@ -392,8 +394,9 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
}
@Override
public List<CollectionTypeNameAndCountDTO> getTypeNameAndCountByWechatId(Long wechatUserId) {
return serveCollectDao.getTypeNameAndCountByWechatId(wechatUserId);
public List<CollectionTypeNameAndCountDTO> getTypeNameAndCountByWechatId(Long wechatUserId, Long officialAccountsId) {
List<Long> wechatUserIds = readerConsr.getRelateUserIdList(wechatUserId, officialAccountsId);
return serveCollectDao.getTypeNameAndCountByWechatId(wechatUserIds);
}
@Override
......@@ -645,8 +648,9 @@ public class ServeCollectBizImpl implements ServeCollectBiz {
}
@Override
public List<Long> getAllCollect(Long wechatUserId,String typeCode) {
return serveCollectDao.getAllCollect(wechatUserId,typeCode);
public List<Long> getAllCollect(Long wechatUserId,String typeCode,Long officialAccountsId) {
List<Long> wechatUserIds = readerConsr.getRelateUserIdList(wechatUserId, officialAccountsId);
return serveCollectDao.getAllCollect(wechatUserIds,typeCode);
}
@Override
......
package com.pcloud.book.applet.contants;
/**
* @ClassName com.pcloud.book.applet.contants.AppletResourceApplyConstants
* @Author zhuyajie
* @Description 资源适用范围
* @Date 2021/5/8 14:54
* @Version 1.0
**/
public class AppletResourceApplyConstants {
/**
* 资源类型
* @author:zhuyajie
* @date:2021/5/8 15:03
* * @param null
*/
public enum TargetTypeEnum {
THIRD_RESOURCE("THIRD_RESOURCE"),
BOOKLIST("BOOKLIST"),
BANNER("BANNER"),
TEACHER("TEACHER");
private String value;
public String getValue() {
return value;
}
TargetTypeEnum(String value) {
this.value = value;
}
}
/**
* 适用人群
* @author:zhuyajie
* @date:2021/5/8 15:03
* * @param null
*/
public enum CrowdTypeEnum {
PRESCHOOL(1,"学龄前"),
PRIMARY_SCHOOL(2,"小学"),
JUNIOR_HIGH_SCHOOL(3,"初中"),
SENIOR_HIGH_SCHOOL(4,"高中"),
UNIVERSITY(5, "大学"),
ADULT(6,"成人");
private Integer code;
private String name;
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
CrowdTypeEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
}
/**
* 内容类型
* @author:zhuyajie
* @date:2021/5/8 15:07
* * @param null
*/
public enum ContentTypeEnum {
ONLINE(1,"线上网课"),
OFFILINE(2,"线下班"),
GROUP(3,"社群"),
RESOURCE(4,"资源服务");
private Integer code;
private String name;
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
ContentTypeEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
}
}
package com.pcloud.book.applet.dao;
import com.pcloud.book.applet.entity.AnswerSubscribePopup;
import com.pcloud.common.core.dao.BaseDao;
/**
* 用户书刊订阅二维码弹出记录(AnswerSubscribePopup)表数据库访问层
*
* @author makejava
* @since 2021-05-14 15:28:33
*/
public interface AnswerSubscribePopupDao extends BaseDao<AnswerSubscribePopup>{
/**
* 查最近记录
* @author:zhuyajie
* @date:2021/5/14 16:44
* * @param null
*/
AnswerSubscribePopup getLastRecord(Long wechatUserId);
}
\ No newline at end of file
package com.pcloud.book.applet.dao;
import com.pcloud.book.applet.dto.AppletRecordDTO;
import com.pcloud.book.applet.entity.AppletRecordSevenDay;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* H5资源广场(关键词搜索7天浏览量高的应用作品)(AppletRecordSevenDay)表数据库访问层
*
* @author makejava
* @since 2021-05-19 17:18:26
*/
public interface AppletRecordSevenDayDao extends BaseDao<AppletRecordSevenDay>{
void deleteBySourceType(Integer sourceType);
List<AppletRecordDTO> getResourceByGrade4H5(Integer sourceType, List<Long> gradeLabelIds, Integer limit);
}
\ No newline at end of file
package com.pcloud.book.applet.dao;
import com.pcloud.book.applet.entity.AppletResourceApply;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* 第三方资源/书单/banner适用范围(AppletResourceApply)表数据库访问层
*
* @author makejava
* @since 2021-05-08 14:11:42
*/
public interface AppletResourceApplyDao extends BaseDao<AppletResourceApply>{
/**
* 删除适用人群
* @author:zhuyajie
* @date:2021/5/8 15:27
* * @param null
*/
void deleteCrowdType(Long targetId, String targetType);
/**
* 删除内容类型
* @author:zhuyajie
* @date:2021/5/8 15:27
* * @param null
*/
void deleteContentType(Long targetId, String targetType);
/**
* 查适用人群
* @author:zhuyajie
* @date:2021/5/8 15:48
* * @param null
*/
List<Integer> getCrowdTypeList(Long targetId, String targetType);
/**
* 查内容类型
* @author:zhuyajie
* @date:2021/5/8 15:48
* * @param null
*/
List<Integer> getContentTypeList(Long targetId, String targetType);
}
\ No newline at end of file
......@@ -49,7 +49,7 @@ public interface AppletUserBookcaseDao extends BaseDao<AppletUserBookcase> {
UserLastBookReDTO getUserLastGroupBookRe(Long wechatUserId);
UserLastBookReDTO getUserLastRe(Long wechatUserId);
UserLastBookReDTO getUserLastRe(List<Long> wechatUserIdList);
/**
* 批量删除
......@@ -61,7 +61,7 @@ public interface AppletUserBookcaseDao extends BaseDao<AppletUserBookcase> {
void updateUserReadType(AppletUserBookcase appletUserBookcase);
AppletUserBookcase getUserReadType(Long wechatUserId, Long bookId, Long adviserId, Long channelId);
AppletUserBookcase getUserReadType(List<Long> wechatUserIdList, Long bookId, Long adviserId, Long channelId);
/**
* 查书架列表
* @author:zhuyajie
......@@ -76,7 +76,7 @@ public interface AppletUserBookcaseDao extends BaseDao<AppletUserBookcase> {
* @date:2020/5/29 13:11
* * @param null
*/
List<Long> getBookcaseIdListByUser(Long wechatUserId);
List<Long> getBookcaseIdListByUser(List<Long> wechatUserIdList);
/**
* 更新书刊对应的权益
* @author:zhuyajie
......
......@@ -23,13 +23,13 @@ public interface ServeCollectDao extends BaseDao<ServeCollect> {
List<ServeCollect> getList4RightsSetting(List<ServeCollect> serveCollects);
List<Long> getAllCollect(Long wechatUserId,String typeCode);
List<Long> getAllCollect(List<Long> wechatUserIds,String typeCode);
List<ServeCollectDTO> getList4Collect(List<ServeCollectDTO> serveCollects);
List<ServeCollect> getList4RightsSettingByWechatUserId(Long wechatUserId);
List<CollectionTypeNameAndCountDTO> getTypeNameAndCountByWechatId(Long wechatUserId );
List<CollectionTypeNameAndCountDTO> getTypeNameAndCountByWechatId(List<Long> wechatUserIds );
ServeCollectDTO isCollected(Long wechatUserId,Long serveId );
......
package com.pcloud.book.applet.dao.impl;
import com.pcloud.book.applet.dao.AnswerSubscribePopupDao;
import com.pcloud.book.applet.entity.AnswerSubscribePopup;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
/**
* @ClassName com.pcloud.book.applet.dao.impl.AnswerSubscribePopupDaoImpl
* @Author zhuyajie
* @Description 书刊订阅二维码弹出记录
* @Date 2021/5/14 15:30
* @Version 1.0
**/
@Component
public class AnswerSubscribePopupDaoImpl extends BaseDaoImpl<AnswerSubscribePopup> implements AnswerSubscribePopupDao {
@Override
public AnswerSubscribePopup getLastRecord(Long wechatUserId) {
return getSessionTemplate().selectOne(getStatement("getLastRecord"), wechatUserId);
}
}
package com.pcloud.book.applet.dao.impl;
import com.pcloud.book.applet.dao.AppletRecordSevenDayDao;
import com.pcloud.book.applet.dto.AppletRecordDTO;
import com.pcloud.book.applet.entity.AppletRecordSevenDay;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @ClassName com.pcloud.book.applet.dao.impl.AppletRecordSevenDayDaoImpl
* @Author zhuyajie
* @Description 资源7天统计
* @Date 2021/5/19 17:22
* @Version 1.0
**/
@Component
public class AppletRecordSevenDayDaoImpl extends BaseDaoImpl<AppletRecordSevenDay> implements AppletRecordSevenDayDao {
@Override
public void deleteBySourceType(Integer sourceType) {
getSessionTemplate().delete(getStatement("deleteBySourceType"), sourceType);
}
@Override
public List<AppletRecordDTO> getResourceByGrade4H5(Integer sourceType, List<Long> gradeLabelIds, Integer limit) {
Map<String, Object> map = new HashMap<>();
map.put("sourceType", sourceType);
map.put("gradeLabelIds", gradeLabelIds);
map.put("limit", limit);
return getSessionTemplate().selectList(getStatement("getResourceByGrade4H5"), map);
}
}
package com.pcloud.book.applet.dao.impl;
import com.pcloud.book.applet.dao.AppletResourceApplyDao;
import com.pcloud.book.applet.entity.AppletResourceApply;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @ClassName com.pcloud.book.applet.dao.impl.AppletResourceApplyDaoImpl
* @Author zhuyajie
* @Description
* @Date 2021/5/8 14:46
* @Version 1.0
**/
@Component
public class AppletResourceApplyDaoImpl extends BaseDaoImpl<AppletResourceApply> implements AppletResourceApplyDao {
@Override
public void deleteCrowdType(Long targetId, String targetType) {
Map<String, Object> map = new HashMap<>();
map.put("targetId", targetId);
map.put("targetType", targetType);
getSessionTemplate().delete(getStatement("deleteCrowdType"), map);
}
@Override
public void deleteContentType(Long targetId, String targetType) {
Map<String, Object> map = new HashMap<>();
map.put("targetId", targetId);
map.put("targetType", targetType);
getSessionTemplate().delete(getStatement("deleteContentType"), map);
}
@Override
public List<Integer> getCrowdTypeList(Long targetId, String targetType) {
Map<String, Object> map = new HashMap<>();
map.put("targetId", targetId);
map.put("targetType", targetType);
return getSessionTemplate().selectList(getStatement("getCrowdTypeList"), map);
}
@Override
public List<Integer> getContentTypeList(Long targetId, String targetType) {
Map<String, Object> map = new HashMap<>();
map.put("targetId", targetId);
map.put("targetType", targetType);
return getSessionTemplate().selectList(getStatement("getContentTypeList"), map);
}
}
......@@ -62,8 +62,8 @@ public class AppletUserBookcaseDaoImpl extends BaseDaoImpl<AppletUserBookcase> i
}
@Override
public UserLastBookReDTO getUserLastRe(Long wechatUserId) {
return getSessionTemplate().selectOne(getStatement("getUserLastRe"),wechatUserId);
public UserLastBookReDTO getUserLastRe(List<Long> wechatUserIdList) {
return getSessionTemplate().selectOne(getStatement("getUserLastRe"),wechatUserIdList);
}
@Override
......@@ -77,9 +77,9 @@ public class AppletUserBookcaseDaoImpl extends BaseDaoImpl<AppletUserBookcase> i
}
@Override
public AppletUserBookcase getUserReadType(Long wechatUserId, Long bookId, Long adviserId, Long channelId) {
public AppletUserBookcase getUserReadType(List<Long> wechatUserIdList, Long bookId, Long adviserId, Long channelId) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("wechatUserId",wechatUserId);
paramMap.put("wechatUserIdList",wechatUserIdList);
paramMap.put("bookId",bookId);
paramMap.put("adviserId",adviserId);
paramMap.put("channelId",channelId);
......@@ -92,8 +92,8 @@ public class AppletUserBookcaseDaoImpl extends BaseDaoImpl<AppletUserBookcase> i
}
@Override
public List<Long> getBookcaseIdListByUser(Long wechatUserId) {
return getSessionTemplate().selectList(getStatement("getBookcaseIdListByUser"), wechatUserId);
public List<Long> getBookcaseIdListByUser(List<Long> wechatUserIdList) {
return getSessionTemplate().selectList(getStatement("getBookcaseIdListByUser"), wechatUserIdList);
}
@Override
......
......@@ -43,8 +43,8 @@ public class ServeCollectDaoImpl extends BaseDaoImpl<ServeCollect> implements Se
}
@Override
public List<CollectionTypeNameAndCountDTO> getTypeNameAndCountByWechatId(Long wechatUserId) {
return super.getSqlSession().selectList(getStatement("getTypeNameAndCountByWechatId"),wechatUserId);
public List<CollectionTypeNameAndCountDTO> getTypeNameAndCountByWechatId(List<Long> wechatUserIds) {
return super.getSqlSession().selectList(getStatement("getTypeNameAndCountByWechatId"),wechatUserIds);
}
@Override
......@@ -76,9 +76,9 @@ public class ServeCollectDaoImpl extends BaseDaoImpl<ServeCollect> implements Se
}
@Override
public List<Long> getAllCollect(Long wechatUserId,String typeCode) {
public List<Long> getAllCollect(List<Long> wechatUserIds,String typeCode) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("wechatUserId",wechatUserId);
paramMap.put("wechatUserIds",wechatUserIds);
paramMap.put("typeCode",typeCode);
return getSessionTemplate().selectList(getStatement("getAllCollect"), paramMap);
}
......
package com.pcloud.book.applet.dto;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ClassName com.pcloud.book.applet.dto.AddResourceApplyDTO
* @Author zhuyajie
* @Description 资源适用范围
* @Date 2021/5/8 15:13
* @Version 1.0
**/
@Data
public class AddResourceApplyDTO {
@ApiModelProperty("第三方资源/外部书单/banner主键")
private Long targetId;
@ApiModelProperty("目标类型")
private String targetType;
@ApiModelProperty("适用人群类型")
private List<Integer> crowdTypeList;
@ApiModelProperty("内容类型")
private List<Integer> contentTypeList;
}
......@@ -35,4 +35,17 @@ public class AnswerSubscribeDTO extends BaseDto {
*/
private Long accountSettingId;
/**
* 用户是否关注公众号
*/
private Boolean isSubscribe;
/**
* 公众号二维码
*/
private String qrcodeUrl;
/**
* 订阅类型(1书刊订阅2书刊答案订阅)
*/
private Integer subscribeType;
}
\ No newline at end of file
......@@ -8,6 +8,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
@EqualsAndHashCode(callSuper = true)
@Data
......@@ -80,4 +81,7 @@ public class AppletBannerDTO extends BaseDto {
@ApiModelProperty("广告位置")
private String adPosition;
@ApiModelProperty("适用人群类型")
private List<Integer> crowdTypeList;
}
......@@ -99,4 +99,17 @@ public class AppletRecordDTO {
@ApiModelProperty("图书封面")
private String coverImg;
/**
* 专业标签
*/
private Long proLabelId;
/**
* 深度标签
*/
private Long depLabelId;
/**
* 目的标签
*/
private Long purLabelId;
}
......@@ -109,5 +109,11 @@ public class AppletThirdResourcesDTO extends BaseDto {
@ApiModelProperty("小程序原始id")
private String baseAppId;
@ApiModelProperty("适用人群类型")
private List<Integer> crowdTypeList;
@ApiModelProperty("内容类型")
private List<Integer> contentTypeList;
}
......@@ -17,8 +17,8 @@ public class UserLastBookReDTO {
@ApiModelProperty("书id")
private Long bookId;
@ApiModelProperty("是否社群书")
private Boolean bookGroup;
@ApiModelProperty("是否小睿书")
private Boolean openRays;
@ApiModelProperty("编辑id")
private Long adviserId;
......@@ -26,12 +26,6 @@ public class UserLastBookReDTO {
@ApiModelProperty("运营Id")
private Long channelId;
@ApiModelProperty("权益id")
private Long rightSettingId;
@ApiModelProperty("阅读方式")
private Integer readType;
@ApiModelProperty("是否馆配图书")
private Integer isLibraryBook;
......
package com.pcloud.book.applet.entity;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import java.io.Serializable;
import lombok.Data;
/**
* 用户书刊订阅二维码弹出记录(AnswerSubscribePopup)实体类
*
* @author makejava
* @since 2021-05-14 15:28:33
*/
@Data
public class AnswerSubscribePopup extends BaseEntity {
private static final long serialVersionUID = -89378633611621717L;
/**
* 主键
*/
private Long id;
/**
* 用户id
*/
private Long wechatUserId;
/**
* 公众号id
*/
private Long accountSettingId;
/**
* 书刊id
*/
private Long bookId;
/**
* 渠道id
*/
private Long channelId;
/**
* 编辑id
*/
private Long adviserId;
/**
* 订阅类型(1书刊订阅2书刊答案订阅)
*/
private Integer subscribeType;
}
\ No newline at end of file
......@@ -8,6 +8,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
@EqualsAndHashCode(callSuper = true)
@Data
......@@ -63,4 +64,6 @@ public class AppletBanner extends BaseEntity {
@ApiModelProperty("更新banner是否涉及定时任务")
private Integer isTime;
@ApiModelProperty("适用人群类型")
private List<Integer> crowdTypeList;
}
......@@ -22,17 +22,15 @@ public class AppletLinkClick extends BaseEntity {
/**
* 用户id
*/
@NotNull
private Long wechatUserId;
/**
* 1资讯/2 券库
* 1资讯/2券库/3编辑群/4第三方群/5书单
*/
@NotNull
private Integer typeId;
/**
* 业务id
*/
@NotNull
private Long fromId;
/**
* 业务id
......@@ -48,7 +46,12 @@ public class AppletLinkClick extends BaseEntity {
)
private Date createTime;
/**
* 公众号id
*/
private Long officialAccountsId;
/**
* 书单id
*/
private Long booklistId;
}
\ No newline at end of file
package com.pcloud.book.applet.entity;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import java.io.Serializable;
import lombok.Data;
/**
* H5资源广场(关键词搜索7天浏览量高的应用作品)(AppletRecordSevenDay)实体类
*
* @author makejava
* @since 2021-05-19 17:18:26
*/
@Data
public class AppletRecordSevenDay extends BaseEntity {
private static final long serialVersionUID = 615812208250214724L;
/**
* 主键
*/
private Long id;
/**
* 5 作品6 应用
*/
private Integer recordType;
/**
* 来源id
*/
private Long fromId;
/**
* 来源名称
*/
private String fromName;
/**
* 应用作品类型
*/
private String typeCode;
/**
* 跳转链接
*/
private String linkUrl;
/**
* 专业标签
*/
private Long proLabelId;
/**
* 深度标签
*/
private Long depLabelId;
/**
* 目的标签
*/
private Long purLabelId;
/**
* 浏览量
*/
private Integer clickCount;
/**
* 浏览人数
*/
private Integer userCount;
/**
* 模块栏目类型(1手抄报2涂色3DIY4亲子游戏5试卷6课件7作文8知识点)
*/
private Integer sourceType;
}
\ No newline at end of file
package com.pcloud.book.applet.entity;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import java.io.Serializable;
import lombok.Data;
/**
* 第三方资源/书单/banner适用范围(AppletResourceApply)实体类
*
* @author makejava
* @since 2021-05-08 14:11:42
*/
@Data
public class AppletResourceApply extends BaseEntity {
private static final long serialVersionUID = -81487714212498658L;
/**
* 主键
*/
private Long id;
/**
* 第三方资源/外部书单/banner主键
*/
private Long targetId;
/**
* 目标类型
*/
private String targetType;
/**
* 适用用户学龄段类型
*/
private Integer crowdType;
/**
* 适用内容类型
*/
private Integer contentType;
}
\ No newline at end of file
......@@ -30,4 +30,6 @@ public class AppletThirdResourcesClick extends BaseEntity {
private Long newsId;
@ApiModelProperty("奖包券id")
private Long giftPackageId;
@ApiModelProperty("公众号id")
private Long officialAccountsId;
}
\ No newline at end of file
......@@ -29,4 +29,6 @@ public class AppletUserBookcase extends BaseEntity {
@ApiModelProperty("是否社群书")
private Long bookGroupId;
private Long officialAccountsId;
}
......@@ -619,11 +619,13 @@ public class AppletHomeFacade {
@CookieValue("userInfo") String userInfo,
@RequestBody @ApiParam("图书") AppletUserBookcase appletUserBookcase) {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
if (null == appletUserBookcase || null == appletUserBookcase.getBookId() || null == appletUserBookcase.getAdviserId()
|| null == appletUserBookcase.getChannelId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少参数");
}
appletUserBookcase.setWechatUserId(wechatUserId);
appletUserBookcase.setOfficialAccountsId(officialAccountsId);
return new ResponseDto<>(appletUserBookcaseBiz.addUserBook(appletUserBookcase));
}
......@@ -634,10 +636,11 @@ public class AppletHomeFacade {
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页数量") Integer numPerPage){
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
if (null==currentPage || null == numPerPage){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少分页参数");
}
return new ResponseDto<>(appletUserBookcaseBiz.listByWechatUserId(wechatUserId,currentPage,numPerPage));
return new ResponseDto<>(appletUserBookcaseBiz.listByWechatUserId(wechatUserId,currentPage,numPerPage,officialAccountsId));
}
@ApiOperation("小程序首页书籍信息")
......@@ -740,7 +743,8 @@ public class AppletHomeFacade {
@CookieValue("userInfo") String userInfo
) throws PermissionException{
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
return new ResponseDto<>(appletUserBookcaseBiz.getUserLastBookRe(wechatUserId));
Long officialAccountsId = Cookie.getId(userInfo,Cookie._OFFICIAL_ACCOUNTS_ID);
return new ResponseDto<>(appletUserBookcaseBiz.getUserLastBookRe(wechatUserId, officialAccountsId));
}
@ApiOperation("获取社群共读")
......@@ -811,7 +815,8 @@ public class AppletHomeFacade {
@PostMapping("deleteBookcaseRecordByIds")
public ResponseDto<?> deleteBookcaseRecordByIds(@CookieValue("userInfo") String userInfo, @RequestBody List<Long> ids) {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
appletUserBookcaseBiz.deleteByIds(ids, wechatUserId);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
appletUserBookcaseBiz.deleteByIds(ids, wechatUserId, officialAccountsId);
return new ResponseDto<>();
}
......@@ -822,6 +827,9 @@ public class AppletHomeFacade {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少参数");
}
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
appletLinkClick.setWechatUserId(wechatUserId);
appletLinkClick.setOfficialAccountsId(officialAccountsId);
appletNewsBiz.addClickRecord(appletLinkClick);
return new ResponseDto<>();
}
......@@ -967,10 +975,11 @@ public class AppletHomeFacade {
@GetMapping("getBookcaseIdListByUser")
public ResponseDto<?> getBookcaseIdListByUser(@CookieValue("userInfo") String userInfo){
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
Long officialAccountsId = Cookie.getId(userInfo,Cookie._OFFICIAL_ACCOUNTS_ID);
if(!NumberUtil.isNumber(wechatUserId)){
throw BookBizException.PARAM_DELETION;
}
return new ResponseDto<>(appletUserBookcaseBiz.getBookcaseIdListByUser(wechatUserId));
return new ResponseDto<>(appletUserBookcaseBiz.getBookcaseIdListByUser(wechatUserId,officialAccountsId));
}
@ApiOperation("批量更新资讯自定义标识")
......@@ -1193,8 +1202,7 @@ public class AppletHomeFacade {
}
answerSubscribeDTO.setWechatUserId(wechatUserId);
answerSubscribeDTO.setAccountSettingId(accountSettingId);
answerSubscribeBiz.answerSubscribe(answerSubscribeDTO);
return new ResponseDto<>();
return new ResponseDto<>(answerSubscribeBiz.answerSubscribe(answerSubscribeDTO));
}
@ApiOperation("答案订阅")
......@@ -1257,6 +1265,34 @@ public class AppletHomeFacade {
}
@ApiOperation("H5首页-精选书单")
@GetMapping("getBooklistByGradeLabel4ResourcePage")
public ResponseDto<?> getBooklistByGradeLabel4ResourcePage(
@RequestParam("gradeLabelId") Long gradeLabelId, @RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage) {
if (null == gradeLabelId) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少用户年级标签");
}
if (null == currentPage || null == numPerPage) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少分页参数");
}
return new ResponseDto<>(appletBooklistBiz.getBooklistByGradeLabel4ResourcePage(gradeLabelId, currentPage, numPerPage));
}
@ApiOperation("H5首页-banner列表")
@GetMapping("getBannerByGradeLabel4ResourcePage")
public ResponseDto<?> getBannerByGradeLabel4ResourcePage(
@RequestParam("gradeLabelId") Long gradeLabelId,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页数量") Integer numPerPage) {
if (null == gradeLabelId) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少用户年级标签");
}
if (null == currentPage || null == numPerPage) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少分页参数");
}
return new ResponseDto<>(appletBannerBiz.getBannerByGradeLabel4ResourcePage(gradeLabelId, currentPage, numPerPage));
}
}
......
......@@ -13,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
/**
* (AppletRecordAggrWeekStatis)表控制层
*
......@@ -39,4 +41,23 @@ public class AppletRecordAggrStatisFacade {
return new ResponseDto<>(appletRecordAggrStatisBiz.getAggrStatis(wechatUserId, keyword, sourceType, rankType, currentPage, numPerPage));
}
@ApiOperation("H5资源查询")
@GetMapping("getResource4H5")
public ResponseDto<?> getResource4H5(@CookieValue("userInfo") String userInfo,
@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "sourceType", required = false) Integer sourceType,
@RequestParam(value = "currentPage", defaultValue = "0") Integer currentPage,
@RequestParam(value = "numPerPage", defaultValue = "10") Integer numPerPage) {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
return new ResponseDto<>(appletRecordAggrStatisBiz.getResource4H5(wechatUserId, officialAccountsId, keyword, sourceType, currentPage, numPerPage));
}
@ApiOperation("更新H5资源广场资源")
@GetMapping("updateH5Resource")
public ResponseDto<?> updateH5Resource() {
appletRecordAggrStatisBiz.updateH5Resource();
return new ResponseDto<>();
}
}
......@@ -94,8 +94,9 @@ public class AppletRecordFacade {
public ResponseDto<PageBeanNew<AppletRecordDTO>> listAppletRecord(@CookieValue("userInfo") String userInfo,
@RequestBody AppletRecordQueryVO appletRecordQueryVO) {
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
PageBeanNew<AppletRecordDTO> recordDTOPageBeanNew = appletRecordBiz.listAppletRecord(wechatUserId, appletRecordQueryVO.getDate(),
appletRecordQueryVO.getRecordTypes(), appletRecordQueryVO.getQueryName(), appletRecordQueryVO.getCurrentPage(), appletRecordQueryVO.getNumPerPage(), appletRecordQueryVO.getTypeName());
appletRecordQueryVO.getRecordTypes(), appletRecordQueryVO.getQueryName(), appletRecordQueryVO.getCurrentPage(), appletRecordQueryVO.getNumPerPage(), appletRecordQueryVO.getTypeName(),officialAccountsId);
return new ResponseDto<>(recordDTOPageBeanNew);
}
......@@ -111,7 +112,8 @@ public class AppletRecordFacade {
public ResponseDto<List<AppletRecordDTO>> getAppletRecordCatalogue(@CookieValue("userInfo") String userInfo,
@RequestBody AppletRecordQueryVO appletRecordQueryVO) {
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
List<AppletRecordDTO> appletRecordDTOS = appletRecordBiz.getAppletRecordCatalogue(wechatUserId, appletRecordQueryVO.getDate());
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
List<AppletRecordDTO> appletRecordDTOS = appletRecordBiz.getAppletRecordCatalogue(wechatUserId, appletRecordQueryVO.getDate(),officialAccountsId);
return new ResponseDto<>(appletRecordDTOS);
}
......
......@@ -40,9 +40,12 @@ public class AppletThirdResourcesFacade {
public ResponseDto<?> addClickRecord(@CookieValue("userInfo") String userInfo,
@RequestBody @ApiParam AppletThirdResourcesClick thirdResourcesClick) {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
if (null == thirdResourcesClick || null == thirdResourcesClick.getThirdResourcesId() || null == thirdResourcesClick.getWechatUserId()) {
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
if (null == thirdResourcesClick || null == thirdResourcesClick.getThirdResourcesId() ) {
throw new WechatUserException(WechatUserException.FIELD_IS_NULL, "缺失参数");
}
thirdResourcesClick.setWechatUserId(wechatUserId);
thirdResourcesClick.setOfficialAccountsId(officialAccountsId);
thirdResourcesBiz.addServiceRecord(thirdResourcesClick);
return new ResponseDto<>();
}
......@@ -163,4 +166,17 @@ public class AppletThirdResourcesFacade {
return new ResponseDto<>(thirdResourceRecordDTOPageBeanNew);
}
@ApiOperation("H5资源页-我的-为你推荐")
@GetMapping("getThirdResourcesByGradeLabel4ResourcePage")
public ResponseDto<?> getThirdResourcesByGradeLabel4ResourcePage(
@RequestParam("gradeLabelId") Long gradeLabelId, @RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage) {
if (null == gradeLabelId) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少用户年级标签");
}
if (null == currentPage || null == numPerPage) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少分页参数");
}
return new ResponseDto<>(thirdResourcesBiz.getThirdResourcesByGradeLabel4ResourcePage(gradeLabelId, currentPage, numPerPage));
}
}
\ No newline at end of file
......@@ -54,7 +54,8 @@ public class ServeCollectFacade {
@RequestParam(value = "numPerPage", defaultValue = "10") Integer numPerPage)
throws BizException, PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
return new ResponseDto<>(serveCollectBiz.getList(wechatUserId, currentPage, numPerPage, typeCode));
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
return new ResponseDto<>(serveCollectBiz.getList(wechatUserId, currentPage, numPerPage, typeCode, officialAccountsId));
}
@ApiOperation("新增")
......@@ -104,12 +105,13 @@ public class ServeCollectFacade {
return new ResponseDto<>();
}
@ApiOperation("删除")
@ApiOperation("获取所有的收藏id")
@GetMapping("getAllCollect")
public ResponseDto<?> getAllCollect(@CookieValue("userInfo") String userInfo,
@RequestParam(value = "typeCode",required = false) String typeCode) throws BizException, PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
List<Long> ids = serveCollectBiz.getAllCollect(wechatUserId,typeCode);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
List<Long> ids = serveCollectBiz.getAllCollect(wechatUserId,typeCode, officialAccountsId);
return new ResponseDto<>(ListUtils.isEmpty(ids) ? new ArrayList<>() : ids);
}
......@@ -117,7 +119,8 @@ public class ServeCollectFacade {
@GetMapping("getTypeNameAndCountByWechatUserId")
public ResponseDto<List<CollectionTypeNameAndCountDTO>> getTypeNameAndCountByWechatUserId(@CookieValue("userInfo") String userInfo){
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
List<CollectionTypeNameAndCountDTO> typeNameAndCountByWechatId = serveCollectBiz.getTypeNameAndCountByWechatId(wechatUserId);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
List<CollectionTypeNameAndCountDTO> typeNameAndCountByWechatId = serveCollectBiz.getTypeNameAndCountByWechatId(wechatUserId, officialAccountsId);
return new ResponseDto<>(ListUtils.isEmpty(typeNameAndCountByWechatId) ? new ArrayList<>() : typeNameAndCountByWechatId);
}
......
package com.pcloud.book.applet.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.pcloud.book.applet.biz.AnswerSubscribeBiz;
import com.pcloud.book.applet.biz.AppletBannerBiz;
import com.pcloud.book.applet.biz.AppletBooklistBiz;
......@@ -13,6 +12,7 @@ import com.pcloud.book.applet.biz.AppletThirdResourcesStaticBiz;
import com.pcloud.book.applet.biz.AppletUserBookcaseBiz;
import com.pcloud.book.applet.biz.ReadBookRecordBiz;
import com.pcloud.book.applet.biz.ServeCollectBiz;
import com.pcloud.book.applet.dto.AnswerSubscribeUserDTO;
import com.pcloud.book.applet.dto.AppletAppOrProductDTO;
import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.dto.AppletNewsVO;
......@@ -24,6 +24,7 @@ import com.pcloud.book.applet.dto.PcloudGroupActivityDTO;
import com.pcloud.book.applet.dto.ServeCollectDTO;
import com.pcloud.book.applet.entity.ServeCollect;
import com.pcloud.book.applet.service.AppletService;
import com.pcloud.book.group.biz.ResourcePageBiz;
import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.skill.biz.PcloudGroupActivityBiz;
import com.pcloud.book.skill.entity.PcloudGroupActivity;
......@@ -90,6 +91,8 @@ public class AppletServiceImpl implements AppletService {
private ReadBookRecordBiz readBookRecordBiz;
@Autowired
private AppletUserBookcaseBiz appletUserBookcaseBiz;
@Autowired
private ResourcePageBiz resourcePageBiz;
@Override
......@@ -206,6 +209,8 @@ public class AppletServiceImpl implements AppletService {
@GetMapping("updateAggrStatisCache")
public void updateAggrStatisCache(){
appletRecordAggrStatisBiz.updateAggrStatisCache();
appletRecordAggrStatisBiz.updateH5Resource();
resourcePageBiz.insertCourseStatistic();
}
@Override
......@@ -259,4 +264,10 @@ public class AppletServiceImpl implements AppletService {
public ResponseEntity<ResponseDto<List<Long>>> getSameClassifyUserIds(@RequestBody List<Long> wechatUserIds){
return ResponseHandleUtil.toResponse(appletUserBookcaseBiz.getSameClassifyUserIds(wechatUserIds));
}
@Override
@GetMapping("getUserSubscribeInfo")
public ResponseEntity<ResponseDto<AnswerSubscribeUserDTO>> getUserSubscribeInfo(@RequestParam("wechatUserId") Long wechatUserId){
return ResponseHandleUtil.toResponse(answerSubscribeBiz.getUserSubscribeInfo(wechatUserId));
}
}
......@@ -2025,38 +2025,11 @@ public class BookSet {
if (ListUtils.isEmpty(recordList)) {
return;
}
List<BookSceneIdListDTO> bookSceneIdListDTOS = new ArrayList<>();
for (Object obj : recordList) {
BookDto bookDto = (BookDto) obj;
BookSceneIdListDTO dto = new BookSceneIdListDTO();
dto.setAdviserId(bookDto.getAdviserId());
dto.setBookId(bookDto.getBookId());
dto.setChannelId(bookDto.getChannelId());
bookSceneIdListDTOS.add(dto);
}
List<BookSceneIdListDTO> sceneIdListDTOS = qrcodeSceneConsr.listSceneIds4Book(bookSceneIdListDTOS);
Map<String, List<Long>> bookSceneIdMap = new HashMap<>();
if (!ListUtils.isEmpty(sceneIdListDTOS)) {
for (BookSceneIdListDTO dto : sceneIdListDTOS) {
if (!ListUtils.isEmpty(dto.getSceneIds())) {
String key = dto.getBookId() + "-" + dto.getAdviserId() + "-" + dto.getChannelId();
bookSceneIdMap.put(key, dto.getSceneIds());
}
}
}
for (Object obj : recordList) {
BookDto bookDto = (BookDto) obj;
Integer isOpenRobotProcess = 0;
String key = bookDto.getBookId() + "-" + bookDto.getAdviserId() + "-" + bookDto.getChannelId();
if (!MapUtils.isEmpty(bookSceneIdMap) && bookSceneIdMap.containsKey(key)) {
List<Long> sceneIdList = bookSceneIdMap.get(key);
//开启小睿的二维码
List<Long> openRaysSceneIds = resourcePageBiz.getOpenRaysSceneIds(sceneIdList);
if (!ListUtils.isEmpty(openRaysSceneIds)) {
isOpenRobotProcess = 1;
}
}
bookDto.setIsOpenRobotProcess(isOpenRobotProcess);
//开启小睿
Boolean openRays = resourcePageBiz.isOpenRaysBook(bookDto.getBookId(), bookDto.getChannelId(), bookDto.getAdviserId());
bookDto.setIsOpenRobotProcess(openRays?1:0);
}
}
......
......@@ -7,6 +7,7 @@ import cn.hutool.core.collection.CollUtil;
import com.pcloud.analysisengine.browse.dto.BookBrowseAndScanStatsDTO;
import com.pcloud.analysisengine.browse.dto.BookServeBrowseCountParameterDTO;
import com.pcloud.analysisengine.browse.dto.BrowseCacheRecordDto;
import com.pcloud.analysisengine.browse.dto.BrowseRecordStatisticDTO;
import com.pcloud.analysisengine.browse.dto.GroupBrowseStatisticVO;
import com.pcloud.analysisengine.browse.dto.SBookAnalyzeDto;
import com.pcloud.analysisengine.browse.service.BrowseRecordService;
......@@ -197,4 +198,16 @@ public class BrowseRecordConsr {
return bookBrowseAndScanStatsDTOS;
}
@ParamLog("浏览量高的资源")
public List<BrowseRecordStatisticDTO> getResourceTopIn7Day4H5(List<String> typeCodes) {
if (ListUtils.isEmpty(typeCodes)) {
return new ArrayList<>();
}
try {
return ResponseHandleUtil.parseList(browseRecordService.getResourceTopIn7Day4H5(typeCodes),BrowseRecordStatisticDTO.class);
} catch (Exception e) {
LOGGER.error("调用失败"+e.getMessage(), e);
}
return null;
}
}
......@@ -597,4 +597,16 @@ public class QrcodeSceneConsr {
}
return 0;
}
@ParamLog("查书刊订阅的公众号二维码")
public GroupQrcodeVO getSubscribeQrcode(Long accountSettingId) {
GroupQrcodeVO qrcodeVO = new GroupQrcodeVO();
try {
qrcodeVO = ResponseHandleUtil.parseResponse(qrcodeSceneService.getSubscribeQrcode(accountSettingId), GroupQrcodeVO.class);
} catch (Exception e) {
LOGGER.error("调用qrcodeSceneService.getSubscribeQrcode失败"+e.getMessage(), e);
}
return qrcodeVO;
}
}
......@@ -8,8 +8,11 @@ import com.pcloud.readercenter.applet.entity.AppletQuestion;
import com.pcloud.readercenter.applet.service.AppletUserService;
import com.pcloud.readercenter.rmall.entity.RmallBookMoneyRecord;
import com.pcloud.readercenter.rmall.service.RmallBookMoneyRecordService;
import com.pcloud.readercenter.userlabel.dto.UserGradeLabelIdDTO;
import com.pcloud.readercenter.userlabel.service.UserLabelService;
import com.pcloud.readercenter.wechat.dto.NickNameAndOpenIdDto;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
......@@ -22,6 +25,7 @@ import com.pcloud.readercenter.wechat.dto.SpecialBookDTO4Reader;
import com.pcloud.readercenter.wechat.dto.SpecialBookQueryDTO4Reader;
import com.pcloud.readercenter.wechat.dto.BuyBookProcessingDataDTO;
import com.pcloud.readercenter.wechat.dto.Wechat;
import com.pcloud.readercenter.wechat.entity.WechatUserOfficialAccounts;
import com.pcloud.usercenter.party.agent.dto.AgentCity;
import com.pcloud.usercenter.party.agent.service.AgentService;
import org.slf4j.Logger;
......@@ -62,6 +66,8 @@ public class ReaderConsr {
private RmallBookMoneyRecordService rmallBookMoneyRecordService;
@Autowired
private AppletUserService appletUserService;
@Autowired
private UserLabelService userLabelService;
public WechatUser getWechatUser(Long wechatUserId) throws BizException {
if (wechatUserId == null) {
......@@ -378,6 +384,64 @@ public class ReaderConsr {
}
return appletQuestionMap;
}
@ParamLog("查用户年级标签")
public UserGradeLabelIdDTO getUserGrade(Long wechatUserId, Long officialAccountsId) {
UserGradeLabelIdDTO dto = new UserGradeLabelIdDTO();
try {
dto = ResponseHandleUtil.parseResponse(userLabelService.getUserGrade(wechatUserId, officialAccountsId),UserGradeLabelIdDTO.class);
} catch (Exception e) {
LOGGER.error("调用userLabelService.getUserGrade失败"+e.getMessage(), e);
}
return dto;
}
@ParamLog("查询指定用户是否授权")
public WechatUserOfficialAccounts getOfficialAccounts(Long officialAccountsId, String openId, Long wechatUserId) {
WechatUserOfficialAccounts accounts = new WechatUserOfficialAccounts();
try {
accounts = ResponseHandleUtil.parseResponse(wechatUserService.getOfficialAccounts(officialAccountsId, openId, wechatUserId), WechatUserOfficialAccounts.class);
} catch (Exception e) {
LOGGER.error("调用wechatUserService.getOfficialAccounts失败"+e.getMessage(), e);
}
return accounts;
}
@ParamLog("获取关联公众号用户id列表(777和23/35515)")
public List<Long> getRelateUserIdList(Long wechatUserId, Long officialAccountsId) {
List<Long> list = new ArrayList<>();
if (null == officialAccountsId) {
return Arrays.asList(wechatUserId);
}
try {
list = ResponseHandleUtil.parseList(wechatUserService.getRelateUserIdList(wechatUserId, officialAccountsId), Long.class);
} catch (Exception e) {
LOGGER.error("调用wechatUserService.getRelateUserIdList失败"+e.getMessage(), e);
}
return list;
}
@ParamLog("更新用户年级标签")
public void addUserGradeLabel(Long userId, Long officialAccountsId, Long labelId) {
try {
userLabelService.addUserGradeLabel(userId, officialAccountsId, labelId);
} catch (Exception e) {
LOGGER.error("调用userLabelService.addUserGradeLabel失败"+e.getMessage(), e);
}
}
@ParamLog("查用户年级子标签")
public List<Long> getUserGradeIdByParentId(Long parentId) {
List<Long> list = new ArrayList<>();
try {
list = ResponseHandleUtil.parseList(userLabelService.getUserGradeIdByParentId(parentId),Long.class);
} catch (Exception e) {
LOGGER.error("调用userLabelService.getUserGradeIdByParentId失败"+e.getMessage(), e);
}
return list;
}
}
......@@ -10,7 +10,6 @@ import com.pcloud.book.book.biz.BookBiz;
import com.pcloud.book.book.constant.BookConstant;
import com.pcloud.book.book.dao.BookAdviserDao;
import com.pcloud.book.book.dao.BookDao;
import com.pcloud.book.book.dto.ErpBookApprovalDTO;
import com.pcloud.book.consumer.analysisengine.BrowseRecordConsr;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.erp.ErpConsr;
......@@ -19,11 +18,10 @@ import com.pcloud.book.es.biz.ESBookAndAdviserBiz;
import com.pcloud.book.es.entity.ESBookAndAdviser;
import com.pcloud.book.es.repository.BookAndAdviserRepository;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.biz.ResourcePageBiz;
import com.pcloud.book.group.dto.BookServeDTO;
import com.pcloud.book.group.enums.JoinGroupTypeEnum;
import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.rightsSetting.constants.RightsSettingConstant;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.book.util.common.YesOrNoEnums;
import com.pcloud.book.util.properties.BookProps;
......@@ -53,8 +51,6 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import redis.clients.jedis.JedisCluster;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -87,24 +83,16 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz {
@Autowired
private BookAndAdviserRepository bookAndAdviserRepository;
@Autowired
private AppletUserBookcaseBiz appletUserBookcaseBiz;
@Autowired
private QrcodeSceneConsr qrcodeSceneConsr;
@Autowired
private BookGroupBiz bookGroupBiz;
@Autowired
private BrowseRecordConsr browseRecordConsr;
@Autowired
private TradeConsr tradeConsr;
@Autowired
private ErpConsr erpConsr;
@Autowired
private RightsSettingBiz rightsSettingBiz;
@Autowired
private BookBiz bookBiz;
@Autowired
private BookAdviserDao bookAdviserDao;
@Autowired
private ResourcePageBiz resourcePageBiz;
@Autowired
private AppletBookIgnorBiz appletBookIgnorBiz;
@ParamLog("导入全部book和bookAdviser")
......@@ -159,24 +147,12 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz {
sourceAdviserIds.add(Long.valueOf(esBookAndAdviser.getAdviserId()));
sourceChannelIds.add(Long.valueOf(esBookAndAdviser.getChannelId()));
}
//书刊资源数量(二维码)
Map<String, Integer> resourceCountMap = qrcodeSceneConsr.mapServeCount4Applet(new ArrayList<>(sourceBookIds));
//书刊资源数量(社群书)
Map<String, Integer> bookGroupResourceCountMap = bookGroupBiz.mapServeCount4Applet(new ArrayList<>(sourceBookIds));
//书刊扫码量浏览量
Map<String, BrowseCacheRecordDto> bookSvUvPvMap = browseRecordConsr.getBookSvUvPv(new ArrayList<>(adviserIds),new ArrayList<>(channelIds),new ArrayList<>(searchBookIds));
// 获取书刊累计收益(销售额)
Map<String, IncomeBackDto> bookIncomeMap = tradeConsr.getBookIncome(bookIncomeQueryVos, null);
for (ESBookAndAdviser bookAndAdviser : list){
String key = bookAndAdviser.getBookId() + "-" + bookAndAdviser.getAdviserId() + "-" + bookAndAdviser.getChannelId();
Integer resourceCount=0;
if (!MapUtils.isEmpty(resourceCountMap) && resourceCountMap.containsKey(key)){
resourceCount = resourceCountMap.get(key);
}
if (!MapUtils.isEmpty(bookGroupResourceCountMap) && bookGroupResourceCountMap.containsKey(key)) {
resourceCount = resourceCount + bookGroupResourceCountMap.get(key);
}
bookAndAdviser.setResourceCount(resourceCount);
//统计基金书数据
BigDecimal fundBookValue = BigDecimal.ZERO;
if (bookAndAdviser.getIsFundSupport()==1) {
......@@ -198,22 +174,8 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz {
Long adviserId = Long.valueOf(bookAndAdviser.getAdviserId());
Long bookId = Long.valueOf(bookAndAdviser.getBookId());
Long channelId = Long.valueOf(bookAndAdviser.getChannelId());
//权益
Long rightsSettingId = 0L;
Integer joinGroupType = bookAndAdviser.getJoinGroupType();
if (null != joinGroupType && JoinGroupTypeEnum.XIAORUI.getCode().equals(joinGroupType)){
if (adviserId>0 && bookId>0 && channelId>0){
RightsSettingDto rightsSettingDto = rightsSettingBiz.getRightsSettingByBookId4AppletHome(bookId,adviserId,channelId);
if (null != rightsSettingDto && null != rightsSettingDto.getId()){
rightsSettingId = rightsSettingDto.getId();
} else {
rightsSettingId = bookBiz.getDefaultRightsSettingId();
}
}
}
bookAndAdviser.setRightsSettingId(rightsSettingId);
//标记是否有答案
List<BookServeDTO> bookServeVOS = bookGroupBiz.getBookAndBookGroupServeIds(adviserId, bookId, channelId);
List<BookServeDTO> bookServeVOS = resourcePageBiz.getBookAndBookGroupServeIds(adviserId, bookId, channelId);
bookGroupBiz.removeCanNotBuy(bookServeVOS);
bookGroupBiz.fillBookServe(bookServeVOS);
Integer hasAnswer = 0;
......@@ -224,6 +186,7 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz {
hasAnswer = 1;
}
}
bookAndAdviser.setResourceCount(bookServeVOS.size());
bookAndAdviser.setHasAnswer(hasAnswer);
}
}
......
......@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
......@@ -88,4 +89,11 @@ public class ESBookAndAdviserFacade {
}
return new ResponseDto<>();
}
@ApiOperation("更新es书刊")
@PostMapping("updateBookAndAdviserToES")
public ResponseDto<?> updateBookAndAdviserToES(@RequestBody List<Long> bookIds) {
esBookAndAdviserBiz.updateBookAndAdviserToES(bookIds);
return new ResponseDto<>();
}
}
......@@ -836,7 +836,7 @@ public interface BookGroupBiz {
* @param wechatUserId
* @param scene
*/
BookGroupDTO getByAppletScene(Long wechatUserId, String scene);
BookGroupDTO getByAppletScene(Long wechatUserId, String scene, Long officialAccountsId);
/**
* 获取小睿社群书和现代纸书所配资源
......
......@@ -2,15 +2,19 @@ package com.pcloud.book.group.biz;
import com.pcloud.book.group.dto.AddBookGroupServeDTO;
import com.pcloud.book.group.dto.BookGroupServeDTO;
import com.pcloud.book.group.dto.BookServeDTO;
import com.pcloud.book.group.dto.ResourcePageCourseDTO;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.group.entity.ResourcePage;
import com.pcloud.book.group.entity.ResourcePageCollect;
import com.pcloud.book.group.entity.ResourcePageTool;
import com.pcloud.book.group.vo.ResourceColumnAndServeVO;
import com.pcloud.book.group.vo.ResourcePageItemVO;
import com.pcloud.book.group.vo.ResourcePageOneServe;
import com.pcloud.book.group.vo.ResourcePageVO;
import com.pcloud.book.group.vo.UpdateResourceColumnVO;
import com.pcloud.book.group.vo.UpdateResourcePageVO;
import com.pcloud.channelcenter.qrcode.dto.BookSceneIdListDTO;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
......@@ -134,12 +138,12 @@ public interface ResourcePageBiz {
*/
List<BookGroupServe> getServeListByBookGroupId(Long bookGroupId);
/**
* 批量更新资源聚合页二维码
* 批量更新资源页应用作品链接
* @author:zhuyajie
* @date:2021/4/20 1:14
* @date:2021/5/27 1:14
* * @param null
*/
void batchUpdateResourceQrcode(List<Long> qrcodeIdList, String qrcodeType);
void batchUpdateResourceUrl(List<Long> sceneIdList);
/**
......@@ -216,4 +220,105 @@ public interface ResourcePageBiz {
* 获取h5页面配了这个资源的二维码集合
*/
List<Long> getSceneIdsByResourceId(Long resourceId);
/**
* 更新书刊id
* @author:zhuyajie
* @date:2021/5/11 18:46
* * @param null
*/
void batchUpdateBookId(List<BookSceneIdListDTO> requestDto);
/**
* 书刊下开启小睿的资源页资源
* @author:zhuyajie
* @date:2021/5/11 19:46
* * @param null
*/
List<BookServeDTO> getBookAndBookGroupServeIds(Long adviserId, Long bookId, Long channelId);
/**
* 查用户H5资源页工具列表
* @author:zhuyajie
* @date:2021/5/12 17:45
* * @param null
*/
List<ResourcePageTool> getToolListByUser(Long wechatUserId, Long officialAccountsId);
/**
* 资源广场模块
* @author:zhuyajie
* @date:2021/5/13 11:26
* * @param null
*/
List<Map<String,Object>> getResourceSourceTypeList(Long wechatUserId, Long officialAccountsId);
/**
* 查用户学龄段
* @author:zhuyajie
* @date:2021/5/13 15:40
* * @param null
*/
Long getUserGrade(Long wechatUserId, Long officialAccountsId);
/**
* 添加课程统计数据
* @author:zhuyajie
* @date:2021/5/17 15:11
* * @param null
*/
void insertCourseStatistic();
/**
* H5首页-根据用户年级查推荐课程
* @author:zhuyajie
* @date:2021/5/17 17:07
* * @param null
*/
PageBeanNew<ResourcePageCourseDTO> listCourseByUser(Long wechatUserId, Long officialAccountsId, Integer currentPage, Integer numPerPage);
/**
* 查年级标签对应的用户年级
* @author:zhuyajie
* @date:2021/5/18 18:58
* * @param null
*/
Long getGradeByGradeLabelId(Long graLabelId);
/**
* 查深度标签对应的用户年级
* @author:zhuyajie
* @date:2021/5/18 19:20
* * @param null
*/
Long getGradeByDepLabelId(Long depLabelId);
/**
* 书刊是否开启小睿
* @author:zhuyajie
* @date:2021/5/25 11:00
* * @param null
*/
Boolean isOpenRaysBook(Long bookId, Long channelId, Long adviserId);
/**
* 获取用户H5新用户状态
* @author:zhuyajie
* @date:2021/5/27 10:39
* * @param null
*/
Map<String, Object> getUserNewState(Long wechatUserId);
/**
* 添加新用户记录
* @author:zhuyajie
* @date:2021/4/26 15:36
* * @param null
*/
void addNewUserRecord(ResourcePageCollect resourcePageCollect);
/**
* 查二维码是否开启小睿
* @author:zhuyajie
* @date:2021/5/27 11:52
* * @param null
*/
Boolean isOpenRaysScene(Long sceneId, Long bookGroupId);
}
......@@ -94,4 +94,20 @@ public interface WeworkTeacherBiz {
* @return
*/
Map<Long, WxWorkTeacherDTO> getWxWorkTeacherByIds(List<Long> teacherIds);
/**
* 根据id查老师
* @author:zhuyajie
* @date:2021/5/10 15:12
* * @param null
*/
WeworkTeacherVO getWxworkTeacherById(Long id);
/**
* H5首页-客服老师
* @author:zhuyajie
* @date:2021/5/11 16:40
* * @param null
*/
PageBeanNew<WeworkTeacherVO> getTeacherByGradeLabel4ResourcePage(Long gradeLabelId, Integer currentPage, Integer numPerPage);
}
......@@ -5201,7 +5201,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
}
@Override
public BookGroupDTO getByAppletScene( Long wechatUserId, String scene) {
public BookGroupDTO getByAppletScene( Long wechatUserId, String scene, Long officialAccountsId) {
BookGroupDTO dto = new BookGroupDTO();
BookAppletScene bookAppletScene = bookAppletSceneDao.getByAppletId(scene);
if (null == bookAppletScene) {
......@@ -5217,6 +5217,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
appletUserBookcase.setAdviserId(bookGroupDTO.getCreateUser());
appletUserBookcase.setBookId(bookGroupDTO.getBookId());
appletUserBookcase.setChannelId(bookGroupDTO.getChannelId());
appletUserBookcase.setOfficialAccountsId(officialAccountsId);
AppletTaskDTO appletTaskDTO = appletUserBookcaseBiz.addUserBook(appletUserBookcase);
if (null != appletTaskDTO && YesOrNoEnums.YES.getValue().equals(appletTaskDTO.getIsFinishTask())) {
dto.setIsFinshTask(appletTaskDTO.getIsFinishTask());
......@@ -5248,6 +5249,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
//用户书刊埋点
AppletUserBookcase appletUserBookcase = new AppletUserBookcase();
appletUserBookcase.setWechatUserId(wechatUserId);
appletUserBookcase.setOfficialAccountsId(officialAccountsId);
appletUserBookcase.setAdviserId(byId.getCreatedByUserLogin());
appletUserBookcase.setBookId(byId.getAdviserBookId());
appletUserBookcase.setChannelId(byId.getChannelPartyId());
......@@ -5265,13 +5267,6 @@ public class BookGroupBizImpl implements BookGroupBiz {
appletRecord.setAdviserId(byId.getCreatedByUserLogin());
appletRecord.setChannelId(byId.getChannelPartyId());
appletRecordBiz.insert(appletRecord);
//现代纸书是否开启小睿流程
BookAdviserDto bookAdviserDto = bookAdviserDao.getBase(byId.getAdviserBookId(), byId.getChannelPartyId(), byId.getCreatedByUserLogin());
if (null != bookAdviserDto && YesOrNoEnums.YES.getValue().equals(bookAdviserDto.getIsOpenRobotProcess())) {
dto.setOpenWeapp(true);
} else {
dto.setOpenWeapp(false);
}
}
return dto;
}
......@@ -5476,8 +5471,8 @@ public class BookGroupBizImpl implements BookGroupBiz {
}
}
}
//社群书配置资源
List<BookGroupServe> bookGroupServes = bookGroupServeDao.getServeListByBook(bookId, channelId, adviserId);
//社群书配置资源,(二维码已统一,无需两边查询)
/* List<BookGroupServe> bookGroupServes = bookGroupServeDao.getServeListByBook(bookId, channelId, adviserId);
if (!ListUtils.isEmpty(bookGroupServes)) {
for (BookGroupServe bookGroupServe : bookGroupServes) {
BookServeDTO bookServeDTO = new BookServeDTO();
......@@ -5496,7 +5491,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
productIds.add(serveId);
}
}
}
}*/
return serveDTOList;
}
......@@ -5597,16 +5592,8 @@ public class BookGroupBizImpl implements BookGroupBiz {
@Override
public Map<String, Object> getBookBaseInfo4Applet( Long adviserId, Long channelId, Long bookId ) {
Map<String, Object> map = new HashMap<>();
//是否小睿,小睿权益id
BookGroupDTO bookGroupDTO = bookGroupDao.getDTOByBookId(bookId, channelId, adviserId);
Integer isXIAORUI = bookAdviserDao.getIsRui(adviserId, bookId, channelId);
map.put("isXIAORUI", YesOrNoEnums.YES.getValue().equals(isXIAORUI) ? Boolean.TRUE : Boolean.FALSE);
if (YesOrNoEnums.YES.getValue().equals(isXIAORUI)) {
RightsSettingDto rightsSettingDto = rightsSettingBiz.getRightsSettingByBookId4AppletHome(bookId, adviserId, channelId);
if (null != rightsSettingDto) {
map.put("rightsSettingId", rightsSettingDto.getId());
}
}
//是否开启小睿
map.put("openRays", resourcePageBiz.isOpenRaysBook(bookId, channelId, adviserId));
//书刊分类对应的小睿分类
BookAdviserDto adviserDto = bookAdviserDao.getBase(bookId, channelId, adviserId);
map.put("isK12", Boolean.FALSE);
......@@ -5645,9 +5632,6 @@ public class BookGroupBizImpl implements BookGroupBiz {
map.put("publish", bookDto.getPublish());
}
map.put("isLibraryBook", bookBiz.checkIsLibraryBook(adviserId, bookId) ? 1 : 0);
if (Objects.isNull(map.get("rightsSettingId"))) {
map.put("rightsSettingId", bookBiz.getDefaultRightsSettingId());
}
//资源数量
/* List<BookServeDTO> serveDTOList = this.getBookAndBookGroupServeIds(adviserId, bookId, channelId);
this.removeCanNotBuy(serveDTOList);
......
......@@ -4,6 +4,9 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.pcloud.book.applet.biz.AppletResourceApplyBiz;
import com.pcloud.book.applet.contants.AppletResourceApplyConstants;
import com.pcloud.book.applet.dto.AddResourceApplyDTO;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.group.biz.GroupMaterialAccountBiz;
import com.pcloud.book.group.biz.WeworkTeacherBiz;
......@@ -61,6 +64,8 @@ public class WeworkTeacherBizImpl implements WeworkTeacherBiz {
private GroupMaterialAccountBiz groupMaterialAccountBiz;
@Autowired
private WeworkTeacherBookBindMapper weworkTeacherBookBindMapper;
@Autowired
private AppletResourceApplyBiz appletResourceApplyBiz;
@Override
@ParamLog(value = "新增客服老师")
......@@ -101,9 +106,26 @@ public class WeworkTeacherBizImpl implements WeworkTeacherBiz {
weworkTeacher.setMediaId(mediaId);
weworkTeacher.setMaterialUrl(materialUrl);
weworkTeacherMapper.insert(weworkTeacher);
//设置适用人群
this.updateResourceApply(weworkTeacher.getId(), weworkTeacherVO.getCrowdTypeList());
return weworkTeacher.getId();
}
/**
* 更新适用人群
* @author:zhuyajie
* @date:2021/5/10 16:02
* * @param null
*/
private void updateResourceApply(Long id, List<Integer> crowdTypeList) {
AddResourceApplyDTO addResourceApplyDTO = new AddResourceApplyDTO();
addResourceApplyDTO.setTargetId(id);
addResourceApplyDTO.setTargetType(AppletResourceApplyConstants.TargetTypeEnum.TEACHER.getValue());
addResourceApplyDTO.setCrowdTypeList(crowdTypeList);
appletResourceApplyBiz.addResourceApply(addResourceApplyDTO);
}
@Override
@ParamLog(value = "更新客服老师", isAfterReturn = false)
@Transactional(rollbackFor = Exception.class)
......@@ -141,6 +163,8 @@ public class WeworkTeacherBizImpl implements WeworkTeacherBiz {
throw new BookBizException(BookBizException.ID_NOT_EXIST, "更新客服老师,更新素材失败!");
}
}
//设置适用人群
this.updateResourceApply(weworkTeacher.getId(), weworkTeacherVO.getCrowdTypeList());
return weworkTeacher.getId();
}
......@@ -252,4 +276,22 @@ public class WeworkTeacherBizImpl implements WeworkTeacherBiz {
return weworkTeacherMapper.getWxWorkTeacherByIds(teacherIds);
}
@Override
public WeworkTeacherVO getWxworkTeacherById(Long id) {
WeworkTeacherVO vo = weworkTeacherMapper.getWxworkTeacherById(id);
vo.setCrowdTypeList(appletResourceApplyBiz.getCrowdTypeList(id, AppletResourceApplyConstants.TargetTypeEnum.TEACHER.getValue()));
return vo;
}
@Override
public PageBeanNew<WeworkTeacherVO> getTeacherByGradeLabel4ResourcePage(Long gradeLabelId, Integer currentPage, Integer numPerPage) {
int offset = numPerPage * currentPage;
Integer count = weworkTeacherMapper.countTeacherByGradeLabel(gradeLabelId.intValue());
if (Objects.isNull(count) || count < 1) {
return new PageBeanNew<>();
}
List<WeworkTeacherVO> list = weworkTeacherMapper.getTeacherByGradeLabel(gradeLabelId.intValue(), offset, numPerPage);
return new PageBeanNew<>(currentPage, numPerPage, count, list);
}
}
package com.pcloud.book.group.constant;
import com.pcloud.book.applet.contants.AppletResourceApplyConstants;
import com.pcloud.common.constant.CacheConstant;
/**
* @ClassName com.pcloud.book.group.constant.ResourcePageConstants
* @Author zhuyajie
......@@ -137,4 +140,141 @@ public class ResourcePageConstants {
this.desc = desc;
}
}
/**
* H5工具类型
* @author:zhuyajie
* @date:2021/5/12 16:35
* * @param null
*/
public enum ToolTypeEnum{
HELP(1, "互助"),
CLOCK(2, "打卡"),
ANSWER(3, "搜答案"),
RESOURCE(4, "资源广场"),
WORD(5, "背单词"),
PRETEST(6, "题库"),
SUBJECTNOTE(7, "错题本"),
TEACHER(8, "1v1老师"),
COURSE(9, "课程"),
BOOKLIST(10, "书单");
private Integer code;
private String name;
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
ToolTypeEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
}
/**
* 资源广场学龄段对应模块
* @author:zhuyajie
* @date:2021/5/13 11:22
* * @param null
*/
public enum CrowdSourceEnum {
/**
* 学龄前:育儿宝库:
*/
PRESCHOOL(new Integer[]{AppletResourceApplyConstants.CrowdTypeEnum.PRESCHOOL.getCode()},
new ResourceSourceTypeEnum[]{ResourceSourceTypeEnum.CHILD}),
/**
* 小学、初中、高中、大学:搜教辅资料:(答案、试卷、课件/教案、作文、知识点汇总)
*/
SCHOOL(new Integer[]{
AppletResourceApplyConstants.CrowdTypeEnum.PRIMARY_SCHOOL.getCode(),
AppletResourceApplyConstants.CrowdTypeEnum.JUNIOR_HIGH_SCHOOL.getCode(),
AppletResourceApplyConstants.CrowdTypeEnum.SENIOR_HIGH_SCHOOL.getCode(),
AppletResourceApplyConstants.CrowdTypeEnum.UNIVERSITY.getCode()},
new ResourceSourceTypeEnum[]{
ResourceSourceTypeEnum.PAPER,
ResourceSourceTypeEnum.PDF,
ResourceSourceTypeEnum.ARTICLE,
ResourceSourceTypeEnum.KNOWLEDGE});
private Integer[] crowdTypes;
private ResourceSourceTypeEnum[] sourceTypes;
public Integer[] getCrowdTypes() {
return crowdTypes;
}
public ResourceSourceTypeEnum[] getSourceTypes() {
return sourceTypes;
}
CrowdSourceEnum(Integer[] crowdTypes, ResourceSourceTypeEnum[] sourceTypes) {
this.crowdTypes = crowdTypes;
this.sourceTypes = sourceTypes;
}
}
/**
* 资源广场模块
* @author:zhuyajie
* @date:2021/5/13 11:46
* * @param null
*/
public enum ResourceSourceTypeEnum{
CHILD(1,"育儿宝库", new String[]{"手抄报","涂色","手工","亲子","游戏","简笔画","启蒙","早教"},
new Integer[]{AppletResourceApplyConstants.CrowdTypeEnum.PRESCHOOL.getCode()}),
PAPER(5,"试卷", new String[]{"试卷"},
new Integer[]{AppletResourceApplyConstants.CrowdTypeEnum.PRIMARY_SCHOOL.getCode(),
AppletResourceApplyConstants.CrowdTypeEnum.JUNIOR_HIGH_SCHOOL.getCode(),
AppletResourceApplyConstants.CrowdTypeEnum.SENIOR_HIGH_SCHOOL.getCode(),
AppletResourceApplyConstants.CrowdTypeEnum.UNIVERSITY.getCode()}),
PDF(6,"课件/教案",new String[]{"课件","教案"},
new Integer[]{AppletResourceApplyConstants.CrowdTypeEnum.PRIMARY_SCHOOL.getCode(),
AppletResourceApplyConstants.CrowdTypeEnum.JUNIOR_HIGH_SCHOOL.getCode(),
AppletResourceApplyConstants.CrowdTypeEnum.SENIOR_HIGH_SCHOOL.getCode(),
AppletResourceApplyConstants.CrowdTypeEnum.UNIVERSITY.getCode()}),
ARTICLE(7,"作文",new String[]{"作文"},
new Integer[]{AppletResourceApplyConstants.CrowdTypeEnum.PRIMARY_SCHOOL.getCode(),
AppletResourceApplyConstants.CrowdTypeEnum.JUNIOR_HIGH_SCHOOL.getCode(),
AppletResourceApplyConstants.CrowdTypeEnum.SENIOR_HIGH_SCHOOL.getCode(),
AppletResourceApplyConstants.CrowdTypeEnum.UNIVERSITY.getCode()}),
KNOWLEDGE(8,"知识点汇总", new String[]{"知识点汇总"},
new Integer[]{AppletResourceApplyConstants.CrowdTypeEnum.PRIMARY_SCHOOL.getCode(),
AppletResourceApplyConstants.CrowdTypeEnum.JUNIOR_HIGH_SCHOOL.getCode(),
AppletResourceApplyConstants.CrowdTypeEnum.SENIOR_HIGH_SCHOOL.getCode(),
AppletResourceApplyConstants.CrowdTypeEnum.UNIVERSITY.getCode()});
private Integer code;
private String name;
private String[] keywords;
private Integer[] crowdTypes;
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
public String[] getKeywords() {
return keywords;
}
public Integer[] getCrowdTypes() {
return crowdTypes;
}
ResourceSourceTypeEnum(Integer code, String name, String[] keywords, Integer[] crowdTypes) {
this.code = code;
this.name = name;
this.keywords = keywords;
this.crowdTypes = crowdTypes;
}
}
}
......@@ -19,4 +19,12 @@ public interface ResourcePageCollectDao extends BaseDao<ResourcePageCollect>{
* * @param null
*/
ResourcePageCollect getCollectRecordByUser(Long wechatUserId, Long resourcePageId);
/**
* 获取非新用户状态
* @author:zhuyajie
* @date:2021/5/27 10:38
* * @param null
*/
Integer getUserIsNotNew(Long wechatUserId);
}
\ No newline at end of file
package com.pcloud.book.group.dao;
import com.pcloud.book.group.entity.ResourcePageCourse;
import com.pcloud.common.core.dao.BaseDao;
/**
* 7天浏览量高的资源统计(ResourcePageCourse)表数据库访问层
*
* @author makejava
* @since 2021-05-17 14:50:36
*/
public interface ResourcePageCourseDao extends BaseDao<ResourcePageCourse>{
void deleteAll();
Long getGradeByGradeLabelId(Long graLabelId);
Long getGradeByDepLabelId(Long depLabelId);
}
\ No newline at end of file
......@@ -35,14 +35,6 @@ public interface ResourcePageDao extends BaseDao<ResourcePage>{
ResourcePage getByBookId(Long bookId, Long channelId, Long adviserId);
/**
* 根据书设置小睿关闭
* @author:zhuyajie
* @date:2021/3/31 12:01
* * @param null
*/
void setRaysCloseByBook(Map<String, Object> paramMap);
/**
* 修改页面更新时间
* @author:zhuyajie
* @date:2021/4/2 15:21
......@@ -72,13 +64,6 @@ public interface ResourcePageDao extends BaseDao<ResourcePage>{
* * @param null
*/
List<Long> getOpenRaysSceneIds(List<Long> sceneIds);
/**
* 批量关闭小睿流程
* @author:zhuyajie
* @date:2021/4/30 14:47
* * @param null
*/
void setRaysCloseBySceneIds(List<Long> sceneIds);
/**
* 批量更新sceneId
......@@ -97,4 +82,27 @@ public interface ResourcePageDao extends BaseDao<ResourcePage>{
ResourcePage getPageByColumnId(Long resourcePageColumnId);
List<Long> getSceneIdsByResourceId(Long resourceId);
/**
* 更新书刊id
* @author:zhuyajie
* @date:2021/5/11 18:50
* * @param null
*/
void updateBookBySceneIds(List<Long> sceneIds, Long bookId, Long channelId);
/**
*同一本书其他码下关闭小睿流程
* @author:zhuyajie
* @date:2021/5/12 9:59
* * @param null
*/
void setOtherPageRaysClose(Long bookId, Long channelId, Long createUser, Long sceneId, Long bookGroupId);
/**
* 书刊是否开启小睿
* @author:zhuyajie
* @date:2021/5/25 11:03
* * @param null
*/
Boolean isOpenRaysBook(Long bookId, Long channelId, Long adviserId);
}
\ No newline at end of file
package com.pcloud.book.group.dao;
import com.pcloud.book.group.dto.BookGroupServeDTO;
import com.pcloud.book.group.dto.BookServeDTO;
import com.pcloud.book.group.dto.ResourcePageUrlDTO;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.group.entity.ResourcePageItem;
import com.pcloud.book.group.vo.ResourcePageItemVO;
......@@ -76,4 +78,16 @@ public interface ResourcePageItemDao extends BaseDao<ResourcePageItem>{
ResourcePageItemVO checkOneServeItemByPageId(Long resourcePageId);
void deleteByServeId(Long resourceId);
/**
* 查配置的应用作品
* @author:zhuyajie
* @date:2021/5/11 19:53
* * @param null
*/
List<BookServeDTO> getAppServeByPage(Long resourcePageId);
List<ResourcePageUrlDTO> getServeUrl4Update(List<Long> sceneIdList);
void batchUpdateServeUrlById(List<ResourcePageUrlDTO> list);
}
\ No newline at end of file
package com.pcloud.book.group.dao;
import com.pcloud.book.group.entity.ResourcePageTool;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* H5资源页工具类型(ResourcePageTool)表数据库访问层
*
* @author makejava
* @since 2021-05-12 17:32:24
*/
public interface ResourcePageToolDao extends BaseDao<ResourcePageTool>{
List<ResourcePageTool> getByUserLabel(Long userGradeLabelId);
}
\ No newline at end of file
......@@ -26,4 +26,9 @@ public class ResourcePageCollectDaoImpl extends BaseDaoImpl<ResourcePageCollect>
map.put("resourcePageId", resourcePageId);
return getSessionTemplate().selectOne(getStatement("getCollectRecordByUser"), map);
}
@Override
public Integer getUserIsNotNew(Long wechatUserId) {
return getSessionTemplate().selectOne(getStatement("getUserIsNotNew"), wechatUserId);
}
}
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.ResourcePageCourseDao;
import com.pcloud.book.group.entity.ResourcePageCourse;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
/**
* @ClassName com.pcloud.book.group.dao.impl.ResourcePageCourseDaoImpl
* @Author zhuyajie
* @Description 资源统计
* @Date 2021/5/17 14:52
* @Version 1.0
**/
@Component
public class ResourcePageCourseDaoImpl extends BaseDaoImpl<ResourcePageCourse> implements ResourcePageCourseDao{
@Override
public void deleteAll() {
getSessionTemplate().delete(getStatement("deleteAll"));
}
@Override
public Long getGradeByGradeLabelId(Long graLabelId) {
return getSessionTemplate().selectOne(getStatement("getGradeByGradeLabelId"), graLabelId);
}
@Override
public Long getGradeByDepLabelId(Long depLabelId) {
return getSessionTemplate().selectOne(getStatement("getGradeByDepLabelId"), depLabelId);
}
}
......@@ -35,11 +35,6 @@ public class ResourcePageDaoImpl extends BaseDaoImpl<ResourcePage> implements Re
}
@Override
public void setRaysCloseByBook(Map<String, Object> paramMap) {
getSessionTemplate().update(getStatement("setRaysCloseByBook"), paramMap);
}
@Override
public void updatePageUpdateTime(Long resourcePageId) {
getSessionTemplate().update(getStatement("updatePageUpdateTime"), resourcePageId);
}
......@@ -60,11 +55,6 @@ public class ResourcePageDaoImpl extends BaseDaoImpl<ResourcePage> implements Re
}
@Override
public void setRaysCloseBySceneIds(List<Long> sceneIds) {
getSessionTemplate().update(getStatement("setRaysCloseBySceneIds"), sceneIds);
}
@Override
public void batchUpdateSceneIdByBookGroup(List<AddBookGroupServeDTO> list) {
getSessionTemplate().update(getStatement("batchUpdateSceneIdByBookGroup"), list);
}
......@@ -78,4 +68,33 @@ public class ResourcePageDaoImpl extends BaseDaoImpl<ResourcePage> implements Re
public List<Long> getSceneIdsByResourceId(Long resourceId) {
return getSessionTemplate().selectList(getStatement("getSceneIdsByResourceId"), resourceId);
}
@Override
public void updateBookBySceneIds(List<Long> sceneIds, Long bookId, Long channelId) {
Map<String, Object> map = new HashMap<>();
map.put("sceneIds", sceneIds);
map.put("bookId", bookId);
map.put("channelId", channelId);
getSessionTemplate().update(getStatement("updateBookBySceneIds"), map);
}
@Override
public void setOtherPageRaysClose(Long bookId, Long channelId, Long createUser, Long sceneId, Long bookGroupId) {
Map<String, Object> map = new HashMap<>();
map.put("bookId", bookId);
map.put("channelId", channelId);
map.put("createUser", createUser);
map.put("bookGroupId", bookGroupId);
map.put("sceneId", sceneId);
getSessionTemplate().update(getStatement("setOtherPageRaysClose"), map);
}
@Override
public Boolean isOpenRaysBook(Long bookId, Long channelId, Long adviserId) {
Map<String, Object> map = new HashMap<>();
map.put("bookId", bookId);
map.put("channelId", channelId);
map.put("adviserId", adviserId);
return getSessionTemplate().selectOne(getStatement("isOpenRaysBook"), map);
}
}
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.ResourcePageItemDao;
import com.pcloud.book.group.dto.BookServeDTO;
import com.pcloud.book.group.dto.ResourcePageUrlDTO;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.group.entity.ResourcePageItem;
import com.pcloud.book.group.vo.ResourcePageItemVO;
......@@ -76,4 +78,19 @@ public class ResourcePageItemDaoImpl extends BaseDaoImpl<ResourcePageItem> imple
public void deleteByServeId(Long resourceId) {
getSessionTemplate().delete(getStatement("deleteByServeId"), resourceId);
}
@Override
public List<BookServeDTO> getAppServeByPage(Long resourcePageId) {
return getSessionTemplate().selectList(getStatement("getAppServeByPage"), resourcePageId);
}
@Override
public List<ResourcePageUrlDTO> getServeUrl4Update(List<Long> sceneIdList) {
return getSessionTemplate().selectList(getStatement("getServeUrl4Update"), sceneIdList);
}
@Override
public void batchUpdateServeUrlById(List<ResourcePageUrlDTO> list) {
getSessionTemplate().update(getStatement("batchUpdateServeUrlById"), list);
}
}
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.ResourcePageToolDao;
import com.pcloud.book.group.entity.ResourcePageTool;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @ClassName com.pcloud.book.group.dao.impl.ResourcePageToolDaoImpl
* @Author zhuyajie
* @Description H5工具
* @Date 2021/5/12 17:38
* @Version 1.0
**/
@Component
public class ResourcePageToolDaoImpl extends BaseDaoImpl<ResourcePageTool> implements ResourcePageToolDao{
@Override
public List<ResourcePageTool> getByUserLabel(Long userGradeLabelId) {
return getSessionTemplate().selectList(getStatement("getByUserLabel"), userGradeLabelId);
}
}
package com.pcloud.book.group.dto;
import com.pcloud.common.dto.BaseDto;
import lombok.Data;
/**
* 7天浏览量高的资源统计(ResourcePageCourse)实体类
*
* @author makejava
* @since 2021-05-17 14:50:36
*/
@Data
public class ResourcePageCourseDTO extends BaseDto {
private static final long serialVersionUID = -38057094074172299L;
/**
* 资源id
*/
private Long serveId;
/**
* 资源名称
*/
private String serveName;
/**
* 资源类型(APP/PRODUCT)
*/
private String serveType;
/**
* 资源类型
*/
private String typeCode;
/**
* 资源类型名称
*/
private String typeName;
/**
* 渠道id
*/
private Long channelId;
private String servePic;
private String transverseImg;
/**
* 跳转结果链接
*/
private String resultUrl;
}
\ No newline at end of file
package com.pcloud.book.group.dto;
import lombok.Data;
/**
* @ClassName com.pcloud.book.group.dto.ResourcePageUrlDTO
* @Author zhuyajie
* @Description 资源页资源链接
* @Date 2021/5/27 17:42
* @Version 1.0
**/
@Data
public class ResourcePageUrlDTO {
private Long sceneId;
private String linkUrl;
private Long id;
}
......@@ -50,4 +50,12 @@ public class ResourcePage extends BaseEntity {
*/
private String bookCover;
/**
* 书刊id
*/
private Long bookId;
/**
* 渠道id
*/
private Long channelId;
}
\ No newline at end of file
......@@ -29,5 +29,8 @@ public class ResourcePageCollect extends BaseEntity {
* 收藏状态
*/
private Integer collectState;
/**
* 新用户状态
*/
private Integer isNew;
}
\ No newline at end of file
package com.pcloud.book.group.entity;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import java.io.Serializable;
import lombok.Data;
/**
* 7天浏览量高的资源统计(ResourcePageCourse)实体类
*
* @author makejava
* @since 2021-05-17 14:50:36
*/
@Data
public class ResourcePageCourse extends BaseEntity {
private static final long serialVersionUID = -38057094074172299L;
/**
* 主键
*/
private Long id;
/**
* 资源id
*/
private Long serveId;
/**
* 资源名称
*/
private String serveName;
/**
* 资源类型(APP/PRODUCT)
*/
private String serveType;
/**
* 资源类型
*/
private String typeCode;
/**
* 资源类型名称
*/
private String typeName;
/**
* 渠道id
*/
private Long channelId;
/**
* 出版社id
*/
private Long agentId;
/**
* 专业标签
*/
private Long proLabelId;
/**
* 深度标签
*/
private Long depLableId;
/**
* 目的标签
*/
private Long purLabelId;
/**
* 浏览量
*/
private Integer browseCount;
}
\ No newline at end of file
package com.pcloud.book.group.entity;
import com.pcloud.common.entity.BaseEntity;
import lombok.Data;
/**
* H5资源页工具类型(ResourcePageTool)实体类
*
* @author makejava
* @since 2021-05-12 17:32:24
*/
@Data
public class ResourcePageTool extends BaseEntity {
private static final long serialVersionUID = 655562186731451576L;
/**
* 用户年级标签
*/
private Long userGradeLabelId;
/**
* 工具类型
*/
private Integer toolType;
/**
* 工具名称
*/
private String toolName;
}
\ No newline at end of file
......@@ -1224,7 +1224,8 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "scene不能为空!");
}
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
BookGroupDTO bookGroupDTO = bookGroupBiz.getByAppletScene(wechatUserId, scene);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
BookGroupDTO bookGroupDTO = bookGroupBiz.getByAppletScene(wechatUserId, scene, officialAccountsId);
return new ResponseDto<>(bookGroupDTO);
}
......
......@@ -4,6 +4,7 @@ import com.pcloud.book.group.biz.ResourcePageBiz;
import com.pcloud.book.group.entity.ResourcePageCollect;
import com.pcloud.book.group.vo.UpdateResourceColumnVO;
import com.pcloud.book.group.vo.UpdateResourcePageVO;
import com.pcloud.channelcenter.qrcode.dto.BookSceneIdListDTO;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
......@@ -147,10 +148,10 @@ public class ResourcePageFacade {
return new ResponseDto<>(resourcePageBiz.getResourcePageByBookGroupIdOrSceneId4Wechat(bookGroupId, wechatUserId, sceneId));
}
@ApiOperation("批量更新资源页二维码")
@PostMapping("batchUpdateResourceQrcode")
public ResponseDto<?> batchUpdateResourceQrcode(@RequestBody List<Long> qrcodeIdList, @RequestParam("qrcodeType") String qrcodeType) {
resourcePageBiz.batchUpdateResourceQrcode(qrcodeIdList, qrcodeType);
@ApiOperation("批量更新资源页应用作品链接")
@PostMapping("batchUpdateResourceUrl")
public ResponseDto<?> batchUpdateResourceUrl(@RequestBody List<Long> sceneIdList) {
resourcePageBiz.batchUpdateResourceUrl(sceneIdList);
return new ResponseDto<>();
}
......@@ -171,4 +172,63 @@ public class ResourcePageFacade {
resourcePageBiz.addCollectRecord(resourcePageCollect);
return new ResponseDto<>();
}
@ApiOperation("更新书刊id")
@PostMapping("batchUpdateBookId")
public ResponseDto<?> batchUpdateBookId(@RequestBody List<BookSceneIdListDTO> requestDto) {
resourcePageBiz.batchUpdateBookId(requestDto);
return new ResponseDto<>();
}
@ApiOperation("查H5资源页工具")
@GetMapping("getToolListByUser")
public ResponseDto<?> getToolListByUser(@CookieValue("userInfo") String userInfo) {
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
return new ResponseDto<>(resourcePageBiz.getToolListByUser(wechatUserId, officialAccountsId));
}
@ApiOperation("资源广场模块")
@GetMapping("getResourceSourceTypeList")
public ResponseDto<?> getResourceSourceTypeList(@CookieValue("userInfo") String userInfo) {
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
return new ResponseDto<>(resourcePageBiz.getResourceSourceTypeList(wechatUserId, officialAccountsId));
}
@ApiOperation("添加课程统计数据")
@GetMapping("insertCourseStatistic")
public ResponseDto<?> insertCourseStatistic() {
resourcePageBiz.insertCourseStatistic();
return new ResponseDto<>();
}
@ApiOperation("H5首页-根据用户年级查推荐课程")
@GetMapping("listCourseByUser")
public ResponseDto<?> listCourseByUser(@CookieValue("userInfo") String userInfo,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage) {
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
return new ResponseDto<>(resourcePageBiz.listCourseByUser(wechatUserId, officialAccountsId, currentPage, numPerPage));
}
@ApiOperation("获取用户H5新用户状态")
@GetMapping("getUserNewState")
public ResponseDto<?> getUserNewState(@CookieValue("userInfo") String userInfo) {
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
return new ResponseDto<>(resourcePageBiz.getUserNewState(wechatUserId));
}
@ApiOperation("添加非新用户记录")
@PostMapping("addNewUserRecord")
public ResponseDto<?> addNewUserRecord(@CookieValue("userInfo") String userInfo, @RequestBody ResourcePageCollect resourcePageCollect) {
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
resourcePageCollect.setWechatUserId(wechatUserId);
resourcePageCollect.setOfficialAccountsId(officialAccountsId);
resourcePageBiz.addNewUserRecord(resourcePageCollect);
return new ResponseDto<>();
}
}
package com.pcloud.book.group.facade.impl;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.group.biz.WeworkTeacherBiz;
import com.pcloud.book.group.vo.WeworkTeacherBookBindVO;
import com.pcloud.book.group.vo.WeworkTeacherVO;
......@@ -11,6 +12,7 @@ import com.pcloud.common.utils.cookie.Cookie;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -104,4 +106,26 @@ public class WeworkTeacherFacadeImpl {
SessionUtil.getInfoToken4Redis(token);
return new ResponseDto<>(weworkTeacherBiz.getBookWxworkTeacherList(name, currentPage, numPerPage));
}
@ApiOperation("根据id查老师")
@GetMapping("getWxworkTeacherById")
public ResponseDto<?> getWxworkTeacherById(@RequestHeader("token") String token,
@RequestParam("id") Long id) {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(weworkTeacherBiz.getWxworkTeacherById(id));
}
@ApiOperation("H5首页-客服老师")
@GetMapping("getTeacherByGradeLabel4ResourcePage")
public ResponseDto<?> getTeacherByGradeLabel4ResourcePage(
@RequestParam("gradeLabelId") Long gradeLabelId,
@RequestParam("currentPage") Integer currentPage, @RequestParam("numPerPage") Integer numPerPage) {
if (null == gradeLabelId) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少用户年级标签");
}
if (null == currentPage || null == numPerPage) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少分页参数");
}
return new ResponseDto<>(weworkTeacherBiz.getTeacherByGradeLabel4ResourcePage(gradeLabelId, currentPage, numPerPage));
}
}
......@@ -42,4 +42,12 @@ public interface WeworkTeacherMapper {
@MapKey("id")
Map<Long, WxWorkTeacherDTO> getWxWorkTeacherByIds(@Param("ids") List<Long> teacherIds);
WeworkTeacherVO getWxworkTeacherById(Long id);
List<WeworkTeacherVO> getTeacherByGradeLabel(@Param("crowdType") Integer crowdType,
@Param("offset") Integer offset,
@Param("limit") Integer limit);
Integer countTeacherByGradeLabel(Integer crowdType);
}
......@@ -476,4 +476,11 @@ public class BookGroupServiceImpl implements BookGroupService {
@RequestParam("numPerPage") Integer numPerPage){
return ResponseHandleUtil.toResponse(bookGroupBiz.getAllRaysScene(currentPage, numPerPage));
}
@Override
@GetMapping("isOpenRaysScene")
public ResponseEntity<ResponseDto<Boolean>> isOpenRaysScene(@RequestParam(value = "sceneId", required = false) Long sceneId,
@RequestParam(value = "bookGroupId", required = false) Long bookGroupId) {
return ResponseHandleUtil.toResponse(resourcePageBiz.isOpenRaysScene(sceneId, bookGroupId));
}
}
......@@ -11,6 +11,7 @@ import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
......@@ -91,6 +92,9 @@ public class WeworkTeacherVO implements Serializable {
@ApiModelProperty("更新时间")
private Date updateTime;
@ApiModelProperty("适用人群类型")
private List<Integer> crowdTypeList;
private static final long serialVersionUID = 3857636238754367824L;
......
......@@ -2,9 +2,11 @@ package com.pcloud.book.mapper.clickhouse;
import com.pcloud.book.applet.dto.AppletRecordDTO;
import com.pcloud.book.applet.entity.AppletRecord;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -18,4 +20,5 @@ public interface AppletRecordCHMapper {
void optimize();
List<AppletRecordDTO> getAggrStatis4H5(Map<String,Object> paramMap);
}
......@@ -43,6 +43,17 @@ public class BookProps {
*/
private static Long miniOfficialAccountsId;
private static Long operateOfficalId;
public static Long getOperateOfficalId() {
return operateOfficalId;
}
@Value("${operate_official_id}")
public void setOperateOfficalId(Long operateOfficalId) {
BookProps.operateOfficalId = operateOfficalId;
}
public static String getJisuAppKey() {
return jisuAppKey;
}
......
......@@ -75,4 +75,42 @@
<update id="optimize">
optimize table applet_record
</update>
<select id="getAggrStatis4H5" resultType="com.pcloud.book.applet.dto.AppletRecordDTO">
SELECT
record_type recordType,
from_id fromId,
any(from_name) fromName,
any(link_url) linkUrl,
any(type_code) typeCode,
COUNT(id) clickCount,
COUNT(DISTINCT wechat_user_id) userCount
FROM applet_record
WHERE
record_type in (5,6)
<if test="sourceKeywords != null and sourceKeywords.size() > 0">
AND
<foreach collection="sourceKeywords" item="sourceKeyword" separator=" OR " open="(" close=")">
from_name LIKE concat('%',#{sourceKeyword},'%')
</foreach>
</if>
<if test="beginDate != null">
AND create_time >= #{beginDate}
</if>
<if test="endDate != null">
AND create_time &lt;= #{endDate}
</if>
<if test="fromIdList != null and fromIdList.size() > 0">
AND from_id in
<foreach collection="fromIdList" index="index" separator="," open="(" close=")" item="item">
#{item}
</foreach>
</if>
GROUP BY record_type, from_id
ORDER BY userCount DESC
<if test="offset != null and limit > 0">
LIMIT #{offset}, #{limit}
</if>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pcloud.book.applet.dao.impl.AnswerSubscribePopupDaoImpl">
<resultMap type="com.pcloud.book.applet.entity.AnswerSubscribePopup" id="AnswerSubscribePopupMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="wechatUserId" column="wechat_user_id" jdbcType="INTEGER"/>
<result property="accountSettingId" column="account_setting_id" jdbcType="INTEGER"/>
<result property="bookId" column="book_id" jdbcType="INTEGER"/>
<result property="channelId" column="channel_id" jdbcType="INTEGER"/>
<result property="adviserId" column="adviser_id" jdbcType="INTEGER"/>
<result property="subscribeType" column="subscribe_type" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<!--查询单个-->
<select id="getById" resultMap="AnswerSubscribePopupMap">
select
id, wechat_user_id, account_setting_id, book_id, channel_id, adviser_id, subscribe_type, create_time, update_time
from book.answer_subscribe_popup
where id = #{id}
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into book.answer_subscribe_popup(wechat_user_id, account_setting_id, book_id, channel_id, adviser_id, subscribe_type, create_time, update_time)
values (#{wechatUserId}, #{accountSettingId}, #{bookId}, #{channelId}, #{adviserId}, #{subscribeType}, now(), now())
</insert>
<!--通过主键修改数据-->
<update id="update">
update book.answer_subscribe_popup
<set>
<if test="wechatUserId != null">
wechat_user_id = #{wechatUserId},
</if>
<if test="accountSettingId != null">
account_setting_id = #{accountSettingId},
</if>
<if test="bookId != null">
book_id = #{bookId},
</if>
<if test="channelId != null">
channel_id = #{channelId},
</if>
<if test="adviserId != null">
adviser_id = #{adviserId},
</if>
<if test="subscribeType != null">
subscribe_type = #{subscribeType},
</if>
update_time = now(),
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from book.answer_subscribe_popup where id = #{id}
</delete>
<select id="getLastRecord" resultMap="AnswerSubscribePopupMap" parameterType="long">
SELECT
id, wechat_user_id, account_setting_id, book_id, channel_id, adviser_id, subscribe_type
FROM
answer_subscribe_popup
WHERE
wechat_user_id = #{wechatUserId}
ORDER BY
create_time DESC
LIMIT 1
</select>
</mapper>
\ No newline at end of file
......@@ -197,4 +197,29 @@
SELECT IFNULL(MAX(seq),0) FROM applet_banner
WHERE agent_id = #{agentId}
</select>
<select id="listBannerByGrade" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletBannerDTO">
SELECT
c.id,
c.banner_pic bannerPic,
c.jump_type jumpType,
c.jump_url jumpUrl,
c.fill_type fillType,
c.serve_id serveId,
c.serve_type serveType
FROM
applet_resource_apply a
LEFT JOIN applet_banner c ON a.target_id = c.id
WHERE
a.crowd_type = #{crowdType}
AND a.target_type = "BANNER"
AND a.target_id > 0
AND c.show_state = 1
GROUP BY
a.target_id
ORDER BY
c.seq ASC
</select>
</mapper>
\ No newline at end of file
......@@ -9,12 +9,15 @@
<result property="fromId" column="from_id" jdbcType="INTEGER"/>
<result property="recordType" column="record_type" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="officialAccountsId" column="official_accounts_id" jdbcType="INTEGER"/>
<result property="booklistId" column="booklist_id" jdbcType="INTEGER"/>
</resultMap>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into book.applet_link_click(wechat_user_id, type_id, from_id, record_type, create_time, create_date)
values (#{wechatUserId}, #{typeId}, #{fromId}, #{recordType}, NOW(),NOW())
insert into book.applet_link_click(wechat_user_id, type_id, from_id, record_type, create_time, create_date,
official_accounts_id, booklist_id)
values (#{wechatUserId}, #{typeId}, #{fromId}, #{recordType}, NOW(),NOW(), #{officialAccountsId}, #{booklistId})
</insert>
<select id="getListThirdResourcesAnalysis" parameterType="map"
......
......@@ -206,4 +206,28 @@
where
id = #{id}
</select>
<select id="listBooklistIdByGradeLabelAndClickCount" parameterType="map" resultType="long">
SELECT
a.target_id
FROM
applet_resource_apply a
LEFT JOIN applet_link_click c ON a.target_id = c.booklist_id
AND c.type_id = 5
AND c.create_date >= #{startDate}
LEFT JOIN applet_outer_booklist b ON a.target_id = b.id
WHERE
a.crowd_type = #{crowdType}
AND a.target_type = "BOOKLIST"
AND a.target_id > 0
AND b.is_show_home = 1
AND b.is_delete = 0
GROUP BY
a.target_id
ORDER BY
COUNT(c.id) DESC,
c.create_time DESC,
a.target_id DESC
</select>
</mapper>
\ No newline at end of file
......@@ -158,8 +158,11 @@
`applet_record_day_serve`
WHERE
is_delete = 0
<if test="wechatUserId != null">
and wechat_user_id = #{wechatUserId}
<if test="wechatUserIds != null">
and wechat_user_id IN
<foreach collection="wechatUserIds" separator="," open="(" close=")" index="index" item="wechatUserId">
${wechatUserId}
</foreach>
</if>
<if test="date != null">
and create_date = #{date}
......@@ -229,7 +232,10 @@
FROM
applet_record_day_serve
WHERE
wechat_user_id = #{wechatUserId}
wechat_user_id IN
<foreach collection="wechatUserIds" separator="," open="(" close=")" index="index" item="item">
#{item}
</foreach>
AND
create_date &gt; DATE_SUB(curdate(),INTERVAL 30 day)
AND
......
......@@ -159,8 +159,11 @@
`applet_record_serve`
WHERE
is_delete = 0
<if test="wechatUserId != null">
and wechat_user_id = #{wechatUserId}
<if test="wechatUserIds != null">
and wechat_user_id IN
<foreach collection="wechatUserIds" separator="," open="(" close=")" index="index" item="wechatUserId">
${wechatUserId}
</foreach>
</if>
<if test="recordTypes != null">
and record_type in
......@@ -228,7 +231,10 @@
FROM
applet_record_serve
WHERE
wechat_user_id = #{wechatUserId}
wechat_user_id IN
<foreach collection="wechatUserIds" item="item" index="index" close=")" open="(" separator=",">
#{item}
</foreach>
and
CASE
WHEN record_type in (1,5,6) THEN
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pcloud.book.applet.dao.impl.AppletRecordSevenDayDaoImpl">
<resultMap type="com.pcloud.book.applet.entity.AppletRecordSevenDay" id="AppletRecordSevenDayMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="recordType" column="record_type" jdbcType="INTEGER"/>
<result property="fromId" column="from_id" jdbcType="INTEGER"/>
<result property="fromName" column="from_name" jdbcType="VARCHAR"/>
<result property="typeCode" column="type_code" jdbcType="VARCHAR"/>
<result property="linkUrl" column="link_url" jdbcType="VARCHAR"/>
<result property="proLabelId" column="pro_label_id" jdbcType="INTEGER"/>
<result property="depLabelId" column="dep_label_id" jdbcType="INTEGER"/>
<result property="purLabelId" column="pur_label_id" jdbcType="INTEGER"/>
<result property="clickCount" column="click_count" jdbcType="INTEGER"/>
<result property="userCount" column="user_count" jdbcType="INTEGER"/>
<result property="sourceType" column="source_type" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<!--查询单个-->
<select id="getById" resultMap="AppletRecordSevenDayMap">
select
id, record_type, from_id, from_name, type_code, link_url, pro_label_id, dep_label_id, pur_label_id,click_count, user_count, source_type, create_time
from book.applet_record_seven_day
where id = #{id}
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into book.applet_record_seven_day(record_type, from_id, from_name, type_code, link_url, pro_label_id, dep_label_id, pur_label_id, click_count, user_count, source_type, create_time)
values (#{recordType}, #{fromId}, #{fromName}, #{typeCode}, #{linkUrl}, #{proLabelId}, #{depLabelId}, #{purLabelId}, #{clickCount}, #{userCount}, #{sourceType},now())
</insert>
<insert id="batchInsert" keyProperty="id" useGeneratedKeys="true">
insert into book.applet_record_seven_day(record_type, from_id, from_name,
type_code, link_url, pro_label_id, dep_label_id,
pur_label_id, click_count, user_count, source_type, create_time)
values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.recordType}, #{item.fromId}, #{item.fromName},
#{item.typeCode}, #{item.linkUrl}, #{item.proLabelId}, #{item.depLabelId},
#{item.purLabelId}, #{item.clickCount}, #{item.userCount}, #{item.sourceType}, now())
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update book.applet_record_seven_day
<set>
<if test="recordType != null">
record_type = #{recordType},
</if>
<if test="fromId != null">
from_id = #{fromId},
</if>
<if test="fromName != null and fromName != ''">
from_name = #{fromName},
</if>
<if test="typeCode != null and typeCode != ''">
type_code = #{typeCode},
</if>
<if test="linkUrl != null and linkUrl != ''">
link_url = #{linkUrl},
</if>
<if test="proLabelId != null">
pro_label_id = #{proLabelId},
</if>
<if test="depLabelId != null">
dep_label_id = #{depLabelId},
</if>
<if test="purLabelId != null">
pur_label_id = #{purLabelId},
</if>
<if test="userCount != null">
user_count = #{userCount},
</if>
<if test="sourceType != null">
source_type = #{sourceType},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from book.applet_record_seven_day where id = #{id}
</delete>
<delete id="deleteBySourceType" parameterType="integer">
delete from book.applet_record_seven_day where source_type = #{sourceType}
</delete>
<select id="getResourceByGrade4H5" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletRecordDTO">
SELECT
a.record_type recordType,
a.from_id fromId,
a.from_name fromName,
a.link_url linkUrl,
a.type_code typeCode,
a.click_count clickCount,
a.user_count userCount
FROM
applet_record_seven_day a
INNER JOIN resource_page_grade_label g ON a.dep_label_id = g.dep_label_id
WHERE
a.source_type = #{sourceType}
<if test="gradeLabelIds != null and gradeLabelIds.size>0">
AND g.user_grade_label_id IN
<foreach collection="gradeLabelIds" separator="," index="index" item="item" close=")" open="(">
${item}
</foreach>
</if>
GROUP BY
a.record_type,
a.from_id
ORDER BY
a.click_count DESC
<if test="limit != null">
limit #{limit}
</if>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pcloud.book.applet.dao.impl.AppletResourceApplyDaoImpl">
<resultMap type="com.pcloud.book.applet.entity.AppletResourceApply" id="AppletResourceApplyMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="targetId" column="target_id" jdbcType="INTEGER"/>
<result property="targetType" column="target_type" jdbcType="VARCHAR"/>
<result property="crowdType" column="crowd_type" jdbcType="INTEGER"/>
<result property="contentType" column="content_type" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<!--查询单个-->
<select id="getById" resultMap="AppletResourceApplyMap">
select
id, target_id, target_type, crowd_type, content_type, create_time
from book.applet_resource_apply
where id = #{id}
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into book.applet_resource_apply(target_id, target_type, crowd_type, content_type, create_time)
values (#{targetId}, #{targetType}, #{crowdType}, #{contentType}, now())
</insert>
<insert id="batchInsert" keyProperty="id" useGeneratedKeys="true">
insert into book.applet_resource_apply(target_id, target_type, crowd_type, content_type, create_time)
values
<foreach collection="list" separator="," index="index" item="item">
(#{item.targetId}, #{item.targetType}, #{item.crowdType}, #{item.contentType}, now())
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update book.applet_resource_apply
<set>
<if test="targetId != null">
target_id = #{targetId},
</if>
<if test="targetType != null and targetType != ''">
target_type = #{targetType},
</if>
<if test="crowdType != null">
crowd_type = #{crowdType},
</if>
<if test="contentType != null">
content_type = #{contentType},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from book.applet_resource_apply where id = #{id}
</delete>
<delete id="deleteCrowdType" parameterType="map">
delete from book.applet_resource_apply
where
target_id = #{targetId}
and target_type = #{targetType}
and crowd_type>0
</delete>
<delete id="deleteContentType" parameterType="map">
delete from book.applet_resource_apply
where
target_id = #{targetId}
and target_type = #{targetType}
and content_type>0
</delete>
<select id="getCrowdTypeList" parameterType="map" resultType="integer">
SELECT DISTINCT
crowd_type
FROM
applet_resource_apply
WHERE
target_id = #{targetId}
AND target_type = #{targetType}
AND crowd_type > 0
</select>
<select id="getContentTypeList" parameterType="map" resultType="integer">
SELECT DISTINCT
content_type
FROM
applet_resource_apply
WHERE
target_id = #{targetId}
AND target_type = #{targetType}
AND content_type > 0
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment