From 5908c563c7ba044401b35bbb88ac1b060d85a7bc Mon Sep 17 00:00:00 2001 From: zhenghaoyu Date: Wed, 29 May 2024 16:02:26 +0800 Subject: [PATCH] =?UTF-8?q?1.=E7=BB=93=E7=AE=97=E5=8A=9F=E8=83=BD=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../statistics/dto/MerchantStatisticsDTO.java | 2 +- .../dto/StatisticsBalanceRecordDTO.java | 3 ++- .../controller/MerchantBalanceController.java | 12 +++++------ .../mapper/StatisticsOrderInfoMapper.xml | 20 +++++++++---------- ...StatisticsBalanceOrderInfoServiceImpl.java | 20 +++++++++++++++++-- 5 files changed, 37 insertions(+), 20 deletions(-) diff --git a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/MerchantStatisticsDTO.java b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/MerchantStatisticsDTO.java index 2b84490e0..b9f8ac49b 100644 --- a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/MerchantStatisticsDTO.java +++ b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/MerchantStatisticsDTO.java @@ -23,6 +23,6 @@ public class MerchantStatisticsDTO implements Serializable { private List orderInfoIds; - private Long balanceOrderId; + private Long balanceOrderInfoId; } diff --git a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/StatisticsBalanceRecordDTO.java b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/StatisticsBalanceRecordDTO.java index b693279b2..332887812 100644 --- a/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/StatisticsBalanceRecordDTO.java +++ b/blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/StatisticsBalanceRecordDTO.java @@ -4,11 +4,12 @@ import com.logpm.statistics.entity.StatisticsBalanceRecordEntity; import com.logpm.statistics.entity.StatisticsBalanceRecordPhotoEntity; import lombok.Data; +import java.util.ArrayList; import java.util.List; @Data public class StatisticsBalanceRecordDTO extends StatisticsBalanceRecordEntity { - private List recordPhotoEntityList; + private List recordPhotoEntityList = new ArrayList<>(); } diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/controller/MerchantBalanceController.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/controller/MerchantBalanceController.java index 5d67944a7..1126c8020 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/controller/MerchantBalanceController.java +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/controller/MerchantBalanceController.java @@ -133,7 +133,7 @@ public class MerchantBalanceController { @ResponseBody @PostMapping("/findRecordList") @ApiOperationSupport(order = 1) - @ApiOperation(value = "查询异常列表", notes = "传入balanceRecordDTO") + @ApiOperation(value = "查询结算记录列表", notes = "传入balanceRecordDTO") public R findRecordList(@RequestBody StatisticsBalanceRecordDTO balanceRecordDTO) { String method = "############findRecordList: "; log.info(method+"请求参数{}",balanceRecordDTO); @@ -158,19 +158,19 @@ public class MerchantBalanceController { @ResponseBody @PostMapping("/findBalanceDetail") @ApiOperationSupport(order = 1) - @ApiOperation(value = "查询异常列表", notes = "传入merchantStatisticsDTO") + @ApiOperation(value = "查询结算单详情", notes = "传入merchantStatisticsDTO") public R findBalanceDetail(@RequestBody MerchantStatisticsDTO merchantStatisticsDTO) { String method = "############findBalanceDetail: "; log.info(method+"请求参数{}",merchantStatisticsDTO); try{ - Long balanceOrderId = merchantStatisticsDTO.getBalanceOrderId(); - if(Objects.isNull(balanceOrderId)){ - log.warn(method+"请选择正确的结算单 balanceOrderId={}",balanceOrderId); + Long balanceOrderInfoId = merchantStatisticsDTO.getBalanceOrderInfoId(); + if(Objects.isNull(balanceOrderInfoId)){ + log.warn(method+"请选择正确的结算单 balanceOrderInfoId={}",balanceOrderInfoId); return R.fail(405,"请选择正确的结算单"); } - return balanceOrderInfoService.findBalanceDetail(balanceOrderId); + return balanceOrderInfoService.findBalanceDetail(balanceOrderInfoId); }catch (CustomerException e){ log.error(e.message,e); return R.fail(e.code,e.message); diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml index 8a11e5bd8..e0663c77c 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml @@ -39,11 +39,11 @@ GROUP_CONCAT(lscr.remark) changesRemark, MAX(lscr.create_time) changesTime, GROUP_CONCAT(DISTINCT lstp.product_name) goodsName, - sum(lstp.total_num) totalcount, - sum(lstp.total_weight) totalWeight, - sum(lstp.total_volume) totalVolume, - sum(lstp.open_price+lswp.open_price+lsdp.open_price) openFee, - sum(lstp.total_price+lswp.total_price+lsdp.total_price) totalFee, + IFNULL(sum(lstp.total_num),0) totalcount, + IFNULL(sum(lstp.total_weight),0) totalWeight, + IFNULL(sum(lstp.total_volume),0) totalVolume, + IFNULL(sum(lstp.open_price+lswp.open_price+lsdp.open_price),0) openFee, + IFNULL(sum(lstp.total_price+lswp.total_price+lsdp.total_price),0) totalFee, sum(lstp.pickup_fee) pickupFee, sum(lstp.real_pickup_fee) realPickupFee, sum(lstp.freight_fee) freightFee, @@ -159,11 +159,11 @@ GROUP_CONCAT(lscr.remark) changesRemark, MAX(lscr.create_time) changesTime, GROUP_CONCAT(DISTINCT lstp.product_name) goodsName, - sum(lstp.total_num) totalcount, - sum(lstp.total_weight) totalWeight, - sum(lstp.total_volume) totalVolume, - sum(lstp.open_price+lswp.open_price+lsdp.open_price) openFee, - sum(lstp.total_price+lswp.total_price+lsdp.total_price) totalFee, + IFNULL(sum(lstp.total_num),0) totalcount, + IFNULL(sum(lstp.total_weight),0) totalWeight, + IFNULL(sum(lstp.total_volume),0) totalVolume, + IFNULL(sum(lstp.open_price+lswp.open_price+lsdp.open_price),0) openFee, + IFNULL(sum(lstp.total_price+lswp.total_price+lsdp.total_price),0) totalFee, sum(lstp.pickup_fee) pickupFee, sum(lstp.real_pickup_fee) realPickupFee, sum(lstp.freight_fee) freightFee, diff --git a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsBalanceOrderInfoServiceImpl.java b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsBalanceOrderInfoServiceImpl.java index 2181a44ab..d742108ac 100644 --- a/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsBalanceOrderInfoServiceImpl.java +++ b/blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsBalanceOrderInfoServiceImpl.java @@ -1,5 +1,6 @@ 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.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -22,6 +23,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; @@ -105,6 +107,11 @@ public class StatisticsBalanceOrderInfoServiceImpl extends BaseServiceImpl list = balanceAbnormalService.list(balanceAbnormalEntityQueryWrapper); + + if(list.isEmpty()){ + return R.data(CollUtil.newArrayList()); + } + //把list中所有元素的id放到一个List集合中 List idList= list.stream() .map(StatisticsBalanceAbnormalEntity::getId) @@ -118,13 +125,15 @@ public class StatisticsBalanceOrderInfoServiceImpl extends BaseServiceImpl> groupedPhotos = abnormalPhotoEntityList.stream() .collect(Collectors.groupingBy(StatisticsBalanceAbnormalPhotoEntity::getAbnormalId)); + List abnormalVOList = new ArrayList<>(); list.forEach(balanceAbnormalEntity -> { StatisticsBalanceAbnormalVO balanceAbnormalVO = new StatisticsBalanceAbnormalVO(); BeanUtil.copy(balanceAbnormalEntity,balanceAbnormalVO); balanceAbnormalVO.setAbnormalPhotoEntityList(groupedPhotos.get(balanceAbnormalEntity.getId())); + abnormalVOList.add(balanceAbnormalVO); }); - return R.data(list); + return R.data(abnormalVOList); } @Transactional(rollbackFor = Exception.class) @@ -189,6 +198,11 @@ public class StatisticsBalanceOrderInfoServiceImpl extends BaseServiceImpl list = balanceRecordService.list(balanceAbnormalEntityQueryWrapper); + + if(list.isEmpty()){ + return R.data(CollUtil.newArrayList()); + } + //把list中所有元素的id放到一个List集合中 List idList= list.stream() .map(StatisticsBalanceRecordEntity::getId) @@ -202,15 +216,17 @@ public class StatisticsBalanceOrderInfoServiceImpl extends BaseServiceImpl> groupedPhotos = recordPhotoEntityList.stream() .collect(Collectors.groupingBy(StatisticsBalanceRecordPhotoEntity::getRecordId)); + List balanceRecordVOS = new ArrayList<>(); list.forEach(balanceRecordEntity -> { StatisticsBalanceRecordVO balanceRecordVO = new StatisticsBalanceRecordVO(); BeanUtil.copy(balanceRecordEntity,balanceRecordVO); balanceRecordVO.setRecordPhotoEntityList(groupedPhotos.get(balanceRecordEntity.getId())); balanceRecordVO.setBalanceUserName(balanceRecordEntity.getBalanceUserName()); balanceRecordVO.setBalanceRemark(balanceRecordEntity.getBalanceRemark()); + balanceRecordVOS.add(balanceRecordVO); }); - return R.data(list); + return R.data(balanceRecordVOS); } @Override