Browse Source

1.修复售后问题

master
pref_mail@163.com 10 months ago
parent
commit
debc3427b8
  1. 6
      blade-service-api/logpm-aftersales-api/src/main/java/com/logpm/aftersales/vo/AftersalesWorkOrderVO.java
  2. 12
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesCompletionRecordMapper.xml
  3. 1
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesWorkOrderMapper.xml
  4. 61
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesWorkOrderServiceImpl.java

6
blade-service-api/logpm-aftersales-api/src/main/java/com/logpm/aftersales/vo/AftersalesWorkOrderVO.java

@ -100,4 +100,10 @@ public class AftersalesWorkOrderVO extends AftersalesWorkOrderEntity {
private String ids;
private String typeServiceName;
/**
* 是否能申述
* 0 不能 1 可以申述
*/
private Integer canRepresentations;
}

12
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesCompletionRecordMapper.xml

@ -36,8 +36,16 @@
SELECT * FROM logpm_aftersales_completion_record ${ew.customSqlSegment}
</select>
<select id="getTotalMoney" resultType="java.lang.String">
SELECT SUM(money) AS money FROM logpm_aftersales_completion_record where work_order_id = #{param.id} and
is_deleted = 0 and warehouse_id = #{warehouseId}
SELECT SUM(money) AS money FROM logpm_aftersales_completion_record where
is_deleted = 0
<if test="#{param.id}!=null">
and work_order_id = #{param.id}
</if>
<if test="#{warehouseId} !=null">
and warehouse_id = #{warehouseId}
</if>
</select>
</mapper>

1
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/mapper/AftersalesWorkOrderMapper.xml

@ -54,7 +54,6 @@
<select id="pageListOwn" resultType="com.logpm.aftersales.entity.AftersalesWorkOrderEntity">
SELECT DISTINCT
lawo.id,
lawo.work_order_type,

61
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/service/impl/AftersalesWorkOrderServiceImpl.java

@ -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;
}
}
}
}
//
}

Loading…
Cancel
Save