应付配置增加附加费配置,应付账单新增核销、对账、凭证、审核功能

This commit is contained in:
liuminghui
2026-11-12 18:20:32 +08:00
parent 1ba431540d
commit 6675808dfc
55 changed files with 5898 additions and 185 deletions
@@ -1,8 +1,14 @@
package com.bms.web.controller.price;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
@@ -15,6 +21,7 @@ import com.bms.common.core.domain.AjaxResult;
import com.bms.common.core.page.TableDataInfo;
import com.bms.price.domain.PayBill;
import com.bms.price.domain.PayBillCommand;
import com.bms.price.domain.PayBillFile;
import com.bms.price.service.IPayBillService;
/**
@@ -119,4 +126,176 @@ public class PayBillController extends BaseController
payBillService.voidBill(command);
return success();
}
/**
* 草稿提交审核。
*
* @param billId 应付账单ID
*/
@PreAuthorize("@ss.hasAnyPermi('price:payBill:submit,price:payBill:confirm')")
@PutMapping("/submit/{billId}")
public AjaxResult submit(@PathVariable Long billId)
{
payBillService.submit(billId);
return success();
}
/**
* 审核通过。蓝字账单需要先有凭证。
*
* @param billId 应付账单ID
*/
@PreAuthorize("@ss.hasAnyPermi('price:payBill:approve,price:payBill:confirm')")
@PutMapping("/approve/{billId}")
public AjaxResult approve(@PathVariable Long billId)
{
payBillService.approve(billId);
return success();
}
/**
* 审核驳回。
*
* @param command 账单ID和驳回意见
*/
@PreAuthorize("@ss.hasAnyPermi('price:payBill:approve,price:payBill:confirm')")
@PutMapping("/reject")
public AjaxResult reject(@RequestBody PayBillCommand command)
{
payBillService.reject(command);
return success();
}
/**
* 草稿登记对方金额。
*
* @param command 账单和费用行
*/
@PreAuthorize("@ss.hasAnyPermi('price:payBill:add,price:payBill:submit')")
@PutMapping("/diff")
public AjaxResult diff(@RequestBody PayBillCommand command)
{
payBillService.saveSupplierAmounts(command);
return success();
}
/**
* 接受我方或接受对方金额。
*
* @param command 费用行和处理方式
*/
@PreAuthorize("@ss.hasAnyPermi('price:payBill:add,price:payBill:submit')")
@PutMapping("/diff/accept")
public AjaxResult accept(@RequestBody PayBillCommand command)
{
payBillService.acceptDiff(command);
return success();
}
/**
* 从草稿剔除一条费用。
*
* @param command 账单ID和行ID
*/
@PreAuthorize("@ss.hasAnyPermi('price:payBill:add,price:payBill:submit')")
@PutMapping("/line/remove")
public AjaxResult removeLine(@RequestBody PayBillCommand command)
{
payBillService.removeLine(command);
return success();
}
/**
* 上传应付凭证。
*
* @param file 凭证
*/
@PreAuthorize("@ss.hasAnyPermi('price:payVoucher:add,price:payBill:add')")
@PostMapping("/file")
public AjaxResult saveFile(@RequestBody PayBillFile file)
{
payBillService.saveFile(file);
return success();
}
/**
* 删除应付凭证。
*
* @param fileId 凭证ID
*/
@PreAuthorize("@ss.hasAnyPermi('price:payVoucher:remove,price:payBill:void')")
@DeleteMapping("/file/{fileId}")
public AjaxResult deleteFile(@PathVariable Long fileId)
{
payBillService.deleteFile(fileId);
return success();
}
/**
* 查询应付凭证。
*
* @param query 账单号、供应商、发票号、类型
*/
@PreAuthorize("@ss.hasAnyPermi('price:payVoucher:list,price:payBill:query')")
@GetMapping("/file/list")
public TableDataInfo fileList(PayBillFile query)
{
startPage();
return getDataTable(payBillService.listFiles(query));
}
/**
* 对未付款的已确认账单开红字。
*
* @param command 原账单和原因
*/
@PreAuthorize("@ss.hasAnyPermi('price:payBill:approve,price:payBill:confirm')")
@PostMapping("/red")
public AjaxResult red(@RequestBody PayBillCommand command)
{
return success(payBillService.redBill(command));
}
/**
* 草稿保存税率和汇率。
*
* @param command 账单、税率、汇率和汇率日期
*/
@PreAuthorize("@ss.hasAnyPermi('price:payBill:add,price:payBill:submit')")
@PutMapping("/finance")
public AjaxResult finance(@RequestBody PayBillCommand command)
{
payBillService.saveFinance(command);
return success();
}
/**
* 导出对账单。
*
* @param billId 应付账单ID
* @param response 文件流
*/
@PreAuthorize("@ss.hasPermi('price:payBill:query')")
@GetMapping("/statement/{billId}")
public void statement(@PathVariable Long billId, HttpServletResponse response) throws Exception
{
String name = URLEncoder.encode("应付对账单.xlsx", StandardCharsets.UTF_8).replace("+", "%20");
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + name);
payBillService.exportStatement(billId, response.getOutputStream());
}
/**
* 导入对方金额。
*
* @param billId 应付账单ID
* @param file 导出的对账单
*/
@PreAuthorize("@ss.hasAnyPermi('price:payBill:add,price:payBill:submit')")
@PostMapping("/diff/import")
public AjaxResult importDiff(@RequestParam Long billId, @RequestParam("file") MultipartFile file)
{
payBillService.importSupplierAmounts(billId, file);
return success();
}
}
@@ -0,0 +1,137 @@
package com.bms.web.controller.price;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bms.common.core.controller.BaseController;
import com.bms.common.core.domain.AjaxResult;
import com.bms.common.core.page.TableDataInfo;
import com.bms.price.domain.PayPayment;
import com.bms.price.domain.PayPaymentAlloc;
import com.bms.price.service.IPayPaymentService;
/**
* 账单管理下的应付付款。
*/
@RestController
@RequestMapping("/price/payPayment")
public class PayPaymentController extends BaseController
{
@Autowired
private IPayPaymentService payPaymentService;
/**
* 分页查询应付付款。
*
* @param query 付款单号、供应商、状态、币种
* @return 付款单列表
*/
@PreAuthorize("@ss.hasPermi('price:payPayment:list')")
@GetMapping("/list")
public TableDataInfo list(PayPayment query)
{
startPage();
List<PayPayment> list = payPaymentService.selectPayPaymentList(query);
return getDataTable(list);
}
/**
* 付款单详情,含核销明细。
*
* @param paymentId 付款单ID
* @return 付款单
*/
@PreAuthorize("@ss.hasPermi('price:payPayment:query')")
@GetMapping("/{paymentId}")
public AjaxResult detail(@PathVariable Long paymentId)
{
return success(payPaymentService.selectPayPaymentDetail(paymentId));
}
/**
* 查询这个供应商、这个币种下还能核销的账单。
*
* @param supplierId 供应商ID
* @param currency 币种
* @return 未付账单
*/
@PreAuthorize("@ss.hasPermi('price:payPayment:query')")
@GetMapping("/open")
public AjaxResult open(Long supplierId, String currency)
{
List<PayPaymentAlloc> list = payPaymentService.selectOpenBills(supplierId, currency);
return success(list);
}
/**
* 登记草稿付款。确认后才核销账单。
*
* @param payment 付款单和核销明细
* @return 付款单
*/
@PreAuthorize("@ss.hasPermi('price:payPayment:add')")
@PostMapping
public AjaxResult create(@RequestBody PayPayment payment)
{
return success(payPaymentService.create(payment));
}
/**
* 确认付款并核销。
*
* @param paymentId 付款单ID
*/
@PreAuthorize("@ss.hasPermi('price:payPayment:confirm')")
@PutMapping("/confirm/{paymentId}")
public AjaxResult confirm(@PathVariable Long paymentId)
{
payPaymentService.confirm(paymentId);
return success();
}
/**
* 作废草稿付款。已确认的付款不在这里作废。
*
* @param paymentId 付款单ID
*/
@PreAuthorize("@ss.hasPermi('price:payPayment:void')")
@PutMapping("/void/{paymentId}")
public AjaxResult voidPayment(@PathVariable Long paymentId)
{
payPaymentService.voidPayment(paymentId);
return success();
}
/**
* 反核销。账单未付金额恢复。
*
* @param paymentId 付款单ID
*/
@PreAuthorize("@ss.hasPermi('price:payPayment:confirm')")
@PutMapping("/reverse/{paymentId}")
public AjaxResult reverse(@PathVariable Long paymentId)
{
payPaymentService.reverse(paymentId);
return success();
}
/**
* 退款。冲回核销,付款单改为已退款。
*
* @param paymentId 付款单ID
*/
@PreAuthorize("@ss.hasPermi('price:payPayment:confirm')")
@PutMapping("/refund/{paymentId}")
public AjaxResult refund(@PathVariable Long paymentId)
{
payPaymentService.refund(paymentId);
return success();
}
}
@@ -30,8 +30,10 @@ import com.bms.price.domain.PayProduct;
import com.bms.price.domain.PayProductTerm;
import com.bms.price.domain.PaySaveCommand;
import com.bms.price.pay.PayDetailExporter;
import com.bms.price.domain.PaySurchargeRuleSave;
import com.bms.price.service.IPayOrderCostService;
import com.bms.price.service.IPayProductService;
import com.bms.price.service.IPaySurchargeRuleService;
import jakarta.servlet.http.HttpServletResponse;
/**
@@ -47,6 +49,9 @@ public class PayProductController extends BaseController
@Autowired
private IPayOrderCostService payOrderCostService;
@Autowired
private IPaySurchargeRuleService paySurchargeRuleService;
@PreAuthorize("@ss.hasPermi('price:pay:list')")
@GetMapping("/list")
public TableDataInfo list(PayProduct query)
@@ -102,6 +107,31 @@ public class PayProductController extends BaseController
payProductService.writeSource(productId, response.getOutputStream());
}
/** 当前版本的附加费计费条件。同一版本只有一份。 */
@PreAuthorize("@ss.hasAnyPermi('price:pay:query,price:pay:edit')")
@GetMapping("/surchargeRule")
public AjaxResult surchargeRule(@RequestParam Long productId, @RequestParam Long termId)
{
return success(paySurchargeRuleService.list(productId, termId));
}
/** 上一版条件,复制到当前页后再保存。 */
@PreAuthorize("@ss.hasAnyPermi('price:pay:query,price:pay:edit')")
@GetMapping("/surchargeRule/previous")
public AjaxResult previousSurchargeRule(@RequestParam Long productId)
{
return success(paySurchargeRuleService.previous(productId));
}
@PreAuthorize("@ss.hasPermi('price:pay:edit')")
@Log(title = "应付附加费计费条件", businessType = BusinessType.UPDATE)
@PostMapping("/surchargeRule")
public AjaxResult saveSurchargeRule(@RequestBody PaySurchargeRuleSave command)
{
paySurchargeRuleService.save(command);
return success();
}
@PreAuthorize("@ss.hasPermi('price:pay:query')")
@GetMapping("/{productId}")
public AjaxResult getInfo(@PathVariable Long productId)