|
|
|
@ -118,40 +118,43 @@ public class PaymentController {
|
|
|
|
|
@PostMapping("/submitprice")
|
|
|
|
|
@Transactional
|
|
|
|
|
public ActionResult submitprice(@RequestBody PaymentListVO paymentListVO) {
|
|
|
|
|
PaymentEntity paymentEntity = paymentService.getById(paymentListVO.getId());
|
|
|
|
|
paymentEntity.setStatus("1");
|
|
|
|
|
paymentService.updateById(paymentEntity);
|
|
|
|
|
QueryWrapper<PaymentdocEntity> paymentdocQueryWrapper=new QueryWrapper<>();
|
|
|
|
|
paymentdocQueryWrapper.lambda().eq(PaymentdocEntity::getDocumentNo, paymentEntity.getPaymentno());
|
|
|
|
|
List<PaymentdocEntity> paymentdocList = paymentdocService.list(paymentdocQueryWrapper);
|
|
|
|
|
for (PaymentdocEntity paymentdocEntity : paymentdocList) {
|
|
|
|
|
//paymentdocEntity.setDocStatus("3");
|
|
|
|
|
paymentdocEntity.setIsSubmit("0");
|
|
|
|
|
paymentdocEntity.setPaymentAmount(paymentEntity.getPaymentamount().add(paymentdocEntity.getPaymentAmount()));//已付款金额
|
|
|
|
|
paymentdocEntity.setUnpaymentAmount(paymentdocEntity.getRamount().subtract(paymentdocEntity.getPaymentAmount()));//未付款金额
|
|
|
|
|
int i = paymentdocEntity.getPaymentAmount().compareTo(paymentdocEntity.getRamount());
|
|
|
|
|
if (i == 1) {
|
|
|
|
|
return ActionResult.fail("付款金额过多,请先修改付款金额");
|
|
|
|
|
}
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
paymentdocEntity.setDocStatus("3");
|
|
|
|
|
paymentdocEntity.setIsStop("1");
|
|
|
|
|
List<PaymentdocItem0Entity> paymentdocItem0EntityList = paymentdocService.GetPaymentdocItem0List(paymentdocEntity.getId());
|
|
|
|
|
for (PaymentdocItem0Entity paymentdocItem0Entity : paymentdocItem0EntityList) {
|
|
|
|
|
PurchaseorderitemEntity purchaseorderitemEntity = purchaseorderitemService.getById(paymentdocItem0Entity.getPurchaseorderId());
|
|
|
|
|
purchaseorderitemEntity.setIsPayment("0");
|
|
|
|
|
purchaseorderitemService.updateById(purchaseorderitemEntity);
|
|
|
|
|
String[] idList = paymentListVO.getId().split(",");
|
|
|
|
|
for (String ids : idList) {
|
|
|
|
|
PaymentEntity paymentEntity = paymentService.getById(ids);
|
|
|
|
|
paymentEntity.setStatus("1");
|
|
|
|
|
paymentService.updateById(paymentEntity);
|
|
|
|
|
QueryWrapper<PaymentdocEntity> paymentdocQueryWrapper = new QueryWrapper<>();
|
|
|
|
|
paymentdocQueryWrapper.lambda().eq(PaymentdocEntity::getDocumentNo, paymentEntity.getPaymentno());
|
|
|
|
|
List<PaymentdocEntity> paymentdocList = paymentdocService.list(paymentdocQueryWrapper);
|
|
|
|
|
for (PaymentdocEntity paymentdocEntity : paymentdocList) {
|
|
|
|
|
//paymentdocEntity.setDocStatus("3");
|
|
|
|
|
paymentdocEntity.setIsSubmit("0");
|
|
|
|
|
paymentdocEntity.setPaymentAmount(paymentEntity.getPaymentamount().add(paymentdocEntity.getPaymentAmount()));//已付款金额
|
|
|
|
|
paymentdocEntity.setUnpaymentAmount(paymentdocEntity.getRamount().subtract(paymentdocEntity.getPaymentAmount()));//未付款金额
|
|
|
|
|
int i = paymentdocEntity.getPaymentAmount().compareTo(paymentdocEntity.getRamount());
|
|
|
|
|
if (i == 1) {
|
|
|
|
|
return ActionResult.fail("付款金额过多,请先修改付款金额");
|
|
|
|
|
}
|
|
|
|
|
if (i == 0) {
|
|
|
|
|
paymentdocEntity.setDocStatus("3");
|
|
|
|
|
paymentdocEntity.setIsStop("1");
|
|
|
|
|
List<PaymentdocItem0Entity> paymentdocItem0EntityList = paymentdocService.GetPaymentdocItem0List(paymentdocEntity.getId());
|
|
|
|
|
for (PaymentdocItem0Entity paymentdocItem0Entity : paymentdocItem0EntityList) {
|
|
|
|
|
PurchaseorderitemEntity purchaseorderitemEntity = purchaseorderitemService.getById(paymentdocItem0Entity.getPurchaseorderId());
|
|
|
|
|
purchaseorderitemEntity.setIsPayment("0");
|
|
|
|
|
purchaseorderitemService.updateById(purchaseorderitemEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
paymentdocService.updateById(paymentdocEntity);
|
|
|
|
|
}
|
|
|
|
|
List<Payment_item0Entity> payment_item0EntityList = paymentService.GetPayment_item0List(paymentEntity.getId());
|
|
|
|
|
for (Payment_item0Entity payment_item0Entity : payment_item0EntityList) {
|
|
|
|
|
PaymentdocItem0Entity paymentdocItem0Entity = paymentdoc_item0Service.getById(payment_item0Entity.getPaymentdocitemId());
|
|
|
|
|
paymentdocItem0Entity.setPaymentAmount(paymentdocItem0Entity.getPaymentAmount().add(payment_item0Entity.getAmount()));
|
|
|
|
|
paymentdoc_item0Service.updateById(paymentdocItem0Entity);
|
|
|
|
|
}
|
|
|
|
|
paymentdocService.updateById(paymentdocEntity);
|
|
|
|
|
}
|
|
|
|
|
List<Payment_item0Entity> payment_item0EntityList = paymentService.GetPayment_item0List(paymentEntity.getId());
|
|
|
|
|
for (Payment_item0Entity payment_item0Entity : payment_item0EntityList) {
|
|
|
|
|
PaymentdocItem0Entity paymentdocItem0Entity = paymentdoc_item0Service.getById(payment_item0Entity.getPaymentdocitemId());
|
|
|
|
|
paymentdocItem0Entity.setPaymentAmount(paymentdocItem0Entity.getPaymentAmount().add(payment_item0Entity.getAmount()));
|
|
|
|
|
paymentdoc_item0Service.updateById(paymentdocItem0Entity);
|
|
|
|
|
}
|
|
|
|
|
return ActionResult.success("提交成功");
|
|
|
|
|
return ActionResult.success("提交成功");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/confirmprice")
|
|
|
|
|