Browse Source

1.结算功能模块更新

dist.1.3.0
zhenghaoyu 10 months ago
parent
commit
5908c563c7
  1. 2
      blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/MerchantStatisticsDTO.java
  2. 3
      blade-service-api/logpm-statisticsdata-api/src/main/java/com/logpm/statistics/dto/StatisticsBalanceRecordDTO.java
  3. 12
      blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/controller/MerchantBalanceController.java
  4. 20
      blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml
  5. 20
      blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsBalanceOrderInfoServiceImpl.java

2
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<Long> orderInfoIds; private List<Long> orderInfoIds;
private Long balanceOrderId; private Long balanceOrderInfoId;
} }

3
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 com.logpm.statistics.entity.StatisticsBalanceRecordPhotoEntity;
import lombok.Data; import lombok.Data;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@Data @Data
public class StatisticsBalanceRecordDTO extends StatisticsBalanceRecordEntity { public class StatisticsBalanceRecordDTO extends StatisticsBalanceRecordEntity {
private List<StatisticsBalanceRecordPhotoEntity> recordPhotoEntityList; private List<StatisticsBalanceRecordPhotoEntity> recordPhotoEntityList = new ArrayList<>();
} }

12
blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/controller/MerchantBalanceController.java

@ -133,7 +133,7 @@ public class MerchantBalanceController {
@ResponseBody @ResponseBody
@PostMapping("/findRecordList") @PostMapping("/findRecordList")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "查询异常列表", notes = "传入balanceRecordDTO") @ApiOperation(value = "查询结算记录列表", notes = "传入balanceRecordDTO")
public R findRecordList(@RequestBody StatisticsBalanceRecordDTO balanceRecordDTO) { public R findRecordList(@RequestBody StatisticsBalanceRecordDTO balanceRecordDTO) {
String method = "############findRecordList: "; String method = "############findRecordList: ";
log.info(method+"请求参数{}",balanceRecordDTO); log.info(method+"请求参数{}",balanceRecordDTO);
@ -158,19 +158,19 @@ public class MerchantBalanceController {
@ResponseBody @ResponseBody
@PostMapping("/findBalanceDetail") @PostMapping("/findBalanceDetail")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "查询异常列表", notes = "传入merchantStatisticsDTO") @ApiOperation(value = "查询结算单详情", notes = "传入merchantStatisticsDTO")
public R findBalanceDetail(@RequestBody MerchantStatisticsDTO merchantStatisticsDTO) { public R findBalanceDetail(@RequestBody MerchantStatisticsDTO merchantStatisticsDTO) {
String method = "############findBalanceDetail: "; String method = "############findBalanceDetail: ";
log.info(method+"请求参数{}",merchantStatisticsDTO); log.info(method+"请求参数{}",merchantStatisticsDTO);
try{ try{
Long balanceOrderId = merchantStatisticsDTO.getBalanceOrderId(); Long balanceOrderInfoId = merchantStatisticsDTO.getBalanceOrderInfoId();
if(Objects.isNull(balanceOrderId)){ if(Objects.isNull(balanceOrderInfoId)){
log.warn(method+"请选择正确的结算单 balanceOrderId={}",balanceOrderId); log.warn(method+"请选择正确的结算单 balanceOrderInfoId={}",balanceOrderInfoId);
return R.fail(405,"请选择正确的结算单"); return R.fail(405,"请选择正确的结算单");
} }
return balanceOrderInfoService.findBalanceDetail(balanceOrderId); return balanceOrderInfoService.findBalanceDetail(balanceOrderInfoId);
}catch (CustomerException e){ }catch (CustomerException e){
log.error(e.message,e); log.error(e.message,e);
return R.fail(e.code,e.message); return R.fail(e.code,e.message);

20
blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/mapper/StatisticsOrderInfoMapper.xml

@ -39,11 +39,11 @@
GROUP_CONCAT(lscr.remark) changesRemark, GROUP_CONCAT(lscr.remark) changesRemark,
MAX(lscr.create_time) changesTime, MAX(lscr.create_time) changesTime,
GROUP_CONCAT(DISTINCT lstp.product_name) goodsName, GROUP_CONCAT(DISTINCT lstp.product_name) goodsName,
sum(lstp.total_num) totalcount, IFNULL(sum(lstp.total_num),0) totalcount,
sum(lstp.total_weight) totalWeight, IFNULL(sum(lstp.total_weight),0) totalWeight,
sum(lstp.total_volume) totalVolume, IFNULL(sum(lstp.total_volume),0) totalVolume,
sum(lstp.open_price+lswp.open_price+lsdp.open_price) openFee, IFNULL(sum(lstp.open_price+lswp.open_price+lsdp.open_price),0) openFee,
sum(lstp.total_price+lswp.total_price+lsdp.total_price) totalFee, IFNULL(sum(lstp.total_price+lswp.total_price+lsdp.total_price),0) totalFee,
sum(lstp.pickup_fee) pickupFee, sum(lstp.pickup_fee) pickupFee,
sum(lstp.real_pickup_fee) realPickupFee, sum(lstp.real_pickup_fee) realPickupFee,
sum(lstp.freight_fee) freightFee, sum(lstp.freight_fee) freightFee,
@ -159,11 +159,11 @@
GROUP_CONCAT(lscr.remark) changesRemark, GROUP_CONCAT(lscr.remark) changesRemark,
MAX(lscr.create_time) changesTime, MAX(lscr.create_time) changesTime,
GROUP_CONCAT(DISTINCT lstp.product_name) goodsName, GROUP_CONCAT(DISTINCT lstp.product_name) goodsName,
sum(lstp.total_num) totalcount, IFNULL(sum(lstp.total_num),0) totalcount,
sum(lstp.total_weight) totalWeight, IFNULL(sum(lstp.total_weight),0) totalWeight,
sum(lstp.total_volume) totalVolume, IFNULL(sum(lstp.total_volume),0) totalVolume,
sum(lstp.open_price+lswp.open_price+lsdp.open_price) openFee, IFNULL(sum(lstp.open_price+lswp.open_price+lsdp.open_price),0) openFee,
sum(lstp.total_price+lswp.total_price+lsdp.total_price) totalFee, IFNULL(sum(lstp.total_price+lswp.total_price+lsdp.total_price),0) totalFee,
sum(lstp.pickup_fee) pickupFee, sum(lstp.pickup_fee) pickupFee,
sum(lstp.real_pickup_fee) realPickupFee, sum(lstp.real_pickup_fee) realPickupFee,
sum(lstp.freight_fee) freightFee, sum(lstp.freight_fee) freightFee,

20
blade-service/logpm-statisticsdata/src/main/java/com/logpm/statistics/service/impl/StatisticsBalanceOrderInfoServiceImpl.java

@ -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

Loading…
Cancel
Save