Commit 86f2474b by 田超

Merge branch 'feature/1005527' into 'master'

feat:[1005527]关注公众号延时推送

See merge request rays/pcloud-book!1419
parents ba1fe81a b6f5631f
......@@ -291,4 +291,10 @@ public interface BookGroupService {
@ApiOperation("查询栏目配置的rays工具类型")
@GetMapping("getConfiguredRaysAppTypeCode")
ResponseEntity<ResponseDto<List<String>>> getConfiguredRaysAppTypeCode(@RequestParam("resourcePageColumnId") Long resourcePageColumnId);
@ApiOperation("书刊是否是小学段")
@GetMapping("checkBookChildGrade")
ResponseEntity<ResponseDto<Boolean>> checkBookChildGrade(@RequestParam("bookId") Long bookId,
@RequestParam("adviserId") Long adviserId,
@RequestParam("channelId") Long channelId);
}
......@@ -464,4 +464,12 @@ public interface ResourcePageBiz {
* * @param null
*/
List<String> getConfiguredRaysAppTypeCode(Long resourcePageColumnId);
/**
* 书刊是否是小学段
* @author:zhuyajie
* @date:2021/9/26 14:39
* * @param null
*/
Boolean checkBookChildGrade(Long bookId, Long adviserId, Long channelId);
}
......@@ -21,7 +21,9 @@ import com.pcloud.book.applet.dto.AppletOuterBooklistDTO;
import com.pcloud.book.applet.dto.GroupActivity4AppletDTO;
import com.pcloud.book.applet.entity.AppletThirdResources;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookAdviserBiz;
import com.pcloud.book.book.biz.BookBiz;
import com.pcloud.book.book.dto.BookAdviserDto;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.book.dto.RaysSceneCatalogDto;
import com.pcloud.book.book.entity.Book;
......@@ -178,6 +180,8 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
private ResourcePagePicDao resourcePagePicDao;
@Autowired
private TradeConsr tradeConsr;
@Autowired
private BookAdviserBiz bookAdviserBiz;
@Value("${nft.book}")
private List<Long> nftBookId;
......@@ -432,7 +436,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
if (!ListUtils.isEmpty(productIds4Shelve)){
//作品自动上架
List<Long> productIds = productIds4Shelve;
ThreadPoolUtils.OTHER_POOL.execute(()->{
ThreadPoolUtils.RESOURCE_POOL.execute(()->{
Long channelId = updateResourceColumnVO.getChannelId();
if (null == channelId) {
channelId = getChannelIdFromUrl(updateResourceColumnVO.getItemVOList().get(0).getLinkUrl());
......@@ -1060,13 +1064,13 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
Map<Long, AppDto> appDtoMap= new HashMap<>();
Map<Long, ProductDto> productDtoMap = new HashMap<>();
Map<Long, MapBaseStatusDTO> appPriceMap = new HashMap<>();
Future<Map<Long, AppDto>>appMapSubmit = ThreadPoolUtils.OTHER_POOL.submit(() ->{
Future<Map<Long, AppDto>>appMapSubmit = ThreadPoolUtils.RESOURCE_POOL.submit(() ->{
return appConsr.mapBaseByIds(appIds);
});
Future<Map<Long, ProductDto>>productMapSubmit = ThreadPoolUtils.OTHER_POOL.submit(() ->{
Future<Map<Long, ProductDto>>productMapSubmit = ThreadPoolUtils.RESOURCE_POOL.submit(() ->{
return productConsr.getProBasesByIds(productIds);
});
Future<Map<Long, MapBaseStatusDTO>> appPriceMapSubmit = ThreadPoolUtils.OTHER_POOL.submit(() ->{
Future<Map<Long, MapBaseStatusDTO>> appPriceMapSubmit = ThreadPoolUtils.RESOURCE_POOL.submit(() ->{
return appConsr.mapBaseStatusById(appIds);
});
try {
......@@ -1094,10 +1098,10 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
Map<Long, Boolean> courseBuyStateMap = new HashMap<>();
if (null != wechatUserId) {
appOfficialAccountToolMap = appConsr.getPayOfficialAccountsToolByAppIds(appIds);
Future<Map<Long, Boolean>> buyStateSubmit = ThreadPoolUtils.OTHER_POOL.submit(() ->{
Future<Map<Long, Boolean>> buyStateSubmit = ThreadPoolUtils.RESOURCE_POOL.submit(() ->{
return tradeConsr.mapAppProductBuyState(wechatUserId, appIds, nonCourseProductIds);
});
Future<Map<Long, Boolean>> courseBuyStateSubmit = ThreadPoolUtils.OTHER_POOL.submit(() ->{
Future<Map<Long, Boolean>> courseBuyStateSubmit = ThreadPoolUtils.RESOURCE_POOL.submit(() ->{
return tradeConsr.mapCourseProductBuyState(wechatUserId, courseProductIds);
});
try {
......@@ -1368,7 +1372,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
// 修改该单页面的更新时间
resourcePageDao.updatePageUpdateTime(resourcePageId);
//同步RAYS码资源配置
ThreadPoolUtils.OTHER_POOL.execute(()->{
ThreadPoolUtils.RESOURCE_POOL.execute(()->{
ResourcePage resourcePage = resourcePageDao.getById(resourcePageId);
this.updateOwnMessage4Qr(null == resourcePage? null : resourcePage.getSceneId());
});
......@@ -1388,7 +1392,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
//栏目重新排序
this.updateSeq4Batch(column.getResourcePageId(), column.getNavigationId());
//同步RAYS码资源配置
ThreadPoolUtils.OTHER_POOL.execute(()->{
ThreadPoolUtils.RESOURCE_POOL.execute(()->{
ResourcePage resourcePage = resourcePageDao.getPageByColumnId(resourcePageColumnId);
this.updateOwnMessage4Qr(null == resourcePage? null : resourcePage.getSceneId());
});
......@@ -1475,7 +1479,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
page.getBookGroupId() == null ? page.getSceneId() : page.getBookGroupId(),
AdviserTaskConstants.OperateTypeEnum.CONFIGURE_RESOURCE.getValue());
//同步RAYS码资源配置
ThreadPoolUtils.OTHER_POOL.execute(()->{
ThreadPoolUtils.RESOURCE_POOL.execute(()->{
this.updateOwnMessage4Qr(updateResourcePageVO.getSceneId());
});
return resourcePageId;
......@@ -2526,7 +2530,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
this.deleteNavigation(navigationId);
}
//同步RAYS码资源配置
ThreadPoolUtils.OTHER_POOL.execute(() -> {
ThreadPoolUtils.RESOURCE_POOL.execute(() -> {
ResourcePage resourcePage = resourcePageDao.getById(navigationParamDTO.getResourcePageId());
this.updateOwnMessage4Qr(null == resourcePage ? null : resourcePage.getSceneId());
});
......@@ -2692,4 +2696,29 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
public List<String> getConfiguredRaysAppTypeCode(Long resourcePageColumnId) {
return resourcePageItemDao.getConfiguredRaysAppTypeCode(resourcePageColumnId);
}
@Override
public Boolean checkBookChildGrade(Long bookId, Long adviserId, Long channelId) {
//获取书刊匹配的年级标签
BookAdviserDto bookAdviserDto = bookAdviserBiz.getBase(bookId, channelId, adviserId);
if (null == bookAdviserDto) {
return false;
}
Long gradeId = null;
if (null != bookAdviserDto.getGraLabelId()) {
gradeId = this.getGradeByGradeLabelId(bookAdviserDto.getGraLabelId());
}
if (null != bookAdviserDto.getDepLabelId()) {
gradeId = this.getGradeByDepLabelId(bookAdviserDto.getDepLabelId());
}
if (null == gradeId) {
return false;
}
//小学段所有年级
List<Long> gradeLabelIds = readerConsr.getUserGradeIdByParentId(2L);
if (!ListUtils.isEmpty(gradeLabelIds) && gradeLabelIds.contains(gradeId)) {
return true;
}
return false;
}
}
......@@ -496,4 +496,12 @@ public class BookGroupServiceImpl implements BookGroupService {
public ResponseEntity<ResponseDto<List<String>>> getConfiguredRaysAppTypeCode(@RequestParam("resourcePageColumnId") Long resourcePageColumnId) {
return ResponseHandleUtil.toResponse(resourcePageBiz.getConfiguredRaysAppTypeCode(resourcePageColumnId));
}
@Override
@GetMapping("checkBookChildGrade")
public ResponseEntity<ResponseDto<Boolean>> checkBookChildGrade(@RequestParam("bookId") Long bookId,
@RequestParam("adviserId") Long adviserId,
@RequestParam("channelId") Long channelId) {
return ResponseHandleUtil.toResponse(resourcePageBiz.checkBookChildGrade(bookId, adviserId, channelId));
}
}
......@@ -80,6 +80,10 @@ public class ThreadPoolUtils {
public static final ExecutorService SMALL_THREAD_POOL = new ThreadPoolExecutor(8, 8, 0L, TimeUnit.SECONDS,
new LinkedBlockingQueue<>(), new ThreadFactoryBuilder().setNameFormat("small-pool-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy());
public static final ExecutorService RESOURCE_POOL = new ThreadPoolExecutor(8, 8, 0L, TimeUnit.SECONDS,
new LinkedBlockingQueue<>(), new ThreadFactoryBuilder().setNameFormat("resource-pool-%d").build(), new ThreadPoolExecutor.CallerRunsPolicy());
/**
* 超级搜索更新线程
*/
......
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