Commit b6f5631f by 朱亚洁

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

parent ba1fe81a
...@@ -291,4 +291,10 @@ public interface BookGroupService { ...@@ -291,4 +291,10 @@ public interface BookGroupService {
@ApiOperation("查询栏目配置的rays工具类型") @ApiOperation("查询栏目配置的rays工具类型")
@GetMapping("getConfiguredRaysAppTypeCode") @GetMapping("getConfiguredRaysAppTypeCode")
ResponseEntity<ResponseDto<List<String>>> getConfiguredRaysAppTypeCode(@RequestParam("resourcePageColumnId") Long resourcePageColumnId); 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 { ...@@ -464,4 +464,12 @@ public interface ResourcePageBiz {
* * @param null * * @param null
*/ */
List<String> getConfiguredRaysAppTypeCode(Long resourcePageColumnId); 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; ...@@ -21,7 +21,9 @@ import com.pcloud.book.applet.dto.AppletOuterBooklistDTO;
import com.pcloud.book.applet.dto.GroupActivity4AppletDTO; import com.pcloud.book.applet.dto.GroupActivity4AppletDTO;
import com.pcloud.book.applet.entity.AppletThirdResources; import com.pcloud.book.applet.entity.AppletThirdResources;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookAdviserBiz;
import com.pcloud.book.book.biz.BookBiz; 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.BookDto;
import com.pcloud.book.book.dto.RaysSceneCatalogDto; import com.pcloud.book.book.dto.RaysSceneCatalogDto;
import com.pcloud.book.book.entity.Book; import com.pcloud.book.book.entity.Book;
...@@ -178,6 +180,8 @@ public class ResourcePageBizImpl implements ResourcePageBiz { ...@@ -178,6 +180,8 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
private ResourcePagePicDao resourcePagePicDao; private ResourcePagePicDao resourcePagePicDao;
@Autowired @Autowired
private TradeConsr tradeConsr; private TradeConsr tradeConsr;
@Autowired
private BookAdviserBiz bookAdviserBiz;
@Value("${nft.book}") @Value("${nft.book}")
private List<Long> nftBookId; private List<Long> nftBookId;
...@@ -432,7 +436,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz { ...@@ -432,7 +436,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
if (!ListUtils.isEmpty(productIds4Shelve)){ if (!ListUtils.isEmpty(productIds4Shelve)){
//作品自动上架 //作品自动上架
List<Long> productIds = productIds4Shelve; List<Long> productIds = productIds4Shelve;
ThreadPoolUtils.OTHER_POOL.execute(()->{ ThreadPoolUtils.RESOURCE_POOL.execute(()->{
Long channelId = updateResourceColumnVO.getChannelId(); Long channelId = updateResourceColumnVO.getChannelId();
if (null == channelId) { if (null == channelId) {
channelId = getChannelIdFromUrl(updateResourceColumnVO.getItemVOList().get(0).getLinkUrl()); channelId = getChannelIdFromUrl(updateResourceColumnVO.getItemVOList().get(0).getLinkUrl());
...@@ -1060,13 +1064,13 @@ public class ResourcePageBizImpl implements ResourcePageBiz { ...@@ -1060,13 +1064,13 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
Map<Long, AppDto> appDtoMap= new HashMap<>(); Map<Long, AppDto> appDtoMap= new HashMap<>();
Map<Long, ProductDto> productDtoMap = new HashMap<>(); Map<Long, ProductDto> productDtoMap = new HashMap<>();
Map<Long, MapBaseStatusDTO> appPriceMap = 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); 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); 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); return appConsr.mapBaseStatusById(appIds);
}); });
try { try {
...@@ -1094,10 +1098,10 @@ public class ResourcePageBizImpl implements ResourcePageBiz { ...@@ -1094,10 +1098,10 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
Map<Long, Boolean> courseBuyStateMap = new HashMap<>(); Map<Long, Boolean> courseBuyStateMap = new HashMap<>();
if (null != wechatUserId) { if (null != wechatUserId) {
appOfficialAccountToolMap = appConsr.getPayOfficialAccountsToolByAppIds(appIds); 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); 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); return tradeConsr.mapCourseProductBuyState(wechatUserId, courseProductIds);
}); });
try { try {
...@@ -1368,7 +1372,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz { ...@@ -1368,7 +1372,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
// 修改该单页面的更新时间 // 修改该单页面的更新时间
resourcePageDao.updatePageUpdateTime(resourcePageId); resourcePageDao.updatePageUpdateTime(resourcePageId);
//同步RAYS码资源配置 //同步RAYS码资源配置
ThreadPoolUtils.OTHER_POOL.execute(()->{ ThreadPoolUtils.RESOURCE_POOL.execute(()->{
ResourcePage resourcePage = resourcePageDao.getById(resourcePageId); ResourcePage resourcePage = resourcePageDao.getById(resourcePageId);
this.updateOwnMessage4Qr(null == resourcePage? null : resourcePage.getSceneId()); this.updateOwnMessage4Qr(null == resourcePage? null : resourcePage.getSceneId());
}); });
...@@ -1388,7 +1392,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz { ...@@ -1388,7 +1392,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
//栏目重新排序 //栏目重新排序
this.updateSeq4Batch(column.getResourcePageId(), column.getNavigationId()); this.updateSeq4Batch(column.getResourcePageId(), column.getNavigationId());
//同步RAYS码资源配置 //同步RAYS码资源配置
ThreadPoolUtils.OTHER_POOL.execute(()->{ ThreadPoolUtils.RESOURCE_POOL.execute(()->{
ResourcePage resourcePage = resourcePageDao.getPageByColumnId(resourcePageColumnId); ResourcePage resourcePage = resourcePageDao.getPageByColumnId(resourcePageColumnId);
this.updateOwnMessage4Qr(null == resourcePage? null : resourcePage.getSceneId()); this.updateOwnMessage4Qr(null == resourcePage? null : resourcePage.getSceneId());
}); });
...@@ -1475,7 +1479,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz { ...@@ -1475,7 +1479,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
page.getBookGroupId() == null ? page.getSceneId() : page.getBookGroupId(), page.getBookGroupId() == null ? page.getSceneId() : page.getBookGroupId(),
AdviserTaskConstants.OperateTypeEnum.CONFIGURE_RESOURCE.getValue()); AdviserTaskConstants.OperateTypeEnum.CONFIGURE_RESOURCE.getValue());
//同步RAYS码资源配置 //同步RAYS码资源配置
ThreadPoolUtils.OTHER_POOL.execute(()->{ ThreadPoolUtils.RESOURCE_POOL.execute(()->{
this.updateOwnMessage4Qr(updateResourcePageVO.getSceneId()); this.updateOwnMessage4Qr(updateResourcePageVO.getSceneId());
}); });
return resourcePageId; return resourcePageId;
...@@ -2526,7 +2530,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz { ...@@ -2526,7 +2530,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
this.deleteNavigation(navigationId); this.deleteNavigation(navigationId);
} }
//同步RAYS码资源配置 //同步RAYS码资源配置
ThreadPoolUtils.OTHER_POOL.execute(() -> { ThreadPoolUtils.RESOURCE_POOL.execute(() -> {
ResourcePage resourcePage = resourcePageDao.getById(navigationParamDTO.getResourcePageId()); ResourcePage resourcePage = resourcePageDao.getById(navigationParamDTO.getResourcePageId());
this.updateOwnMessage4Qr(null == resourcePage ? null : resourcePage.getSceneId()); this.updateOwnMessage4Qr(null == resourcePage ? null : resourcePage.getSceneId());
}); });
...@@ -2692,4 +2696,29 @@ public class ResourcePageBizImpl implements ResourcePageBiz { ...@@ -2692,4 +2696,29 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
public List<String> getConfiguredRaysAppTypeCode(Long resourcePageColumnId) { public List<String> getConfiguredRaysAppTypeCode(Long resourcePageColumnId) {
return resourcePageItemDao.getConfiguredRaysAppTypeCode(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 { ...@@ -496,4 +496,12 @@ public class BookGroupServiceImpl implements BookGroupService {
public ResponseEntity<ResponseDto<List<String>>> getConfiguredRaysAppTypeCode(@RequestParam("resourcePageColumnId") Long resourcePageColumnId) { public ResponseEntity<ResponseDto<List<String>>> getConfiguredRaysAppTypeCode(@RequestParam("resourcePageColumnId") Long resourcePageColumnId) {
return ResponseHandleUtil.toResponse(resourcePageBiz.getConfiguredRaysAppTypeCode(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 { ...@@ -80,6 +80,10 @@ public class ThreadPoolUtils {
public static final ExecutorService SMALL_THREAD_POOL = new ThreadPoolExecutor(8, 8, 0L, TimeUnit.SECONDS, 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()); 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