|
|
|
@ -20,6 +20,7 @@ import com.logpm.basicdata.vo.PriceDispatchVO;
|
|
|
|
|
import com.logpm.basicdata.vo.PriceWarehouseAdditionalVO; |
|
|
|
|
import com.logpm.basicdata.vo.PriceWarehouseBasicVO; |
|
|
|
|
import com.logpm.basicdata.vo.PriceWarehouseVO; |
|
|
|
|
import com.logpm.statistics.dto.AdvanceDetailDTO; |
|
|
|
|
import com.logpm.statistics.dto.AftersalesOrderDTO; |
|
|
|
|
import com.logpm.statistics.dto.ChangesRecordDTO; |
|
|
|
|
import com.logpm.statistics.dto.MerchantStatisticsDTO; |
|
|
|
@ -99,12 +100,16 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
|
|
|
|
|
|
|
|
|
|
//把records中所有的orderInfoId放入一个集合
|
|
|
|
|
List<Long> orderInfoIdList = records.stream().map(StatisticsOrderInfoVO::getOrderInfoId).collect(Collectors.toList()); |
|
|
|
|
// 得到运单ID
|
|
|
|
|
// 得到运单ID集合
|
|
|
|
|
Set<Long> waybillIds = records.stream().map(StatisticsOrderInfoVO::getWaybillId).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
|
|
// 查询运单明细集合
|
|
|
|
|
List<WaybillDetailByWaybillNoVo> waybillDetailByWaybillId = baseMapper.findWaybillDetailByWaybillId(waybillIds); |
|
|
|
|
|
|
|
|
|
//得到运单号
|
|
|
|
|
Set<String> orderCodeSet = records.stream().map(StatisticsOrderInfoVO::getOrderCode).collect(Collectors.toSet()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 通过运单号进行分组
|
|
|
|
|
Map<Long, List<WaybillDetailByWaybillNoVo>> waybillDetailByWaybillIdMap = waybillDetailByWaybillId.stream().collect(Collectors.groupingBy(WaybillDetailByWaybillNoVo::getWaybillId)); |
|
|
|
|
|
|
|
|
@ -122,10 +127,28 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
|
|
|
|
|
orderPackageInfoMap = null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<AdvanceDetailDTO> advanceDetailDTOS=baseMapper.selectAdvinceDetail(waybillIds, orderCodeSet); |
|
|
|
|
|
|
|
|
|
records.forEach(statisticsOrderInfoVO -> { |
|
|
|
|
// Long waybillId = statisticsOrderInfoVO.getWaybillId();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Long waybillId = statisticsOrderInfoVO.getWaybillId(); |
|
|
|
|
String orderCode = statisticsOrderInfoVO.getOrderCode(); |
|
|
|
|
// 查询站存单上的
|
|
|
|
|
|
|
|
|
|
List<AdvanceDetailDTO> advanceDetailDTOList = advanceDetailDTOS.stream(). |
|
|
|
|
filter(advanceDetailDTO -> advanceDetailDTO.getWaybillId().equals(waybillId) && advanceDetailDTO.getOrderCode().equals(orderCode)).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 对advanceDetailDTOList 按照 incomeCategoryName 进分组 并统计数量
|
|
|
|
|
Map<String, List<AdvanceDetailDTO>> collect = advanceDetailDTOList.stream().collect(Collectors.groupingBy(AdvanceDetailDTO::getIncomeCategoryName)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Long orderInfoId = statisticsOrderInfoVO.getOrderInfoId(); |
|
|
|
|
if(orderPackageInfoMap!=null){ |
|
|
|
|
|
|
|
|
@ -137,31 +160,82 @@ public class StatisticsOrderInfoServiceImpl extends BaseServiceImpl<StatisticsOr
|
|
|
|
|
BeanUtil.copy(statisticsPackageFeeInfoVO, statisticsOrderInfoVO); |
|
|
|
|
|
|
|
|
|
if(StringUtil.isNotBlank(statisticsOrderInfoVO.getGoodsName())){ |
|
|
|
|
String[] split = statisticsOrderInfoVO.getGoodsName().split(","); |
|
|
|
|
// String[] split = statisticsOrderInfoVO.getGoodsName().split(",");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<WaybillDetailByWaybillNoVo> waybillDetailByWaybillNoVos = waybillDetailByWaybillIdMap.get(statisticsOrderInfoVO.getWaybillId()); |
|
|
|
|
|
|
|
|
|
StringBuffer sb = new StringBuffer(); |
|
|
|
|
StringBuffer sb1 = new StringBuffer(); |
|
|
|
|
StringBuffer sb3 = new StringBuffer(); |
|
|
|
|
|
|
|
|
|
for (String s : split) { |
|
|
|
|
if(collect.isEmpty()){ |
|
|
|
|
|
|
|
|
|
Optional<WaybillDetailByWaybillNoVo> first = waybillDetailByWaybillNoVos.stream().filter(waybillDetailByWaybillNoVo -> waybillDetailByWaybillNoVo.getProductName().equals(s)).findFirst(); |
|
|
|
|
if(!waybillDetailByWaybillNoVos.isEmpty()){ |
|
|
|
|
|
|
|
|
|
if(first.isPresent()){ |
|
|
|
|
WaybillDetailByWaybillNoVo waybillDetailByWaybillNoVo = first.get(); |
|
|
|
|
for (WaybillDetailByWaybillNoVo waybillDetailByWaybillNoVo : waybillDetailByWaybillNoVos) { |
|
|
|
|
|
|
|
|
|
if(!sb3.toString().isEmpty()){ |
|
|
|
|
sb3.append(","); |
|
|
|
|
} |
|
|
|
|
sb3.append(waybillDetailByWaybillNoVo.getProductName()); |
|
|
|
|
|
|
|
|
|
if(!sb.toString().isEmpty()){ |
|
|
|
|
sb.append(","); |
|
|
|
|
} |
|
|
|
|
sb.append(waybillDetailByWaybillNoVo.getNum()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!sb1.toString().isEmpty()){ |
|
|
|
|
sb1.append(","); |
|
|
|
|
} |
|
|
|
|
sb1.append(waybillDetailByWaybillNoVo.getPrice()); |
|
|
|
|
|
|
|
|
|
if(!sb.toString().isEmpty()){ |
|
|
|
|
sb.append(","); |
|
|
|
|
} |
|
|
|
|
sb.append(waybillDetailByWaybillNoVo.getNum()); |
|
|
|
|
|
|
|
|
|
if(!sb1.toString().isEmpty()){ |
|
|
|
|
sb1.append(","); |
|
|
|
|
} |
|
|
|
|
sb1.append(waybillDetailByWaybillNoVo.getPrice()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
collect.keySet().forEach(s -> { |
|
|
|
|
if(!sb3.toString().isEmpty()){ |
|
|
|
|
sb3.append(","); |
|
|
|
|
} |
|
|
|
|
sb3.append(s); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<AdvanceDetailDTO> advanceDetailDTOS1 = collect.get(s); |
|
|
|
|
Optional<WaybillDetailByWaybillNoVo> first = waybillDetailByWaybillNoVos.stream().filter(waybillDetailByWaybillNoVo -> waybillDetailByWaybillNoVo.getProductName().equals(s)).findFirst(); |
|
|
|
|
|
|
|
|
|
if(first.isPresent()){ |
|
|
|
|
WaybillDetailByWaybillNoVo waybillDetailByWaybillNoVo = first.get(); |
|
|
|
|
|
|
|
|
|
if(!sb.toString().isEmpty()){ |
|
|
|
|
sb.append(","); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//统计 advanceDetailDTOS1 这个集合种 quantity 的和值
|
|
|
|
|
int sum = advanceDetailDTOS1.stream().mapToInt(AdvanceDetailDTO::getQuantity).sum(); |
|
|
|
|
sb.append(sum); |
|
|
|
|
|
|
|
|
|
if(!sb1.toString().isEmpty()){ |
|
|
|
|
sb1.append(","); |
|
|
|
|
} |
|
|
|
|
sb1.append(waybillDetailByWaybillNoVo.getPrice()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
statisticsOrderInfoVO.setGoodsName(sb3.toString()); |
|
|
|
|
statisticsOrderInfoVO.setGoodsNum(sb.toString()); |
|
|
|
|
statisticsOrderInfoVO.setGoodsPrice(sb1.toString()); |
|
|
|
|
} |
|
|
|
|