feat(finance): 新增付款单管理功能

- 新增付款单详情抽屉组件,展示付款单及应付单详细信息
- 新增付款单列表页面,支持多条件筛选和分页查询
- 新增财务管理路由模块,包含付款单子菜单
- 优化应付单日期格式化逻辑,统一使用HH:mm:ss格式
- 实现合并付款单并发起支付功能,支持批量处理应付单
- 新增付款明细实体类及相关Mapper、Service实现
- 完善应付单查询条件,增加预计付款时间范围查询
- 调整付款计划相关类包结构,统一移至sip.domain包下
dev_1.0.0
chenhao 2025-12-09 09:11:32 +08:00
parent 30d551fe59
commit 05865dc2ef
35 changed files with 1659 additions and 176 deletions

View File

@ -25,3 +25,12 @@ export function updatePaymentPlan(payableBillId, data) {
data: data
})
}
// 合并并发起付款
export function mergeAndInitiatePayment(data) {
return request({
url: '/finance/payable/mergeAndInitiatePayment',
method: 'post',
data: data
})
}

View File

@ -0,0 +1,30 @@
import request from '@/utils/request'
import { tansParams } from "@/utils/ruoyi"
// 查询付款单列表
export function listPayment(query) {
return request({
url: '/finance/payment/list',
method: 'post',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
data: tansParams(query)
})
}
// 查询付款单详细
export function getPayment(id) {
return request({
url: '/finance/payment/' + id,
method: 'get'
})
}
// 退回付款单
export function returnPayment(id) {
return request({
url: '/finance/payment/returnPayment/' + id,
method: 'delete'
})
}

View File

@ -142,6 +142,24 @@ export const dynamicRoutes = [
}
]
},
{
path: '/finance',
component: Layout,
redirect: 'noRedirect',
name: 'Finance',
meta: {
title: '财务管理',
icon: 'money'
},
children: [
{
path: 'payment',
component: () => import('@/views/finance/payment/index'),
name: 'Payment',
meta: { title: '付款单', icon: 'form' }
}
]
},
{
path: '/inventory/execution',
component: Layout,

View File

@ -292,6 +292,7 @@ export default {
planAmount: plan.planAmount,
planRate: plan.planRate,
remark: plan.remark,
id: plan.id,
})),
})),
totalMergePaymentAmount: this.totalPlannedAmount, // Total amount for the merged bill

View File

@ -12,12 +12,14 @@
</el-button>
<el-table :data="paymentPlans" border @selection-change="selectPlan" ref="paymentPlanTable">
<el-table-column type="selection" width="50" align="center"/>
<el-table-column v-show="false" prop="id" width="50" align="center"/>
<el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
<el-table-column label="预计付款时间" align="center" width="200">
<template slot-scope="scope">
<el-date-picker v-model="scope.row.planPaymentDate" type="date" style="width: 180px"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期"
:readonly="!scope.row.detailId"
:disabled="!isEditing || scope.row.status === 'paid'"></el-date-picker>
</template>
</el-table-column>
@ -28,6 +30,7 @@
:precision="2"
:step="100"
:min="0.01"
:readonly="!scope.row.detailId"
:max="totalPriceWithTax"
@change="handleAmountChange(scope.row)"
:disabled="!isEditing || scope.row.status === 'paid'"
@ -42,6 +45,7 @@
:step="1"
:min="0.01"
:max="100"
:readonly="!scope.row.detailId"
@change="handleRateChange(scope.row)"
:disabled="!isEditing || scope.row.status === 'paid'"
></el-input-number>
@ -50,19 +54,19 @@
<el-table-column label="备注" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.remark" placeholder="请输入备注"
:disabled="!isEditing || scope.row.status === 'paid'"></el-input>
:disabled="!isEditing || scope.row.detailId"></el-input>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="150" fixed="right">
<template slot-scope="scope">
<el-button v-if="isEditing"
<el-button v-if="isEditing && !scope.row.detailId"
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAddPaymentPlanRow"
>增加下行
</el-button>
<el-button v-if="isEditing"
<el-button v-if="isEditing && !scope.row.detailId"
size="mini"
type="text"
icon="el-icon-delete"
@ -145,6 +149,7 @@ export default {
},
methods: {
selectPlan( selection){
console.log(selection)
this.selectedPlan=selection
},
fetchPaymentPlans(payableId) {

View File

@ -73,7 +73,7 @@
<el-date-picker
v-model="dateRange"
style="width: 240px"
value-format="yyyy-MM-dd hh:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
@ -84,7 +84,7 @@
<el-date-picker
v-model="estimatedPaymentDateRange"
style="width: 240px"
value-format="yyyy-MM-dd hh:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
@ -200,7 +200,7 @@
</template>
<script>
import { listPayable } from "@/api/finance/payable";
import { listPayable, mergeAndInitiatePayment } from "@/api/finance/payable";
import EditForm from './components/EditForm.vue';
import MergePaymentDialog from './components/MergePaymentDialog.vue';
@ -328,11 +328,11 @@ export default {
},
/** 确认合并付款单操作 */
confirmMergePayment(paymentData) {
console.log("Merged payment data received:", paymentData);
// TODO: Call backend API to initiate merged payment
// this.$modal.msgSuccess("");
this.isMergePaymentDialogOpen = false;
this.getList(); // Refresh the list
mergeAndInitiatePayment(paymentData).then(() => {
this.$modal.msgSuccess("合并付款单发起成功");
this.isMergePaymentDialogOpen = false;
this.getList(); // Refresh the list
});
}
}
};

View File

