Commit 2daed7f2 by 田超

Merge branch 'master' of ssh://begitlab.chubanyun.me:12122/rays/pcloud-book into feature/110

parents 7249061b a58ba714
...@@ -474,4 +474,16 @@ public class BookConstant { ...@@ -474,4 +474,16 @@ public class BookConstant {
* 手机号授权 * 手机号授权
*/ */
public static final String BOOK_PHONE_AUTH_CACHE_KEY = CacheConstant.BOOK + "getBookPhoneAuth:"; public static final String BOOK_PHONE_AUTH_CACHE_KEY = CacheConstant.BOOK + "getBookPhoneAuth:";
/**
* 编辑默认渠道缓存
*/
public static final String ADVISER_DEFAULT_CHANNEL_ID_CACHE = CacheConstant.BOOK + "adviserDefaultChannelIdCache";
/**
* 关注公众号临时二维码
*/
public static final String PAGE_ID_TEMP_CODE_CACHE = CacheConstant.BOOK + "TEMPCODE";
public static final String PAGE_ID_CODE_CACHE = CacheConstant.BOOK + "PAGECODE";
public static final String PAGE_ID_LOGOURL_CACHE = CacheConstant.BOOK + "LOGOURL";
} }
...@@ -317,4 +317,9 @@ public interface BookService { ...@@ -317,4 +317,9 @@ public interface BookService {
@ApiOperation("更新昨日修改过的书刊的标签") @ApiOperation("更新昨日修改过的书刊的标签")
@GetMapping("updateYesterdayBookNewLabel") @GetMapping("updateYesterdayBookNewLabel")
void updateYesterdayBookNewLabel(); void updateYesterdayBookNewLabel();
@GetMapping("getBookFromRedis")
ResponseEntity<ResponseDto<BookDto>> getBookFromRedis(@RequestParam(value = "bookId") Long bookId);
} }
...@@ -77,7 +77,7 @@ public interface AppletRecordBiz { ...@@ -77,7 +77,7 @@ public interface AppletRecordBiz {
*/ */
Map<Long, AppletAppOrProductDTO> getAppOrProductBrowseCount(Integer recordType, List<Long> serveIds); Map<Long, AppletAppOrProductDTO> getAppOrProductBrowseCount(Integer recordType, List<Long> serveIds);
void fillAppletRecord(List<AppletRecordDTO> recordList, Integer bookType); void fillAppletRecord(List<AppletRecordDTO> recordList, Integer bookType, Long wechatUserId);
Object handleAppletRecordTypeCode(Long lastAppletRecordId); Object handleAppletRecordTypeCode(Long lastAppletRecordId);
......
...@@ -148,7 +148,7 @@ public class AppletRecordAggrStatisBizImpl implements AppletRecordAggrStatisBiz ...@@ -148,7 +148,7 @@ public class AppletRecordAggrStatisBizImpl implements AppletRecordAggrStatisBiz
aggrStatis = appletRecordCHMapper.getAggrStatis(paramMap); aggrStatis = appletRecordCHMapper.getAggrStatis(paramMap);
} }
// 加载其它数据 // 加载其它数据
appletRecordBiz.fillAppletRecord(aggrStatis, YesOrNoNumEnum.NO.getValue()); appletRecordBiz.fillAppletRecord(aggrStatis, YesOrNoNumEnum.NO.getValue(), null);
// 删除部分不存在的数据 // 删除部分不存在的数据
aggrStatis = aggrStatis.stream().filter(x->x.getSourceDelete() == 0).collect(Collectors.toList()); aggrStatis = aggrStatis.stream().filter(x->x.getSourceDelete() == 0).collect(Collectors.toList());
// 设置缓存 // 设置缓存
...@@ -354,7 +354,7 @@ public class AppletRecordAggrStatisBizImpl implements AppletRecordAggrStatisBiz ...@@ -354,7 +354,7 @@ public class AppletRecordAggrStatisBizImpl implements AppletRecordAggrStatisBiz
//7天内扫码量高的资源的总扫码量 //7天内扫码量高的资源的总扫码量
List<AppletRecordDTO> sourceAggrStatis = appletRecordCHMapper.getAggrStatis4H5(map); List<AppletRecordDTO> sourceAggrStatis = appletRecordCHMapper.getAggrStatis4H5(map);
appletRecordBiz.fillAppletRecord(sourceAggrStatis, YesOrNoNumEnum.NO.getValue()); appletRecordBiz.fillAppletRecord(sourceAggrStatis, YesOrNoNumEnum.NO.getValue(), null);
sourceAggrStatis = sourceAggrStatis.stream().filter(x -> x.getSourceDelete() == 0).collect(Collectors.toList()); sourceAggrStatis = sourceAggrStatis.stream().filter(x -> x.getSourceDelete() == 0).collect(Collectors.toList());
if (ListUtils.isEmpty(sourceAggrStatis)) { if (ListUtils.isEmpty(sourceAggrStatis)) {
continue; continue;
...@@ -423,7 +423,7 @@ public class AppletRecordAggrStatisBizImpl implements AppletRecordAggrStatisBiz ...@@ -423,7 +423,7 @@ public class AppletRecordAggrStatisBizImpl implements AppletRecordAggrStatisBiz
if (ListUtils.isEmpty(countList)) { if (ListUtils.isEmpty(countList)) {
return new PageBeanNew(currentPage, numPerPage, 0, Lists.newArrayList()); return new PageBeanNew(currentPage, numPerPage, 0, Lists.newArrayList());
} }
appletRecordBiz.fillAppletRecord(countList, YesOrNoNumEnum.NO.getValue()); appletRecordBiz.fillAppletRecord(countList, YesOrNoNumEnum.NO.getValue(), wechatUserId);
countList = countList.stream().filter(x -> x.getSourceDelete() == 0).collect(Collectors.toList()); countList = countList.stream().filter(x -> x.getSourceDelete() == 0).collect(Collectors.toList());
dealServeNamePic(countList, isDefaultList, sourceFrom); dealServeNamePic(countList, isDefaultList, sourceFrom);
if (ListUtils.isEmpty(countList)) { if (ListUtils.isEmpty(countList)) {
......
...@@ -50,11 +50,12 @@ import com.pcloud.book.group.tools.SendWeixinRequestTools; ...@@ -50,11 +50,12 @@ import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.rightsSetting.biz.RightsSettingBiz; import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.skill.biz.PcloudGroupActivityBiz; import com.pcloud.book.skill.biz.PcloudGroupActivityBiz;
import com.pcloud.book.applet.dto.GroupActivity4AppletDTO; import com.pcloud.book.applet.dto.GroupActivity4AppletDTO;
import com.pcloud.book.skill.remind.RedisTool; import com.pcloud.book.util.common.CommonUtils;
import com.pcloud.book.util.common.ThreadPoolUtils; import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.book.util.properties.BookProps;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto; import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.mybatis.cache.redis.RedisCache; import com.pcloud.common.enums.AppTypeEnum;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
...@@ -62,7 +63,6 @@ import com.pcloud.common.utils.BeanUtils; ...@@ -62,7 +63,6 @@ import com.pcloud.common.utils.BeanUtils;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.NumberUtil; import com.pcloud.common.utils.NumberUtil;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils; import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.cache.redis.RedisSessionUtils;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.readercenter.common.enums.YesOrNoNumEnum; import com.pcloud.readercenter.common.enums.YesOrNoNumEnum;
import com.pcloud.resourcecenter.product.dto.ProductDto; import com.pcloud.resourcecenter.product.dto.ProductDto;
...@@ -73,8 +73,8 @@ import org.slf4j.Logger; ...@@ -73,8 +73,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
...@@ -137,6 +137,8 @@ public class AppletRecordBizImpl implements AppletRecordBiz { ...@@ -137,6 +137,8 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
private AppletTrackMapper appletTrackMapper; private AppletTrackMapper appletTrackMapper;
@Autowired @Autowired
private ReaderConsr readerConsr; private ReaderConsr readerConsr;
@Autowired
private BookProps bookProps;
@Override @Override
@ParamLog("通过ID查询单条数据") @ParamLog("通过ID查询单条数据")
...@@ -267,7 +269,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz { ...@@ -267,7 +269,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
} }
recordList = listAppletRecord.getRecordList(); recordList = listAppletRecord.getRecordList();
fillAppletRecord(recordList, bookType); fillAppletRecord(recordList, bookType, wechatUserId);
return listAppletRecord; return listAppletRecord;
} }
...@@ -440,7 +442,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz { ...@@ -440,7 +442,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
} }
private void fillTypeCode(List<AppletRecordDTO> recordList) { private void fillTypeCode(List<AppletRecordDTO> recordList) {
fillAppletRecord(recordList, YesOrNoNumEnum.YES.getValue()); fillAppletRecord(recordList, YesOrNoNumEnum.YES.getValue(), null);
recordList.stream().forEach(appletRecordDTO -> { recordList.stream().forEach(appletRecordDTO -> {
if (Objects.equals(AppletRecordTypeEnum.NEWS.value, appletRecordDTO.getRecordType()) && null != appletRecordDTO.getAppletNewsDTO()) { if (Objects.equals(AppletRecordTypeEnum.NEWS.value, appletRecordDTO.getRecordType()) && null != appletRecordDTO.getAppletNewsDTO()) {
//填充资讯信息 //填充资讯信息
...@@ -458,7 +460,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz { ...@@ -458,7 +460,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
} }
@Override @Override
public void fillAppletRecord(List<AppletRecordDTO> recordList, Integer bookType) { public void fillAppletRecord(List<AppletRecordDTO> recordList, Integer bookType, Long wechatUserId) {
if (ListUtils.isEmpty(recordList)) { if (ListUtils.isEmpty(recordList)) {
return; return;
} }
...@@ -587,7 +589,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz { ...@@ -587,7 +589,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
appletRecordDTO.setCoverImg(Optional.ofNullable(bookDtoMap.get(appletRecordDTO.getBookId())).map(BookDto::getCoverImg).orElse("")); appletRecordDTO.setCoverImg(Optional.ofNullable(bookDtoMap.get(appletRecordDTO.getBookId())).map(BookDto::getCoverImg).orElse(""));
} }
//填充应用信息 //填充应用信息
fillApp4Record(appDtoMap, appDtoMappFuture, appletRecordDTO); fillApp4Record(appDtoMap, appDtoMappFuture, appletRecordDTO, wechatUserId);
} else if (Objects.equals(AppletRecordTypeEnum.BOOK.value, appletRecordDTO.getRecordType())) { } else if (Objects.equals(AppletRecordTypeEnum.BOOK.value, appletRecordDTO.getRecordType())) {
//填充书籍信息 //填充书籍信息
fillBook4Record(appletUserBookcaseDTOMap, appletUserBookcaseDTOMapFuture, appletRecordDTO); fillBook4Record(appletUserBookcaseDTOMap, appletUserBookcaseDTOMapFuture, appletRecordDTO);
...@@ -722,7 +724,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz { ...@@ -722,7 +724,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
appletRecordDTO.setIsDelete(appletNewsDTO.getIsDelete()); appletRecordDTO.setIsDelete(appletNewsDTO.getIsDelete());
} }
private void fillApp4Record(Map<Long, AppDto> appDtoMap, Future<Map<Long, AppDto>> appDtoMappFuture, AppletRecordDTO appletRecordDTO) { private void fillApp4Record(Map<Long, AppDto> appDtoMap, Future<Map<Long, AppDto>> appDtoMappFuture, AppletRecordDTO appletRecordDTO, Long wechatUserId) {
try { try {
appDtoMap = appDtoMappFuture.get(); appDtoMap = appDtoMappFuture.get();
} catch (InterruptedException | ExecutionException e) { } catch (InterruptedException | ExecutionException e) {
...@@ -764,6 +766,25 @@ public class AppletRecordBizImpl implements AppletRecordBiz { ...@@ -764,6 +766,25 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
} }
appletAppOrProductDTO.setServeType(AppAndProductTypeEnum.APP.value); appletAppOrProductDTO.setServeType(AppAndProductTypeEnum.APP.value);
appletAppOrProductDTO.setServeId(appletRecordDTO.getFromId()); appletAppOrProductDTO.setServeId(appletRecordDTO.getFromId());
//优化跳转
if (AppTypeEnum.ARTICLE.value.equals(appletAppOrProductDTO.getServeTypeCode())) {
if (appDto != null && !StringUtil.isEmpty(appDto.getTurnUrl())) {
if (appDto.getTurnUrl().contains("5rs.me/") || appDto.getTurnUrl().contains("raysgo.com/") || appDto.getTurnUrl().contains("raysyun.com/")
|| null == wechatUserId) {
appletAppOrProductDTO.setResultUrl(appDto.getTurnUrl());
} else {
Long sceneId = CommonUtils.getSceneId(appletAppOrProductDTO.getResultUrl());
if (null != sceneId) {
//外链跳转到指定中间页
String jumpUrl = BookProps.getProductDomain() + "transfer?offId" + accountSettingDto.getAccountSettingId() + "&appId=" + appDto.getAppId() + "&url=" +
URLEncoder.encode(appDto.getTurnUrl()) + "&sceneId=" + sceneId + "&wechatUserId=" + wechatUserId;
appletAppOrProductDTO.setResultUrl(jumpUrl);
}
}
}
}
appletRecordDTO.setAppletAppOrProductDTO(appletAppOrProductDTO); appletRecordDTO.setAppletAppOrProductDTO(appletAppOrProductDTO);
} }
...@@ -880,7 +901,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz { ...@@ -880,7 +901,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
} }
private void fillTypeCode4List(List<AppletRecordDTO> recordList) { private void fillTypeCode4List(List<AppletRecordDTO> recordList) {
fillAppletRecord(recordList, YesOrNoNumEnum.YES.getValue()); fillAppletRecord(recordList, YesOrNoNumEnum.YES.getValue(), null);
recordList.stream().forEach(appletRecordDTO -> { recordList.stream().forEach(appletRecordDTO -> {
if (Objects.equals(AppletRecordTypeEnum.PRODUCT.value, appletRecordDTO.getRecordType()) && null != appletRecordDTO.getAppletAppOrProductDTO()) { if (Objects.equals(AppletRecordTypeEnum.PRODUCT.value, appletRecordDTO.getRecordType()) && null != appletRecordDTO.getAppletAppOrProductDTO()) {
// 填充作品信息 // 填充作品信息
...@@ -909,7 +930,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz { ...@@ -909,7 +930,7 @@ public class AppletRecordBizImpl implements AppletRecordBiz {
if (ListUtils.isEmpty(recordList)) { if (ListUtils.isEmpty(recordList)) {
return new AppletRecordDTO(); return new AppletRecordDTO();
} }
fillAppletRecord(recordList, YesOrNoNumEnum.NO.getValue()); fillAppletRecord(recordList, YesOrNoNumEnum.NO.getValue(), wechatUserId);
recordList = recordList.stream().filter(x -> x.getSourceDelete() == 0).collect(Collectors.toList()); recordList = recordList.stream().filter(x -> x.getSourceDelete() == 0).collect(Collectors.toList());
if (ListUtils.isEmpty(recordList)) { if (ListUtils.isEmpty(recordList)) {
return new AppletRecordDTO(); return new AppletRecordDTO();
......
...@@ -503,4 +503,6 @@ public interface BookAdviserBiz { ...@@ -503,4 +503,6 @@ public interface BookAdviserBiz {
* 获取编辑的立项书数量和非立项书数量 * 获取编辑的立项书数量和非立项书数量
*/ */
Map<Long, AdviserBookStatisDto> getAdviserBookStatis(AdviserBookStatisRequestDto requestDto); Map<Long, AdviserBookStatisDto> getAdviserBookStatis(AdviserBookStatisRequestDto requestDto);
Integer getBookIsOpenCatalog(Long bookId, Long channelId, Long adviserId);
} }
...@@ -826,4 +826,11 @@ public interface BookBiz { ...@@ -826,4 +826,11 @@ public interface BookBiz {
* 通过isbn,书名等信息去es库里面匹配图书封面 * 通过isbn,书名等信息去es库里面匹配图书封面
*/ */
List<String> listBookCover(String isbn, String bookName, String author, String publish); List<String> listBookCover(String isbn, String bookName, String author, String publish);
/**
* 从缓存中获取基本信息
* @param bookId
* @return
*/
BookDto getBookFromRedis(Long bookId);
} }
...@@ -3544,4 +3544,10 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -3544,4 +3544,10 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
} }
return adviserBookStatisList.stream().collect(Collectors.toMap(x->x.getAdviserId(), Function.identity(), (v1, v2)->v1)); return adviserBookStatisList.stream().collect(Collectors.toMap(x->x.getAdviserId(), Function.identity(), (v1, v2)->v1));
} }
@Override
public Integer getBookIsOpenCatalog(Long bookId, Long channelId, Long adviserId) {
Integer isOpenCatalog = bookAdviserDao.getBookIsOpenCatalog(bookId,channelId,adviserId);
return null == isOpenCatalog?0:isOpenCatalog;
}
} }
...@@ -2613,11 +2613,6 @@ public class BookBizImpl implements BookBiz { ...@@ -2613,11 +2613,6 @@ public class BookBizImpl implements BookBiz {
if (bookDto == null) { if (bookDto == null) {
return new BookDto(); return new BookDto();
} }
Integer joinGroupType = bookGroupDao.getJoinGroupType(paramMap);
if (JoinGroupTypeEnum.XIAORUI.getCode().equals(joinGroupType)) {
Long classifyId = bookRaysClassifyDao.getClassifyIdByBookTemplateId(bookDto.getTempletId());
bookDto.setClassifyId(null != classifyId ? classifyId.intValue() : null);
}
// 填充分类 // 填充分类
CompletableFuture<Void> fillClassifyFuture = CompletableFuture.runAsync(() -> { CompletableFuture<Void> fillClassifyFuture = CompletableFuture.runAsync(() -> {
...@@ -4668,4 +4663,16 @@ public class BookBizImpl implements BookBiz { ...@@ -4668,4 +4663,16 @@ public class BookBizImpl implements BookBiz {
dto.setPublish(publish); dto.setPublish(publish);
return bookElasticSearchConsr.searchBookExtendImg(dto); return bookElasticSearchConsr.searchBookExtendImg(dto);
} }
@Override
public BookDto getBookFromRedis(Long bookId) {
BookDto bookDto = bookCache.getBookFromRedis(bookId);
if (null == bookDto) {
bookDto = bookDao.getBaseById(bookId);
if (null != bookDto) {
bookCache.setBookInfoToRedis(bookDto);
}
}
return bookDto;
}
} }
...@@ -17,6 +17,8 @@ import java.util.Objects; ...@@ -17,6 +17,8 @@ import java.util.Objects;
@Component("bookCache") @Component("bookCache")
public class BookCache { public class BookCache {
private static String BOOK_BASE_INFO_CACHE = "book:baseinfo:cache";
public void clearCache4BookBaseInfo(Long bookId){ public void clearCache4BookBaseInfo(Long bookId){
if (Objects.nonNull(bookId)){ if (Objects.nonNull(bookId)){
StringBuffer key = new StringBuffer(BookConstant.BOOK_CACHE); StringBuffer key = new StringBuffer(BookConstant.BOOK_CACHE);
...@@ -92,6 +94,7 @@ public class BookCache { ...@@ -92,6 +94,7 @@ public class BookCache {
} }
JedisClusterUtils.del(key.toString()); JedisClusterUtils.del(key.toString());
JedisClusterUtils.del(isbnKey.toString()); JedisClusterUtils.del(isbnKey.toString());
JedisClusterUtils.hdel(BOOK_BASE_INFO_CACHE, bookId.toString());
} }
/** /**
...@@ -144,5 +147,20 @@ public class BookCache { ...@@ -144,5 +147,20 @@ public class BookCache {
return JedisClusterUtils.decr(key); return JedisClusterUtils.decr(key);
} }
public BookDto getBookFromRedis(Long bookId) {
if (null == bookId) {
return null;
}
BookDto bookDto = JedisClusterUtils.hgetJson2Class(BOOK_BASE_INFO_CACHE, bookId.toString(), BookDto.class);
return bookDto;
}
public void setBookInfoToRedis(BookDto bookDto) {
if (null == bookDto || null == bookDto.getBookId()) {
return;
}
JedisClusterUtils.hset2Json(BOOK_BASE_INFO_CACHE, bookDto.getBookId().toString(), bookDto);
}
} }
...@@ -357,4 +357,6 @@ public interface BookAdviserDao extends BaseDao<BookAdviser> { ...@@ -357,4 +357,6 @@ public interface BookAdviserDao extends BaseDao<BookAdviser> {
void batchUpdateIsPrint(List<BookRequestVO> bookRequestVOS); void batchUpdateIsPrint(List<BookRequestVO> bookRequestVOS);
List<AdviserBookStatisDto> getAdviserBookStatis(AdviserBookStatisRequestDto requestDto); List<AdviserBookStatisDto> getAdviserBookStatis(AdviserBookStatisRequestDto requestDto);
Integer getBookIsOpenCatalog(Long bookId, Long channelId, Long adviserId);
} }
...@@ -547,4 +547,13 @@ public class BookAdviserDaoImpl extends BaseDaoImpl<BookAdviser> implements Book ...@@ -547,4 +547,13 @@ public class BookAdviserDaoImpl extends BaseDaoImpl<BookAdviser> implements Book
public List<AdviserBookStatisDto> getAdviserBookStatis(AdviserBookStatisRequestDto requestDto) { public List<AdviserBookStatisDto> getAdviserBookStatis(AdviserBookStatisRequestDto requestDto) {
return getSessionTemplate().selectList(getStatement("getAdviserBookStatis"), requestDto); return getSessionTemplate().selectList(getStatement("getAdviserBookStatis"), requestDto);
} }
@Override
public Integer getBookIsOpenCatalog(Long bookId, Long channelId, Long adviserId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId",bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId", adviserId);
return getSessionTemplate().selectOne(getStatement("getBookIsOpenCatalog"), paramMap);
}
} }
...@@ -230,11 +230,7 @@ public class BookAdviserServiceImpl implements BookAdviserService { ...@@ -230,11 +230,7 @@ public class BookAdviserServiceImpl implements BookAdviserService {
public ResponseEntity<ResponseDto<Integer>> getBookIsOpenCatalog(@RequestParam("bookId") Long bookId, public ResponseEntity<ResponseDto<Integer>> getBookIsOpenCatalog(@RequestParam("bookId") Long bookId,
@RequestParam("channelId") Long channelId, @RequestParam("channelId") Long channelId,
@RequestParam("adviserId") Long adviserId) throws BizException { @RequestParam("adviserId") Long adviserId) throws BizException {
Integer isOpenCatalog = 0; Integer isOpenCatalog = bookAdviserBiz.getBookIsOpenCatalog(bookId, channelId, adviserId);
BookAdviserDto base = bookAdviserBiz.getBase(bookId, channelId, adviserId);
if (null != base) {
isOpenCatalog = base.getIsOpenCatalog();
}
return ResponseHandleUtil.toResponse(isOpenCatalog); return ResponseHandleUtil.toResponse(isOpenCatalog);
} }
......
...@@ -297,4 +297,12 @@ public class BookServiceImpl implements BookService { ...@@ -297,4 +297,12 @@ public class BookServiceImpl implements BookService {
public void updateYesterdayBookNewLabel() { public void updateYesterdayBookNewLabel() {
ThreadPoolUtils.OTHER_THREAD_POOL.execute(()->bookLabelBiz.updateYesterdayBookNewLabel()); ThreadPoolUtils.OTHER_THREAD_POOL.execute(()->bookLabelBiz.updateYesterdayBookNewLabel());
} }
@Override
@GetMapping("getBookFromRedis")
public ResponseEntity<ResponseDto<BookDto>> getBookFromRedis(@RequestParam("bookId") Long bookId) {
return ResponseHandleUtil.toResponse(bookBiz.getBookFromRedis(bookId));
}
} }
...@@ -306,4 +306,16 @@ public class AppConsr { ...@@ -306,4 +306,16 @@ public class AppConsr {
} }
return null; return null;
} }
@ParamLog(description = "获取应用基本信息与价格", isAfterReturn = false)
public Map<Long, AppDto> mapBaseWithPriceByIds(List<Long> appIds){
if(ListUtils.isEmpty(appIds)) return null;
try{
Map<Long, AppDto> appBaseStatus = ResponseHandleUtil.parseMap(appService.mapBaseWithPriceByIds(appIds), Long.class, AppDto.class);
return appBaseStatus;
}catch (Exception e){
LOGGER.error("获取应用基本信息与价格失败"+ e.getMessage(), e);
}
return null;
}
} }
...@@ -186,6 +186,52 @@ public class ProductConsr { ...@@ -186,6 +186,52 @@ public class ProductConsr {
} }
/**
* 资源中心拉取商品最基本信息
*/
public Map<Long, ProductDto> getProductBasesByIds4Book(List<Long> productIds) throws BizException {
LOGGER.info("【资源中心(消)】获取商品最最基本信息4Book,<START>.[productIds]=" + productIds + "]");
if (productIds == null || productIds.isEmpty()) {
return null;
}
Map<Long, ProductDto> productDtoMap = new HashMap<>();
productIds = productIds.stream().distinct().collect(Collectors.toList());
Integer size = productIds.size();
if (productIds.size() > 1000) {
Integer[] queryCountArray = {0, 1, 2, 3};
Integer queryCount = 4;
//并发查询
List<Long> finalProductIds = productIds;
Map<Long, ProductDto> finalProductDtoMap = productDtoMap;
CompletableFuture[] completableFutures = Arrays.stream(queryCountArray).
map(x -> CompletableFuture.supplyAsync(() -> {
Integer startIndex = size / queryCount * x;
Integer endIndex = size / queryCount * (x + 1);
List<Long> queryList = finalProductIds.subList(startIndex, endIndex);
Map<Long, ProductDto> productMap = ResponseHandleUtil.parseMapResponse(productService.getProductBasesByIds4Book(queryList), Long.class,
ProductDto.class);
return productMap;
}, ThreadPoolUtils.EXPORT_THREAD_POOL).whenComplete(((productMap, throwable) -> {
finalProductDtoMap.putAll(productMap);
}))).toArray(CompletableFuture[]::new);
try {
CompletableFuture.allOf(completableFutures).get();
} catch (InterruptedException | ExecutionException e) {
LOGGER.warn("[getProductBasesByIds4Book] 填充信息失败,err:{}", e.getMessage(), e);
}
return finalProductDtoMap;
} else {
try {
productDtoMap = ResponseHandleUtil.parseMapResponse(productService.getProductBasesByIds4Book(productIds), Long.class, ProductDto.class);
} catch (BizException e) {
LOGGER.warn("调用:productService.getProductBasesByIds4Book报错", e.getMessage(), e);
}
return productDtoMap;
}
}
/** /**
* 资源中心拉取商品基本信息 * 资源中心拉取商品基本信息
*/ */
......
...@@ -371,4 +371,40 @@ public class TradeConsr { ...@@ -371,4 +371,40 @@ public class TradeConsr {
} }
return null; return null;
} }
/**
* 应用作品购买状态
*/
public Map<String, Boolean> mapAppProductBuyStateOpt(Long wechatUserId, List<Long> appIds, List<Long> productIds) {
if (null == wechatUserId || (ListUtils.isEmpty(appIds) && ListUtils.isEmpty(productIds))) {
return new HashMap<>();
}
OrderSearchDto orderSearchDto = new OrderSearchDto();
orderSearchDto.setAppIds(appIds);
orderSearchDto.setProductIds(productIds);
orderSearchDto.setWechatUserId(wechatUserId);
try {
return ResponseHandleUtil.parseMap(orderFormService.mapAppProductBuyStateOpt(orderSearchDto),String.class,Boolean.class);
} catch (Exception e) {
LOGGER.error("调用orderFormService.mapAppProductBuyStateOpt失败"+e.getMessage(), e);
}
return null;
}
/**
* 课程单节课购买状态
*/
public Map<Long, Boolean> mapCourseProductBuyStateOpt(Long wechatUserId, List<Long> productIds) {
if (null == wechatUserId || ListUtils.isEmpty(productIds)) {
return new HashMap<>();
}
OrderSearchDto orderSearchDto = new OrderSearchDto();
orderSearchDto.setProductIds(productIds);
orderSearchDto.setWechatUserId(wechatUserId);
try {
return ResponseHandleUtil.parseMap(orderFormService.mapCourseProductBuyStateOpt(orderSearchDto),Long.class,Boolean.class);
} catch (Exception e) {
LOGGER.error("调用orderFormService.mapCourseProductBuyStateOpt失败"+e.getMessage(), e);
}
return null;
}
} }
...@@ -2,7 +2,6 @@ package com.pcloud.book.copyright.biz.impl; ...@@ -2,7 +2,6 @@ package com.pcloud.book.copyright.biz.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr; import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.live.LiveCons; import com.pcloud.book.consumer.live.LiveCons;
...@@ -32,10 +31,8 @@ import com.pcloud.common.utils.DateUtils; ...@@ -32,10 +31,8 @@ import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils; import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.cookie.Cookie; import com.pcloud.common.utils.cookie.Cookie;
import com.pcloud.readercenter.wechat.entity.WechatUser; import com.pcloud.readercenter.wechat.entity.WechatUser;
import com.pcloud.resourcecenter.base.constants.ResourceRedisCons; import com.pcloud.resourcecenter.base.constants.ResourceRedisCons;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -191,41 +188,24 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz { ...@@ -191,41 +188,24 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
@Override @Override
public Boolean checkIsHaveAuthWithServer(String userInfo, Long serverId, String serverType) { public Boolean checkIsHaveAuthWithServer(String userInfo, Long serverId, String serverType) {
// 如果包含超级作者资源, 则直接返回 // 如果包含超级作者资源, 则直接返回
long t1 = System.currentTimeMillis(); if (checkIsSuperProduct(serverId)) {
if(checkIsSuperProduct(serverId)){
long t2 = System.currentTimeMillis();
System.out.println("第0阶段耗时=" + (t2 - t1));
return false; return false;
} }
long t2 = System.currentTimeMillis();
System.out.println("第1阶段耗时=" + (t2 - t1));
// 否则查询授权关系 // 否则查询授权关系
Long bookId = qrcodeSceneConsr.getBookId4SceneId(Cookie.getId(userInfo,Cookie._SCENE_ID)); Long bookId = qrcodeSceneConsr.getBookId4SceneId(Cookie.getId(userInfo, Cookie._SCENE_ID));
long t3 = System.currentTimeMillis();
System.out.println("第2阶段耗时=" + (t3 - t2));
Long channelId = Cookie.getId(userInfo, Cookie._CHANNEL_ID); Long channelId = Cookie.getId(userInfo, Cookie._CHANNEL_ID);
Long adviserId = Cookie.getId(userInfo,Cookie._ADVISER_ID); Long adviserId = Cookie.getId(userInfo, Cookie._ADVISER_ID);
Long wecharUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID); Long wecharUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
if("live".equalsIgnoreCase(serverType)){ if ("live".equalsIgnoreCase(serverType)) {
List<Long> id = new ArrayList<>(1); List<Long> id = new ArrayList<>(1);
id.add(serverId); id.add(serverId);
Map<Long, Boolean> map = liveCons.checkIsSuperMerchant(id); Map<Long, Boolean> map = liveCons.checkIsSuperMerchant(id);
if(map != null && Boolean.TRUE.equals(map.get(serverId))){ if (map != null && Boolean.TRUE.equals(map.get(serverId))) {
return false; return false;
} }
else{
return checkIsHaveAuthWithServer(bookId,channelId,adviserId,wecharUserId,serverId);
}
}
else{
Boolean aBoolean = checkIsHaveAuthWithServer(bookId, channelId, adviserId, wecharUserId, serverId);
long t4 = System.currentTimeMillis();
System.out.println("第3阶段耗时=" + (t4 - t3));
return aBoolean;
} }
return checkIsHaveAuthWithServer(bookId, channelId, adviserId, wecharUserId, serverId);
} }
private Boolean checkIsHaveAuthWithServer(Long bookId, Long channelId, Long adviserId, Long wecharUserId, Long serverId) { private Boolean checkIsHaveAuthWithServer(Long bookId, Long channelId, Long adviserId, Long wecharUserId, Long serverId) {
......
...@@ -531,9 +531,16 @@ public interface ResourcePageBiz { ...@@ -531,9 +531,16 @@ public interface ResourcePageBiz {
* @param channelId * @param channelId
* @param enableAdverting * @param enableAdverting
* @param navigationId * @param navigationId
* @param officialAccountsId
* @return * @return
*/ */
List<ResourceColumnAndServeVO> getColumnAndServeListByPageId4Wechat(Long resourcePageId, Long wechatUserId, Long bookId, Long adviserId, Long channelId, Integer enableAdverting, Long navigationId); List<ResourceColumnAndServeVO> getColumnAndServeListByPageId4Wechat(Long resourcePageId, Long wechatUserId, Long bookId, Long adviserId, Long channelId, Integer enableAdverting, Long navigationId, Long officialAccountsId);
List<Integer> getColumnTypeByPageId4Wechat(Long resourcePageId, Long wechatUserId, Long bookId, Long adviserId, Long channelId, Integer enableAdverting, Long navigationId);
//优化 此处把模块分开调接口 columnType
List<ResourceColumnAndServeVO> getColumnAndServeListByPageId4WechatV2(Long resourcePageId, Long wechatUserId, Long bookId, Long adviserId, Long channelId,
Integer enableAdverting, Long navigationId,Integer columnType, Long officialAccountsId);
/** /**
* 保存分享配置 * 保存分享配置
......
...@@ -99,6 +99,9 @@ public class ResourcePageBookstoreBizImpl implements ResourcePageBookstoreBiz { ...@@ -99,6 +99,9 @@ public class ResourcePageBookstoreBizImpl implements ResourcePageBookstoreBiz {
@Override @Override
public List<ResourcePageBookstoreVO> getByResourcePageId(Long resourcePageId, Long channelId, Long wechatUserId, ResourcePageFixtureTypeEnum fixtureTypeEnum) { public List<ResourcePageBookstoreVO> getByResourcePageId(Long resourcePageId, Long channelId, Long wechatUserId, ResourcePageFixtureTypeEnum fixtureTypeEnum) {
if (null == resourcePageId) {
return CollUtil.toList();
}
List<ResourcePageBookstoreVO> list = resourcePageBookstoreDao.getByResourcePageId(resourcePageId, fixtureTypeEnum.fixtureType); List<ResourcePageBookstoreVO> list = resourcePageBookstoreDao.getByResourcePageId(resourcePageId, fixtureTypeEnum.fixtureType);
if(CollUtil.isEmpty(list)){ if(CollUtil.isEmpty(list)){
return CollUtil.toList(); return CollUtil.toList();
......
...@@ -55,4 +55,8 @@ public interface BookAppletSceneDao extends BaseDao<BookAppletScene> { ...@@ -55,4 +55,8 @@ public interface BookAppletSceneDao extends BaseDao<BookAppletScene> {
* @return * @return
*/ */
BookAppletSceneDTO getBookAppletByBookId(Long bookId, Long channelId, Long adviserId); BookAppletSceneDTO getBookAppletByBookId(Long bookId, Long channelId, Long adviserId);
String getAppletIdByBookGroupId(Long bookGroupId);
String getAppletIdBySceneId(Long sceneId);
} }
...@@ -27,4 +27,6 @@ public interface ResourcePageCollectDao extends BaseDao<ResourcePageCollect>{ ...@@ -27,4 +27,6 @@ public interface ResourcePageCollectDao extends BaseDao<ResourcePageCollect>{
* * @param null * * @param null
*/ */
Integer getUserIsNotNew(Long wechatUserId); Integer getUserIsNotNew(Long wechatUserId);
Integer getCollectStateByUser(Long wechatUserId, Long resourcePageId);
} }
\ No newline at end of file
...@@ -29,7 +29,9 @@ public interface ResourcePageColumnDao extends BaseDao<ResourcePageColumn> { ...@@ -29,7 +29,9 @@ public interface ResourcePageColumnDao extends BaseDao<ResourcePageColumn> {
* @date:2021/3/29 13:45 * @date:2021/3/29 13:45
* * @param null * * @param null
*/ */
List<ResourceColumnAndServeVO> getColumnListByPageId(Long resourcePageId, Long navigationId); List<ResourceColumnAndServeVO> getColumnListByPageId(Long resourcePageId, Long navigationId,Integer columnType);
List<Integer> getColumnIdListByPageId(Long resourcePageId, Long navigationId);
/** /**
* 根据类型查询 * 根据类型查询
......
...@@ -125,4 +125,8 @@ public interface ResourcePageDao extends BaseDao<ResourcePage>{ ...@@ -125,4 +125,8 @@ public interface ResourcePageDao extends BaseDao<ResourcePage>{
* * @param null * * @param null
*/ */
void updateNavigationFormat(Long resourcePageId, Integer navigationColor, Integer navigationFormat, Integer navigationJumpType); void updateNavigationFormat(Long resourcePageId, Integer navigationColor, Integer navigationFormat, Integer navigationJumpType);
Long getBookIdByBookGroupId(Long bookGroupId);
Long getBookIdBySceneId(Long sceneId);
} }
...@@ -56,4 +56,14 @@ public class BookAppletSceneDaoImpl extends BaseDaoImpl<BookAppletScene> impleme ...@@ -56,4 +56,14 @@ public class BookAppletSceneDaoImpl extends BaseDaoImpl<BookAppletScene> impleme
map.put("adviserId", adviserId); map.put("adviserId", adviserId);
return getSessionTemplate().selectOne(getStatement("getBookAppletByBookId"), map); return getSessionTemplate().selectOne(getStatement("getBookAppletByBookId"), map);
} }
@Override
public String getAppletIdByBookGroupId(Long bookGroupId) {
return getSessionTemplate().selectOne(getStatement("getAppletIdByBookGroupId"), bookGroupId);
}
@Override
public String getAppletIdBySceneId(Long sceneId) {
return getSessionTemplate().selectOne(getStatement("getAppletIdBySceneId"), sceneId);
}
} }
...@@ -31,4 +31,12 @@ public class ResourcePageCollectDaoImpl extends BaseDaoImpl<ResourcePageCollect> ...@@ -31,4 +31,12 @@ public class ResourcePageCollectDaoImpl extends BaseDaoImpl<ResourcePageCollect>
public Integer getUserIsNotNew(Long wechatUserId) { public Integer getUserIsNotNew(Long wechatUserId) {
return getSessionTemplate().selectOne(getStatement("getUserIsNotNew"), wechatUserId); return getSessionTemplate().selectOne(getStatement("getUserIsNotNew"), wechatUserId);
} }
@Override
public Integer getCollectStateByUser(Long wechatUserId, Long resourcePageId) {
Map<String, Object> map = new HashMap<>();
map.put("wechatUserId", wechatUserId);
map.put("resourcePageId", resourcePageId);
return getSessionTemplate().selectOne(getStatement("getCollectStateByUser"), map);
}
} }
...@@ -30,14 +30,23 @@ public class ResourcePageColumnDaoImpl extends BaseDaoImpl<ResourcePageColumn> i ...@@ -30,14 +30,23 @@ public class ResourcePageColumnDaoImpl extends BaseDaoImpl<ResourcePageColumn> i
} }
@Override @Override
public List<ResourceColumnAndServeVO> getColumnListByPageId(Long resourcePageId, Long navigationId) { public List<ResourceColumnAndServeVO> getColumnListByPageId(Long resourcePageId, Long navigationId,Integer columnType) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("navigationId", navigationId); map.put("navigationId", navigationId);
map.put("resourcePageId", resourcePageId); map.put("resourcePageId", resourcePageId);
map.put("columnType", columnType);
return getSessionTemplate().selectList(getStatement("getColumnListByPageId"), map); return getSessionTemplate().selectList(getStatement("getColumnListByPageId"), map);
} }
@Override @Override
public List<Integer> getColumnIdListByPageId(Long resourcePageId, Long navigationId) {
Map<String, Object> map = new HashMap<>();
map.put("navigationId", navigationId);
map.put("resourcePageId", resourcePageId);
return getSessionTemplate().selectList(getStatement("getColumnIdListByPageId"), map);
}
@Override
public List<ResourcePageColumn> getByColumnTypeAndPage(Long resourcePageId, Integer columnType) { public List<ResourcePageColumn> getByColumnTypeAndPage(Long resourcePageId, Integer columnType) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("resourcePageId", resourcePageId); map.put("resourcePageId", resourcePageId);
......
...@@ -166,4 +166,14 @@ public class ResourcePageDaoImpl extends BaseDaoImpl<ResourcePage> implements Re ...@@ -166,4 +166,14 @@ public class ResourcePageDaoImpl extends BaseDaoImpl<ResourcePage> implements Re
map.put("navigationJumpType", navigationJumpType); map.put("navigationJumpType", navigationJumpType);
getSessionTemplate().update(getStatement("updateNavigationFormat"), map); getSessionTemplate().update(getStatement("updateNavigationFormat"), map);
} }
@Override
public Long getBookIdByBookGroupId(Long bookGroupId) {
return getSessionTemplate().selectOne(getStatement("getBookIdByBookGroupId"), bookGroupId);
}
@Override
public Long getBookIdBySceneId(Long sceneId) {
return getSessionTemplate().selectOne(getStatement("getBookIdBySceneId"), sceneId);
}
} }
...@@ -108,7 +108,40 @@ public class ResourcePageFacade { ...@@ -108,7 +108,40 @@ public class ResourcePageFacade {
@RequestParam(value = "enableAdverting", required = false) Integer enableAdverting, @RequestParam(value = "enableAdverting", required = false) Integer enableAdverting,
@RequestParam(value = "navigationId", required = false) Long navigationId){ @RequestParam(value = "navigationId", required = false) Long navigationId){
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID); Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
return new ResponseDto<>(resourcePageBiz.getColumnAndServeListByPageId4Wechat(resourcePageId, wechatUserId, bookId, adviserId, channelId, enableAdverting, navigationId)); Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
return new ResponseDto<>(resourcePageBiz.getColumnAndServeListByPageId4Wechat(resourcePageId, wechatUserId, bookId, adviserId,
channelId, enableAdverting, navigationId, officialAccountsId));
}
//优化 此处把模块分开调接口
@ApiOperation("客户端-根据页面id查资源页栏目分类")
@GetMapping("getColumnTypeByPageId4Wechat")
public ResponseDto<?> getColumnTypeByPageId4Wechat(@CookieValue("userInfo") String userInfo,
@RequestParam("resourcePageId") Long resourcePageId,
@RequestParam(value = "bookId", required = false) Long bookId,
@RequestParam(value = "adviserId", required = false) Long adviserId,
@RequestParam(value = "channelId", required = false) Long channelId,
@RequestParam(value = "enableAdverting", required = false) Integer enableAdverting,
@RequestParam(value = "navigationId", required = false) Long navigationId){
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
return new ResponseDto<>(resourcePageBiz.getColumnTypeByPageId4Wechat(resourcePageId, wechatUserId, bookId, adviserId, channelId, enableAdverting, navigationId));
}
//优化 此处把模块分开调接口 columnType
@ApiOperation("客户端-根据页面id查资源页栏目及资源")
@GetMapping("getColumnAndServeListByPageId4WechatV2")
public ResponseDto<?> getColumnAndServeListByPageId4WechatV2(@CookieValue("userInfo") String userInfo,
@RequestParam("resourcePageId") Long resourcePageId,
@RequestParam(value = "bookId", required = false) Long bookId,
@RequestParam(value = "adviserId", required = false) Long adviserId,
@RequestParam(value = "channelId", required = false) Long channelId,
@RequestParam(value = "enableAdverting", required = false) Integer enableAdverting,
@RequestParam(value = "navigationId", required = false) Long navigationId,
@RequestParam(value = "columnType", required = false) Integer columnType){
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
return new ResponseDto<>(resourcePageBiz.getColumnAndServeListByPageId4WechatV2(resourcePageId, wechatUserId, bookId, adviserId,
channelId, enableAdverting, navigationId,columnType, officialAccountsId));
} }
@ApiOperation("客户端分页查栏目资源") @ApiOperation("客户端分页查栏目资源")
......
...@@ -2,6 +2,7 @@ package com.pcloud.book.util.common; ...@@ -2,6 +2,7 @@ package com.pcloud.book.util.common;
import java.util.*; import java.util.*;
import cn.hutool.core.util.StrUtil;
import com.pcloud.common.utils.DateNewUtils; import com.pcloud.common.utils.DateNewUtils;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
...@@ -166,4 +167,22 @@ public class CommonUtils { ...@@ -166,4 +167,22 @@ public class CommonUtils {
calendar.set(14, 0); calendar.set(14, 0);
return calendar.getTime(); return calendar.getTime();
} }
public static Long getSceneId(String url) {
if (StrUtil.isEmpty(url) || !url.contains("sceneId")) {
return null;
}
String sceneIdStr = null;
Long sceneId = null;
try {
sceneIdStr = url.substring( url.indexOf("sceneId") + 8 , url.indexOf("&", url.indexOf("sceneId")));
} catch (Exception e) {
e.printStackTrace();
}
if (StrUtil.isNotEmpty(sceneIdStr)) {
sceneId = Long.valueOf(sceneIdStr);
}
return sceneId;
}
} }
...@@ -106,8 +106,9 @@ public class ThreadPoolUtils { ...@@ -106,8 +106,9 @@ public class ThreadPoolUtils {
/** /**
* 远程调用线程池 * 远程调用线程池
* maximumPoolSize设置大一些,避免阻塞
*/ */
public static final ThreadPoolExecutor REMOTE_CALL_POOL = new ThreadPoolExecutor(8, 8, 0, TimeUnit.SECONDS, public static final ThreadPoolExecutor REMOTE_CALL_POOL = new ThreadPoolExecutor(8, 128, 0, TimeUnit.SECONDS,
new LinkedBlockingQueue<>(), new ThreadFactoryBuilder().setNameFormat("remote-call-pool-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy()); new LinkedBlockingQueue<>(), new ThreadFactoryBuilder().setNameFormat("remote-call-pool-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy());
/** /**
* 书刊记录埋点线程池 * 书刊记录埋点线程池
......
...@@ -161,4 +161,16 @@ public class BookProps { ...@@ -161,4 +161,16 @@ public class BookProps {
public void setMiniOfficialAccountsId(Long miniOfficialAccountsId) { public void setMiniOfficialAccountsId(Long miniOfficialAccountsId) {
BookProps.miniOfficialAccountsId = miniOfficialAccountsId; BookProps.miniOfficialAccountsId = miniOfficialAccountsId;
} }
private static String productDomain;
public static String getProductDomain() {
return productDomain;
}
@Value("${PRODUCT_DOMAIN}")
public void setProductDomain(String productDomain) {
BookProps.productDomain = productDomain;
}
} }
...@@ -1406,4 +1406,18 @@ ...@@ -1406,4 +1406,18 @@
HAVING bookCount >= #{bookCount} HAVING bookCount >= #{bookCount}
</if> </if>
</select> </select>
<select id="getBookIsOpenCatalog" resultType="integer" parameterType="map">
SELECT
IFNULL(is_open_catalog,0)
FROM
BOOK_ADVISER
WHERE
BOOK_ID = #{bookId}
AND
CHANNEL_ID = #{channelId}
AND
ADVISER_ID = #{adviserId}
</select>
</mapper> </mapper>
...@@ -141,4 +141,22 @@ ...@@ -141,4 +141,22 @@
limit 1 limit 1
</select> </select>
<select id="getAppletIdByBookGroupId" parameterType="long" resultType="string">
SELECT
applet_id
FROM book_applet_scene
WHERE book_group_id=#{bookGroupId}
AND is_delete = 0
limit 1
</select>
<select id="getAppletIdBySceneId" parameterType="long" resultType="string">
SELECT
applet_id
FROM book_applet_scene
WHERE scene_id=#{sceneId}
AND is_delete = 0
limit 1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -71,4 +71,14 @@ ...@@ -71,4 +71,14 @@
and is_new = 0 and is_new = 0
</select> </select>
<select id="getCollectStateByUser" parameterType="map" resultType="integer">
select
collect_state
from resource_page_collect
where resource_page_id = #{resourcePageId}
and wechat_user_id = #{wechatUserId}
and collect_state = 1
limit 1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -125,11 +125,26 @@ ...@@ -125,11 +125,26 @@
<if test="navigationId != null"> <if test="navigationId != null">
and navigation_id = #{navigationId} and navigation_id = #{navigationId}
</if> </if>
<if test="columnType!=null">
and column_type = #{columnType}
</if>
ORDER BY ORDER BY
column_seq ASC, column_seq ASC,
id ASC id ASC
</select> </select>
<select id="getColumnIdListByPageId" resultType="Integer" parameterType="map">
SELECT
DISTINCT column_type
FROM
resource_page_column
WHERE
resource_page_id = #{resourcePageId}
<if test="navigationId != null">
and navigation_id = #{navigationId}
</if>
</select>
<select id="getByColumnTypeAndPage" parameterType="map" resultMap="ResourcePageColumnMap"> <select id="getByColumnTypeAndPage" parameterType="map" resultMap="ResourcePageColumnMap">
select select
id, resource_page_id, column_type, column_name, column_format, column_seq, show_more, show_count, create_time, navigation_id, background_type, background_url id, resource_page_id, column_type, column_name, column_format, column_seq, show_more, show_count, create_time, navigation_id, background_type, background_url
......
...@@ -355,4 +355,20 @@ ...@@ -355,4 +355,20 @@
where id = #{id} where id = #{id}
</select> </select>
<select id="getBookIdByBookGroupId" parameterType="long" resultType="long" >
select
book_id
from resource_page
where book_group_id = #{bookGroupId}
limit 1
</select>
<select id="getBookIdBySceneId" parameterType="long" resultType="long">
select
book_id
from resource_page
where scene_id = #{sceneId}
limit 1
</select>
</mapper> </mapper>
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