|
@@ -50,15 +50,11 @@ import com.fjhx.item.enums.ProductAvailableRecordType;
|
|
|
import com.fjhx.item.service.product.ProductInfoService;
|
|
|
import com.fjhx.purchase.entity.arrival.po.ArrivalDetail;
|
|
|
import com.fjhx.purchase.entity.pay.po.Pay;
|
|
|
-import com.fjhx.purchase.entity.purchase.po.Purchase;
|
|
|
-import com.fjhx.purchase.entity.purchase.po.PurchaseDetail;
|
|
|
import com.fjhx.purchase.entity.quality.po.QualityDetail;
|
|
|
import com.fjhx.purchase.entity.subscribe.po.SubscribeDetail;
|
|
|
import com.fjhx.purchase.mapper.subscribe.SubscribeDetailMapper;
|
|
|
import com.fjhx.purchase.service.arrival.ArrivalDetailService;
|
|
|
import com.fjhx.purchase.service.pay.PayDetailService;
|
|
|
-import com.fjhx.purchase.service.purchase.PurchaseDetailService;
|
|
|
-import com.fjhx.purchase.service.purchase.PurchaseService;
|
|
|
import com.fjhx.purchase.service.quality.QualityDetailService;
|
|
|
import com.fjhx.purchase.service.subscribe.SubscribeDetailService;
|
|
|
import com.fjhx.sale.entity.claim.po.ClaimContract;
|
|
@@ -163,9 +159,6 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
private EhsdPurchaseService ehsdPurchaseService;
|
|
|
|
|
|
@Autowired
|
|
|
- private PurchaseDetailService purchaseDetailService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
private ClaimContractService claimContractService;
|
|
|
|
|
|
@Autowired
|
|
@@ -181,9 +174,6 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
private ContractDocumentaryService contractDocumentaryService;
|
|
|
|
|
|
@Autowired
|
|
|
- private PurchaseService purchaseService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
private ArrivalDetailService arrivalDetailService;
|
|
|
|
|
|
@Autowired
|
|
@@ -1302,6 +1292,13 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
List<SubscribeDetail> purchaseCountByIds = new ArrayList<>();
|
|
|
if (ObjectUtil.isNotEmpty(sdIds)) {
|
|
|
purchaseCountByIds = subscribeDetailMapper.getPurchaseCountByIds(sdIds);
|
|
|
+
|
|
|
+
|
|
|
+ List<EhsdPurchase> ehsdPurchaseList = ehsdPurchaseService.list(q -> q.eq(EhsdPurchase::getDataResourceId, businessId).eq(EhsdPurchase::getStatus, 30));
|
|
|
+ if (ObjectUtil.isNotEmpty(ehsdPurchaseList)) {
|
|
|
+ String codes = ehsdPurchaseList.stream().map(EhsdPurchase::getCode).collect(Collectors.joining(","));
|
|
|
+ throw new ServiceException("该订单存在审批通过的采购合同,请先作废采购合同,采购合同号:" + codes);
|
|
|
+ }
|
|
|
}
|
|
|
Map<Long, BigDecimal> purchaseCountMap = purchaseCountByIds.stream().collect(Collectors.toMap(SubscribeDetail::getId, SubscribeDetail::getCount));
|
|
|
|
|
@@ -1338,6 +1335,13 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ ehsdPurchaseService.update(q -> q
|
|
|
+ .eq(EhsdPurchase::getDataResourceId, businessId)
|
|
|
+ .eq(EhsdPurchase::getStatus, 10)
|
|
|
+ .set(EhsdPurchase::getStatus, FlowStatusEnum1.CANCELLATION.getKey())
|
|
|
+ );
|
|
|
+
|
|
|
|
|
|
productInfoService.editAvailableQuantity(
|
|
|
inOutBoList,
|
|
@@ -1345,6 +1349,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
businessId,
|
|
|
ProductAvailableRecordType.SALE_CANCEL, contract.getCompanyId()
|
|
|
);
|
|
|
+
|
|
|
+ throw new ServiceException("aaaaaaaaaaaaaa");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -1753,8 +1759,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
}
|
|
|
|
|
|
|
|
|
- List<Purchase> purchaseList = purchaseService.listByIds(purchaseIdList);
|
|
|
- List<PurchaseDetail> purchaseDetailList = purchaseDetailService.list(q -> q.in(PurchaseDetail::getPurchaseId, purchaseIdList));
|
|
|
+ List<EhsdPurchase> purchaseList = ehsdPurchaseService.listByIds(purchaseIdList);
|
|
|
+ List<EhsdPurchaseProduct> purchaseDetailList = ehsdPurchaseProductService.list(q -> q.in(EhsdPurchaseProduct::getPurchaseId, purchaseIdList));
|
|
|
|
|
|
|
|
|
setContractInfo(vo, purchaseList);
|
|
@@ -1847,27 +1853,27 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
|
|
|
* 赋值采购合同数据
|
|
|
*/
|
|
|
- private void setPurchaseInfo(PayDecisionAidVo vo, List<Purchase> purchaseList, List<PurchaseDetail> purchaseDetailList) {
|
|
|
+ private void setPurchaseInfo(PayDecisionAidVo vo, List<EhsdPurchase> purchaseList, List<EhsdPurchaseProduct> purchaseDetailList) {
|
|
|
|
|
|
- Map<Long, List<PurchaseDetail>> purchaseDetailMap = purchaseDetailList.stream()
|
|
|
- .collect(Collectors.groupingBy(PurchaseDetail::getPurchaseId));
|
|
|
+ Map<Long, List<EhsdPurchaseProduct>> purchaseDetailMap = purchaseDetailList.stream()
|
|
|
+ .collect(Collectors.groupingBy(EhsdPurchaseProduct::getPurchaseId));
|
|
|
|
|
|
List<PayDecisionAidVo.PurchaseInfo> list = new ArrayList<>();
|
|
|
|
|
|
- for (Purchase purchase : purchaseList) {
|
|
|
- List<PurchaseDetail> itemList = purchaseDetailMap.get(purchase.getId());
|
|
|
+ for (EhsdPurchase purchase : purchaseList) {
|
|
|
+ List<EhsdPurchaseProduct> itemList = purchaseDetailMap.get(purchase.getId());
|
|
|
|
|
|
if (itemList.size() == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- for (PurchaseDetail purchaseDetail : itemList) {
|
|
|
+ for (EhsdPurchaseProduct purchaseDetail : itemList) {
|
|
|
PayDecisionAidVo.PurchaseInfo purchaseInfo = new PayDecisionAidVo.PurchaseInfo();
|
|
|
purchaseInfo.setPurchaseId(purchase.getId());
|
|
|
purchaseInfo.setPurchaseCode(purchase.getCode());
|
|
|
purchaseInfo.setPurchaseDetailsId(purchaseDetail.getId());
|
|
|
- purchaseInfo.setProductId(purchaseDetail.getBussinessId());
|
|
|
- purchaseInfo.setPurchaseQuantity(purchaseDetail.getCount());
|
|
|
+ purchaseInfo.setProductId(purchaseDetail.getProductId());
|
|
|
+ purchaseInfo.setPurchaseQuantity(purchaseDetail.getQuantity());
|
|
|
list.add(purchaseInfo);
|
|
|
}
|
|
|
}
|
|
@@ -1884,11 +1890,11 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
|
|
|
* 赋值销售合同数据
|
|
|
*/
|
|
|
- private void setContractInfo(PayDecisionAidVo vo, List<Purchase> purchaseList) {
|
|
|
+ private void setContractInfo(PayDecisionAidVo vo, List<EhsdPurchase> purchaseList) {
|
|
|
|
|
|
List<Long> contractIdList = purchaseList.stream()
|
|
|
.filter(item -> Objects.equals(item.getDataResource(), 1))
|
|
|
- .map(Purchase::getDataResourceId)
|
|
|
+ .map(EhsdPurchase::getDataResourceId)
|
|
|
.filter(Objects::nonNull)
|
|
|
.distinct()
|
|
|
.collect(Collectors.toList());
|