Commit ed328fe2 by 阮思源

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

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