|
@@ -34,7 +34,6 @@ import com.fjhx.purchase.entity.subscribe.po.Subscribe;
|
|
|
import com.fjhx.purchase.entity.subscribe.po.SubscribeDetail;
|
|
|
import com.fjhx.purchase.mapper.purchase.PurchaseMapper;
|
|
|
import com.fjhx.purchase.service.arrival.ArrivalDetailService;
|
|
|
-import com.fjhx.purchase.service.arrival.ArrivalService;
|
|
|
import com.fjhx.purchase.service.invoice.InvoiceDetailsService;
|
|
|
import com.fjhx.purchase.service.pay.PayDetailService;
|
|
|
import com.fjhx.purchase.service.purchase.PurchaseDetailService;
|
|
@@ -46,7 +45,6 @@ import com.fjhx.supply.entity.supplier.po.SupplierInfo;
|
|
|
import com.fjhx.supply.service.supplier.SupplierInfoService;
|
|
|
import com.fjhx.wms.entity.warehouse.po.Warehouse;
|
|
|
import com.fjhx.wms.service.warehouse.WarehouseService;
|
|
|
-import com.ruoyi.common.core.domain.BaseIdPo;
|
|
|
import com.ruoyi.common.core.domain.BaseSelectDto;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.common.utils.PageUtils;
|
|
@@ -93,16 +91,13 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase>
|
|
|
private ArrivalDetailService arrivalDetailService;
|
|
|
|
|
|
@Autowired
|
|
|
- WarehouseService warehouseService;
|
|
|
+ private WarehouseService warehouseService;
|
|
|
|
|
|
@Autowired
|
|
|
- ArrivalService arrivalService;
|
|
|
+ private SubscribeDetailService subscribeDetailService;
|
|
|
|
|
|
@Autowired
|
|
|
- SubscribeDetailService subscribeDetailService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- SubscribeService subscribeService;
|
|
|
+ private SubscribeService subscribeService;
|
|
|
|
|
|
@Autowired
|
|
|
private CodingRuleService codingRuleService;
|
|
@@ -110,7 +105,6 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase>
|
|
|
@Autowired
|
|
|
private PurchasePayRecordDetailService purchasePayRecordDetailService;
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 列表
|
|
|
*
|
|
@@ -120,39 +114,31 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase>
|
|
|
@Override
|
|
|
public Page<PurchaseVo> getPage(PurchaseSelectDto dto) {
|
|
|
IWrapper<Purchase> wrapper = getWrapper();
|
|
|
- wrapper.orderByDesc("p", Purchase::getCreateTime);
|
|
|
- if (ObjectUtils.isNotEmpty(dto.getPurchaseStatus())) {
|
|
|
- wrapper.eq("p", Purchase::getPurchaseStatus, dto.getPurchaseStatus());
|
|
|
- }
|
|
|
- if (ObjectUtils.isNotEmpty(dto.getArrivalStatus())) {
|
|
|
- wrapper.eq("p", Purchase::getArrivalStatus, dto.getArrivalStatus());
|
|
|
- }
|
|
|
- if (ObjectUtils.isNotEmpty(dto.getPayStatus())) {
|
|
|
- wrapper.eq("p", Purchase::getPayStatus, dto.getPayStatus());
|
|
|
- }
|
|
|
|
|
|
- wrapper.like("p",Purchase::getCode,dto.getCode());//采购单号
|
|
|
- wrapper.eq("p",Purchase::getSupplyId,dto.getSupplyId());//供应商ID
|
|
|
+ wrapper.eq("p", Purchase::getPurchaseStatus, dto.getPurchaseStatus());
|
|
|
+ wrapper.eq("p", Purchase::getArrivalStatus, dto.getArrivalStatus());
|
|
|
+ wrapper.eq("p", Purchase::getPayStatus, dto.getPayStatus());
|
|
|
+ wrapper.like("p", Purchase::getCode, dto.getCode());// 采购单号
|
|
|
+ wrapper.eq("p", Purchase::getSupplyId, dto.getSupplyId());// 供应商ID
|
|
|
+ wrapper.eq("p", Purchase::getCode, dto.getKeyword());// 根据采购单号关键字搜索
|
|
|
+ wrapper.ge("p", Purchase::getAmount, dto.getStartAmount());// 采购开始金额
|
|
|
+ wrapper.le("p", Purchase::getAmount, dto.getEndAmount());// 采购结束金额
|
|
|
+ wrapper.ge("P", Purchase::getCreateTime, dto.getBeginTime());// 采购开始时间
|
|
|
+ wrapper.le("p", Purchase::getCreateTime, dto.getEndTime());// 采购结束时间
|
|
|
|
|
|
- wrapper.eq("p", Purchase::getCode, dto.getKeyword());//根据采购单号关键字搜索
|
|
|
+ wrapper.orderByDesc("p", Purchase::getCreateTime);
|
|
|
|
|
|
- wrapper.ge("p",Purchase::getAmount,dto.getStartAmount());//采购开始金额
|
|
|
- wrapper.le("p",Purchase::getAmount,dto.getEndAmount());//采购结束金额
|
|
|
- wrapper.ge("P",Purchase::getCreateTime,dto.getBeginTime());//采购开始时间
|
|
|
- wrapper.le("p",Purchase::getCreateTime,dto.getEndTime());//采购结束时间
|
|
|
Page<PurchaseVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
List<PurchaseVo> list = page.getRecords();
|
|
|
- if (CollectionUtils.isNotEmpty(list)) {
|
|
|
- List<Long> supplyIds = list.stream().map(PurchaseVo::getSupplyId).collect(Collectors.toList());
|
|
|
- List<SupplierInfo> supplierInfoList = supplierInfoService.list(Wrappers.<SupplierInfo>query().lambda().in(SupplierInfo::getId, supplyIds));
|
|
|
- Map<Long, List<SupplierInfo>> supplyMap = supplierInfoList.stream().distinct().collect(Collectors.groupingBy(SupplierInfo::getId));
|
|
|
- if (MapUtils.isNotEmpty(supplyMap)) {
|
|
|
- for (PurchaseVo p : list) {
|
|
|
- List<SupplierInfo> supplys = supplyMap.getOrDefault(p.getSupplyId(), null);
|
|
|
- p.setSupplyName(supplys == null ? null : supplys.get(0).getName());
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
+ return page;
|
|
|
}
|
|
|
+
|
|
|
+ supplierInfoService.attributeAssign(list, PurchaseVo::getSupplyId, (item, supplierInfo) -> {
|
|
|
+ item.setSupplyName(supplierInfo.getName());
|
|
|
+ });
|
|
|
+
|
|
|
return page;
|
|
|
}
|
|
|
|