@ -0,0 +1,168 @@
<template>
<el-drawer
title="付款单详情"
:visible.sync="visible"
direction="rtl"
size="70%"
@close="handleClose"
>
<div class="dialog-body" v-if="detail">
<div class="section">
<el-divider content-position="left">采购-付款单</el-divider>
<div class="details-container">
<el-row :gutter="20">
<el-col :span="8">
<div class="detail-item"><strong>采购-付款单编号:</strong> {{ detail.paymentBillCode }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>预计付款时间:</strong> {{ detail.paymentTime }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>制造商名称:</strong> {{ detail.vendorName }}</div>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<div class="detail-item"><strong>含税总价:</strong> {{ detail.totalPriceWithTax }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>未税总价:</strong> {{ detail.totalPriceWithoutTax }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>税额:</strong> {{ detail.taxAmount }}</div>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<div class="detail-item"><strong>付款单类型:</strong>
<dict-tag :options="dict.type.payment_bill_type" :value="detail.paymentBillType"/>
</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>预付单剩余额度:</strong> {{ detail.preResidueAmount || '-' }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>财务付款时间:</strong> {{ detail.actualPaymentTime || '-'}}</div>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<div class="detail-item"><strong>支付方式:</strong> {{ detail.paymentMethod || '-'}}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>回执单/退款图:</strong> {{ detail.receiptAttachmentId }} /
{{ detail.refundProofAttachmentId }}
</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>付款状态:</strong> {{ detail.paymentStatus }}</div>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<div class="detail-item"><strong>备注:</strong> {{ detail.remark }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>上传人姓名:</strong> {{ detail.createBy }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>账户名称:</strong> {{ detail.payName }}</div>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<div class="detail-item"><strong>银行账号:</strong> {{ detail.payBankNumber }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>银行开户行:</strong> {{ detail.payBankOpenAddress }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>银行行号:</strong> {{ detail.bankNumber }}</div>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<div class="detail-item"><strong>审批节点:</strong> {{ detail.approveNode|| '-' }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>审批状态:</strong> {{ detail.approveStatus || '-'}}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>审批通过时间:</strong> {{ detail.approveTime || '-'}}</div>
</el-col>
</el-row>
</div>
</div>
<div class="section">
<el-divider content-position="left">采购-应付单</el-divider>
<el-table :data="detail.payableDetails">
<el-table-column type="index" label="序号" width="50"></el-table-column>
<el-table-column property="projectCode" label="项目编号"></el-table-column>
<el-table-column property="projectName" label="项目名称"></el-table-column>
<el-table-column property="payableBillCode" label="采购应付单编号"></el-table-column>
<el-table-column property="totalPriceWithTax" label="含税总价"></el-table-column>
<el-table-column property="paymentAmount" label="本次付款金额"></el-table-column>
<el-table-column property="paymentRatio" label="本次付款比例"></el-table-column>
</el-table>
</div>
</div>
</el-drawer>
</template>
<script>
export default {
name: "DetailDrawer",
props: {
visible: {
type: Boolean,
default: false,
},
detail: {
type: Object,
default: () => null,
},
},
dicts:['payment_bill_type'],
methods: {
handleClose() {
this.$emit("update:visible", false);
},
},
};
</script>
<style scoped>
.dialog-body {
max-height: calc(100vh - 50px); /* Adjust based on actual header/footer height */
overflow-y: auto;
padding: 0 20px 20px 20px; /* Adjust padding to match dialog-body style */
}
.details-container {
border: 1px solid #EBEEF5;
padding: 20px;
border-radius: 4px;
}
.detail-item {
display: flex;
border: 1px solid #EBEEF5;
padding: 10px;
border-radius: 4px;
margin-bottom: 10px;
font-size: 14px;
align-items: center;
}
.section {
margin-bottom: 20px;
}
.grid-content {
border-radius: 4px;
min-height: 36px;
line-height: 36px;
}
</style>

View File

@ -0,0 +1,298 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="项目编号" prop="projectCode">
<el-input
v-model="queryParams.projectCode"
placeholder="请输入项目编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="项目名称" prop="projectName">
<el-input
v-model="queryParams.projectName"
placeholder="请输入项目名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="付款单编号" prop="paymentBillCode">
<el-input
v-model="queryParams.paymentBillCode"
placeholder="请输入付款单编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="制造商名称" prop="vendorCode">
<el-input
v-model="queryParams.vendorCode"
placeholder="请输入制造商名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="应付单编号" prop="payableBillCode">
<el-input
v-model="queryParams.payableBillCode"
placeholder="请输入应付单编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="付款单类型" prop="paymentBillType">
<el-select v-model="queryParams.paymentBillType" placeholder="请选择付款单类型" clearable>
<el-option v-for="dict in dict.type.payment_bill_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
</el-select>
</el-form-item>
<el-form-item label="支付方式" prop="paymentMethod">
<el-select v-model="queryParams.paymentMethod" placeholder="请选择支付方式" clearable>
<el-option label="方式一" value="1" />
<el-option label="方式二" value="2" />
</el-select>
</el-form-item>
<el-form-item label="审批状态" prop="approveStatus">
<el-select v-model="queryParams.approveStatus" placeholder="请选择审批状态" clearable>
<el-option label="待提交" value="0" />
<el-option label="审批中" value="1" />
<el-option label="已审批" value="2" />
<el-option label="已驳回" value="3" />
</el-select>
</el-form-item>
<el-form-item label="付款状态" prop="paymentStatus">
<el-select v-model="queryParams.paymentStatus" placeholder="请选择付款状态" clearable>
<el-option label="待付款" value="0" />
<el-option label="已付款" value="1" />
</el-select>
</el-form-item>
<el-form-item label="审批节点" prop="approveNode">
<el-input
v-model="queryParams.approveNode"
placeholder="请输入审批节点"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="审批通过时间">
<el-date-picker
v-model="dateRangeApproval"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item label="预计付款时间">
<el-date-picker
v-model="dateRangeEstimated"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item label="实际付款时间">
<el-date-picker
v-model="dateRangeActual"
style="width: 240px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="paymentList">
<el-table-column label="付款单编号" align="center" prop="paymentBillCode" />
<el-table-column label="预计付款时间" align="center" prop="paymentTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.paymentTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="制造商名称" align="center" prop="vendorCode" />
<el-table-column label="含税总价" align="center" prop="totalPriceWithTax" />
<el-table-column label="付款单类型" align="center" prop="paymentBillType" >
<template slot-scope="scope">
<dict-tag :options="dict.type.payment_bill_type" :value="scope.row.paymentBillType"/>
</template>
</el-table-column>
<el-table-column label="预付单剩余额度" align="center" prop="preResidueAmount" />
<el-table-column label="实际付款时间" align="center" prop="actualPaymentTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.actualPaymentTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="支付方式" align="center" prop="paymentMethod" />
<el-table-column label="付款状态" align="center" prop="paymentStatus" >
<template slot-scope="scope">
<dict-tag :options="dict.type.payment_status" :value="scope.row.paymentStatus"/>
</template>
</el-table-column>
<el-table-column label="审批状态" align="center" prop="approveStatus" >
<template slot-scope="scope">
<dict-tag :options="dict.type.approve_status" :value="scope.row.approveStatus"/>
</template>
</el-table-column>
<el-table-column label="审批通过时间" align="center" prop="approveTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.approveTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="审批节点" align="center" prop="approveNode" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleDetail(scope.row)"
>查看详情</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-refresh-left"
@click="handleReturn(scope.row)"
>退回</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 详情抽屉 -->
<detail-drawer :visible.sync="detailOpen" :detail="detailData"></detail-drawer>
</div>
</template>
<script>
import { listPayment, getPayment, returnPayment } from "@/api/finance/payment";
import { addDateRange } from "@/utils/ruoyi";
import DetailDrawer from "./components/DetailDrawer.vue";
export default {
name: "Payment",
components: {
DetailDrawer
},
dicts:['payment_bill_type','approve_status','payment_status'],
data() {
return {
//
loading: true,
//
showSearch: true,
//
total: 0,
//
paymentList: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
projectCode: null,
projectName: null,
paymentBillCode: null,
vendorCode: null,
payableBillCode: null,
paymentBillType: null,
paymentMethod: null,
approveStatus: null,
paymentStatus: null,
approveNode: null,
},
//
dateRangeApproval: [],
dateRangeEstimated: [],
dateRangeActual: [],
//
detailOpen: false,
detailData: null,
};
},
created() {
this.getList();
},
methods: {
addDateRange, // Mixin addDateRange function
/** 查询付款单列表 */
getList() {
this.loading = true;
let query = { ...this.queryParams };
query = this.addDateRange(query, this.dateRangeApproval, 'ApproveTime');
query = this.addDateRange(query, this.dateRangeEstimated, 'PaymentTime');
query = this.addDateRange(query, this.dateRangeActual, 'ActualPaymentTime');
listPayment(query).then(response => {
this.paymentList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRangeApproval = [];
this.dateRangeEstimated = [];
this.dateRangeActual = [];
this.resetForm("queryForm");
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
//
console.log("handleAdd");
},
/** 详情按钮操作 */
handleDetail(row) {
getPayment(row.id).then(response => {
this.detailData = response.data;
this.detailOpen = true;
});
},
/** 退回按钮操作 */
handleReturn(row) {
this.$modal.confirm('是否确认退回付款单编号为"' + row.paymentBillCode + '"的数据项?').then(function() {
return returnPayment(row.id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("退回成功");
}).catch(() => {});
}
}
};
</script>

View File

@ -21,6 +21,8 @@ import com.ruoyi.sip.service.IOmsInvoiceReceiptBillService;
import com.ruoyi.sip.domain.OmsInvoiceReceiptBill;
import org.springframework.ui.ModelMap;
import com.ruoyi.sip.domain.dto.MergedPaymentDataDto;
/**
* Controller
*
@ -133,4 +135,16 @@ public class OmsPayableBillController extends BaseController
{
return toAjax(omsPayableBillService.deleteOmsPayableBillByIds(ids));
}
/**
*
*/
@RequiresPermissions("finance:payable:mergePayment")
@Log(title = "合并并发起付款单", businessType = BusinessType.INSERT)
@PostMapping("/mergeAndInitiatePayment")
@ResponseBody
public AjaxResult mergeAndInitiatePayment(@RequestBody MergedPaymentDataDto dto)
{
return toAjax(omsPayableBillService.mergeAndInitiatePayment(dto));
}
}

View File

@ -3,9 +3,9 @@ package com.ruoyi.sip.controller;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.sip.oms.domain.OmsPayablePaymentPlan;
import com.ruoyi.sip.domain.OmsPayablePaymentPlan;
import com.ruoyi.sip.oms.service.IOmsPayablePaymentPlanService;
import com.ruoyi.sip.service.IOmsPayablePaymentPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

View File

@ -5,11 +5,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.sip.domain.OmsPaymentBill;
@ -71,11 +67,12 @@ public class OmsPaymentBillController extends BaseController
/**
*
*/
@RequiresPermissions("finance:payment:add")
@GetMapping("/add")
public String add()
@RequiresPermissions("finance:payment:query")
@GetMapping("/{id}")
@ResponseBody
public AjaxResult query(@PathVariable("id") Long id)
{
return prefix + "/add";
return AjaxResult.success(omsPaymentBillService.query(id));
}
/**
@ -125,4 +122,109 @@ public class OmsPaymentBillController extends BaseController
{
return toAjax(omsPaymentBillService.deleteOmsPaymentBillByIds(ids));
}
/**
* 退
*/
@RequiresPermissions("finance:payment:return")
@Log(title = "退回付款单", businessType = BusinessType.UPDATE)
@DeleteMapping("/returnPayment/{id}")
@ResponseBody
public AjaxResult returnPayment(@PathVariable("id") Long id)
{
try {
// 验证付款单ID
if (id == null) {
return AjaxResult.error("付款单ID不能为空");
}
// 调用服务层方法处理退回逻辑
return omsPaymentBillService.returnPaymentBill(id);
} catch (Exception e) {
logger.error("退回付款单失败", e);
return AjaxResult.error("操作失败:" + e.getMessage());
}
}
// /**
// * 提交申请付款
// */
// @RequiresPermissions("finance:payment:apply")
// @Log(title = "申请付款", businessType = BusinessType.UPDATE)
// @PostMapping("/applyPayment")
// @ResponseBody
// public AjaxResult applyPaymentSave(OmsPaymentBill omsPaymentBill)
// {
// return toAjax(omsPaymentBillService.applyPayment(omsPaymentBill));
// }
//
// /**
// * 查看回执单页面
// */
// @GetMapping("/viewReceipt/{id}")
// public String viewReceipt(@PathVariable("id") Long id, @RequestParam("type") String type, ModelMap mmap)
// {
// OmsPaymentBill paymentBill = omsPaymentBillService.selectOmsPaymentBillById(id);
// if (paymentBill != null)
// {
// if ("receipt".equals(type) && (paymentBill.getReceiptAttachmentId() != null)) {
// mmap.put("attachment", omsFinAttachmentService.selectOmsFinAttachmentById(paymentBill.getReceiptAttachmentId()));
// } else if ("proof".equals(type) && paymentBill.getRefundProofAttachmentId() != null) {
// mmap.put("attachment", omsFinAttachmentService.selectOmsFinAttachmentById(paymentBill.getRefundProofAttachmentId()));
// }
// }
// mmap.put("paymentBill", paymentBill);
// return prefix + "/viewReceipt";
// }
//
// /**
// * 上传回执单
// */
// @RequiresPermissions("finance:payment:uploadReceipt")
// @Log(title = "上传回执单", businessType = BusinessType.UPDATE)
// @PostMapping("/uploadReceipt")
// @ResponseBody
// public AjaxResult uploadReceipt(@RequestParam("paymentBillId") Long paymentBillId, @RequestParam("file") MultipartFile file)
// {
// try
// {
// return omsPaymentBillService.uploadReceipt(paymentBillId, file);
// }
// catch (Exception e)
// {
// logger.error("上传回执单失败", e);
// return AjaxResult.error("操作失败:" + e.getMessage());
// }
// }
//
// /**
// * 申请退款
// */
// @PostMapping("/applyRefund")
// @ResponseBody
// public AjaxResult applyRefund(@RequestParam("id") Long id) {
// try {
// return omsPaymentBillService.applyRefund(id);
// } catch (Exception e) {
// logger.error("申请退款失败", e);
// return AjaxResult.error("操作失败:" + e.getMessage());
// }
// }
//
// /**
// * 上传退款图
// */
// @PostMapping("/uploadRefundProof")
// @ResponseBody
// public AjaxResult uploadRefundProof(@RequestParam("paymentBillId") Long paymentBillId, @RequestParam("file") MultipartFile file) {
// try {
// return omsPaymentBillService.uploadRefundProof(paymentBillId, file);
// } catch (Exception e) {
// logger.error("上传退款图失败", e);
// return AjaxResult.error("操作失败:" + e.getMessage());
// }
// }
}

View File

@ -77,5 +77,7 @@ public class OmsPayableBill extends BaseEntity
private Date createTimeStart;
private Date createTimeEnd;
private Date estimatedPaymentTimeEnd;
private Date estimatedPaymentTimeStart;
}

View File

@ -0,0 +1,23 @@
package com.ruoyi.sip.domain;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class OmsPayablePaymentDetail extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long id;
private Long paymentPlanId;
private Long payableBillId;
private Integer paymentStatus;
private Date paymentTime;
private BigDecimal paymentAmount;
private BigDecimal paymentRate;
private String paymentBillCode;
}

View File

@ -1,4 +1,4 @@
package com.ruoyi.sip.oms.domain;
package com.ruoyi.sip.domain;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
@ -23,5 +23,6 @@ public class OmsPayablePaymentPlan extends BaseEntity {
/** 计划付款比例 */
private BigDecimal planRate;
private Long detailId;
}

View File

@ -3,6 +3,8 @@ package com.ruoyi.sip.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.Getter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
@ -14,6 +16,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
* @author ruoyi
* @date 2025-10-22
*/
@Data
public class OmsPaymentBill extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -37,6 +40,7 @@ public class OmsPaymentBill extends BaseEntity
/** 制造商名称 */
@Excel(name = "制造商名称")
private String vendorCode;
private String vendorName;
/** 合同编号 */
@Excel(name = "合同编号")
@ -57,124 +61,115 @@ public class OmsPaymentBill extends BaseEntity
/** 删除标志0代表存在 2代表删除 */
private String delFlag;
public void setId(Long id)
{
this.id = id;
/** 项目编号 */
@Excel(name = "项目编号")
private String projectCode;
/** 项目名称 */
@Excel(name = "项目名称")
private String projectName;
/** 预付单剩余额度 */
@Excel(name = "预付单剩余额度")
private BigDecimal preResidueAmount;
/** 实际付款时间 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "实际付款时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date actualPaymentTime;
/** 付款状态 */
@Excel(name = "付款状态")
private String paymentStatus;
/** 审批状态 */
@Excel(name = "审批状态")
private String approveStatus;
/** 审批节点 */
@Excel(name = "审批节点")
private String approveNode;
/** 审批时间 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "审批时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date approveTime;
/** 支付方式 */
@Excel(name = "支付方式")
private String paymentMethod;
/** 应付单编号(关联查询字段) */
@Excel(name = "应付单编号")
private String payableBillCode;
/** 账户名称 */
@Excel(name = "账户名称")
private String payName;
/** 银行账号 */
@Excel(name = "银行账号")
private String payBankNumber;
/** 银行开户行 */
@Excel(name = "银行开户行")
private String payBankOpenAddress;
/** 银行行号 */
@Excel(name = "银行行号")
private String bankNumber;
/** 回执单附件ID */
private Long receiptAttachmentId;
/** 关联的原始付款单ID */
private Long originalBillId;
/** 退款状态 */
private String refundStatus;
/** 退款图附件ID */
private Long refundProofAttachmentId;
@Getter
public enum PaymentBillTypeEnum {
/** 应付单生成 */
FROM_PAYABLE("FROM_PAYABLE", "应付单生成"),
/** 预付单 */
PRE_PAYMENT("PRE_PAYMENT", "预付单"),
/** 退款单 */
REFUND("REFUND", "退款单"),
;
private final String code;
private final String desc;
PaymentBillTypeEnum(String code, String desc) {
this.code = code;
this.desc = desc;
}
}
@Getter
public enum PaymentStatusEnum {
/** 应付单生成 */
REFUNDED("-1", "已退款"),
WAIT_PAYMENT("1", "未付款"),
/** 预付单 */
PAYMENT("2", "已付款"),
;
private final String code;
private final String desc;
PaymentStatusEnum(String code, String desc) {
this.code = code;
this.desc = desc;
}
}
public Long getId()
{
return id;
}
public void setPaymentBillCode(String paymentBillCode)
{
this.paymentBillCode = paymentBillCode;
}
public String getPaymentBillCode()
{
return paymentBillCode;
}
public void setPaymentBillType(String paymentBillType)
{
this.paymentBillType = paymentBillType;
}
public String getPaymentBillType()
{
return paymentBillType;
}
public void setPaymentTime(Date paymentTime)
{
this.paymentTime = paymentTime;
}
public Date getPaymentTime()
{
return paymentTime;
}
public void setVendorCode(String vendorCode)
{
this.vendorCode = vendorCode;
}
public String getVendorCode()
{
return vendorCode;
}
public void setOrderCode(String orderCode)
{
this.orderCode = orderCode;
}
public String getOrderCode()
{
return orderCode;
}
public void setTotalPriceWithTax(BigDecimal totalPriceWithTax)
{
this.totalPriceWithTax = totalPriceWithTax;
}
public BigDecimal getTotalPriceWithTax()
{
return totalPriceWithTax;
}
public void setTotalPriceWithoutTax(BigDecimal totalPriceWithoutTax)
{
this.totalPriceWithoutTax = totalPriceWithoutTax;
}
public BigDecimal getTotalPriceWithoutTax()
{
return totalPriceWithoutTax;
}
public void setTaxAmount(BigDecimal taxAmount)
{
this.taxAmount = taxAmount;
}
public BigDecimal getTaxAmount()
{
return taxAmount;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("paymentBillCode", getPaymentBillCode())
.append("paymentBillType", getPaymentBillType())
.append("paymentTime", getPaymentTime())
.append("vendorCode", getVendorCode())
.append("orderCode", getOrderCode())
.append("totalPriceWithTax", getTotalPriceWithTax())
.append("totalPriceWithoutTax", getTotalPriceWithoutTax())
.append("taxAmount", getTaxAmount())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("delFlag", getDelFlag())
.toString();
}
}

View File

@ -0,0 +1,45 @@
package com.ruoyi.sip.domain.dto;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
public class MergedPaymentDataDto {
private String paymentBillType;
private Date estimatedPaymentTime;
private List<PayableOrderDto> payableOrders;
private BigDecimal totalMergePaymentAmount;
// Getters and Setters
public String getPaymentBillType() {
return paymentBillType;
}
public void setPaymentBillType(String paymentBillType) {
this.paymentBillType = paymentBillType;
}
public Date getEstimatedPaymentTime() {
return estimatedPaymentTime;
}
public void setEstimatedPaymentTime(Date estimatedPaymentTime) {
this.estimatedPaymentTime = estimatedPaymentTime;
}
public List<PayableOrderDto> getPayableOrders() {
return payableOrders;
}
public void setPayableOrders(List<PayableOrderDto> payableOrders) {
this.payableOrders = payableOrders;
}
public BigDecimal getTotalMergePaymentAmount() {
return totalMergePaymentAmount;
}
public void setTotalMergePaymentAmount(BigDecimal totalMergePaymentAmount) {
this.totalMergePaymentAmount = totalMergePaymentAmount;
}
}

View File

@ -0,0 +1,15 @@
package com.ruoyi.sip.domain.dto;
import com.ruoyi.sip.domain.OmsPayablePaymentPlan;
import lombok.Data;
import java.util.List;
@Data
public class PayableOrderDto {
private Long id;
private String payableBillCode;
private List<OmsPayablePaymentPlan> paymentPlans;
}

View File

@ -0,0 +1,24 @@
package com.ruoyi.sip.domain.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.sip.domain.OmsPaymentBill;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* DTO
*
* @author ruoyi
* @date 2024-12-08
*/
@Data
public class PaymentBillDetailDTO extends OmsPaymentBill {
/** 关联的应付单明细列表 */
private List<PaymentBillPayableDetailDTO> payableDetails;
}

View File

@ -0,0 +1,33 @@
package com.ruoyi.sip.domain.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
* DTO
*
* @author ruoyi
* @date 2024-12-08
*/
@Data
public class PaymentBillPayableDetailDTO {
/** 项目编号 */
private String projectCode;
/** 项目名称 */
private String projectName;
/** 采购应付单编号 */
private String payableBillCode;
/** 应付单含税总价 */
private BigDecimal totalPriceWithTax;
/** 本次付款金额 */
private BigDecimal paymentAmount;
/** 本次付款比例 */
private BigDecimal paymentRate;
}

View File

@ -0,0 +1,44 @@
package com.ruoyi.sip.domain.dto;
import java.math.BigDecimal;
import java.util.Date;
public class PaymentPlanDto {
private Date planPaymentDate;
private BigDecimal planAmount;
private BigDecimal planRate;
private String remark;
// Getters and Setters
public Date getPlanPaymentDate() {
return planPaymentDate;
}
public void setPlanPaymentDate(Date planPaymentDate) {
this.planPaymentDate = planPaymentDate;
}
public BigDecimal getPlanAmount() {
return planAmount;
}
public void setPlanAmount(BigDecimal planAmount) {
this.planAmount = planAmount;
}
public BigDecimal getPlanRate() {
return planRate;
}
public void setPlanRate(BigDecimal planRate) {
this.planRate = planRate;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}

View File

@ -0,0 +1,8 @@
package com.ruoyi.sip.mapper;
import com.ruoyi.sip.domain.OmsPayablePaymentDetail;
import java.util.List;
public interface OmsPayablePaymentDetailMapper {
public int insertOmsPayablePaymentDetail(OmsPayablePaymentDetail omsPayablePaymentDetail);
}

View File

@ -1,8 +1,7 @@
package com.ruoyi.sip.oms.mapper;
package com.ruoyi.sip.mapper;
import java.util.List;
import com.ruoyi.sip.oms.domain.OmsPayablePaymentPlan;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.sip.domain.OmsPayablePaymentPlan;
public interface OmsPayablePaymentPlanMapper {
/**

View File

@ -1,19 +1,23 @@
package com.ruoyi.sip.mapper;
import java.util.List;
import com.ruoyi.sip.domain.OmsPayableBill;
import com.ruoyi.sip.domain.OmsPaymentBill;
import com.ruoyi.sip.domain.dto.PaymentBillDetailDTO;
import com.ruoyi.sip.domain.dto.PaymentBillPayableDetailDTO;
/**
* Mapper
*
*
* @author ruoyi
* @date 2025-10-22
*/
public interface OmsPaymentBillMapper
public interface OmsPaymentBillMapper
{
/**
*
*
*
* @param id
* @return
*/
@ -21,7 +25,7 @@ public interface OmsPaymentBillMapper
/**
*
*
*
* @param omsPaymentBill
* @return
*/
@ -29,7 +33,7 @@ public interface OmsPaymentBillMapper
/**
*
*
*
* @param omsPaymentBill
* @return
*/
@ -37,7 +41,7 @@ public interface OmsPaymentBillMapper
/**
*
*
*
* @param omsPaymentBill
* @return
*/
@ -45,7 +49,7 @@ public interface OmsPaymentBillMapper
/**
*
*
*
* @param id
* @return
*/
@ -53,9 +57,37 @@ public interface OmsPaymentBillMapper
/**
*
*
*
* @param ids
* @return
*/
public int deleteOmsPaymentBillByIds(String[] ids);
/**
*
*
* @param prefix
* @return
*/
public int selectMaxCodeByPrefix(String prefix);
/**
*
*
* @param id
* @return
*/
public PaymentBillDetailDTO selectPaymentBillDetail(Long id);
/**
*
*
* @param paymentBillId
* @return
*/
public List<PaymentBillPayableDetailDTO> selectPaymentBillPayableDetails(Long paymentBillId);
void clearRelationPayable(String payableBillCode);
}

View File

@ -3,6 +3,8 @@ package com.ruoyi.sip.service;
import java.util.List;
import com.ruoyi.sip.domain.OmsPayableBill;
import com.ruoyi.sip.domain.dto.MergedPaymentDataDto;
/**
* Service
*
@ -58,4 +60,12 @@ public interface IOmsPayableBillService
* @return
*/
public int deleteOmsPayableBillById(Long id);
/**
*
*
* @param dto
* @return
*/
public int mergeAndInitiatePayment(MergedPaymentDataDto dto);
}

View File

@ -0,0 +1,7 @@
package com.ruoyi.sip.service;
import com.ruoyi.sip.domain.OmsPayablePaymentDetail;
public interface IOmsPayablePaymentDetailService {
public int insertOmsPayablePaymentDetail(OmsPayablePaymentDetail omsPayablePaymentDetail);
}

View File

@ -1,7 +1,7 @@
package com.ruoyi.sip.oms.service;
package com.ruoyi.sip.service;
import java.util.List;
import com.ruoyi.sip.oms.domain.OmsPayablePaymentPlan;
import com.ruoyi.sip.domain.OmsPayablePaymentPlan;
public interface IOmsPayablePaymentPlanService {
/**

View File

@ -1,7 +1,10 @@
package com.ruoyi.sip.service;
import java.util.List;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.sip.domain.OmsPaymentBill;
import com.ruoyi.sip.domain.dto.PaymentBillDetailDTO;
/**
* Service
@ -58,4 +61,9 @@ public interface IOmsPaymentBillService
* @return
*/
public int deleteOmsPaymentBillById(Long id);
PaymentBillDetailDTO query(Long id);
AjaxResult returnPaymentBill(Long id);
}

View File

@ -1,23 +1,29 @@
package com.ruoyi.sip.service.impl;
import java.text.DateFormat;
import java.util.List;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.enums.ApproveStatusEnum;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.sip.domain.OmsPayableBill;
import com.ruoyi.sip.domain.*;
import com.ruoyi.sip.mapper.OmsPayableBillMapper;
import com.ruoyi.sip.service.IOmsPayableBillService;
import com.ruoyi.sip.service.IVendorInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.sip.oms.domain.OmsPayablePaymentPlan;
import com.ruoyi.sip.oms.mapper.OmsPayablePaymentPlanMapper;
import com.ruoyi.sip.mapper.OmsPayablePaymentPlanMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.sip.domain.dto.MergedPaymentDataDto;
import com.ruoyi.sip.domain.dto.PayableOrderDto;
import com.ruoyi.sip.domain.dto.PaymentPlanDto;
import com.ruoyi.sip.service.IOmsPaymentBillService;
import com.ruoyi.sip.service.IOmsPayablePaymentDetailService;
/**
* Service
*
@ -32,6 +38,14 @@ public class OmsPayableBillServiceImpl implements IOmsPayableBillService {
@Autowired
private OmsPayablePaymentPlanMapper omsPayablePaymentPlanMapper;
@Autowired
private IOmsPaymentBillService omsPaymentBillService;
@Autowired
private IOmsPayablePaymentDetailService omsPayablePaymentDetailService;
@Autowired
private IVendorInfoService vendorInfoService;
/**
*
*
@ -138,4 +152,52 @@ public class OmsPayableBillServiceImpl implements IOmsPayableBillService {
omsPayablePaymentPlanMapper.deleteOmsPayablePaymentPlanByPayableBillId(id);
return omsPayableBillMapper.deleteOmsPayableBillById(id);
}
@Override
@Transactional
public int mergeAndInitiatePayment(MergedPaymentDataDto dto) {
// 1. 创建付款单
OmsPaymentBill paymentBill = new OmsPaymentBill();
OmsPayableBill firstPayableBill = omsPayableBillMapper.selectOmsPayableBillById(dto.getPayableOrders().get(0).getId());
VendorInfo vendorInfo = vendorInfoService.selectVendorInfoByVendorCode(firstPayableBill.getVendorCode());
paymentBill.setPaymentBillType(dto.getPaymentBillType());
paymentBill.setPaymentTime(dto.getEstimatedPaymentTime());
paymentBill.setTotalPriceWithTax(dto.getTotalMergePaymentAmount());
paymentBill.setVendorCode(firstPayableBill.getVendorCode());
paymentBill.setCreateBy(ShiroUtils.getUserId().toString());
paymentBill.setPaymentBillType(OmsPaymentBill.PaymentBillTypeEnum.FROM_PAYABLE.getCode());
paymentBill.setPayName(vendorInfo.getPayName());
paymentBill.setPayBankNumber(vendorInfo.getPayBankNumber());
paymentBill.setPayBankOpenAddress(vendorInfo.getPayBankOpenAddress());
paymentBill.setBankNumber(vendorInfo.getBankNumber());
paymentBill.setPaymentStatus(OmsPaymentBill.PaymentStatusEnum.WAIT_PAYMENT.getCode());
paymentBill.setApproveStatus(ApproveStatusEnum.WAIT_APPROVE.getCode());
omsPaymentBillService.insertOmsPaymentBill(paymentBill);
// 2. 创建付款明细
for (PayableOrderDto payableOrderDto : dto.getPayableOrders()) {
for (OmsPayablePaymentPlan paymentPlanDto : payableOrderDto.getPaymentPlans()) {
OmsPayablePaymentDetail detail = new OmsPayablePaymentDetail();
detail.setPayableBillId(payableOrderDto.getId());
detail.setPaymentPlanId(paymentPlanDto.getId());
detail.setPaymentBillCode(paymentBill.getPaymentBillCode());
detail.setPaymentAmount(paymentPlanDto.getPlanAmount());
detail.setPaymentRate(paymentPlanDto.getPlanRate());
detail.setPaymentTime(paymentPlanDto.getPlanPaymentDate());
detail.setRemark(paymentPlanDto.getRemark());
detail.setCreateBy(ShiroUtils.getLoginName());
omsPayablePaymentDetailService.insertOmsPayablePaymentDetail(detail);
}
// 3. 更新应付单状态
// OmsPayableBill payableBill = omsPayableBillMapper.selectOmsPayableBillById(payableOrderDto.getId());
// // 这里可以根据业务逻辑更新状态,例如 "付款中"
// // payableBill.setPaymentStatus("1");
// omsPayableBillMapper.updateOmsPayableBill(payableBill);
}
return 1;
}
}

View File

@ -0,0 +1,19 @@
package com.ruoyi.sip.service.impl;
import com.ruoyi.sip.domain.OmsPayablePaymentDetail;
import com.ruoyi.sip.mapper.OmsPayablePaymentDetailMapper;
import com.ruoyi.sip.service.IOmsPayablePaymentDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class OmsPayablePaymentDetailServiceImpl implements IOmsPayablePaymentDetailService {
@Autowired
private OmsPayablePaymentDetailMapper omsPayablePaymentDetailMapper;
@Override
public int insertOmsPayablePaymentDetail(OmsPayablePaymentDetail omsPayablePaymentDetail) {
return omsPayablePaymentDetailMapper.insertOmsPayablePaymentDetail(omsPayablePaymentDetail);
}
}

View File

@ -1,4 +1,4 @@
package com.ruoyi.sip.oms.service.impl;
package com.ruoyi.sip.service.impl;
import java.util.List;
import java.util.Set;
@ -8,9 +8,9 @@ import com.ruoyi.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.sip.oms.mapper.OmsPayablePaymentPlanMapper;
import com.ruoyi.sip.oms.domain.OmsPayablePaymentPlan;
import com.ruoyi.sip.oms.service.IOmsPayablePaymentPlanService;
import com.ruoyi.sip.mapper.OmsPayablePaymentPlanMapper;
import com.ruoyi.sip.domain.OmsPayablePaymentPlan;
import com.ruoyi.sip.service.IOmsPayablePaymentPlanService;
@Service

View File

@ -1,13 +1,21 @@
package com.ruoyi.sip.service.impl;
import java.util.List;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.sip.domain.OmsPayableBill;
import com.ruoyi.sip.domain.dto.PaymentBillDetailDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.sip.mapper.OmsPaymentBillMapper;
import com.ruoyi.sip.domain.OmsPaymentBill;
import com.ruoyi.sip.service.IOmsPaymentBillService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
@ -16,6 +24,7 @@ import com.ruoyi.common.core.text.Convert;
* @date 2025-10-22
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class OmsPaymentBillServiceImpl implements IOmsPaymentBillService
{
@Autowired
@ -54,10 +63,27 @@ public class OmsPaymentBillServiceImpl implements IOmsPaymentBillService
@Override
public int insertOmsPaymentBill(OmsPaymentBill omsPaymentBill)
{
omsPaymentBill.setPaymentBillCode(generatePaymentBillCode());
omsPaymentBill.setCreateTime(DateUtils.getNowDate());
return omsPaymentBillMapper.insertOmsPaymentBill(omsPaymentBill);
}
/**
* FK+YYMMdd+
* @return
*/
private String generatePaymentBillCode() {
String prefix = "FK";
// 查询当天已有的最大序列号
String codePrefix = prefix + DateUtil.format(DateUtil.date(), DatePattern.PURE_DATE_PATTERN);
int maxSequence = omsPaymentBillMapper.selectMaxCodeByPrefix(codePrefix);
// 生成新的序列号
int newSequence = maxSequence + 1;
// 序列号补零到4位
String sequenceStr = String.format("%04d", newSequence);
return codePrefix + sequenceStr;
}
/**
*
*
@ -94,4 +120,169 @@ public class OmsPaymentBillServiceImpl implements IOmsPaymentBillService
{
return omsPaymentBillMapper.deleteOmsPaymentBillById(id);
}
@Override
public PaymentBillDetailDTO query(Long id) {
PaymentBillDetailDTO paymentBillDetailDTO = omsPaymentBillMapper.selectPaymentBillDetail(id);
return paymentBillDetailDTO;
}
@Override
public AjaxResult returnPaymentBill(Long paymentBillId) {
try {
// 1. 验证付款单是否存在
OmsPaymentBill paymentBill = omsPaymentBillMapper.selectOmsPaymentBillById(paymentBillId);
if (paymentBill == null) {
return AjaxResult.error("付款单不存在");
}
// 2. 检查付款单类型只有FROM_PAYABLE类型的付款单才能退回
if (!OmsPaymentBill.PaymentBillTypeEnum.FROM_PAYABLE.getCode().equals(paymentBill.getPaymentBillType())) {
return AjaxResult.error("只有由应付单合并生成的付款单才能执行退回操作");
}
// 3. 清楚关联
omsPaymentBillMapper.clearRelationPayable(paymentBill.getPaymentBillCode());
// 6. 删除付款单记录
int result = omsPaymentBillMapper.deleteOmsPaymentBillById(paymentBillId);
if (result <= 0) {
throw new RuntimeException("删除付款单失败");
}
return AjaxResult.success("付款单退回成功!");
} catch (Exception e) {
throw new RuntimeException("退回付款单操作失败:" + e.getMessage(), e);
}
}
/**
*
*
* @param paymentBill
* @return
*/
// @Override
// public int applyPayment(OmsPaymentBill paymentBill) {
// paymentBill.setUpdateTime(DateUtils.getNowDate());
// paymentBill.setUpdateBy(ShiroUtils.getLoginName());
// // todo 开启审批流程
// paymentBill.setApproveStatus(OmsPaymentBill.ApproveStatusEnum.UNDER_APPROVAL.getCode());
// return omsPaymentBillMapper.updateOmsPaymentBill(paymentBill);
// }
// @Override
// public AjaxResult uploadReceipt(Long paymentBillId, MultipartFile file) throws Exception {
// OmsPaymentBill paymentBill = selectOmsPaymentBillById(paymentBillId);
// if (paymentBill == null) {
// return AjaxResult.error("付款单不存在");
// }
//
// if (file.isEmpty())
// {
// return AjaxResult.error("上传文件不能为空");
// }
// // 上传文件路径
// String filePath = RuoYiConfig.getUploadPath();
// // 上传并返回新文件名称
// String fileName = FileUploadUtils.upload(filePath, file);
//
// SysUser loginUser = ShiroUtils.getSysUser();
// OmsFinAttachment attachment = new OmsFinAttachment();
// attachment.setRelatedBillId(paymentBillId);
// attachment.setRelatedBillType(OmsFinAttachment.RelatedBillTypeEnum.PAYMENT.getCode());
// attachment.setFileName(file.getOriginalFilename());
// attachment.setFilePath(fileName);
// attachment.setFileSize(file.getSize());
// attachment.setFileType(file.getContentType());
// attachment.setCreateBy(loginUser.getUserId().toString());
// omsFinAttachmentService.insertOmsFinAttachment(attachment);
// paymentBill.setActualPaymentTime(DateUtils.getNowDate());
// paymentBill.setReceiptAttachmentId(attachment.getId());
// paymentBill.setPaymentStatus(OmsPaymentBill.PaymentStatusEnum.PAYMENT.getCode());
// updateOmsPaymentBill(paymentBill);
//
// return AjaxResult.success(attachment);
// }
//
// @Override
// @Transactional
// public AjaxResult applyRefund(Long originalPaymentId) {
// // 1. 验证原始付款单
// OmsPaymentBill originalBill = selectOmsPaymentBillById(originalPaymentId);
// if (originalBill == null) {
// return AjaxResult.error("原始付款单不存在");
// }
// if (!OmsPaymentBill.PaymentStatusEnum.PAYMENT.getCode().equals(originalBill.getPaymentStatus())) {
// return AjaxResult.error("只有已付款的订单才能申请退款");
// }
// if ("REFUND_APPLIED".equals(originalBill.getRefundStatus())) {
// return AjaxResult.error("该付款单已申请过退款,请勿重复操作");
// }
//
// // 2. 创建新的退款单
// OmsPaymentBill refundBill = new OmsPaymentBill();
//
// // 复制属性并取反金额
// refundBill.setTotalPriceWithTax(originalBill.getTotalPriceWithTax().negate());
// refundBill.setTotalPriceWithoutTax(originalBill.getTotalPriceWithoutTax().negate());
// refundBill.setTaxAmount(originalBill.getTaxAmount().negate());
//
// refundBill.setVendorCode(originalBill.getVendorCode());
// refundBill.setOrderCode(originalBill.getOrderCode());
// refundBill.setPayName(originalBill.getPayName());
// refundBill.setPayBankNumber(originalBill.getPayBankNumber());
// refundBill.setPayBankOpenAddress(originalBill.getPayBankOpenAddress());
// refundBill.setBankNumber(originalBill.getBankNumber());
//
// // 设置新属性
// refundBill.setPaymentBillType(OmsPaymentBill.PaymentBillTypeEnum.REFUND.getCode());
// refundBill.setPaymentStatus(OmsPaymentBill.PaymentStatusEnum.WAIT_PAYMENT.getCode());
// refundBill.setApproveStatus(OmsPaymentBill.ApproveStatusEnum.UNDER_APPROVAL.getCode());
// refundBill.setOriginalBillId(originalPaymentId);
// refundBill.setRemark("退款-关联原付款单:" + originalBill.getPaymentBillCode());
//
// insertOmsPaymentBill(refundBill);
//
// // 3. 更新原始付款单状态
// originalBill.setRefundStatus("1");
// updateOmsPaymentBill(originalBill);
//
// return AjaxResult.success("退款申请已提交,新的退款单号为:" + refundBill.getPaymentBillCode());
// }
//
// @Override
// public AjaxResult uploadRefundProof(Long paymentBillId, MultipartFile file) throws Exception {
// OmsPaymentBill paymentBill = selectOmsPaymentBillById(paymentBillId);
// if (paymentBill == null) {
// return AjaxResult.error("付款单不存在");
// }
// if (!OmsPaymentBill.PaymentBillTypeEnum.REFUND.getCode().equals(paymentBill.getPaymentBillType())) {
// return AjaxResult.error("只有退款单才能上传退款图");
// }
//
// if (file.isEmpty())
// {
// return AjaxResult.error("上传文件不能为空");
// }
//
// // 上传文件并创建附件记录
// OmsFinAttachment attachment = omsFinAttachmentService.uploadAttachment(file, paymentBillId, OmsFinAttachment.RelatedBillTypeEnum.PAYMENT);
//
// // 更新付款单
// paymentBill.setRefundProofAttachmentId(attachment.getId());
// // 更新为“已付款”
// paymentBill.setPaymentStatus(OmsPaymentBill.PaymentStatusEnum.PAYMENT.getCode());
// paymentBill.setActualPaymentTime(DateUtils.getNowDate());
// updateOmsPaymentBill(paymentBill);
//
// return AjaxResult.success(attachment);
// }
}

View File

@ -72,13 +72,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTimeStart != null or createTimeEnd != null">
<choose>
<when test="createTimeStart != null and createTimeEnd != null">
and t1.create_time between #{createTimeStart} and #{createTimeEnd}
and t1.create_time between date_format(#{createTimeStart}, '%Y-%m-%d 00:00:00') and date_format(#{createTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
<when test="createTimeStart != null">
and t1.create_time <![CDATA[ >= ]]> #{createTimeStart}
and t1.create_time <![CDATA[ >= ]]> date_format(#{createTimeStart}, '%Y-%m-%d 00:00:00')
</when>
<when test="createTimeEnd != null">
and t1.create_time <![CDATA[ <= ]]> #{createTimeEnd}
and t1.create_time <![CDATA[ <= ]]> date_format(#{createTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
</choose>
</if>
<if test="estimatedPaymentTimeStart != null or estimatedPaymentTimeEnd != null">
<choose>
<when test="estimatedPaymentTimeStart != null and estimatedPaymentTimeEnd != null">
and t1.estimated_payment_time between date_format(#{estimatedPaymentTimeStart}, '%Y-%m-%d 00:00:00') and date_format(#{estimatedPaymentTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
<when test="estimatedPaymentTimeStart != null">
and t1.estimated_payment_time <![CDATA[ >= ]]> date_format(#{estimatedPaymentTimeStart}, '%Y-%m-%d 00:00:00')
</when>
<when test="estimatedPaymentTimeEnd != null">
and t1.estimated_payment_time <![CDATA[ <= ]]> date_format(#{estimatedPaymentTimeEnd}, '%Y-%m-%d 23:59:59')
</when>
</choose>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.sip.mapper.OmsPayablePaymentDetailMapper">
<resultMap type="OmsPayablePaymentDetail" id="OmsPayablePaymentDetailResult">
<result property="id" column="id" />
<result property="paymentPlanId" column="payment_plan_id" />
<result property="payableBillId" column="payable_bill_id" />
<result property="paymentStatus" column="payment_status" />
<result property="paymentTime" column="payment_time" />
<result property="paymentAmount" column="payment_amount" />
<result property="paymentRate" column="payment_rate" />
<result property="paymentBillCode" column="payment_bill_code" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<insert id="insertOmsPayablePaymentDetail" parameterType="OmsPayablePaymentDetail" useGeneratedKeys="true" keyProperty="id">
insert into oms_payable_payment_detail (
<if test="paymentPlanId != null">payment_plan_id,</if>
<if test="payableBillId != null">payable_bill_id,</if>
<if test="paymentStatus != null">payment_status,</if>
<if test="paymentTime != null">payment_time,</if>
<if test="paymentAmount != null">payment_amount,</if>
<if test="paymentRate != null">payment_rate,</if>
<if test="paymentBillCode != null and paymentBillCode != ''">payment_bill_code,</if>
<if test="remark != null and remark != ''">remark,</if>
create_by,
create_time
) values (
<if test="paymentPlanId != null">#{paymentPlanId},</if>
<if test="payableBillId != null">#{payableBillId},</if>
<if test="paymentStatus != null">#{paymentStatus},</if>
<if test="paymentTime != null">#{paymentTime},</if>
<if test="paymentAmount != null">#{paymentAmount},</if>
<if test="paymentRate != null">#{paymentRate},</if>
<if test="paymentBillCode != null and paymentBillCode != ''">#{paymentBillCode},</if>
<if test="remark != null and remark != ''">#{remark},</if>
#{createBy},
sysdate()
)
</insert>
</mapper>

View File

@ -20,29 +20,128 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="delFlag" column="del_flag" />
<result property="projectCode" column="project_code" />
<result property="projectName" column="project_name" />
<result property="preResidueAmount" column="pre_residue_amount" />
<result property="actualPaymentTime" column="actual_payment_time" />
<result property="paymentStatus" column="payment_status" />
<result property="approveStatus" column="approve_status" />
<result property="approveNode" column="approve_node" />
<result property="approveTime" column="approve_time" />
<result property="paymentMethod" column="payment_method" />
<result property="payableBillCode" column="payable_bill_code" />
<result property="payName" column="pay_name" />
<result property="payBankNumber" column="pay_bank_number" />
<result property="payBankOpenAddress" column="pay_bank_open_address" />
<result property="bankNumber" column="bank_number" />
<result property="receiptAttachmentId" column="receipt_attachment_id" />
<result property="refundProofAttachmentId" column="refund_proof_attachment_id" />
<result property="refundStatus" column="refund_status" />
</resultMap>
<resultMap type="com.ruoyi.sip.domain.dto.PaymentBillDetailDTO" id="PaymentBillDetailResult">
<result property="id" column="id" />
<result property="paymentBillCode" column="payment_bill_code" />
<result property="paymentTime" column="payment_time" />
<result property="vendorCode" column="vendor_code" />
<result property="totalPriceWithTax" column="total_price_with_tax" />
<result property="totalPriceWithoutTax" column="total_price_without_tax" />
<result property="taxAmount" column="tax_amount" />
<result property="paymentBillType" column="payment_bill_type" />
<result property="preResidueAmount" column="pre_residue_amount" />
<result property="actualPaymentTime" column="actual_payment_time" />
<result property="paymentMethod" column="payment_method" />
<result property="receiptAttachmentId" column="receipt_attachment_id" />
<result property="refundProofAttachmentId" column="refund_proof_attachment_id" />
<result property="paymentStatus" column="payment_status" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="payName" column="pay_name" />
<result property="payBankNumber" column="pay_bank_number" />
<result property="payBankOpenAddress" column="pay_bank_open_address" />
<result property="bankNumber" column="bank_number" />
<result property="approveNode" column="approve_node" />
<result property="approveStatus" column="approve_status" />
<result property="approveTime" column="approve_time" />
</resultMap>
<resultMap type="com.ruoyi.sip.domain.dto.PaymentBillPayableDetailDTO" id="PaymentBillPayableDetailResult">
<result property="projectCode" column="project_code" />
<result property="projectName" column="project_name" />
<result property="payableBillCode" column="payable_bill_code" />
<result property="totalPriceWithTax" column="total_price_with_tax" />
<result property="paymentAmount" column="payment_amount" />
<result property="paymentRate" column="payment_rate" />
</resultMap>
<sql id="selectOmsPaymentBillVo">
select id, payment_bill_code, payment_bill_type, payment_time, vendor_code, order_code, total_price_with_tax, total_price_without_tax, tax_amount, create_by, create_time, update_by, update_time, remark, del_flag from oms_payment_bill
select
pb.id,
pb.payment_bill_code,
pb.payment_bill_type,
pb.payment_time,
pb.vendor_code,
pb.order_code,
pb.total_price_with_tax,
pb.total_price_without_tax,
pb.tax_amount,
pb.create_by,
pb.create_time,
pb.update_by,
pb.update_time,
pb.remark,
pb.del_flag,
pb.project_code,
pb.project_name,
pb.pre_residue_amount,
pb.actual_payment_time,
pb.payment_status,
pb.approve_status,
pb.approve_node,
pb.approve_time,
pb.payment_method,
pb.pay_name,
pb.pay_bank_number,
pb.pay_bank_open_address,
pb.bank_number,
pb.refund_proof_attachment_id,
pb.receipt_attachment_id,
pb.refund_status,
ovi.vendor_name
from oms_payment_bill pb
left join oms_vendor_info ovi on pb.vendor_code = ovi.vendor_code
</sql>
<select id="selectOmsPaymentBillList" parameterType="OmsPaymentBill" resultMap="OmsPaymentBillResult">
<include refid="selectOmsPaymentBillVo"/>
<where>
<if test="paymentBillCode != null and paymentBillCode != ''"> and payment_bill_code = #{paymentBillCode}</if>
<if test="paymentBillType != null and paymentBillType != ''"> and payment_bill_type = #{paymentBillType}</if>
<if test="paymentTime != null "> and payment_time = #{paymentTime}</if>
<if test="vendorCode != null and vendorCode != ''"> and vendor_code = #{vendorCode}</if>
<if test="orderCode != null and orderCode != ''"> and order_code = #{orderCode}</if>
<if test="totalPriceWithTax != null "> and total_price_with_tax = #{totalPriceWithTax}</if>
<if test="totalPriceWithoutTax != null "> and total_price_without_tax = #{totalPriceWithoutTax}</if>
<if test="taxAmount != null "> and tax_amount = #{taxAmount}</if>
<where>
<if test="paymentBillCode != null and paymentBillCode != ''"> and pb.payment_bill_code like concat('%', #{paymentBillCode}, '%')</if>
<if test="paymentBillType != null and paymentBillType != ''"> and pb.payment_bill_type = #{paymentBillType}</if>
<if test="paymentTime != null "> and date_format(pb.payment_time,'%Y-%m-%d') = date_format(#{paymentTime},'%Y-%m-%d')</if>
<if test="vendorCode != null and vendorCode != ''"> and pb.vendor_code like concat('%', #{vendorCode}, '%')</if>
<if test="orderCode != null and orderCode != ''"> and pb.order_code like concat('%', #{orderCode}, '%')</if>
<if test="totalPriceWithTax != null "> and pb.total_price_with_tax = #{totalPriceWithTax}</if>
<if test="totalPriceWithoutTax != null "> and pb.total_price_without_tax = #{totalPriceWithoutTax}</if>
<if test="taxAmount != null "> and pb.tax_amount = #{taxAmount}</if>
<if test="projectCode != null and projectCode != ''"> and pb.project_code like concat('%', #{projectCode}, '%')</if>
<if test="projectName != null and projectName != ''"> and pb.project_name like concat('%', #{projectName}, '%')</if>
<if test="paymentStatus != null and paymentStatus != ''"> and pb.payment_status = #{paymentStatus}</if>
<if test="approveStatus != null and approveStatus != ''"> and pb.approve_status = #{approveStatus}</if>
<if test="approveNode != null and approveNode != ''"> and pb.approve_node = #{approveNode}</if>
<if test="approveTime != null "> and date_format(pb.approve_time,'%Y-%m-%d') = date_format(#{approveTime},'%Y-%m-%d')</if>
<if test="actualPaymentTime != null "> and date_format(pb.actual_payment_time,'%Y-%m-%d') = date_format(#{actualPaymentTime},'%Y-%m-%d')</if>
<if test="paymentMethod != null and paymentMethod != ''"> and pb.payment_method = #{paymentMethod}</if>
<if test="payableBillCode != null and payableBillCode != ''"> and apb.payable_bill_code like concat('%', #{payableBillCode}, '%')</if>
and pb.del_flag = '0'
</where>
group by pb.id
order by pb.create_time desc
</select>
<select id="selectOmsPaymentBillById" parameterType="Long" resultMap="OmsPaymentBillResult">
<include refid="selectOmsPaymentBillVo"/>
where id = #{id}
where pb.id = #{id}
group by pb.id
</select>
<insert id="insertOmsPaymentBill" parameterType="OmsPaymentBill" useGeneratedKeys="true" keyProperty="id">
@ -62,6 +161,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="delFlag != null">del_flag,</if>
<if test="projectCode != null">project_code,</if>
<if test="projectName != null">project_name,</if>
<if test="preResidueAmount != null">pre_residue_amount,</if>
<if test="actualPaymentTime != null">actual_payment_time,</if>
<if test="paymentStatus != null">payment_status,</if>
<if test="approveStatus != null">approve_status,</if>
<if test="approveNode != null">approve_node,</if>
<if test="approveTime != null">approve_time,</if>
<if test="paymentMethod != null">payment_method,</if>
<if test="payName != null">pay_name,</if>
<if test="payBankNumber != null">pay_bank_number,</if>
<if test="payBankOpenAddress != null">pay_bank_open_address,</if>
<if test="bankNumber != null">bank_number,</if>
<if test="refundProofAttachmentId != null">refund_proof_attachment_id,</if>
<if test="receiptAttachmentId != null">receipt_attachment_id,</if>
<if test="refundStatus != null">refund_status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="paymentBillCode != null and paymentBillCode != ''">#{paymentBillCode},</if>
@ -78,6 +193,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="projectCode != null">#{projectCode},</if>
<if test="projectName != null">#{projectName},</if>
<if test="preResidueAmount != null">#{preResidueAmount},</if>
<if test="actualPaymentTime != null">#{actualPaymentTime},</if>
<if test="paymentStatus != null">#{paymentStatus},</if>
<if test="approveStatus != null">#{approveStatus},</if>
<if test="approveNode != null">#{approveNode},</if>
<if test="approveTime != null">#{approveTime},</if>
<if test="paymentMethod != null">#{paymentMethod},</if>
<if test="payName != null">#{payName},</if>
<if test="payBankNumber != null">#{payBankNumber},</if>
<if test="payBankOpenAddress != null">#{payBankOpenAddress},</if>
<if test="bankNumber != null">#{bankNumber},</if>
<if test="refundProofAttachmentId != null">#{refundProofAttachmentId},</if>
<if test="receiptAttachmentId != null">#{receiptAttachmentId},</if>
<if test="refundStatus != null">#{refundStatus},</if>
</trim>
</insert>
@ -98,6 +229,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="projectCode != null">project_code = #{projectCode},</if>
<if test="projectName != null">project_name = #{projectName},</if>
<if test="preResidueAmount != null">pre_residue_amount = #{preResidueAmount},</if>
<if test="actualPaymentTime != null">actual_payment_time = #{actualPaymentTime},</if>
<if test="paymentStatus != null">payment_status = #{paymentStatus},</if>
<if test="approveStatus != null">approve_status = #{approveStatus},</if>
<if test="approveNode != null">approve_node = #{approveNode},</if>
<if test="approveTime != null">approve_time = #{approveTime},</if>
<if test="paymentMethod != null">payment_method = #{paymentMethod},</if>
<if test="payName != null">pay_name = #{payName},</if>
<if test="payBankNumber != null">pay_bank_number = #{payBankNumber},</if>
<if test="payBankOpenAddress != null">pay_bank_open_address = #{payBankOpenAddress},</if>
<if test="bankNumber != null">bank_number = #{bankNumber},</if>
<if test="refundProofAttachmentId != null">refund_proof_attachment_id = #{refundProofAttachmentId},</if>
<if test="receiptAttachmentId != null">receipt_attachment_id = #{receiptAttachmentId},</if>
<if test="refundStatus != null">refund_status = #{refundStatus},</if>
</trim>
where id = #{id}
</update>
@ -112,5 +259,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<delete id="clearRelationPayable">
delete from oms_payable_payment_detail where payment_bill_code=#{code}
</delete>
<select id="selectMaxCodeByPrefix" parameterType="String" resultType="Integer">
SELECT IFNULL(MAX(CAST(SUBSTRING(payment_bill_code, LENGTH(#{prefix}) + 1) AS SIGNED)), 0)
FROM oms_payment_bill
WHERE payment_bill_code LIKE CONCAT(#{prefix}, '%')
</select>
<select id="selectPaymentBillDetail" resultType="com.ruoyi.sip.domain.dto.PaymentBillDetailDTO">
<include refid="selectOmsPaymentBillVo"/>
where pb.id = #{id}
</select>
<select id="selectPaymentBillPayableDetails"
resultType="com.ruoyi.sip.domain.dto.PaymentBillPayableDetailDTO">
</select>
</mapper>

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.sip.mapper.OmsPayablePaymentPlanMapper">
<resultMap type="OmsPayablePaymentPlan" id="OmsPayablePaymentPlanResult">
<result property="id" column="id" />
<result property="payableBillId" column="payable_bill_id" />
<result property="planPaymentDate" column="plan_payment_date" />
<result property="planAmount" column="plan_amount" />
<result property="planRate" column="plan_rate" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectOmsPayablePaymentPlanVo">
select id, payable_bill_id, plan_payment_date, plan_amount, plan_rate, remark, create_time, create_by, update_time from oms_payable_payment_plan
</sql>
<select id="selectOmsPayablePaymentPlanListByPayableBillId" parameterType="Long" resultMap="OmsPayablePaymentPlanResult">
SELECT
t1.id,
t1.payable_bill_id,
t1.plan_payment_date,
t1.plan_amount,
t1.plan_rate,
t1.remark,
t1.create_time,
t1.create_by,
t1.update_time,
t2.id as detail_id
FROM
oms_payable_payment_plan t1
left join oms_payable_payment_detail t2 on t1.id=t2.payment_plan_id
where t1.payable_bill_id = #{payableBillId}
order by t1.plan_payment_date
</select>
<select id="selectOmsPayablePaymentPlanIdsByPayableBillId" parameterType="Long" resultType="Long">
select id from oms_payable_payment_plan where payable_bill_id = #{payableBillId}
</select>
<insert id="insertOmsPayablePaymentPlan" parameterType="OmsPayablePaymentPlan" useGeneratedKeys="true" keyProperty="id">
insert into oms_payable_payment_plan(
<if test="payableBillId != null">payable_bill_id,</if>
<if test="planPaymentDate != null">plan_payment_date,</if>
<if test="planAmount != null">plan_amount,</if>
<if test="planRate != null">plan_rate,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="payableBillId != null">#{payableBillId},</if>
<if test="planPaymentDate != null">#{planPaymentDate},</if>
<if test="planAmount != null">#{planAmount},</if>
<if test="planRate != null">#{planRate},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateOmsPayablePaymentPlan" parameterType="OmsPayablePaymentPlan">
update oms_payable_payment_plan
<trim prefix="SET" suffixOverrides=",">
<if test="planPaymentDate != null">plan_payment_date = #{planPaymentDate},</if>
<if test="planAmount != null">plan_amount = #{planAmount},</if>
<if test="planRate != null">plan_rate = #{planRate},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
update_time = sysdate()
</trim>
where id = #{id}
</update>
<delete id="deleteOmsPayablePaymentPlanById" parameterType="Long">
delete from oms_payable_payment_plan where id = #{id}
</delete>
<delete id="deleteOmsPayablePaymentPlanByPayableBillId" parameterType="Long">
delete from oms_payable_payment_plan where payable_bill_id = #{payableBillId}
</delete>
<insert id="batchOmsPayablePaymentPlan">
insert into oms_payable_payment_plan( payable_bill_id, plan_payment_date, plan_amount, plan_rate, remark, create_by, create_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.payableBillId}, #{item.planPaymentDate}, #{item.planAmount}, #{item.planRate}, #{item.remark}, #{item.createBy}, sysdate())
</foreach>
</insert>
</mapper>