Parcourir la source

Merge branch 'master' into test

yzc il y a 1 an
Parent
commit
fa4d8bfd8c

+ 16 - 2
hx-purchase/src/main/java/com/fjhx/purchase/controller/purchase/PurchaseController.java

@@ -66,6 +66,14 @@ public class PurchaseController {
     }
 
     /**
+     * 批量查询采购单
+     */
+    @PostMapping("/getListInId")
+    public List<Purchase> getListInId(@RequestBody List<Long> ids) {
+        return purchaseService.getListInId(ids);
+    }
+
+    /**
      * 采购新增
      */
     @PostMapping("/add")
@@ -90,13 +98,19 @@ public class PurchaseController {
     }
 
     /**
+     * 根据供应商查询无发票的采购合同
+     */
+    @GetMapping("/getNoInvoiceListBySupplyId")
+    public List<Purchase> getNoInvoiceListBySupplyId(@RequestParam("supplyId") String supplyId) {
+        return purchaseService.getNoInvoiceListBySupplyId(supplyId);
+    }
+    /**
      * 根据供应商查询采购合同
      */
     @GetMapping("/getListBySupplyId")
     public List<Purchase> getListBySupplyId(@RequestParam("supplyId") String supplyId) {
-        return purchaseService.getListBySupplyId(supplyId);
+        return purchaseService.getNoInvoiceListBySupplyId(supplyId);
     }
-
     /**
      * 货款账单
      */

+ 15 - 0
hx-purchase/src/main/java/com/fjhx/purchase/service/purchase/PurchaseService.java

@@ -54,6 +54,14 @@ public interface PurchaseService extends BaseService<Purchase> {
     void delete(Long id);
 
     /**
+     * 根据供应商查询无发票的采购合同
+     *
+     * @param supplyId
+     * @return
+     */
+    List<Purchase> getNoInvoiceListBySupplyId(String supplyId);
+
+    /**
      * 根据供应商查询采购合同
      *
      * @param supplyId
@@ -70,4 +78,11 @@ public interface PurchaseService extends BaseService<Purchase> {
      * 采购统计(采购列表)
      */
     Map<String,Object> purchaseStatistics(PurchaseSelectDto dto);
+
+    /**
+     * 批量查询
+     * @param ids
+     * @return
+     */
+    List<Purchase> getListInId(List<Long> ids);
 }

+ 44 - 1
hx-purchase/src/main/java/com/fjhx/purchase/service/purchase/impl/PurchaseServiceImpl.java

@@ -361,7 +361,39 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase>
     }
 
     /**
-     * 根据供应商查询采购合同
+     * 根据供应商查询无发票的采购合同
+     *
+     * @param supplyId
+     * @return
+     */
+    @Override
+    public List<Purchase> getNoInvoiceListBySupplyId(String supplyId) {
+        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<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));
+        List<PayDetailVo> payDetailVoList = payDetailService.getSumMoneyByPurchaseIds(ids);
+        Map<Long, BigDecimal> payMap = payDetailVoList.stream().collect(Collectors.toMap(PayDetailVo::getPurchaseId, PayDetailVo::getSumMoney));
+        for (Purchase p : list) {
+            if (MapUtils.isNotEmpty(invoiceMap)) {
+                p.setSumInvoiceMoney(invoiceMap.getOrDefault(p.getId(), BigDecimal.ZERO));
+            } else {
+                p.setSumInvoiceMoney(BigDecimal.ZERO);
+            }
+            if (MapUtils.isNotEmpty(payMap)) {
+                p.setSumPayMoney(payMap.getOrDefault(p.getId(), BigDecimal.ZERO));
+            } else {
+                p.setSumPayMoney(BigDecimal.ZERO);
+            }
+        }
+
+        return list;
+    }
+    /**
+     * 根据供应商查询无发票的采购合同
      *
      * @param supplyId
      * @return
@@ -501,6 +533,17 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase>
         return map;
     }
 
+    /**
+     * 批量查询
+     * @param ids
+     * @return
+     */
+    @Override
+    public List<Purchase> getListInId(List<Long> ids) {
+        List<Purchase> list = this.list(Wrappers.<Purchase>query().lambda().in(Purchase::getId,ids));
+        return list;
+    }
+
     @Override
     public Page<? extends DocumentaryData> getDocumentaryPage(JSONObject selectData, BaseSelectDto
             dto, List<Long> excludeBusinessId) {

+ 5 - 5
hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractServiceImpl.java

@@ -214,7 +214,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
             wrapper.eq("t1", Contract::getSellCorporationId, dto.getSellCorporationId());
         }
         if (StringUtils.isNotEmpty(dto.getRefundStatusNew())) {
-            wrapper.in("t1.refundStatusNew", dto.getRefundStatusNew().split(","));
+            wrapper.in("t1.refundStatusNew", Arrays.asList(dto.getRefundStatusNew().split(",")));
         }
         if (StringUtils.isNotEmpty(dto.getKeyword())) {
             wrapper.keyword(dto.getKeyword(), new SqlField("t1", Contract::getCode));
@@ -897,7 +897,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         List<PurchaseDetail> purchaseDetailList = purchaseDetailService.list(q -> q.in(PurchaseDetail::getPurchaseId, purchaseIdList));
 
         // 赋值关联销售合同
-        setContractInfo(vo, purchaseDetailList);
+        setContractInfo(vo, purchaseList);
 
         // 赋值采购合同数据
         setPurchaseInfo(vo, purchaseList, purchaseDetailList);
@@ -1024,11 +1024,11 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
     /**
      * 赋值销售合同数据
      */
-    private void setContractInfo(PayDecisionAidVo vo, List<PurchaseDetail> purchaseDetailList) {
+    private void setContractInfo(PayDecisionAidVo vo, List<Purchase> purchaseList) {
 
-        List<Long> contractIdList = purchaseDetailList.stream()
+        List<Long> contractIdList = purchaseList.stream()
                 .filter(item -> Objects.equals(item.getDataResource(), 1))
-                .map(PurchaseDetail::getDataResourceId)
+                .map(Purchase::getDataResourceId)
                 .filter(Objects::nonNull)
                 .distinct()
                 .collect(Collectors.toList());

+ 1 - 1
hx-sale/src/main/resources/mapper/contract/ContractMapper.xml

@@ -7,7 +7,7 @@
              (SELECT t1.*,
                      IFNULL(t1.amount, 0) * IFNULL(t1.rate, 0) AS amountCNY,
                      CASE
-                         WHEN (t1.amount - t1.sumClaimMoney) &lt;= 0 THEN
+                         WHEN ( IFNULL( t1.amount, 0 ) * IFNULL( t1.rate, 0 ) - t1.sumClaimMoney ) &lt;=  0 THEN
                              20
                          WHEN t1.sumClaimMoney = 0 THEN
                              0