Commit 8e7486bd by 朱亚洁

feat:[1006950]图书sop

parent 07f1e9cb
......@@ -8,6 +8,9 @@ import com.pcloud.advertising.advertising.dto.AdvertisingSpaceDTO;
import com.pcloud.advertising.advertising.dto.AdvertisingSpaceItemDTO;
import com.pcloud.analysisengine.browse.dto.BrowseRecordStatisticDTO;
import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.appcenter.app.dto.AppRaysDTO;
import com.pcloud.appcenter.app.dto.app.MapBaseStatusDTO;
import com.pcloud.appcenter.app.dto.AppRaysDTO;
import com.pcloud.book.applet.biz.AppletBooklistBiz;
import com.pcloud.book.applet.biz.AppletGroupSearchRecordBiz;
import com.pcloud.book.applet.biz.AppletRecordAggrStatisBiz;
......@@ -331,8 +334,6 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
@Value("${nft.bookGroupId}")
private Long nftBookGroupId;
public static final String nftReleaseLockKey = "CHANNELCENTER:NFT:RELEASE";
@Autowired
private BookProps bookProps;
@Override
public Long updateResourcePage(UpdateResourcePageVO updateResourcePageVO) {
......@@ -381,7 +382,6 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
ResourcePage resourcePage = resourcePageDao.getBySceneId(sceneId);
updateResourcePageVO.setOpenRays(updateResourcePageVO.getOpenRays() == null ? 0 : updateResourcePageVO.getOpenRays());
QrcodeSceneDto qrcodeSceneDto = qrcodeSceneConsr.getById(sceneId);
Integer openRays = null != resourcePage ? resourcePage.getOpenRays() : null;
if (null == resourcePage) {
resourcePage = new ResourcePage();
BeanUtils.copyProperties(updateResourcePageVO, resourcePage);
......@@ -440,18 +440,14 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
addResourcePageToRedis(e);
});
}
//添加小程序默认导航 之前关闭才添加
if (!YesOrNoNumEnum.YES.getValue().equals(openRays)) {
this.addDefaultAppletNavigation(resourcePage.getId());
}
} else {
//删除小程序默认导航
this.deleteAppletDefaultNavigation(resourcePage.getId());
//导航重新排序
this.updateNavigationSeq4Batch(resourcePage.getId());
}
esBookAndAdviserBiz.updateBookAndAdviserToES(Collections.singletonList(resourcePage.getBookId()));
//互助和打卡导航加到图书服务中配置,由前端控制是否配置
this.updateResourcePageModel(resourcePage.getId(),updateResourcePageVO.getResourcePageModelList(),resourcePage.getCreateUser());
Long resourcePageId = resourcePage.getId();
ThreadPoolUtils.OTHER_THREAD_POOL.execute(()-> esBookAndAdviserBiz.updateBookAndAdviserToES(Collections.singletonList(resourcePageId)));
return resourcePage.getId();
}
......@@ -498,7 +494,6 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
ResourcePage resourcePage = resourcePageDao.getByBookGroupId(bookGroupId);
updateResourcePageVO.setOpenRays(updateResourcePageVO.getOpenRays() == null ? 0 : updateResourcePageVO.getOpenRays());
BookGroupDTO dto = bookGroupDao.getDTOById(bookGroupId);
Integer openRays = null != resourcePage ? resourcePage.getOpenRays() : null;
if (null == resourcePage) {
resourcePage = new ResourcePage();
BeanUtils.copyProperties(updateResourcePageVO, resourcePage);
......@@ -548,18 +543,14 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
addResourcePageToRedis(e);
});
}
//添加小程序默认导航 之前关闭才添加
if (!YesOrNoNumEnum.YES.getValue().equals(openRays)) {
this.addDefaultAppletNavigation(resourcePage.getId());
}
} else {
//删除小程序默认导航
this.deleteAppletDefaultNavigation(resourcePage.getId());
//导航重新排序
this.updateNavigationSeq4Batch(resourcePage.getId());
}
esBookAndAdviserBiz.updateBookAndAdviserToES(Collections.singletonList(resourcePage.getBookId()));
//互助和打卡导航加到图书服务中配置,由前端控制是否配置
this.updateResourcePageModel(resourcePage.getId(),updateResourcePageVO.getResourcePageModelList(),resourcePage.getCreateUser());
Long resourcePageId = resourcePage.getId();
ThreadPoolUtils.OTHER_THREAD_POOL.execute(()-> esBookAndAdviserBiz.updateBookAndAdviserToES(Collections.singletonList(resourcePageId)));
return resourcePage.getId();
}
......@@ -596,9 +587,6 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
if (PageLandingPageTypeEnum.RESOURCE.getCode().equals(landingPageType)) {
//本书服务页添加默认导航
this.addDefaultBookServeNavigation(resourcePage.getId());
if (openRays == 1) {
this.addDefaultAppletNavigation(resourcePage.getId());
}
}
return resourcePage;
}
......@@ -1826,10 +1814,14 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
resourcePageVO.setResourcePageCouponList(resourcePageBookstoreBiz.getByResourcePageId(resourcePageVO.getId(), resourcePageVO.getChannelId(), wechatUserId, ResourcePageFixtureTypeEnum.COUPONS));
}
}
List<ResourcePageNavigation> navigations = resourcePageNavigationDao.getByPageId(resourcePageVO.getId());
// 加载跳转数据
this.fillCustomServe(navigations, wechatUserId);
resourcePageVO.setNavigationList(navigations);
// 加载实体书购买
this.fillBookStore(resourcePageVO);
// 加载固定项
this.fillFixture(resourcePageVO);
//加载导航
this.fillNavigation(resourcePageVO, wechatUserId);
//加载图书标准服务
this.fillResourcePageModel(resourcePageVO, wechatUserId);
return resourcePageVO;
}
......@@ -2179,8 +2171,11 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
CompletableFuture<Integer> pushTextFuture = CompletableFuture.supplyAsync(() -> {
return qrcodeSceneConsr.getPushTextOpenStatus(resourcePageVO.getAdviserId());
});
CompletableFuture.allOf(storeFuture, couponFuture, navigationFuture, wxworkPageFuture, pushTextFuture).join();
//加载图书标准服务
CompletableFuture<Void> modelFuture = CompletableFuture.runAsync(() -> {
this.fillResourcePageModel(resourcePageVO, wechatUserId);
});
CompletableFuture.allOf(storeFuture, couponFuture, navigationFuture, wxworkPageFuture, pushTextFuture, modelFuture).join();
List<ResourcePageBookstoreVO> bookstoreVOS = new ArrayList<>();
List<ResourcePageBookstoreVO> couponVOS = new ArrayList<>();
Integer pushTextPermission = 0;
......@@ -2194,8 +2189,6 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
resourcePageVO.setResourcePageBookstoreList(bookstoreVOS);
resourcePageVO.setResourcePageCouponList(couponVOS);
resourcePageVO.setPushTextOpenStatus(pushTextPermission);
//加载图书标准服务
this.fillResourcePageModel(resourcePageVO, wechatUserId);
return resourcePageVO;
}
......@@ -3147,68 +3140,8 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
for (Integer type :types){
resourcePageNavigationDao.deleteNavigation(resourcePageId, type);
}
//删除图书标准服务中的配置
List<String> typeCodes = ResourcePageConstants.APPLET_DEFAULT_TYPECODES;
// resourcePageModelDao.deleteByPageIdAndTypeCode(resourcePageId,typeCodes);
}
/**
* 添加小程序默认导航(互助、打卡)
* @author:zhuyajie
* @date:2021/8/16 14:39
* * @param null
*/
private void addDefaultAppletNavigation(Long resourcePageId) {
ResourcePage resourcePage = resourcePageDao.getById(resourcePageId);
if (null == resourcePage) {
return;
}
//书友互助、阅读打卡
List<Integer> types = ResourcePageConstants.APPLET_DEFAULT_NAVIGATIONS;
Integer maxSeq = resourcePageNavigationDao.getMaxSeq(resourcePageId);
Integer addSeq = 0;
List<ResourcePageNavigation> navigations = new ArrayList<>();
for (Integer type :types){
ResourcePageNavigation resourcePageNavigation = resourcePageNavigationDao.getByType(resourcePageId,type);
if (null != resourcePageNavigation) {
continue;
}
addSeq = addSeq + 1;
ResourcePageNavigation navigation = new ResourcePageNavigation();
navigation.setCreateUser(resourcePage.getCreateUser());
navigation.setNavigationName(ResourcePageConstants.NavigationTypeEnum.getNameByCode(type));
navigation.setNavigationSeq(maxSeq+addSeq);
navigation.setNavigationType(type);
navigation.setResourcePageId(resourcePageId);
navigations.add(navigation);
}
if (!ListUtils.isEmpty(navigations)) {
resourcePageNavigationDao.insert(navigations);
}
//改为在图书标准服务中添加
/* ThreadPoolUtils.RESOURCE_POOL.execute(()->{
List<String> typeCodes = ResourcePageConstants.APPLET_DEFAULT_TYPECODES;
List<ResourcePageModel> modelList = new ArrayList<>();
Map<String, AppRaysDTO> raysDTOMap = appConsr.mapRaysAppByType(typeCodes);
for (String typeCode : typeCodes) {
AppRaysDTO raysDTO = raysDTOMap.get(typeCode);
if (null == raysDTO) {
continue;
}
ResourcePageModel model = new ResourcePageModel();
model.setResourcePageId(resourcePageId);
model.setServeTitle(raysDTO.getTitle());
model.setServeId(raysDTO.getAppId());
model.setServeType(ResourcePageConstants.ServeTypeEnum.APP.getValue());
model.setTypeCode(typeCode);
model.setLinkUrl("/rayh5/applet?type="+typeCode);
model.setServeIcon("https://oss.5rs.me/oss/uploadfe/png/a6cbbf361afedbe12359b7fa21ef507b.png");
model.setCreateUser(resourcePage.getCreateUser());
modelList.add(model);
}
resourcePageModelDao.insert(modelList);
});*/
}
/**
* 添加本书配套导航
......@@ -3264,23 +3197,6 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
}
/**
* 导航重新排序
* @author:zhuyajie
* @date:2021/8/16 17:54
* * @param null
*/
private void updateNavigationSeq4Batch(Long resourcePageId) {
List<ResourcePageNavigation> navigations = resourcePageNavigationDao.getByPageId(resourcePageId);
if (ListUtils.isEmpty(navigations)) {
return;
}
for (ResourcePageNavigation navigation : navigations) {
navigation.setNavigationSeq(navigations.indexOf(navigation) + 1);
}
resourcePageNavigationDao.updateSeq4Batch(navigations);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveNavigation(NavigationParamDTO navigationParamDTO) {
......@@ -4123,7 +4039,6 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
return new ArrayList<>();
}
fillSelfPic(resourcePageItemVOList);
//填充跳转地址
try {
fillJumpUrl(resourcePageItemVOList, wechatUserId, resourcePageId, officialAccountsId, bookId, adviserId, channelId);
} catch (Exception e) {
......@@ -4302,6 +4217,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
});
}
private void fillTaskType(List<ResourcePageItemVO> itemAppAndProductVOList) {
if (CollUtil.isEmpty(itemAppAndProductVOList)) {
return;
......@@ -4367,4 +4283,5 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
return resourcePageItemDao.mapQrServeCount(sceneIds);
}
}
......@@ -21,5 +21,7 @@ public interface ResourcePageModelDao extends BaseDao<ResourcePageModel> {
void deleteByPageId(Long resourcePageId);
void deleteByPageIdAndTypeCode(Long resourcePageId, List<String> typeCodes);
void deleteByPageIdExcludeTypeCode(Long resourcePageId, List<String> typeCodes);
}
......@@ -35,4 +35,12 @@ public class ResourcePageModelDaoImpl extends BaseDaoImpl<ResourcePageModel> imp
map.put("typeCodes", typeCodes);
getSessionTemplate().delete(getStatement("deleteByPageIdAndTypeCode"), map);
}
@Override
public void deleteByPageIdExcludeTypeCode(Long resourcePageId, List<String> typeCodes) {
Map<String,Object> map = new HashMap<>();
map.put("resourcePageId", resourcePageId);
map.put("typeCodes", typeCodes);
getSessionTemplate().delete(getStatement("deleteByPageIdExcludeTypeCode"), map);
}
}
......@@ -135,7 +135,8 @@
p.font_color,
p.transparency,
p.navigation_jump_type,
p.is_show_price
p.is_show_price,
p.landing_page_type
FROM
resource_page p
LEFT JOIN resource_page_item i ON p.id = i.resource_page_id
......
......@@ -100,5 +100,14 @@
</foreach>
</delete>
<delete id="deleteByPageIdExcludeTypeCode" parameterType="map">
delete from resource_page_model
where resource_page_id = #{resourcePageId}
and type_code not in
<foreach collection="typeCodes" separator="," item="item" index="index" open="(" close=")">
#{item}
</foreach>
</delete>
</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