|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.logpm.statistics.service.impl; |
|
|
|
package com.logpm.statistics.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
@ -22,6 +23,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.Objects; |
|
|
@ -105,6 +107,11 @@ public class StatisticsBalanceOrderInfoServiceImpl extends BaseServiceImpl<Stati |
|
|
|
balanceAbnormalEntityQueryWrapper.eq("balance_order_info_id",balanceOrderInfoId); |
|
|
|
balanceAbnormalEntityQueryWrapper.eq("balance_order_info_id",balanceOrderInfoId); |
|
|
|
|
|
|
|
|
|
|
|
List<StatisticsBalanceAbnormalEntity> list = balanceAbnormalService.list(balanceAbnormalEntityQueryWrapper); |
|
|
|
List<StatisticsBalanceAbnormalEntity> list = balanceAbnormalService.list(balanceAbnormalEntityQueryWrapper); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(list.isEmpty()){ |
|
|
|
|
|
|
|
return R.data(CollUtil.newArrayList()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//把list中所有元素的id放到一个List集合中
|
|
|
|
//把list中所有元素的id放到一个List集合中
|
|
|
|
List<Long> idList= list.stream() |
|
|
|
List<Long> idList= list.stream() |
|
|
|
.map(StatisticsBalanceAbnormalEntity::getId) |
|
|
|
.map(StatisticsBalanceAbnormalEntity::getId) |
|
|
@ -118,13 +125,15 @@ public class StatisticsBalanceOrderInfoServiceImpl extends BaseServiceImpl<Stati |
|
|
|
Map<Long, List<StatisticsBalanceAbnormalPhotoEntity>> groupedPhotos = abnormalPhotoEntityList.stream() |
|
|
|
Map<Long, List<StatisticsBalanceAbnormalPhotoEntity>> groupedPhotos = abnormalPhotoEntityList.stream() |
|
|
|
.collect(Collectors.groupingBy(StatisticsBalanceAbnormalPhotoEntity::getAbnormalId)); |
|
|
|
.collect(Collectors.groupingBy(StatisticsBalanceAbnormalPhotoEntity::getAbnormalId)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<StatisticsBalanceAbnormalVO> abnormalVOList = new ArrayList<>(); |
|
|
|
list.forEach(balanceAbnormalEntity -> { |
|
|
|
list.forEach(balanceAbnormalEntity -> { |
|
|
|
StatisticsBalanceAbnormalVO balanceAbnormalVO = new StatisticsBalanceAbnormalVO(); |
|
|
|
StatisticsBalanceAbnormalVO balanceAbnormalVO = new StatisticsBalanceAbnormalVO(); |
|
|
|
BeanUtil.copy(balanceAbnormalEntity,balanceAbnormalVO); |
|
|
|
BeanUtil.copy(balanceAbnormalEntity,balanceAbnormalVO); |
|
|
|
balanceAbnormalVO.setAbnormalPhotoEntityList(groupedPhotos.get(balanceAbnormalEntity.getId())); |
|
|
|
balanceAbnormalVO.setAbnormalPhotoEntityList(groupedPhotos.get(balanceAbnormalEntity.getId())); |
|
|
|
|
|
|
|
abnormalVOList.add(balanceAbnormalVO); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return R.data(list); |
|
|
|
return R.data(abnormalVOList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@ -189,6 +198,11 @@ public class StatisticsBalanceOrderInfoServiceImpl extends BaseServiceImpl<Stati |
|
|
|
balanceAbnormalEntityQueryWrapper.eq("balance_order_info_id",balanceOrderInfoId); |
|
|
|
balanceAbnormalEntityQueryWrapper.eq("balance_order_info_id",balanceOrderInfoId); |
|
|
|
|
|
|
|
|
|
|
|
List<StatisticsBalanceRecordEntity> list = balanceRecordService.list(balanceAbnormalEntityQueryWrapper); |
|
|
|
List<StatisticsBalanceRecordEntity> list = balanceRecordService.list(balanceAbnormalEntityQueryWrapper); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(list.isEmpty()){ |
|
|
|
|
|
|
|
return R.data(CollUtil.newArrayList()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//把list中所有元素的id放到一个List集合中
|
|
|
|
//把list中所有元素的id放到一个List集合中
|
|
|
|
List<Long> idList= list.stream() |
|
|
|
List<Long> idList= list.stream() |
|
|
|
.map(StatisticsBalanceRecordEntity::getId) |
|
|
|
.map(StatisticsBalanceRecordEntity::getId) |
|
|
@ -202,15 +216,17 @@ public class StatisticsBalanceOrderInfoServiceImpl extends BaseServiceImpl<Stati |
|
|
|
Map<Long, List<StatisticsBalanceRecordPhotoEntity>> groupedPhotos = recordPhotoEntityList.stream() |
|
|
|
Map<Long, List<StatisticsBalanceRecordPhotoEntity>> groupedPhotos = recordPhotoEntityList.stream() |
|
|
|
.collect(Collectors.groupingBy(StatisticsBalanceRecordPhotoEntity::getRecordId)); |
|
|
|
.collect(Collectors.groupingBy(StatisticsBalanceRecordPhotoEntity::getRecordId)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<StatisticsBalanceRecordVO> balanceRecordVOS = new ArrayList<>(); |
|
|
|
list.forEach(balanceRecordEntity -> { |
|
|
|
list.forEach(balanceRecordEntity -> { |
|
|
|
StatisticsBalanceRecordVO balanceRecordVO = new StatisticsBalanceRecordVO(); |
|
|
|
StatisticsBalanceRecordVO balanceRecordVO = new StatisticsBalanceRecordVO(); |
|
|
|
BeanUtil.copy(balanceRecordEntity,balanceRecordVO); |
|
|
|
BeanUtil.copy(balanceRecordEntity,balanceRecordVO); |
|
|
|
balanceRecordVO.setRecordPhotoEntityList(groupedPhotos.get(balanceRecordEntity.getId())); |
|
|
|
balanceRecordVO.setRecordPhotoEntityList(groupedPhotos.get(balanceRecordEntity.getId())); |
|
|
|
balanceRecordVO.setBalanceUserName(balanceRecordEntity.getBalanceUserName()); |
|
|
|
balanceRecordVO.setBalanceUserName(balanceRecordEntity.getBalanceUserName()); |
|
|
|
balanceRecordVO.setBalanceRemark(balanceRecordEntity.getBalanceRemark()); |
|
|
|
balanceRecordVO.setBalanceRemark(balanceRecordEntity.getBalanceRemark()); |
|
|
|
|
|
|
|
balanceRecordVOS.add(balanceRecordVO); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return R.data(list); |
|
|
|
return R.data(balanceRecordVOS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|