|
@@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
|
|
import com.yh.saas.toolkit.workflow.service.IWorkflowService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
@@ -42,7 +43,7 @@ public class PurchaseClosingReportServiceImpl extends ServiceImpl<PurchaseClosin
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 采购入库统计
|
|
|
+ * 采购平仓统计列表
|
|
|
*
|
|
|
* @param purchaseClosingReport
|
|
|
* @return
|
|
@@ -83,6 +84,80 @@ public class PurchaseClosingReportServiceImpl extends ServiceImpl<PurchaseClosin
|
|
|
return page;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 出纳付款
|
|
|
+ * @param purchaseClosingReport
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public String payMoney(PurchaseClosingReport purchaseClosingReport) {
|
|
|
+ List<PurchaseClosingReport> purchaseClosingReportList=purchaseClosingReport.getPurchaseClosingReportList();
|
|
|
+ Float money = purchaseClosingReport.getMoney();
|
|
|
+ //付款多条
|
|
|
+ if (!CollectionUtils.isEmpty(purchaseClosingReportList)) {
|
|
|
+ for (PurchaseClosingReport purchaseClosingReport1 : purchaseClosingReportList) {
|
|
|
+ //付款金额大于本次循环未付金额
|
|
|
+ if (money >= purchaseClosingReport1.getAmountNotPayable()) {
|
|
|
+ money = money - purchaseClosingReport1.getAmountNotPayable();
|
|
|
+ //全部付款
|
|
|
+ purchaseClosingReport1.setStatus(StatusEnum.PUR_PAYaLL.getName());
|
|
|
+ purchaseClosingReport1.setStatusFlag(StatusEnum.PUR_PAYaLL.getFlag());
|
|
|
+ purchaseClosingReport1.setAmountEdPayable(purchaseClosingReport1.getAmountEdPayable() + purchaseClosingReport1.getAmountNotPayable());
|
|
|
+ purchaseClosingReport1.setAmountNotPayable(0.0f);
|
|
|
+ this.updateById(purchaseClosingReport1);
|
|
|
+ } else if (money > 0) {
|
|
|
+ Float moneyTmp = money - purchaseClosingReport1.getAmountNotPayable();
|
|
|
+ //部分付款
|
|
|
+ purchaseClosingReport1.setStatus(StatusEnum.PUR_PAY.getName());
|
|
|
+ purchaseClosingReport1.setStatusFlag(StatusEnum.PUR_PAY.getFlag());
|
|
|
+ purchaseClosingReport1.setAmountEdPayable(purchaseClosingReport1.getAmountEdPayable() + money);
|
|
|
+ purchaseClosingReport1.setAmountNotPayable(purchaseClosingReport1.getAmountNotPayable() - money);
|
|
|
+ this.updateById(purchaseClosingReport1);
|
|
|
+ money = moneyTmp;
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "OK";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 出纳收款
|
|
|
+ * @param purchaseClosingReport
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public String collectMoney(PurchaseClosingReport purchaseClosingReport) {
|
|
|
+ List<PurchaseClosingReport> purchaseClosingReportList=purchaseClosingReport.getPurchaseClosingReportList();
|
|
|
+ Float money = purchaseClosingReport.getMoney();
|
|
|
+ //收款多条
|
|
|
+ if (!CollectionUtils.isEmpty(purchaseClosingReportList)) {
|
|
|
+ for (PurchaseClosingReport purchaseClosingReport1 : purchaseClosingReportList) {
|
|
|
+ //收款金额大于本次循环未收金额
|
|
|
+ if (money >= purchaseClosingReport1.getCollectionNotPayable()) {
|
|
|
+ money = money - purchaseClosingReport1.getCollectionNotPayable();
|
|
|
+ //全部收款
|
|
|
+ purchaseClosingReport1.setStatus(StatusEnum.PUR_COLLECTaLL.getName());
|
|
|
+ purchaseClosingReport1.setStatusFlag(StatusEnum.PUR_COLLECTaLL.getFlag());
|
|
|
+ purchaseClosingReport1.setCollectionEdPayable(purchaseClosingReport1.getCollectionEdPayable() + purchaseClosingReport1.getCollectionNotPayable());
|
|
|
+ purchaseClosingReport1.setCollectionNotPayable(0.0f);
|
|
|
+ this.updateById(purchaseClosingReport1);
|
|
|
+ } else if (money > 0) {
|
|
|
+ Float moneyTmp = money - purchaseClosingReport1.getCollectionNotPayable();
|
|
|
+ //部分收款
|
|
|
+ purchaseClosingReport1.setStatus(StatusEnum.PUR_COLLECT.getName());
|
|
|
+ purchaseClosingReport1.setStatusFlag(StatusEnum.PUR_COLLECT.getFlag());
|
|
|
+ purchaseClosingReport1.setCollectionEdPayable(purchaseClosingReport1.getCollectionEdPayable() + money);
|
|
|
+ purchaseClosingReport1.setCollectionNotPayable(purchaseClosingReport1.getCollectionNotPayable() - money);
|
|
|
+ this.updateById(purchaseClosingReport1);
|
|
|
+ money = moneyTmp;
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "OK";
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 编辑采购平仓统计
|