|
@@ -107,13 +107,9 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase>
|
|
|
private PurchasePayRecordDetailService purchasePayRecordDetailService;
|
|
|
|
|
|
/**
|
|
|
- * 列表
|
|
|
- *
|
|
|
- * @param dto
|
|
|
- * @return
|
|
|
+ * 分页过滤条件复制
|
|
|
*/
|
|
|
- @Override
|
|
|
- public Page<PurchaseVo> getPage(PurchaseSelectDto dto) {
|
|
|
+ private IWrapper<Purchase> getPageWrapper(PurchaseSelectDto dto) {
|
|
|
IWrapper<Purchase> wrapper = getWrapper();
|
|
|
|
|
|
wrapper.eq("p", Purchase::getPurchaseStatus, dto.getPurchaseStatus());
|
|
@@ -128,6 +124,18 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase>
|
|
|
wrapper.le("p", Purchase::getCreateTime, dto.getEndTime());// 采购结束时间
|
|
|
|
|
|
wrapper.orderByDesc("p", Purchase::getCreateTime);
|
|
|
+ return wrapper;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 列表
|
|
|
+ *
|
|
|
+ * @param dto
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Page<PurchaseVo> getPage(PurchaseSelectDto dto) {
|
|
|
+ IWrapper<Purchase> wrapper = getPageWrapper(dto);
|
|
|
|
|
|
Page<PurchaseVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
List<PurchaseVo> list = page.getRecords();
|
|
@@ -371,7 +379,7 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase>
|
|
|
if (StringUtils.isEmpty(supplyId)) {
|
|
|
throw new ServiceException("供应商ID不能为空");
|
|
|
}
|
|
|
- List<Purchase> list = this.list(Wrappers.<Purchase>query().lambda().eq(Purchase::getSupplyId, supplyId).eq(Purchase::getPurchaseStatus, PurchaseStatusEnum.PASS.getKey()).ne(Purchase::getInvoiceType,"0"));
|
|
|
+ List<Purchase> list = this.list(Wrappers.<Purchase>query().lambda().eq(Purchase::getSupplyId, supplyId).eq(Purchase::getPurchaseStatus, PurchaseStatusEnum.PASS.getKey()).ne(Purchase::getInvoiceType, "0"));
|
|
|
List<Long> ids = list.stream().distinct().map(Purchase::getId).collect(Collectors.toList());
|
|
|
List<InvoiceDetailsVo> invoiceDetailsList = invoiceDetailsService.getSumMoneyByPurchaseIds(ids);
|
|
|
Map<Long, BigDecimal> invoiceMap = invoiceDetailsList.stream().collect(Collectors.toMap(InvoiceDetailsVo::getPurchaseId, InvoiceDetailsVo::getSumMoney));
|
|
@@ -392,6 +400,7 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase>
|
|
|
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 根据供应商查询无发票的采购合同
|
|
|
*
|
|
@@ -535,12 +544,13 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase>
|
|
|
|
|
|
/**
|
|
|
* 批量查询
|
|
|
+ *
|
|
|
* @param ids
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
public List<Purchase> getListInId(List<Long> ids) {
|
|
|
- List<Purchase> list = this.list(Wrappers.<Purchase>query().lambda().in(Purchase::getId,ids));
|
|
|
+ List<Purchase> list = this.list(Wrappers.<Purchase>query().lambda().in(Purchase::getId, ids));
|
|
|
return list;
|
|
|
}
|
|
|
|
|
@@ -574,39 +584,27 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase>
|
|
|
|
|
|
/**
|
|
|
* 采购头部统计
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public Map<String, Object> statisticsPurchaseHead() {
|
|
|
- long sumOrderCount = this.count(Wrappers.<Purchase>query().lambda().isNotNull(Purchase::getDataResourceId));
|
|
|
- long noArrivalOrderCount = this.count(Wrappers.<Purchase>query().lambda().isNotNull(Purchase::getDataResourceId).eq(Purchase::getArrivalStatus,0));
|
|
|
- long partArrivalOrderCount = this.count(Wrappers.<Purchase>query().lambda().isNotNull(Purchase::getDataResourceId).eq(Purchase::getArrivalStatus,10));
|
|
|
- long alArrivalOrderCount = this.count(Wrappers.<Purchase>query().lambda().isNotNull(Purchase::getDataResourceId).eq(Purchase::getArrivalStatus,20));
|
|
|
- BigDecimal sumPurchaseMoney = getSumMoney(-1);
|
|
|
- BigDecimal noArrivalPurchaseMoney = getSumMoney(0);
|
|
|
- BigDecimal partArrivalPurchaseMoney = getSumMoney(10);
|
|
|
- BigDecimal alArrivalPurchaseMoney = getSumMoney(20);
|
|
|
+ public Map<String, Object> statisticsPurchaseHead(PurchaseSelectDto dto) {
|
|
|
+ PurchaseVo sumOrder = baseMapper.getPurchaseHead(getPageWrapper(dto));
|
|
|
+ PurchaseVo noArrivalOrder = baseMapper.getPurchaseHead(getPageWrapper(dto).eq(Purchase::getArrivalStatus, 0));
|
|
|
+ PurchaseVo partArrivalOrder = baseMapper.getPurchaseHead(getPageWrapper(dto).eq(Purchase::getArrivalStatus, 10));
|
|
|
+ PurchaseVo alArrivalOrder = baseMapper.getPurchaseHead(getPageWrapper(dto).eq(Purchase::getArrivalStatus, 20));
|
|
|
+
|
|
|
//初始化MAP
|
|
|
Map<String, Object> map = new HashMap<String, Object>() {{
|
|
|
- put("sumOrderCount", sumOrderCount);
|
|
|
- put("sumPurchaseMoney", sumPurchaseMoney);
|
|
|
- put("noArrivalOrderCount", noArrivalOrderCount);
|
|
|
- put("noArrivalPurchaseMoney", noArrivalPurchaseMoney);
|
|
|
- put("partArrivalOrderCount",partArrivalOrderCount);
|
|
|
- put("partArrivalPurchaseMoney", partArrivalPurchaseMoney);
|
|
|
- put("alArrivalOrderCount", alArrivalOrderCount);
|
|
|
- put("alArrivalPurchaseMoney", alArrivalPurchaseMoney);
|
|
|
+ put("sumOrderCount", sumOrder.getPurchaseCount());
|
|
|
+ put("sumPurchaseMoney", sumOrder.getPurchaseMoney());
|
|
|
+ put("noArrivalOrderCount", noArrivalOrder.getPurchaseCount());
|
|
|
+ put("noArrivalPurchaseMoney", noArrivalOrder.getPurchaseMoney());
|
|
|
+ put("partArrivalOrderCount", partArrivalOrder.getPurchaseCount());
|
|
|
+ put("partArrivalPurchaseMoney", partArrivalOrder.getPurchaseMoney());
|
|
|
+ put("alArrivalOrderCount", alArrivalOrder.getPurchaseCount());
|
|
|
+ put("alArrivalPurchaseMoney", alArrivalOrder.getPurchaseMoney());
|
|
|
}};
|
|
|
return map;
|
|
|
}
|
|
|
-
|
|
|
- public BigDecimal getSumMoney(int arrivalStatus){
|
|
|
- QueryWrapper<Purchase> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.select("IFNULL(SUM(amount),0) as purchaseMoney");
|
|
|
- if(arrivalStatus!=-1){
|
|
|
- queryWrapper.eq("arrival_status",arrivalStatus);
|
|
|
- }
|
|
|
- BigDecimal purchaseMoney = (BigDecimal) this.getMap(queryWrapper).getOrDefault("purchaseMoney",BigDecimal.ZERO);
|
|
|
- return purchaseMoney;
|
|
|
- }
|
|
|
}
|