|
@@ -2,6 +2,8 @@ package cn.ezhizao.project.business.payment.controller;
|
|
|
|
|
|
import cn.ezhizao.common.exception.ServiceException;
|
|
|
import cn.ezhizao.common.utils.uuid.SnowflakeIdWorker;
|
|
|
+import cn.ezhizao.framework.aspectj.lang.annotation.Log;
|
|
|
+import cn.ezhizao.framework.aspectj.lang.enums.BusinessType;
|
|
|
import cn.ezhizao.framework.web.controller.BaseController;
|
|
|
import cn.ezhizao.framework.web.domain.AjaxResult;
|
|
|
import cn.ezhizao.framework.web.page.TableDataInfo;
|
|
@@ -76,6 +78,8 @@ public class BizPaymentController extends BaseController {
|
|
|
@ApiOperation(value = "主从保存", notes = "主从保存")
|
|
|
@PostMapping("/save")
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
+ @PreAuthorize("@ss.hasPermi('business:payment:add')")
|
|
|
+ @Log(title = "支付保存", businessType = BusinessType.INSERT)
|
|
|
@ResponseBody
|
|
|
public AjaxResult saveAll(@RequestBody BizPayment payment) throws NoSuchFieldException, IllegalAccessException {
|
|
|
boolean changeFormNo = true;
|
|
@@ -180,12 +184,12 @@ public class BizPaymentController extends BaseController {
|
|
|
List<BizArchiveInput> list = archiveInputService.getList(condition);
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
+
|
|
|
@ApiOperation("获取合同")
|
|
|
@GetMapping("/listContractDetail")
|
|
|
@PreAuthorize("@ss.hasPermi('business:payment:query')")
|
|
|
@ResponseBody
|
|
|
- public TableDataInfo listContractDetail(BizArchiveInputDetail condition) throws NoSuchFieldException, IllegalAccessException
|
|
|
- {
|
|
|
+ public TableDataInfo listContractDetail(BizArchiveInputDetail condition) throws NoSuchFieldException, IllegalAccessException {
|
|
|
setTenantId(condition);
|
|
|
startPage();
|
|
|
List<BizArchiveInputDetail> list = contractDetailService.getList(condition);
|
|
@@ -193,10 +197,29 @@ public class BizPaymentController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermi('expenditure:subject:remove')")
|
|
|
+ @Log(title = "支付删除", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public AjaxResult remove(@PathVariable List<Long> ids) {
|
|
|
+ //查询所有需要删除的数据
|
|
|
+ List<BizPayment> list = paymentService.getByIds(ids);
|
|
|
+ for (BizPayment l:list){
|
|
|
+ //判读是否已经审核
|
|
|
+ if (l.getVerifyStatus() == 1) {
|
|
|
+ //已经审核无法删除
|
|
|
+ return error("删除失败,审核通过的不能删除");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //全未审核则删除
|
|
|
+ return toAjax(paymentService.removeBatchByIds(ids)&&paymentService.removePaymentDetail(ids));
|
|
|
+ }
|
|
|
|
|
|
|
|
|
private BizPayment getForId(Long paymentId) {
|
|
|
- BizPayment payment = paymentService.getById(paymentId);
|
|
|
+ BizPayment payment = new BizPayment();
|
|
|
+ payment.setId(paymentId);
|
|
|
+ List<BizPayment> payments = paymentService.getListByBean(payment);
|
|
|
+ payment = payments.isEmpty() ? null : payments.get(0);
|
|
|
if (payment != null) {
|
|
|
BizArchiveInput condition = new BizArchiveInput();
|
|
|
condition.setId(payment.getContractId());
|
|
@@ -204,11 +227,13 @@ public class BizPaymentController extends BaseController {
|
|
|
BizArchiveInput archiveInput = archiveInputs.isEmpty() ? null : archiveInputs.get(0);
|
|
|
if (archiveInput != null) {
|
|
|
payment.setContractNo(archiveInput.getContractNo());
|
|
|
- payment.setContractAmount(archiveInput.getAmount());
|
|
|
- BizPayment collectionCondition = new BizPayment();
|
|
|
- collectionCondition.setContractId(archiveInput.getId());
|
|
|
- List<BizPayment> collections = paymentService.getListByBean(collectionCondition);
|
|
|
- payment.setNonpayment(archiveInput.getAmount().subtract(BigDecimal.valueOf(collections.stream().mapToDouble(v -> v.getAmount().doubleValue()).sum())).compareTo(BigDecimal.ZERO) > 0);
|
|
|
+ payment.setContractAmount(archiveInput.getTrueAmount());
|
|
|
+ BizPayment payemntConditions = new BizPayment();
|
|
|
+ payemntConditions.setContractId(archiveInput.getId());
|
|
|
+ payemntConditions.setVerifyStatus((byte)1);
|
|
|
+ List<BizPayment> payed = paymentService.getListByBean(payemntConditions);
|
|
|
+// payment.setNonpayment(archiveInput.getAmount().subtract(BigDecimal.valueOf(collections.stream().mapToDouble(v -> v.getAmount().doubleValue()).sum())).compareTo(BigDecimal.ZERO) > 0);
|
|
|
+ payment.setPayedAmount(BigDecimal.valueOf(payed.stream().mapToDouble(v -> v.getAmount().doubleValue()).sum()));
|
|
|
}
|
|
|
SysFileStorage fileConditions = new SysFileStorage();
|
|
|
fileConditions.setMasterId(payment.getId());
|
|
@@ -229,6 +254,8 @@ public class BizPaymentController extends BaseController {
|
|
|
|
|
|
@ApiOperation("审核")
|
|
|
@PostMapping("/verified")
|
|
|
+ @Log(title = "支付审核", businessType = BusinessType.UPDATE)
|
|
|
+ @PreAuthorize("@ss.hasPermi('business:payment:submitVerify')")
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public AjaxResult verified(@RequestBody BizPayment payment) {
|
|
|
try {
|
|
@@ -239,5 +266,4 @@ public class BizPaymentController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|