Commit ed328fe2 by 阮思源

修改关键词应用作品增加统计的bug

parent 0b3e0250
...@@ -2,6 +2,8 @@ package com.pcloud.book.group.biz.impl; ...@@ -2,6 +2,8 @@ package com.pcloud.book.group.biz.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.pcloud.appcenter.app.dto.AppDto; import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.appcenter.base.dto.AppPriceCacheDTO;
import com.pcloud.appcenter.cache.service.AppPriceCacheService;
import com.pcloud.audioapp.audioLesson.service.AudioLessonService; import com.pcloud.audioapp.audioLesson.service.AudioLessonService;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookBiz; import com.pcloud.book.book.biz.BookBiz;
...@@ -40,6 +42,7 @@ import com.pcloud.common.core.dto.SendNotifyDto; ...@@ -40,6 +42,7 @@ import com.pcloud.common.core.dto.SendNotifyDto;
import com.pcloud.common.core.enums.NotifyOriginTypeEnum; import com.pcloud.common.core.enums.NotifyOriginTypeEnum;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.entity.UploadResultInfo; import com.pcloud.common.entity.UploadResultInfo;
import com.pcloud.common.enums.AppTypeEnum;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean; import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
...@@ -149,6 +152,8 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -149,6 +152,8 @@ public class BookGroupBizImpl implements BookGroupBiz {
private ScheduleService scheduleService; private ScheduleService scheduleService;
@Autowired @Autowired
private TimeTableService timeTableService; private TimeTableService timeTableService;
@Autowired
private AppPriceCacheService appPriceCacheService;
/** /**
...@@ -910,48 +915,40 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -910,48 +915,40 @@ public class BookGroupBizImpl implements BookGroupBiz {
List<ListKeywordVO> listKeywordVOS = bookKeywordDao.getKeywordsByClassifyIds(classifyIds,bookId); List<ListKeywordVO> listKeywordVOS = bookKeywordDao.getKeywordsByClassifyIds(classifyIds,bookId);
List<Long> appIds = listKeywordVOS.stream().filter(s -> "APP".equalsIgnoreCase(s.getServeType())).map(ListKeywordVO::getServeId).collect(Collectors.toList()); List<Long> appIds = listKeywordVOS.stream().filter(s -> "APP".equalsIgnoreCase(s.getServeType())).map(ListKeywordVO::getServeId).collect(Collectors.toList());
Map<Long, AppDto> appDtoMap = appConsr.mapByIds(appIds); Map<Long, AppDto> appDtoMap = appConsr.mapByIds(appIds);
Map<Long, Long> appIdToProductIdMap = new HashMap<>(); List<AppPriceCacheDTO> appPriceCacheDTOS = new ArrayList<>();
List<Long> appProductIds = new ArrayList<>();
for (Long appId : appIds) { for (Long appId : appIds) {
if (appDtoMap.get(appId) != null && appDtoMap.get(appId).getProductId() != null) { if (appDtoMap.get(appId) != null) {
appIdToProductIdMap.put(appId, appDtoMap.get(appId).getProductId()); AppPriceCacheDTO appPriceCacheDTO = new AppPriceCacheDTO();
appProductIds.add(appDtoMap.get(appId).getProductId()); appPriceCacheDTO.setAppId(appId);
appPriceCacheDTO.setAppTypeEnum(AppTypeEnum.APP_TYPE_MAP.get(appDtoMap.get(appId).getTypeCode()));
appPriceCacheDTOS.add(appPriceCacheDTO);
} }
} }
Map<Long, BigDecimal> appPriceMap = ResponseHandleUtil.parseMapResponse(appPriceCacheService.getCaches(appPriceCacheDTOS), Long.class, BigDecimal.class);
List<Long> productIds = listKeywordVOS.stream().filter(s -> "PRODUCT".equalsIgnoreCase(s.getServeType())).map(ListKeywordVO::getServeId).collect(Collectors.toList()); List<Long> productIds = listKeywordVOS.stream().filter(s -> "PRODUCT".equalsIgnoreCase(s.getServeType())).map(ListKeywordVO::getServeId).collect(Collectors.toList());
productIds.addAll(appProductIds);
Map<Long, ProductDto> productDtoMap = productConsr.getProBasesByIds(productIds); Map<Long, ProductDto> productDtoMap = productConsr.getProBasesByIds(productIds);
Map<Long, Boolean> isSuperMap = productConsr.getIsSuperByProductIdList(productIds); Map<Long, Boolean> isSuperMap = productConsr.getIsSuperByProductIdList(productIds);
for (ListKeywordVO listKeywordVO : listKeywordVOS) { for (ListKeywordVO listKeywordVO : listKeywordVOS) {
if (ReplyTypeEnum.APP.value.equals(listKeywordVO.getReplyType())) { if (ReplyTypeEnum.APP.value.equals(listKeywordVO.getReplyType())) {
Long productId = 0L;
if ("APP".equalsIgnoreCase(listKeywordVO.getServeType())) { if ("APP".equalsIgnoreCase(listKeywordVO.getServeType())) {
Long appId = listKeywordVO.getServeId(); Long appId = listKeywordVO.getServeId();
AppDto appDto = appDtoMap.get(appId); AppDto appDto = appDtoMap.get(appId);
if (appDto != null) { if (appDto != null) {
listKeywordVO.setTypeCode(appDto.getTypeCode()); listKeywordVO.setTypeCode(appDto.getTypeCode());
} }
productId = appIdToProductIdMap.get(appId); if (appPriceMap != null) {
if (appPriceMap.get(appId) != null) {
listKeywordVO.setRetailPrice(appPriceMap.get(appId).doubleValue());
listKeywordVO.setDealPrice(0D);
}
}
listKeywordVO.setApSource("APP"); listKeywordVO.setApSource("APP");
} }
if ("PRODUCT".equalsIgnoreCase(listKeywordVO.getServeType())) { if ("PRODUCT".equalsIgnoreCase(listKeywordVO.getServeType())) {
productId = listKeywordVO.getServeId(); Long productId = listKeywordVO.getServeId();
ProductDto productDto = productDtoMap.get(productId); ProductDto productDto = productDtoMap.get(productId);
if (productDto != null) { if (productDto != null) {
listKeywordVO.setTypeCode(productDto.getProductTypeCode()); listKeywordVO.setTypeCode(productDto.getProductTypeCode());
}
//判断是否为超级作者作品
if (isSuperMap != null && isSuperMap.get(productId) != null && isSuperMap.get(productId)) {
listKeywordVO.setApSource("SUPER_PRODUCT");
}else {
listKeywordVO.setApSource("PRODUCT");
}
}
ProductDto productDto = null;
if (productId != null) {
productDto = productDtoMap.get(productId);
}
if (productDto != null) {
List<SpecificationDto> specificationDtos = productDto.getSpecification(); List<SpecificationDto> specificationDtos = productDto.getSpecification();
if (!ListUtils.isEmpty(specificationDtos)) { if (!ListUtils.isEmpty(specificationDtos)) {
SpecificationDto specificationDto = specificationDtos.get(0); SpecificationDto specificationDto = specificationDtos.get(0);
...@@ -961,6 +958,13 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -961,6 +958,13 @@ public class BookGroupBizImpl implements BookGroupBiz {
} }
} }
} }
//判断是否为超级作者作品
if (isSuperMap != null && isSuperMap.get(productId) != null && isSuperMap.get(productId)) {
listKeywordVO.setApSource("SUPER_PRODUCT");
} else {
listKeywordVO.setApSource("PRODUCT");
}
}
} }
} }
Map<Long,List<ListKeywordVO>> listMap=listKeywordVOS.stream().collect(Collectors.groupingBy(ListKeywordVO::getClassifyId)); Map<Long,List<ListKeywordVO>> listMap=listKeywordVOS.stream().collect(Collectors.groupingBy(ListKeywordVO::getClassifyId));
......
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