feat(finance): 实现财务计收页面表格列动态显示和数据关联查询

- 在charge页面添加columns配置对象,支持表格列的动态显示和隐藏
- 集成right-toolbar组件的columns属性,实现列显隐控制功能
- 为表格列添加v-if条件渲染和key属性,优化列显示控制
- 在订单通路列添加标签显示,区分总代和直签类型
- 在实体类OmsFinanceCharge中添加项目、供应商、合作伙伴等关联字段
- 使用lombok注解配置getter/setter访问级别,避免自动生成方法冲突
- 实现毛利、毛利率、成本合计等计算字段的业务逻辑
- 更新数据访问层,通过多表关联查询获取项目和合作伙伴信息
- 优化SQL查询语句,添加表别名并完善查询条件的字段引用
- 增加项目编码、项目名称、合作伙伴名称等查询条件支持
dev_1.0.1
chenhao 2026-01-04 10:36:43 +08:00
parent caec1d4bd0
commit 4238f345cb
3 changed files with 161 additions and 56 deletions

View File

@ -53,51 +53,55 @@
v-hasPermi="['finance:charge:export']" v-hasPermi="['finance:charge:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="chargeList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="chargeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <!-- <el-table-column type="selection" width="55" align="center" />-->
<el-table-column label="项目编码" align="center" prop="projectCode" /> <el-table-column label="项目编码" align="center" prop="projectCode" width="180" v-if="columns.projectCode.visible" key="projectCode"/>
<el-table-column label="项目名称" align="center" prop="projectName" /> <el-table-column label="项目名称" align="center" prop="projectName" width="240" v-if="columns.projectName.visible" key="projectName"/>
<el-table-column label="合同编号" align="center" prop="orderCode" /> <el-table-column label="合同编号" align="center" prop="orderCode" width="180" v-if="columns.orderCode.visible" key="orderCode"/>
<el-table-column label="下单通路" align="center" prop="orderChannel" /> <el-table-column label="下单通路" align="center" prop="orderChannel" width="100" v-if="columns.orderChannel.visible" key="orderChannel">
<el-table-column label="供货商" align="center" prop="supplier" /> <template slot-scope="scope">
<el-table-column label="进货商" align="center" prop="partnerName" /> <el-tag>{{ scope.row.orderChannel==='1'? "总代":"直签" }}</el-tag>
<el-table-column label="业务侧可计收时间" align="center" prop="bizChargeDate" width="180"> </template>
</el-table-column>
<el-table-column label="供货商" align="center" prop="supplier" width="180" v-if="columns.supplier.visible" key="supplier"/>
<el-table-column label="进货商" align="center" prop="partnerName" width="180" v-if="columns.partnerName.visible" key="partnerName"/>
<el-table-column label="业务侧可计收时间" align="center" prop="bizChargeDate" width="180" v-if="columns.bizChargeDate.visible" key="bizChargeDate">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.bizChargeDate, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.bizChargeDate, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="财务计收时间" align="center" prop="financeChargeDate" width="180"> <el-table-column label="财务计收时间" align="center" prop="financeChargeDate" width="180" v-if="columns.financeChargeDate.visible" key="financeChargeDate">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.financeChargeDate, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.financeChargeDate, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="收入" align="center"> <el-table-column label="收入" align="center" v-if="columns.incomeWithTaxTotal.visible || columns.incomeWithoutTaxTotal.visible || columns.incomeTax.visible">
<el-table-column label="含税总价(元)" align="center" prop="incomeWithTaxTotal" /> <el-table-column label="含税总价(元)" align="center" prop="incomeWithTaxTotal" width="180" v-if="columns.incomeWithTaxTotal.visible" key="incomeWithTaxTotal"/>
<el-table-column label="未含税总价(元)" align="center" prop="incomeWithoutTaxTotal" /> <el-table-column label="未含税总价(元)" align="center" prop="incomeWithoutTaxTotal" width="180" v-if="columns.incomeWithoutTaxTotal.visible" key="incomeWithoutTaxTotal"/>
<el-table-column label="税额(元)" align="center" prop="incomeTax" > <el-table-column label="税额(元)" align="center" prop="incomeTax" width="180" v-if="columns.incomeTax.visible" key="incomeTax">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ $calc.sub(scope.row.incomeWithTaxTotal, scope.row.incomeWithoutTaxTotal) }}</span> <span>{{ $calc.sub(scope.row.incomeWithTaxTotal, scope.row.incomeWithoutTaxTotal) }}</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column label="成本" align="center"> <el-table-column label="成本" align="center" v-if="columns.costSoftwareWithoutTax.visible || columns.costHardwareWithoutTax.visible || columns.costSoftwareMaintWithoutTax.visible || columns.costHardwareMaintWithoutTax.visible || columns.costProvinceServiceWithoutTax.visible || columns.costOtherWithoutTax.visible || columns.allCostWithoutTax.visible">
<el-table-column label="软件折后未税小计" align="center" prop="costSoftwareWithoutTax" /> <el-table-column label="软件折后未税小计" align="center" prop="costSoftwareWithoutTax" width="180" v-if="columns.costSoftwareWithoutTax.visible" key="costSoftwareWithoutTax"/>
<el-table-column label="硬件折后未税小计" align="center" prop="costHardwareWithoutTax" /> <el-table-column label="硬件折后未税小计" align="center" prop="costHardwareWithoutTax" width="180" v-if="columns.costHardwareWithoutTax.visible" key="costHardwareWithoutTax"/>
<el-table-column label="软件维保折后未税小计" align="center" prop="costSoftwareMaintWithoutTax" /> <el-table-column label="软件维保折后未税小计" align="center" prop="costSoftwareMaintWithoutTax" width="180" v-if="columns.costSoftwareMaintWithoutTax.visible" key="costSoftwareMaintWithoutTax"/>
<el-table-column label="硬件维保折后未税小计" align="center" prop="costHardwareMaintWithoutTax" /> <el-table-column label="硬件维保折后未税小计" align="center" prop="costHardwareMaintWithoutTax" width="180" v-if="columns.costHardwareMaintWithoutTax.visible" key="costHardwareMaintWithoutTax"/>
<el-table-column label="省代服务折后未税小计" align="center" prop="costProvinceServiceWithoutTax" /> <el-table-column label="省代服务折后未税小计" align="center" prop="costProvinceServiceWithoutTax" width="180" v-if="columns.costProvinceServiceWithoutTax.visible" key="costProvinceServiceWithoutTax"/>
<el-table-column label="其它折后未税小计" align="center" prop="costOtherWithoutTax" /> <el-table-column label="其它折后未税小计" align="center" prop="costOtherWithoutTax" width="180" v-if="columns.costOtherWithoutTax.visible" key="costOtherWithoutTax"/>
<el-table-column label="成本未税合计" align="center" prop="costTotalWithoutTax" > <el-table-column label="成本未税合计" align="center" prop="allCostWithoutTax" width="180" v-if="columns.allCostWithoutTax.visible" key="allCostWithoutTax">
</el-table-column> </el-table-column>
</el-table-column> </el-table-column>
<el-table-column label="毛利" align="center" prop="grossProfit" /> <el-table-column label="毛利" align="center" prop="grossProfit" width="180" v-if="columns.grossProfit.visible" key="grossProfit"/>
<el-table-column label="毛利率" align="center" prop="grossProfitRate" /> <el-table-column label="毛利率" align="center" prop="grossProfitRate" width="180" v-if="columns.grossProfitRate.visible" key="grossProfitRate"/>
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark" width="180" v-if="columns.remark.visible" key="remark"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" width="180" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
@ -181,6 +185,30 @@ export default {
projectName: null, projectName: null,
partnerName: null, partnerName: null,
}, },
//
columns: {
projectCode: { label: '项目编码', visible: true },
projectName: { label: '项目名称', visible: true },
orderCode: { label: '合同编号', visible: true },
orderChannel: { label: '下单通路', visible: true },
supplier: { label: '供货商', visible: true },
partnerName: { label: '进货商', visible: true },
bizChargeDate: { label: '业务侧可计收时间', visible: true },
financeChargeDate: { label: '财务计收时间', visible: true },
incomeWithTaxTotal: { label: '含税总价(元)', visible: true },
incomeWithoutTaxTotal: { label: '未含税总价(元)', visible: true },
incomeTax: { label: '税额(元)', visible: true },
costSoftwareWithoutTax: { label: '软件折后未税小计', visible: true },
costHardwareWithoutTax: { label: '硬件折后未税小计', visible: true },
costSoftwareMaintWithoutTax: { label: '软件维保折后未税小计', visible: true },
costHardwareMaintWithoutTax: { label: '硬件维保折后未税小计', visible: true },
costProvinceServiceWithoutTax: { label: '省代服务折后未税小计', visible: true },
costOtherWithoutTax: { label: '其它折后未税小计', visible: true },
allCostWithoutTax: { label: '成本未税合计', visible: true },
grossProfit: { label: '毛利', visible: true },
grossProfitRate: { label: '毛利率', visible: true },
remark: { label: '备注', visible: true }
},
// //
form: {}, form: {},
}; };

