|
@ -1,12 +1,19 @@ |
|
|
package com.ruoyi.aftersales.service.impl; |
|
|
package com.ruoyi.aftersales.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.HashSet; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Set; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
import com.ruoyi.aftersales.domain.AfterSalesShippingDevice; |
|
|
import com.ruoyi.aftersales.domain.AftersalesOutOrderDetail; |
|
|
import com.ruoyi.aftersales.domain.AftersalesOutOrderDetail; |
|
|
|
|
|
import com.ruoyi.aftersales.domain.vo.SelectShippingDeviceVO; |
|
|
|
|
|
import com.ruoyi.aftersales.mapper.AfterSalesShippingDeviceMapper; |
|
|
import com.ruoyi.aftersales.mapper.AftersalesOutOrderDetailMapper; |
|
|
import com.ruoyi.aftersales.mapper.AftersalesOutOrderDetailMapper; |
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
import com.ruoyi.common.utils.ShiroUtils; |
|
|
|
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import com.ruoyi.aftersales.mapper.AftersalesOutOrderMapper; |
|
|
import com.ruoyi.aftersales.mapper.AftersalesOutOrderMapper; |
|
@ -29,6 +36,9 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService |
|
|
@Autowired |
|
|
@Autowired |
|
|
private AftersalesOutOrderDetailMapper aftersalesOutOrderDetailMapper; |
|
|
private AftersalesOutOrderDetailMapper aftersalesOutOrderDetailMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private AfterSalesShippingDeviceMapper afterSalesShippingDeviceMapper; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 查询售后维护设备出库 |
|
|
* 查询售后维护设备出库 |
|
|
* |
|
|
* |
|
@ -171,4 +181,64 @@ public class AftersalesOutOrderServiceImpl implements IAftersalesOutOrderService |
|
|
return filterList; |
|
|
return filterList; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 售后第一次维护设备,添加出货设备信息,展示销售订单的出货设备信息 |
|
|
|
|
|
* */ |
|
|
|
|
|
@Override |
|
|
|
|
|
public List<SelectShippingDeviceVO> getThisSalesOrderShippingDevices(AftersalesOutOrder aftersalesOutOrder) { |
|
|
|
|
|
|
|
|
|
|
|
List<SelectShippingDeviceVO> selectShippingDeviceVOS = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
String relatedOrderCode = aftersalesOutOrder.getRelatedOrderCode(); |
|
|
|
|
|
String salesOrderCode = aftersalesOutOrder.getSalesOrderCode(); |
|
|
|
|
|
//优先使用销售订单号关联
|
|
|
|
|
|
if (StringUtils.isNotEmpty(salesOrderCode)){ |
|
|
|
|
|
List<AfterSalesShippingDevice> afterSalesShippingDevices = afterSalesShippingDeviceMapper.selectShippingDeviceBySalesOrderCode(salesOrderCode); |
|
|
|
|
|
convertToDeviceVOs(afterSalesShippingDevices, selectShippingDeviceVOS); |
|
|
|
|
|
}else { |
|
|
|
|
|
// 关联订单号可能存在逗号分隔的情况
|
|
|
|
|
|
String[] splitRelatedOrderCode = relatedOrderCode.split(","); |
|
|
|
|
|
List<AfterSalesShippingDevice> afterSalesShippingDevices = afterSalesShippingDeviceMapper.selectBatchShippingDeviceBySalesOrderCode(splitRelatedOrderCode); |
|
|
|
|
|
convertToDeviceVOs(afterSalesShippingDevices, selectShippingDeviceVOS); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return selectShippingDeviceVOS; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 售后第一次维护设备,添加出货设备信息,展示其他销售订单的出货设备信息 |
|
|
|
|
|
* */ |
|
|
|
|
|
@Override |
|
|
|
|
|
public List<SelectShippingDeviceVO> getOtherSalesOrderShippingDevices(AftersalesOutOrder aftersalesOutOrder) { |
|
|
|
|
|
|
|
|
|
|
|
List<SelectShippingDeviceVO> selectShippingDeviceVOS = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
List<SelectShippingDeviceVO> thisSalesOrderShippingDevices = this.getThisSalesOrderShippingDevices(aftersalesOutOrder); |
|
|
|
|
|
//查找到当前销售订单的出货设备id集合
|
|
|
|
|
|
List<String> collectShippingDeviceId = thisSalesOrderShippingDevices.stream().map(SelectShippingDeviceVO::getShippingDeviceId).collect(Collectors.toList()); |
|
|
|
|
|
//查找到所有出货设备id集合
|
|
|
|
|
|
List<AfterSalesShippingDevice> afterSalesShippingDevices = afterSalesShippingDeviceMapper.selectAllShippingDevices(); |
|
|
|
|
|
List<String> allShippingDeviceIds = afterSalesShippingDevices.stream().map(AfterSalesShippingDevice::getShippingDeviceId).collect(Collectors.toList()); |
|
|
|
|
|
//筛选出所有出货设备id集合中,不在当前销售订单的出货设备id集合中的数据
|
|
|
|
|
|
List<String> otherShippingDeviceIds = allShippingDeviceIds.stream().filter(item -> !collectShippingDeviceId.contains(item)).collect(Collectors.toList()); |
|
|
|
|
|
List<AfterSalesShippingDevice> list = afterSalesShippingDeviceMapper.selectBatchShippingDeviceById(otherShippingDeviceIds); |
|
|
|
|
|
//转换成vo类
|
|
|
|
|
|
this.convertToDeviceVOs(list, selectShippingDeviceVOS); |
|
|
|
|
|
return selectShippingDeviceVOS; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//转换成vo类
|
|
|
|
|
|
private void convertToDeviceVOs(List<AfterSalesShippingDevice> afterSalesShippingDevices, List<SelectShippingDeviceVO> selectShippingDeviceVOS) { |
|
|
|
|
|
for (AfterSalesShippingDevice device : afterSalesShippingDevices) { |
|
|
|
|
|
SelectShippingDeviceVO selectShippingDeviceVO = new SelectShippingDeviceVO(); |
|
|
|
|
|
selectShippingDeviceVO.setShippingDeviceId(device.getShippingDeviceId()); |
|
|
|
|
|
selectShippingDeviceVO.setDeviceModelCode(device.getDeviceModelCode()); |
|
|
|
|
|
selectShippingDeviceVO.setDeviceRunningNumber(device.getDeviceRunningNumber()); |
|
|
|
|
|
selectShippingDeviceVO.setMakePhotoUrl(device.getMakePhotourl()); |
|
|
|
|
|
selectShippingDeviceVOS.add(selectShippingDeviceVO); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|