|
|
|
@ -934,22 +934,29 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl<AftersalesWo
|
|
|
|
|
AftersalesWorkOrderEntity workOrderEntity = JSONObject.parseObject(JSONObject.toJSONString(aftersalesWorkOrder), AftersalesWorkOrderEntity.class); |
|
|
|
|
IPage<AftersalesWorkOrderEntity> iPage = baseMapper.pageListOwn(page, workOrderEntity); |
|
|
|
|
|
|
|
|
|
iPage.getRecords().forEach(i -> {}); |
|
|
|
|
// 获取售后工单的ID 集合
|
|
|
|
|
List<Long> workOrderIds = iPage.getRecords().stream().map(AftersalesWorkOrderEntity::getId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
// 需要判断当前作业仓库是否存在于责任方和处理方
|
|
|
|
|
// LambdaQueryWrapper<AftersalesProcessorEntity> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
// queryWrapper.eq(AftersalesProcessorEntity::getWorkOrderId,)
|
|
|
|
|
// aftersalesProcessorService.list()
|
|
|
|
|
|
|
|
|
|
IPage<AftersalesWorkOrderVO> data = AftersalesWorkOrderWrapper.build().pageVO(iPage); |
|
|
|
|
// 查询收款方
|
|
|
|
|
LambdaQueryWrapper<AftersalesCompletionRecipientEntity> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
queryWrapper.in(AftersalesCompletionRecipientEntity::getWorkOrderId,workOrderIds); |
|
|
|
|
List<AftersalesCompletionRecipientEntity> list = completionRecipientService.list(queryWrapper); |
|
|
|
|
// 收款方分组
|
|
|
|
|
Map<Long, List<AftersalesCompletionRecipientEntity>> collect = list.stream().collect(Collectors.groupingBy(AftersalesCompletionRecipientEntity::getWorkOrderId)); |
|
|
|
|
|
|
|
|
|
// 查询赔款方
|
|
|
|
|
LambdaQueryWrapper<AftersalesCompletionRecordEntity> queryWrapper1 = new LambdaQueryWrapper<>(); |
|
|
|
|
queryWrapper1.in(AftersalesCompletionRecordEntity::getWorkOrderId,workOrderIds); |
|
|
|
|
List<AftersalesCompletionRecordEntity> list1 = completionRecordService.list(queryWrapper1); |
|
|
|
|
// 赔款方付款分组
|
|
|
|
|
Map<Long, List<AftersalesCompletionRecordEntity>> collect1 = list1.stream().collect(Collectors.groupingBy(AftersalesCompletionRecordEntity::getWorkOrderId)); |
|
|
|
|
|
|
|
|
|
data.getRecords().forEach(i -> updateDepartStatus(i, user,myCurrentWarehouse)); |
|
|
|
|
|
|
|
|
|
IPage<AftersalesWorkOrderVO> data = AftersalesWorkOrderWrapper.build().pageVO(iPage); |
|
|
|
|
|
|
|
|
|
data.getRecords().forEach(i -> updateDepartStatus(i, user,myCurrentWarehouse,collect,collect1)); |
|
|
|
|
|
|
|
|
|
// 需要判断当前作业仓库是否存在于责任方和处理方
|
|
|
|
|
// LambdaQueryWrapper<AftersalesProcessorEntity> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
// queryWrapper.eq(AftersalesProcessorEntity::getWorkOrderId,)
|
|
|
|
|
// aftersalesProcessorService.list()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return data; |
|
|
|
@ -1068,7 +1075,9 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl<AftersalesWo
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void updateDepartStatus(AftersalesWorkOrderVO workOrder, BladeUser user, BasicdataWarehouseEntity myCurrentWarehouse) { |
|
|
|
|
private void updateDepartStatus(AftersalesWorkOrderVO workOrder, BladeUser user, BasicdataWarehouseEntity myCurrentWarehouse |
|
|
|
|
,Map<Long, List<AftersalesCompletionRecipientEntity>> collect, Map<Long, List<AftersalesCompletionRecordEntity>> collect1 |
|
|
|
|
) { |
|
|
|
|
if (ObjectUtils.isNotNull(workOrder.getCustomerServiceId())) { |
|
|
|
|
R<List<User>> listR = userSearchClient.listByUser(String.valueOf(workOrder.getCustomerServiceId())); |
|
|
|
|
if (ObjectUtils.isNotNull(listR.getData())) { |
|
|
|
@ -1080,9 +1089,33 @@ public class AftersalesWorkOrderServiceImpl extends BaseServiceImpl<AftersalesWo
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
workOrder.setTotalAmount(completionRecordService.getTotalMoney(workOrder,myCurrentWarehouse.getId())); |
|
|
|
|
Long id =null; |
|
|
|
|
if(ObjectUtils.isNotNull(myCurrentWarehouse)){ |
|
|
|
|
id=myCurrentWarehouse.getId(); |
|
|
|
|
} |
|
|
|
|
workOrder.setTotalAmount(completionRecordService.getTotalMoney(workOrder,id)); |
|
|
|
|
if(myCurrentWarehouse!=null){ |
|
|
|
|
List<AftersalesCompletionRecipientEntity> aftersalesCompletionRecipientEntities = collect.get(workOrder.getId()); |
|
|
|
|
if(ObjectUtils.isNotNull(aftersalesCompletionRecipientEntities)){ |
|
|
|
|
for (AftersalesCompletionRecipientEntity aftersalesProcessorEntity : aftersalesCompletionRecipientEntities) { |
|
|
|
|
if(myCurrentWarehouse.getId().equals(aftersalesProcessorEntity.getWarehouseId())){ |
|
|
|
|
workOrder.setCanRepresentations(1); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
List<AftersalesCompletionRecordEntity> aftersalesCompletionRecipientEntities1 = collect1.get(workOrder.getId()); |
|
|
|
|
if(ObjectUtils.isNotNull(aftersalesCompletionRecipientEntities1)){ |
|
|
|
|
for (AftersalesCompletionRecordEntity aftersalesCompletionRecipientEntity : aftersalesCompletionRecipientEntities1) { |
|
|
|
|
if(myCurrentWarehouse.getId().equals(aftersalesCompletionRecipientEntity.getWarehouseId())){ |
|
|
|
|
workOrder.setCanRepresentations(1); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|