View File

@ -3,8 +3,10 @@ package com.ruoyi.sip.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AccessLevel;
import lombok.Data; import lombok.Data;
import lombok.Getter; import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
@ -101,6 +103,68 @@ public class OmsFinanceCharge extends BaseEntity
/** 计收状态 0:等待收款完成 1:可申请计收 2:已申请计收 3:已完成计收 */ /** 计收状态 0:等待收款完成 1:可申请计收 2:已申请计收 3:已完成计收 */
@Excel(name = "计收状态", readConverterExp = "0=等待收款完成,1=可申请计收,2=已申请计收,3=已完成计收") @Excel(name = "计收状态", readConverterExp = "0=等待收款完成,1=可申请计收,2=已申请计收,3=已完成计收")
private String chargeStatus; private String chargeStatus;
private String projectCode;
private String projectName;
private String orderChannel;
private String supplier;
private String partnerCode;
private String partnerName;
@Getter(value=AccessLevel.NONE)
@Setter(value=AccessLevel.NONE)
private BigDecimal grossProfit;
@Getter(value=AccessLevel.NONE)
@Setter(value=AccessLevel.NONE)
private BigDecimal grossProfitRate;
@Getter(value=AccessLevel.NONE)
@Setter(value=AccessLevel.NONE)
private BigDecimal allCostWithoutTax;
public BigDecimal getAllCostWithoutTax() {
if (allCostWithoutTax == null) {
allCostWithoutTax = BigDecimal.ZERO;
if (costSoftwareWithoutTax != null) {
allCostWithoutTax = allCostWithoutTax.add(costSoftwareWithoutTax);
}
if (costHardwareWithoutTax != null) {
allCostWithoutTax = allCostWithoutTax.add(costHardwareWithoutTax);
}
if (costSoftwareMaintWithoutTax != null) {
allCostWithoutTax = allCostWithoutTax.add(costSoftwareMaintWithoutTax);
}
if (costHardwareMaintWithoutTax != null) {
allCostWithoutTax = allCostWithoutTax.add(costHardwareMaintWithoutTax);
}
if (costProvinceServiceWithoutTax != null) {
allCostWithoutTax = allCostWithoutTax.add(costProvinceServiceWithoutTax);
}
if (costOtherWithoutTax != null) {
allCostWithoutTax = allCostWithoutTax.add(costOtherWithoutTax);
}
}
return allCostWithoutTax;
}
public BigDecimal getGrossProfit() {
if (this.incomeWithoutTaxTotal==null){
return BigDecimal.ZERO;
}
if (this.getAllCostWithoutTax()==null){
return BigDecimal.ZERO;
}
return this.incomeWithoutTaxTotal.subtract(this.getAllCostWithoutTax());
}
public BigDecimal getGrossProfitRate() {
if (this.getAllCostWithoutTax()==null || this.getAllCostWithoutTax().compareTo(BigDecimal.ZERO)==0){
return BigDecimal.ZERO;
}
return this.getGrossProfit().divide(this.getAllCostWithoutTax(),4,java.math.RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
}
@Getter @Getter
public enum ChargeStatusEnum { public enum ChargeStatusEnum {

View File

@ -30,82 +30,95 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectOmsFinanceChargeVo"> <sql id="selectOmsFinanceChargeVo">
select id, order_code, biz_charge_date, finance_charge_date, select t1.id, t1.order_code, t1.biz_charge_date, t1.finance_charge_date,
income_with_tax_total, income_without_tax_total, t1.income_with_tax_total, t1.income_without_tax_total,
cost_software_without_tax, cost_software_with_tax, t1.cost_software_without_tax, t1.cost_software_with_tax,
cost_hardware_without_tax, cost_hardware_with_tax, t1.cost_hardware_without_tax, t1.cost_hardware_with_tax,
cost_software_maint_without_tax, cost_software_maint_with_tax, t1.cost_software_maint_without_tax, t1.cost_software_maint_with_tax,
cost_hardware_maint_without_tax, cost_hardware_maint_with_tax, t1.cost_hardware_maint_without_tax, t1.cost_hardware_maint_with_tax,
cost_province_service_with_tax, cost_province_service_without_tax, t1.cost_province_service_with_tax, t1.cost_province_service_without_tax,
cost_other_with_tax, cost_other_without_tax, t1.cost_other_with_tax, t1.cost_other_without_tax,
remark, create_time, update_time,update_by, charge_status t1.remark, t1.create_time, t1.update_time,t1.update_by, t1.charge_status
from oms_finance_charge ,t3.project_code,t3.project_name,t2.order_channel,t2.supplier,t2.partner_code,t4.partner_name
from oms_finance_charge t1
left join project_order_info t2 on t1.order_code=t2.order_code
left join project_info t3 on t2.project_id=t3.id
left join partner_info t4 on t2.partner_code=t4.partner_code
</sql> </sql>
<select id="selectOmsFinanceChargeById" parameterType="Long" resultMap="OmsFinanceChargeResult"> <select id="selectOmsFinanceChargeById" parameterType="Long" resultMap="OmsFinanceChargeResult">
<include refid="selectOmsFinanceChargeVo"/> <include refid="selectOmsFinanceChargeVo"/>
where id = #{id} where t1.id = #{id}
</select> </select>
<select id="selectOmsFinanceChargeList" parameterType="OmsFinanceCharge" resultMap="OmsFinanceChargeResult"> <select id="selectOmsFinanceChargeList" parameterType="OmsFinanceCharge" resultMap="OmsFinanceChargeResult">
<include refid="selectOmsFinanceChargeVo"/> <include refid="selectOmsFinanceChargeVo"/>
<where> <where>
<if test="orderCode != null and orderCode != ''"> <if test="orderCode != null and orderCode != ''">
and order_code = #{orderCode} and t1.order_code = #{orderCode}
</if> </if>
<if test="bizChargeDate != null"> <if test="bizChargeDate != null">
and biz_charge_date = #{bizChargeDate} and t1.biz_charge_date = #{bizChargeDate}
</if> </if>
<if test="financeChargeDate != null"> <if test="financeChargeDate != null">
and finance_charge_date = #{financeChargeDate} and t1.finance_charge_date = #{financeChargeDate}
</if> </if>
<if test="incomeWithTaxTotal != null"> <if test="incomeWithTaxTotal != null">
and income_with_tax_total = #{incomeWithTaxTotal} and t1.income_with_tax_total = #{incomeWithTaxTotal}
</if> </if>
<if test="incomeWithoutTaxTotal != null"> <if test="incomeWithoutTaxTotal != null">
and income_without_tax_total = #{incomeWithoutTaxTotal} and t1.income_without_tax_total = #{incomeWithoutTaxTotal}
</if> </if>
<if test="costSoftwareWithoutTax != null"> <if test="costSoftwareWithoutTax != null">
and cost_software_without_tax = #{costSoftwareWithoutTax} and t1.cost_software_without_tax = #{costSoftwareWithoutTax}
</if> </if>
<if test="costSoftwareWithTax != null"> <if test="costSoftwareWithTax != null">
and cost_software_with_tax = #{costSoftwareWithTax} and t1.cost_software_with_tax = #{costSoftwareWithTax}
</if> </if>
<if test="costHardwareWithoutTax != null"> <if test="costHardwareWithoutTax != null">
and cost_hardware_without_tax = #{costHardwareWithoutTax} and t1.cost_hardware_without_tax = #{costHardwareWithoutTax}
</if> </if>
<if test="costHardwareWithTax != null"> <if test="costHardwareWithTax != null">
and cost_hardware_with_tax = #{costHardwareWithTax} and t1.cost_hardware_with_tax = #{costHardwareWithTax}
</if> </if>
<if test="costSoftwareMaintWithoutTax != null"> <if test="costSoftwareMaintWithoutTax != null">
and cost_software_maint_without_tax = #{costSoftwareMaintWithoutTax} and t1.cost_software_maint_without_tax = #{costSoftwareMaintWithoutTax}
</if> </if>
<if test="costSoftwareMaintWithTax != null"> <if test="costSoftwareMaintWithTax != null">
and cost_software_maint_with_tax = #{costSoftwareMaintWithTax} and t1.cost_software_maint_with_tax = #{costSoftwareMaintWithTax}
</if> </if>
<if test="costHardwareMaintWithoutTax != null"> <if test="costHardwareMaintWithoutTax != null">
and cost_hardware_maint_without_tax = #{costHardwareMaintWithoutTax} and t1.cost_hardware_maint_without_tax = #{costHardwareMaintWithoutTax}
</if> </if>
<if test="costHardwareMaintWithTax != null"> <if test="costHardwareMaintWithTax != null">
and cost_hardware_maint_with_tax = #{costHardwareMaintWithTax} and t1.cost_hardware_maint_with_tax = #{costHardwareMaintWithTax}
</if> </if>
<if test="costProvinceServiceWithTax != null"> <if test="costProvinceServiceWithTax != null">
and cost_province_service_with_tax = #{costProvinceServiceWithTax} and t1.cost_province_service_with_tax = #{costProvinceServiceWithTax}
</if> </if>
<if test="costProvinceServiceWithoutTax != null"> <if test="costProvinceServiceWithoutTax != null">
and cost_province_service_without_tax = #{costProvinceServiceWithoutTax} and t1.cost_province_service_without_tax = #{costProvinceServiceWithoutTax}
</if> </if>
<if test="costOtherWithTax != null"> <if test="costOtherWithTax != null">
and cost_other_with_tax = #{costOtherWithTax} and t1.cost_other_with_tax = #{costOtherWithTax}
</if> </if>
<if test="costOtherWithoutTax != null"> <if test="costOtherWithoutTax != null">
and cost_other_without_tax = #{costOtherWithoutTax} and t1.cost_other_without_tax = #{costOtherWithoutTax}
</if> </if>
<if test="remark != null and remark != ''"> <if test="remark != null and remark != ''">
and remark like concat('%', #{remark}, '%') and t1.remark like concat('%', #{remark}, '%')
</if> </if>
<if test="chargeStatus != null and chargeStatus != ''"> <if test="chargeStatus != null and chargeStatus != ''">
and charge_status = #{chargeStatus} and t1.charge_status = #{chargeStatus}
</if>
<if test="projectCode != null and projectCode != ''">
and t3.project_code = #{projectCode}
</if>
<if test="projectName != null and projectName != ''">
and t3.project_name like concat('%', #{projectName}, '%')
</if>
<if test="partnerName != null and partnerName != ''">
and t4.partner_name like concat('%', #{partnerName}, '%')
</if> </if>
</where> </where>
</select> </select>