feat(finance): 应付单详情页新增收票信息展示与预付金额计算

- 调整应付单详情页字段布局,新增项目编号、项目名称等显示项
- 新增“该制造商是否有预付单”和“预付金额”字段展示
- 新增“生成付款单”、“生成收票单”状态展示逻辑
- 新增采购收票单表格展示功能,包括发票类型、开票时间、收票状态等
- 新增收票计划和付款计划组件间的数据同步方法
- 扩展字典类型支持,增加收票相关枚举值
- 增加收票明细列表查询接口及附件信息加载逻辑
- Java后端增加预付金额计算逻辑,并在应付单中返回对应数据
- 优化支付明细和收票明细的状态统计逻辑,提升准确性
- 修改数据库映射文件,补充缺失字段如税率、不含税金额等
- 增加核销相关操作接口,支持批量删除和插入收票明细记录
- 修复部分SQL语句条件判断问题,确保查询结果准确无误
dev_1.0.1
chenhao 2025-12-18 16:13:40 +08:00
parent 6c3f344b92
commit 9be3b62aaf
23 changed files with 527 additions and 104 deletions

View File

@ -8,6 +8,13 @@ export function listWriteOff(query) {
params: query
})
}
export function listTicketWriteOff(query) {
return request({
url: '/finance/ticketWriteoff/list',
method: 'get',
params: query
})
}
// 查询核销详情
export function getWriteOff(id) {
@ -16,6 +23,12 @@ export function getWriteOff(id) {
method: 'get'
})
}
export function getTicketWriteoff(id) {
return request({
url: '/finance/ticketWriteoff/' + id,
method: 'get'
})
}
// 删除核销记录
export function delWriteOff(ids) {
@ -24,3 +37,9 @@ export function delWriteOff(ids) {
method: 'delete'
})
}
export function delTicketWriteoff(ids) {
return request({
url: '/finance/ticketWriteoff/' + ids,
method: 'delete'
})
}

View File

@ -6,36 +6,38 @@
<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> {{ formData.projectCode }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>项目名称:</strong> {{ formData.projectName }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>应付单编号:</strong> {{ formData.payableBillCode }}</div>
</el-col>
<el-col :span="16">
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<div class="detail-item"><strong>生成时间:</strong> {{ formData.createTime }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>该制造商是否有预付单:</strong> {{ formData.preResidueAmount == 0 ? '否' : '是' }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>预付金额:</strong> {{ formData.preResidueAmount }}</div>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<div class="detail-item"><strong>制造商名称:</strong> {{ formData.vendorName }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>项目编号:</strong> {{ formData.projectCode }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>项目名称:</strong> {{ formData.projectName }}</div>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<div class="detail-item"><strong>合同编号:</strong> {{ formData.orderCode }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>出入库单号:</strong> {{ formData.inventoryCode }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item" style="display: flex"><strong>产品类型:</strong>
<dict-tag :options="dict.type.product_type" :value="formData.productType"/>
</div>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
@ -70,6 +72,19 @@
<div class="detail-item"><strong>收票中金额:</strong> {{ this.$calc.sub(this.$calc.sub(formData.totalPriceWithTax,formData.receivedTicketAmount),formData.unreceivedTicketAmount)}}</div>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<div class="detail-item"><strong>生成付款单:</strong> {{ formData.totalPriceWithTax == formData.unpaidPaymentAmount ? '未生成' : formData.unpaidPaymentAmount == 0 ? '已生成' : '部分生成' }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item"><strong>生成收票单:</strong> {{ formData.totalPriceWithTax == formData.unreceivedTicketAmount ? '未生成' : formData.unreceivedTicketAmount == 0 ? '已生成' : '部分生成' }}</div>
</el-col>
<el-col :span="8">
<div class="detail-item" style="display: flex"><strong>产品类型:</strong>
<dict-tag :options="dict.type.product_type" :value="formData.productType"/>
</div>
</el-col>
</el-row>
</div>
</div>
@ -105,12 +120,40 @@
</template>
</el-table-column>
</el-table>
<el-divider content-position="left">采购收票单</el-divider>
<el-table :data="formData.ticketDetailList" style="width: 100%" show-summary :summary-method="getSummaries">
<el-table-column type="index" label="序号" width="50"></el-table-column>
<el-table-column prop="payableDetailType" label="发票类型">
<template slot-scope="scope">
<dict-tag :options="dict.type.ticket_detail_type" :value="scope.row.payableDetailType"/>
</template>
</el-table-column>
<el-table-column prop="vendorTicketTime" label="制造商开票时间">
<template slot-scope="scope">
{{ scope.row.vendorTicketTime || '-' }}
</template>
</el-table-column>
<el-table-column prop="paymentAmount" label="本次收票金额"></el-table-column>
<el-table-column prop="paymentRate" label="本次收票比例"></el-table-column>
<el-table-column prop="receiptStatus" label="收票状态">
<template slot-scope="scope">
<dict-tag :options="dict.type.receipt_status" :value="scope.row.ticketStatus"/>
</template>
</el-table-column>
<el-table-column prop="ticketBillCode" label="采购收票单编号"></el-table-column>
<el-table-column label="发票图">
<template slot-scope="scope">
{{ scope.row.finAttachment && scope.row.finAttachment.fileName || '-'}}
<el-button v-show="scope.row.finAttachment" type="primary" size="mini" @click="downloadFile(scope.row.finAttachment)"></el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane label="付款计划" name="paymentPlan">
<PaymentPlan :isInitEdit=true :payableData="data"/>
<PaymentPlan :isInitEdit=true @syncPlan="refreshTicketPlan()" :payableData="data"/>
</el-tab-pane>
<el-tab-pane label="收票计划" name="receivingTicketPlan">
<ReceivingTicketPlan :isInitEdit=true :payableData="data"/>
<ReceivingTicketPlan ref="ticketPlan" :isInitEdit=true :payableData="data"/>
</el-tab-pane>
</el-tabs>
</div>
@ -127,11 +170,13 @@
import PaymentPlan from './PaymentPlan.vue';
import ReceivingTicketPlan from './ReceivingTicketPlan.vue';
import { getPayable } from "@/api/finance/payable";
import ReceiptPlan from "@/views/finance/receivable/components/ReceiptPlan.vue";
export default {
name: "EditForm",
dicts: ['product_type','payment_status','payable_detail_type'],
dicts: ['product_type','payment_status','payable_detail_type', 'ticket_detail_type', 'receipt_status'],
components: {
ReceiptPlan,
PaymentPlan,
ReceivingTicketPlan
},
@ -167,6 +212,9 @@ export default {
}
},
methods: {
refreshTicketPlan(){
this.$refs.ticketPlan.fetchTicketPlans(this.formData.id);
},
getDetails() {
getPayable(this.data.id).then(res => {
this.formData = res.data;

View File

@ -208,6 +208,7 @@ export default {
ticketPlans.push({
id: order.lastTicketPlanId,
planAmount: order.planTicketAmount,
taxRate: order.taxRate,
planTicketDate: order.planTicketDate,
planRate: this.$calc.mul(this.$calc.div(order.planTicketAmount, order.totalPriceWithTax, 4), 100)
});
@ -298,6 +299,7 @@ export default {
planTicketDate: plan.planTicketDate,
planAmount: plan.planAmount,
planRate: plan.planRate,
taxRate: order.taxRate,
remark: plan.remark,
id: plan.id,
})),

View File

@ -130,7 +130,11 @@
<!-- <el-table-column label="生成时间" align="center" prop="createTime" width="180"/>-->
<el-table-column label="预计付款时间" align="center" prop="planPaymentDate" width="180"/>
<el-table-column label="预计付款金额" align="center" prop="planAmount" width="120" />
<el-table-column label="该制造商是否有预付单" align="center" prop="hasAdvancePayment" width="150" />
<el-table-column label="该制造商是否有预付单" align="center" prop="hasAdvancePayment" width="150">
<template slot-scope="scope">
{{ scope.row.preResidueAmount == 0 ? '否' : '是' }}
</template>
</el-table-column>
<!-- <el-table-column label="预付金额" align="center" prop="advancePaymentAmount" width="120" />-->
<el-table-column label="制造商名称" align="center" prop="vendorName" width="150" />
<!-- <el-table-column label="合同编号" align="center" prop="orderCode" width="150" />-->

View File

@ -84,7 +84,7 @@ public class OmsPayableBill extends BaseEntity
private Date estimatedPaymentTimeEnd;
private Date estimatedPaymentTimeStart;
private BigDecimal preResidueAmount;
/** 已付款金额 */
@Excel(name = "已付款金额")
private BigDecimal paidPaymentAmount;
@ -114,6 +114,7 @@ public class OmsPayableBill extends BaseEntity
private Date planPaymentDateEnd;
private List<OmsPayablePaymentDetail> detailList;
private List<OmsPayableTicketDetail> ticketDetailList;

View File

@ -34,14 +34,23 @@ public class OmsPayableTicketDetail extends BaseEntity {
private Long ticketBillId;
// 实际收票时间
private Date actualTicketTime;
private Date vendorTicketTime;
// 收票状态
private String ticketStatus;
// 不含税支付金额
private BigDecimal paymentAmountWithoutTax;
// 核销ID
private Long writeOffId;
private List<Long> writeOffIdList;
// 税额
private BigDecimal paymentAmountTax;
private OmsFinAttachment finAttachment;
@Getter
public enum PayableDetailTypeEnum {
TICKET("1", "收票"),
RED_RUSH("2", "红冲"),
TICKET_WRITE_OFF("3", "收票核销"),

View File

@ -30,6 +30,7 @@ public class OmsPayableTicketPlan extends BaseEntity {
/** 计划收票比例 */
private BigDecimal planRate;
private BigDecimal taxRate;
private Long detailId;

View File

@ -31,6 +31,7 @@ public class OmsTicketBill extends BaseEntity
/** 收票单编号 */
@Excel(name = "收票单编号")
private String ticketBillCode;
private List<String> ticketBillCodeList;
/** 票据类型 */
@Excel(name = "票据类型")

View File

@ -2,7 +2,6 @@ package com.ruoyi.sip.mapper;
import java.util.List;
import com.ruoyi.sip.domain.OmsPayablePaymentDetail;
import com.ruoyi.sip.domain.OmsPayableTicketDetail;
import com.ruoyi.sip.domain.dto.PaymentBillPayableDetailDTO;
@ -68,8 +67,11 @@ public interface OmsPayableTicketDetailMapper
void clearRelationPayable(String ticketBillCode);
List<OmsPayableTicketDetail> listByPayableBillIdList(List<Long> payableBillId);
List<OmsPayableTicketDetail> list(OmsPayableTicketDetail payableBillId);
List<OmsPayableTicketDetail> selectByTicketPlanIds(List<Long> ticketPlanIds);
List<PaymentBillPayableDetailDTO> listPayableByWriteOffId(List<Long> longs);
void deleteByWriteOffIds(Long[] ids);
}

View File

@ -98,4 +98,6 @@ public interface OmsPaymentBillMapper
void updateReturnWriteOffBatch(List<OmsPaymentBill> updateBills);
List<OmsPaymentBill> listPreResidueAmountByVendorCodeList(List<String> collect);
}

View File

@ -65,4 +65,9 @@ public interface OmsTicketBillMapper
void updateOmsTicketBillByCode(OmsTicketBill omsTicketBill);
List<OmsTicketBill> listApprove(@Param("entity") OmsTicketBill omsTicketBill, @Param("tableName")String buTodo);
OmsTicketBill selectOmsTicketBillByCode(String ticketBillCode);
void updateReturnWriteOffBatch(List<OmsTicketBill> updateBills);
}

View File

@ -72,4 +72,12 @@ public interface IOmsPayableTicketDetailService
List<OmsPayableTicketDetail> selectByTicketPlanIds(List<Long> ticketPlanIds);
List<OmsPayableTicketDetail> listDetailByTicketCode(String ticketBillCode);
List<PaymentBillPayableDetailDTO> listPayableByWriteOffId(List<Long> longs);
List<OmsPayableTicketDetail> listByWriteOffIds(Long[] ids);
void deleteByWriteOffIds(Long[] ids);
void insertBatch(List<OmsPayableTicketDetail> detailList);
}

View File

@ -110,4 +110,6 @@ public interface IOmsPaymentBillService
void returnWriteOff(List<String> collect,List<OmsPayablePaymentDetail> omsPayablePaymentDetails);
OmsPaymentBill selectOmsPaymentBillByCode(String paymentBillCode);
List<OmsPaymentBill> listPreResidueAmountByVendorCodeList(List<String> collect);
}

View File

@ -3,6 +3,7 @@ package com.ruoyi.sip.service;
import java.util.List;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.sip.domain.OmsPayableTicketDetail;
import com.ruoyi.sip.domain.OmsTicketBill;
import org.springframework.web.multipart.MultipartFile;
@ -71,4 +72,8 @@ public interface IOmsTicketBillService
List<OmsTicketBill> listApprove(OmsTicketBill omsTicketBill);
List<OmsTicketBill> listApproved(OmsTicketBill omsTicketBill);
OmsTicketBill selectOmsTicketBillByCode(String ticketBillCode);
void returnTicketWriteOff(List<String> collect, List<OmsPayableTicketDetail> omsPayableTicketDetails);
}

View File

@ -24,9 +24,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@ -81,8 +80,14 @@ public class OmsPayableBillServiceImpl implements IOmsPayableBillService {
@Override
public List<OmsPayableBill> selectOmsPayableBillList(OmsPayableBill omsPayableBill) {
List<OmsPayableBill> omsPayableBills = omsPayableBillMapper.selectOmsPayableBillList(omsPayableBill);
//todo 是否有预付单信息
if (CollUtil.isNotEmpty(omsPayableBills)) {
PageUtils.clearPage();
List<OmsPaymentBill> omsPaymentBills = omsPaymentBillService.listPreResidueAmountByVendorCodeList(omsPayableBills.stream().map(OmsPayableBill::getVendorCode).collect(Collectors.toList()));
Map<String, BigDecimal> decimalMap = omsPaymentBills.stream().filter(item -> item.getPreResidueAmount() != null).collect(Collectors.toMap(OmsPaymentBill::getVendorCode, OmsPaymentBill::getPreResidueAmount, BigDecimal::add));
for (OmsPayableBill payableBill : omsPayableBills) {
payableBill.setPreResidueAmount(decimalMap.getOrDefault(payableBill.getVendorCode(), BigDecimal.ZERO));
}
}
return omsPayableBills;
}
@ -383,6 +388,8 @@ public class OmsPayableBillServiceImpl implements IOmsPayableBillService {
detail.setTicketBillId(ticketBill.getId());
detail.setPaymentAmount(ticketPlanDto.getPlanAmount());
detail.setPaymentRate(ticketPlanDto.getPlanRate());
detail.setPaymentAmountWithoutTax(detail.getPaymentAmount().divide(BigDecimal.ONE.add(ticketPlanDto.getTaxRate()), 2, java.math.RoundingMode.HALF_UP));
detail.setPaymentAmountTax(detail.getPaymentAmount().subtract(detail.getPaymentAmountWithoutTax()));
detail.setPaymentTime(ticketPlanDto.getPlanTicketDate());
detail.setRemark(ticketPlanDto.getRemark());
detail.setCreateBy(ShiroUtils.getLoginName());
@ -408,26 +415,59 @@ public class OmsPayableBillServiceImpl implements IOmsPayableBillService {
}
List<OmsPayablePaymentDetail> omsPayablePaymentDetails = omsPayablePaymentDetailService.listByPayableBillIdList(idList);
Map<Long, Map<String, BigDecimal>> planMap = omsPayablePaymentDetails.stream().collect(Collectors.groupingBy(OmsPayablePaymentDetail::getPayableBillId,
Collectors.groupingBy(
item -> item.getPaymentStatus() == null ? OmsPaymentBill.PaymentStatusEnum.WAIT_PAYMENT.getCode() : item.getPaymentStatus(),
Collectors.reducing(
BigDecimal.ZERO,
detail -> (detail.getPaymentAmount() != null) ? detail.getPaymentAmount() : BigDecimal.ZERO,
BigDecimal::add
))));
// 1. 构建 payableBillId -> (paymentPlanId -> 最新PaymentDetail) 的 Map
Map<Long, Map<Long, OmsPayablePaymentDetail>> planMap =
omsPayablePaymentDetails.stream()
.collect(Collectors.groupingBy(
OmsPayablePaymentDetail::getPayableBillId,
Collectors.toMap(
OmsPayablePaymentDetail::getPaymentPlanId,
Function.identity(),
(d1, d2) -> d1.getCreateTime().after(d2.getCreateTime()) ? d1 : d2
)
));
for (OmsPayableBill payableBill : omsPayableBills) {
Map<String, BigDecimal> amountMap = planMap.get(payableBill.getId());
if (CollUtil.isNotEmpty(amountMap)) {
//已付金额 = 已付款金额-退款金额
payableBill.setPaidPaymentAmount(amountMap.getOrDefault(OmsPaymentBill.PaymentStatusEnum.PAYMENT.getCode(), BigDecimal.ZERO)
.subtract(amountMap.getOrDefault(OmsPaymentBill.PaymentStatusEnum.REFUNDED.getCode(), BigDecimal.ZERO)));
//未付金额=总金额-已付金额-付款中金额
payableBill.setUnpaidPaymentAmount(payableBill.getTotalPriceWithTax().subtract(payableBill.getPaidPaymentAmount())
.subtract(amountMap.getOrDefault(OmsPaymentBill.PaymentStatusEnum.WAIT_PAYMENT.getCode(), BigDecimal.ZERO)));
// 2. 获取当前账单的支付明细 Map避免 NPE
Map<Long, OmsPayablePaymentDetail> paymentDetailMap =
planMap.getOrDefault(payableBill.getId(), Collections.emptyMap());
if (CollUtil.isNotEmpty(paymentDetailMap)) {
// 3. 按支付状态汇总金额
Map<String, BigDecimal> amountMap =
paymentDetailMap.values().stream()
.filter(d -> d.getPaymentAmount() != null)
.collect(Collectors.toMap(
OmsPayablePaymentDetail::getPaymentStatus,
OmsPayablePaymentDetail::getPaymentAmount,
BigDecimal::add
));
// 4. 金额计算(集中处理,逻辑更清晰)
BigDecimal paidAmount = amountMap
.getOrDefault(OmsPaymentBill.PaymentStatusEnum.PAYMENT.getCode(), BigDecimal.ZERO)
.add(amountMap.getOrDefault(
OmsPaymentBill.PaymentStatusEnum.REFUNDED.getCode(), BigDecimal.ZERO));
BigDecimal waitPayAmount =
amountMap.getOrDefault(
OmsPaymentBill.PaymentStatusEnum.WAIT_PAYMENT.getCode(), BigDecimal.ZERO);
payableBill.setPaidPaymentAmount(paidAmount);
payableBill.setUnpaidPaymentAmount(
payableBill.getTotalPriceWithTax()
.subtract(paidAmount)
.subtract(waitPayAmount)
);
}
OmsPayablePaymentPlan payablePaymentPlan = omsPayablePaymentPlanMapper.firstUnPayPlan(payableBill.getId());
payableBill.setLastPaymentPlanId(payablePaymentPlan == null ? -1 : payablePaymentPlan.getId());
// 5. 获取首个未支付计划
OmsPayablePaymentPlan unpaidPlan = omsPayablePaymentPlanMapper.firstUnPayPlan(payableBill.getId());
payableBill.setLastPaymentPlanId(unpaidPlan == null ? -1L : unpaidPlan.getId());
}
return omsPayableBillMapper.updateBatchPayableBillPaymentInfo(omsPayableBills);
}
@ -444,23 +484,51 @@ public class OmsPayableBillServiceImpl implements IOmsPayableBillService {
return 0;
}
List<OmsPayableTicketDetail> omsPayableTicketDetails = omsPayableTicketDetailService.listByPayableBillIdList(idList);
Map<Long, Map<String, BigDecimal>> planMap = omsPayableTicketDetails.stream().collect(Collectors.groupingBy(OmsPayableTicketDetail::getPayableBillId,
Collectors.groupingBy(
item -> item.getTicketStatus() == null ? OmsTicketBill.TicketStatusEnum.WAIT_TICKET.getCode() : item.getTicketStatus(),
Collectors.reducing(
BigDecimal.ZERO,
detail -> (detail.getPaymentAmount() != null) ? detail.getPaymentAmount() : BigDecimal.ZERO,
BigDecimal::add
))));
Map<Long, Map<Long, OmsPayableTicketDetail>> planMap =
omsPayableTicketDetails.stream()
.collect(Collectors.groupingBy(
OmsPayableTicketDetail::getPayableBillId,
Collectors.toMap(
OmsPayableTicketDetail::getTicketPlanId,
Function.identity(),
(d1, d2) -> d1.getCreateTime().after(d2.getCreateTime()) ? d1 : d2
)
));
for (OmsPayableBill payableBill : omsPayableBills) {
Map<String, BigDecimal> amountMap = planMap.get(payableBill.getId());
if (CollUtil.isNotEmpty(amountMap)) {
//已付金额 = 已付款金额-退款金额
payableBill.setReceivedTicketAmount(amountMap.getOrDefault(OmsTicketBill.TicketStatusEnum.TICKET.getCode(), BigDecimal.ZERO)
.subtract(amountMap.getOrDefault(OmsPaymentBill.PaymentStatusEnum.REFUNDED.getCode(), BigDecimal.ZERO)));
//未付金额=总金额-已付金额-付款中金额
payableBill.setUnreceivedTicketAmount(payableBill.getTotalPriceWithTax().subtract(payableBill.getPaidPaymentAmount()
.subtract(amountMap.getOrDefault(OmsTicketBill.TicketStatusEnum.WAIT_TICKET.getCode(), BigDecimal.ZERO))));
// 2. 获取当前账单的支付明细 Map避免 NPE
Map<Long, OmsPayableTicketDetail> paymentDetailMap =
planMap.getOrDefault(payableBill.getId(), Collections.emptyMap());
if (CollUtil.isNotEmpty(paymentDetailMap)) {
// 3. 按支付状态汇总金额
Map<String, BigDecimal> amountMap =
paymentDetailMap.values().stream()
.filter(d -> d.getPaymentAmount() != null)
.collect(Collectors.toMap(
OmsPayableTicketDetail::getTicketStatus,
OmsPayableTicketDetail::getPaymentAmount,
BigDecimal::add
));
// 4. 金额计算(集中处理,逻辑更清晰)
BigDecimal paidAmount = amountMap
.getOrDefault(OmsTicketBill.TicketStatusEnum.TICKET.getCode(), BigDecimal.ZERO)
.add(amountMap.getOrDefault(
OmsTicketBill.TicketStatusEnum.RED_RUSH.getCode(), BigDecimal.ZERO));
BigDecimal waitPayAmount =
amountMap.getOrDefault(
OmsTicketBill.TicketStatusEnum.WAIT_TICKET.getCode(), BigDecimal.ZERO);
payableBill.setPaidPaymentAmount(paidAmount);
payableBill.setUnpaidPaymentAmount(
payableBill.getTotalPriceWithTax()
.subtract(paidAmount)
.subtract(waitPayAmount)
);
}
OmsPayableTicketPlan omsPayableTicketPlan = omsPayableTicketPlanMapper.firstUnPayPlan(payableBill.getId());
payableBill.setLastTicketPlanId(omsPayableTicketPlan == null ? -1 : omsPayableTicketPlan.getId());
@ -473,22 +541,11 @@ public class OmsPayableBillServiceImpl implements IOmsPayableBillService {
OmsPayableBill omsPayableBill = selectOmsPayableBillById(id);
List<OmsPayablePaymentDetail> omsPayablePaymentDetails = omsPayablePaymentDetailService.listByPayableBillId(id);
omsPayableBill.setDetailList(omsPayablePaymentDetails);
// Map<String, BigDecimal> decimalMap = omsPayablePaymentDetails.stream()
// .collect(Collectors.groupingBy(
// item->item.getPaymentStatus()==null?OmsPaymentBill.PaymentStatusEnum.WAIT_PAYMENT.getCode(): item.getPaymentStatus(),
// Collectors.reducing(
// BigDecimal.ZERO,
// detail -> (detail.getPaymentAmount() != null) ? detail.getPaymentAmount() : BigDecimal.ZERO,
// BigDecimal::add
// )
// ));
// omsPayableBill.setPaidAmount(decimalMap.getOrDefault(OmsPaymentBill.PaymentStatusEnum.PAYMENT.getCode(), BigDecimal.ZERO));
// omsPayableBill.setPayingAmount(decimalMap.getOrDefault(OmsPaymentBill.PaymentStatusEnum.WAIT_PAYMENT.getCode(), BigDecimal.ZERO));
// BigDecimal decimal = omsPayableBill.getTotalPriceWithTax().subtract(omsPayableBill.getPaidAmount()).subtract(omsPayableBill.getPayingAmount());
// omsPayableBill.setUnpaidAmount(decimal);
List<OmsPayableTicketDetail> ticketDetailList = omsPayableTicketDetailService.listByPayableBillIdList(Collections.singletonList(id));
omsPayableBill.setTicketDetailList(ticketDetailList);
List<OmsPaymentBill> omsPaymentBills = omsPaymentBillService.listPreResidueAmountByVendorCodeList(Collections.singletonList(omsPayableBill.getVendorCode()));
Map<String, BigDecimal> decimalMap = omsPaymentBills.stream().filter(item -> item.getPreResidueAmount() != null).collect(Collectors.toMap(OmsPaymentBill::getVendorCode, OmsPaymentBill::getPreResidueAmount, BigDecimal::add));
omsPayableBill.setPreResidueAmount(decimalMap.getOrDefault(omsPayableBill.getVendorCode(), BigDecimal.ZERO));
return omsPayableBill;
}

View File

@ -1,17 +1,18 @@
package com.ruoyi.sip.service.impl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.sip.domain.OmsFinAttachment;
import com.ruoyi.sip.domain.OmsPayablePaymentDetail;
import com.ruoyi.sip.domain.dto.PaymentBillPayableDetailDTO;
import org.apache.commons.lang3.StringUtils;
import com.ruoyi.sip.service.IOmsFinAttachmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.sip.mapper.OmsPayableTicketDetailMapper;
@ -30,6 +31,8 @@ public class OmsPayableTicketDetailServiceImpl implements IOmsPayableTicketDetai
@Autowired
private OmsPayableTicketDetailMapper omsPayableTicketDetailMapper;
@Autowired
private IOmsFinAttachmentService finAttachmentService;
/**
*
*
@ -150,7 +153,22 @@ public class OmsPayableTicketDetailServiceImpl implements IOmsPayableTicketDetai
@Override
public List<OmsPayableTicketDetail> listByPayableBillIdList(List<Long> payableBillId) {
return omsPayableTicketDetailMapper.listByPayableBillIdList(payableBillId);
OmsPayableTicketDetail omsPayableTicketDetail = new OmsPayableTicketDetail();
omsPayableTicketDetail.setPayableBillIdList(payableBillId);
List<OmsPayableTicketDetail> list = omsPayableTicketDetailMapper.list(omsPayableTicketDetail);
if (CollUtil.isNotEmpty(list)){
OmsFinAttachment omsFinAttachment = new OmsFinAttachment();
omsFinAttachment.setRelatedBillIdList(list.stream().map(OmsPayableTicketDetail::getTicketBillId).distinct().collect(Collectors.toList()));
omsFinAttachment.setRelatedBillType(OmsFinAttachment.RelatedBillTypeEnum.INVOICE.getCode());
omsFinAttachment.setDelFlag("0");
List<OmsFinAttachment> attachmentList = finAttachmentService.selectOmsFinAttachmentList(omsFinAttachment);
Map<Long, OmsFinAttachment> collect = attachmentList.stream().collect(Collectors.toMap(OmsFinAttachment::getRelatedBillId, Function.identity()));
for (OmsPayableTicketDetail payableTicketDetail : list) {
payableTicketDetail.setFinAttachment(collect.get(payableTicketDetail.getTicketBillId()));
}
}
return list;
}
@Override
@ -164,4 +182,32 @@ public class OmsPayableTicketDetailServiceImpl implements IOmsPayableTicketDetai
omsPayableTicketDetail.setTicketBillCode(ticketBillCode);
return omsPayableTicketDetailMapper.selectOmsPayableTicketDetailList(omsPayableTicketDetail);
}
@Override
public List<PaymentBillPayableDetailDTO> listPayableByWriteOffId(List<Long> longs) {
return omsPayableTicketDetailMapper.listPayableByWriteOffId(longs);
}
@Override
public List<OmsPayableTicketDetail> listByWriteOffIds(Long[] ids) {
if (ids == null || ids.length == 0) {
return new ArrayList<>();
}
OmsPayableTicketDetail omsPayableTicketDetail = new OmsPayableTicketDetail();
omsPayableTicketDetail.setWriteOffIdList(Arrays.asList(ids));
return omsPayableTicketDetailMapper.list(omsPayableTicketDetail);
}
@Override
public void deleteByWriteOffIds(Long[] ids) {
if (ids == null || ids.length == 0) {
return ;
}
omsPayableTicketDetailMapper.deleteByWriteOffIds(ids);
}
@Override
public void insertBatch(List<OmsPayableTicketDetail> detailList) {
omsPayableTicketDetailMapper.insertBatch(detailList);
}
}

View File

@ -601,4 +601,12 @@ public class OmsPaymentBillServiceImpl implements IOmsPaymentBillService , TodoC
return omsPaymentBillMapper.selectOmsPaymentBillByCode(paymentBillCode);
}
@Override
public List<OmsPaymentBill> listPreResidueAmountByVendorCodeList(List<String> collect) {
if (CollUtil.isEmpty(collect)){
return Collections.emptyList();
}
return omsPaymentBillMapper.listPreResidueAmountByVendorCodeList(collect);
}
}

View File

@ -1,8 +1,7 @@
package com.ruoyi.sip.service.impl;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;
@ -17,17 +16,16 @@ import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.sip.domain.*;
import com.ruoyi.sip.domain.dto.PaymentBillPayableDetailDTO;
import com.ruoyi.sip.dto.WriteOffTicketRequestDto;
import com.ruoyi.sip.flowable.domain.Todo;
import com.ruoyi.sip.flowable.service.TodoCommonTemplate;
import com.ruoyi.sip.flowable.service.TodoService;
import com.ruoyi.sip.service.IOmsFinAttachmentService;
import com.ruoyi.sip.service.IOmsPayableBillService;
import com.ruoyi.sip.service.IOmsPayableTicketDetailService;
import com.ruoyi.sip.service.*;
import org.flowable.engine.runtime.ProcessInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import com.ruoyi.sip.mapper.OmsTicketBillMapper;
import com.ruoyi.sip.service.IOmsTicketBillService;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import org.springframework.transaction.annotation.Transactional;
@ -56,6 +54,9 @@ public class OmsTicketBillServiceImpl implements IOmsTicketBillService, TodoComm
@Autowired
private ProcessConfig processConfig;
@Autowired
@Lazy
private IOmsPayableTicketWriteOffService writeOffService;
/**
*
*
@ -303,6 +304,90 @@ public class OmsTicketBillServiceImpl implements IOmsTicketBillService, TodoComm
return omsTicketBillMapper.listApprove(omsTicketBill, "bu_todo_completed");
}
@Override
public OmsTicketBill selectOmsTicketBillByCode(String ticketBillCode) {
return omsTicketBillMapper.selectOmsTicketBillByCode(ticketBillCode);
}
@Override
public void returnTicketWriteOff(List<String> collect, List<OmsPayableTicketDetail> omsPayableTicketDetails) {
OmsTicketBill ticketBill = new OmsTicketBill();
ticketBill.setTicketBillCodeList(collect);
List<OmsTicketBill> omsPaymentBills = selectOmsTicketBillList(ticketBill);
Map<String, List<OmsTicketBill>> listMap = omsPaymentBills.stream()
.collect(Collectors.groupingBy(OmsTicketBill::getTicketBillType));
// 处理预付
List<OmsTicketBill> prePaymentBillList = listMap.remove(OmsPaymentBill.PaymentBillTypeEnum.PRE_PAYMENT.getCode());
// // 预付处理逻辑
// // 1:通过omsPayablePaymentDetailService查询对应的详情然后根据paymentBillCode分组
// // 将含税金额总和计算出来,加在预付单的剩余额度上
// if (CollUtil.isNotEmpty(prePaymentBillList)) {
// // 按付款单code分组核销详情
// Map<String, List<OmsPayablePaymentDetail>> groupedDetails =
// omsPayablePaymentDetails.stream()
// .filter(detail -> detail.getPaymentBillCode() != null)
// .collect(Collectors.groupingBy(OmsPayablePaymentDetail::getPaymentBillCode));
//
// // 计算每个付款单的核销金额合计
// Map<String, BigDecimal> paymentBillWriteOffAmountMap = groupedDetails.entrySet().stream()
// .collect(Collectors.toMap(
// Map.Entry::getKey,
// entry -> entry.getValue().stream()
// .map(OmsPayablePaymentDetail::getPaymentAmount)
// .reduce(BigDecimal.ZERO, BigDecimal::add)
// ));
//
// // 更新预付单的剩余额度 - 批量操作
// List<OmsPaymentBill> updateBills = prePaymentBillList.stream()
// .map(prePaymentBill -> {
// BigDecimal increaseAmount = paymentBillWriteOffAmountMap.getOrDefault(
// prePaymentBill.getPaymentBillCode(), BigDecimal.ZERO);
//
// if (increaseAmount.compareTo(BigDecimal.ZERO) > 0) {
// OmsPaymentBill updateBill = new OmsPaymentBill();
// updateBill.setId(prePaymentBill.getId());
// // 在原剩余额度基础上加回本次核销金额
// BigDecimal newResidueAmount = prePaymentBill.getPreResidueAmount()
// .add(increaseAmount);
// updateBill.setPreResidueAmount(newResidueAmount);
// return updateBill;
// }
// return null;
// })
// .filter(Objects::nonNull)
// .collect(Collectors.toList());
//
// if (CollUtil.isNotEmpty(updateBills)) {
// for (OmsPaymentBill bill : updateBills) {
// updateOmsPaymentBill(bill);
// }
// }
// }
//处理其余数据
if (CollUtil.isNotEmpty(listMap.values())) {
List<OmsTicketBill> updateBills = new ArrayList<>();
for (List<OmsTicketBill> omsPaymentBillList : listMap.values()) {
for (OmsTicketBill tempBill : omsPaymentBillList) {
OmsTicketBill updateBill = new OmsTicketBill();
updateBill.setId(tempBill.getId());
updateBill.setTicketStatus(OmsTicketBill.TicketStatusEnum.WAIT_TICKET.getCode());
updateBill.setActualTicketTime(null);
updateBills.add(updateBill);
}
}
if (CollUtil.isNotEmpty(updateBills)) {
omsTicketBillMapper.updateReturnWriteOffBatch(updateBills);
omsFinAttachmentService.deleteOmsFinAttachmentByPayment(updateBills.stream().map(OmsTicketBill::getId).collect(Collectors.toList()),
OmsFinAttachment.RelatedBillTypeEnum.INVOICE.getCode());
}
}
}
@Override
public Object todoDetail(String businessKey, String processKey, String todoId) {
@ -345,8 +430,16 @@ public class OmsTicketBillServiceImpl implements IOmsTicketBillService, TodoComm
OmsTicketBill omsTicketBill = new OmsTicketBill();
omsTicketBill.setTicketBillCode(businessKey);
omsTicketBill.setApproveStatus(ApproveStatusEnum.APPROVE_COMPLETE.getCode());
omsTicketBill.setTicketStatus(OmsTicketBill.TicketStatusEnum.TICKET.getCode());
omsTicketBill.setApproveTime(DateUtils.getNowDate());
omsTicketBillMapper.updateOmsTicketBillByCode(omsTicketBill);
OmsTicketBill existBill = selectOmsTicketBillByCode(businessKey);
WriteOffTicketRequestDto writeOffRequestDto = new WriteOffTicketRequestDto();
writeOffRequestDto.setTicketBillId(existBill.getId());
writeOffRequestDto.setVendorCode(existBill.getVendorCode());
List<OmsPayableTicketDetail> omsPayableTicketDetails = payableTicketDetailService.listDetailByTicketCode(existBill.getTicketBillCode());
writeOffRequestDto.setDetailList(omsPayableTicketDetails);
writeOffService.autoTicketWriteOff(writeOffRequestDto);
}

View File

@ -76,6 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
t1.create_time,
t1.update_by,
t1.update_time,
t1.tax_rate,
t1.remark,
t1.del_flag ,
t3.project_code,

View File

@ -114,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from (SELECT sum(payment_amount) payment_amount,
payable_bill_id
FROM oms_payable_payment_detail
WHERE payment_bill_code in
WHERE write_off_id is null and payment_bill_code in
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item}
</foreach>
@ -142,7 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="deleteByWriteOffIds" parameterType="java.lang.Long">
DELETE FROM oms_payable_payment_detail WHERE write_off_id IN
<foreach collection="ids" item="item" open="(" separator="," close=")" index="">
<foreach collection="array" item="item" open="(" separator="," close=")" index="">
#{item}
</foreach>
</delete>

View File

@ -414,6 +414,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and pb.del_flag = '0'
</where>
</select>
<select id="listPreResidueAmountByVendorCodeList" resultType="com.ruoyi.sip.domain.OmsPaymentBill">
SELECT
sum( pre_residue_amount ) pre_residue_amount,vendor_code
FROM
oms_payment_bill
where vendor_code in
<foreach item="item" collection="list" separator="," open="(" close=")" index="index">
#{item}
</foreach>
GROUP BY
vendor_code
</select>
</mapper>

View File

@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="id" column="id" />
<result property="ticketPlanId" column="ticket_plan_id" />
<result property="payableBillId" column="payable_bill_id" />
<result property="payableDetailType" column="payable_detail_type" />
<result property="paymentTime" column="payment_time" />
<result property="paymentAmount" column="payment_amount" />
<result property="paymentRate" column="payment_rate" />
@ -19,12 +20,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remark" column="remark" />
<result property="actualTicketTime" column="actual_ticket_time" />
<result property="ticketStatus" column="ticket_status" />
<result property="paymentAmountWithoutTax" column="payment_amount_without_tax" />
<result property="writeOffId" column="write_off_id" />
<result property="paymentAmountTax" column="payment_amount_tax" />
</resultMap>
<sql id="selectOmsPayableTicketDetailVo">
select id, ticket_plan_id, payable_bill_id, payment_time, payment_amount, payment_rate, ticket_bill_code,
create_by, create_time, update_by, update_time, remark
from oms_payable_ticket_detail
select id, ticket_plan_id, payable_bill_id, payable_detail_type, payment_time, payment_amount, payment_rate, ticket_bill_code,
create_by, create_time, update_by, update_time, remark,
payment_amount_without_tax, write_off_id, payment_amount_tax
from oms_payable_ticket_detail t1
</sql>
<select id="selectOmsPayableTicketDetailList" parameterType="com.ruoyi.sip.domain.OmsPayableTicketDetail" resultMap="OmsPayableTicketDetailResult">
@ -36,6 +41,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="payableBillId != null">
and payable_bill_id = #{payableBillId}
</if>
<if test="payableDetailType != null and payableDetailType != ''">
and payable_detail_type = #{payableDetailType}
</if>
<if test="paymentTime != null">
and payment_time = #{paymentTime}
</if>
@ -87,7 +95,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from (SELECT sum(payment_amount) payment_amount,
payable_bill_id
FROM oms_payable_ticket_detail
WHERE ticket_bill_code in
WHERE write_off_id is null and ticket_bill_code in
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item}
</foreach>
@ -96,22 +104,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join project_order_info t3 on t2.order_code = t3.order_code
left join project_info t4 on t3.project_id = t4.id
</select>
<select id="listByPayableBillIdList" resultType="com.ruoyi.sip.domain.OmsPayableTicketDetail">
<select id="list" resultType="com.ruoyi.sip.domain.OmsPayableTicketDetail">
SELECT
t1.*,t2.actual_ticket_time,t2.ticket_status,t2.id as paymentBillId
t1.*,t2.actual_ticket_time,t2.vendor_ticket_time,t2.ticket_status,t2.id as ticketBillId
FROM
oms_payable_ticket_detail t1
LEFT JOIN oms_ticket_bill t2 ON t1.ticket_bill_code = t2.ticket_bill_code
<where>
<if test="list != null and list.size>0">
<if test="payableBillIdList != null and payableBillIdList.size>0">
and t1.payable_bill_id in
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
<foreach item="item" collection="payableBillIdList" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
<if test="writeOffIdList != null and writeOffIdList.size>0">
and t1.write_off_id in
<foreach item="item" collection="writeOffIdList" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
<if test="payableDetailType != null and payableDetailType != ''">
and t1.payable_detail_type = #{payableDetailType}
</if>
</where>
</select>
<select id="listPayableByWriteOffId" resultType="com.ruoyi.sip.domain.dto.PaymentBillPayableDetailDTO">
select t1.payment_amount, t2.payable_bill_code,t2.product_type,t2.create_time,t5.vendor_name, t4.project_name, t4.project_code, t2.total_price_with_tax
from (SELECT sum(payment_amount) payment_amount,
payable_bill_id
FROM oms_payable_ticket_detail
WHERE write_off_id in
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item}
</foreach>
group by payable_bill_id) t1
left join oms_payable_bill t2 on t1.payable_bill_id = t2.id
left join project_order_info t3 on t2.order_code = t3.order_code
left join project_info t4 on t3.project_id = t4.id
left join oms_vendor_info t5 on t2.vendor_code = t5.vendor_code
</select>
<insert id="insertOmsPayableTicketDetail" parameterType="com.ruoyi.sip.domain.OmsPayableTicketDetail" useGeneratedKeys="true" keyProperty="id">
insert into oms_payable_ticket_detail
@ -122,6 +155,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="payableBillId != null">
payable_bill_id,
</if>
<if test="payableDetailType != null and payableDetailType != ''">
payable_detail_type,
</if>
<if test="paymentTime != null">
payment_time,
</if>
@ -149,6 +185,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null and remark != ''">
remark,
</if>
<if test="paymentAmountWithoutTax != null">
payment_amount_without_tax,
</if>
<if test="writeOffId != null">
write_off_id,
</if>
<if test="paymentAmountTax != null">
payment_amount_tax,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ticketPlanId != null">
@ -157,6 +202,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="payableBillId != null">
#{payableBillId},
</if>
<if test="payableDetailType != null and payableDetailType != ''">
#{payableDetailType},
</if>
<if test="paymentTime != null">
#{paymentTime},
</if>
@ -184,14 +232,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null and remark != ''">
#{remark},
</if>
<if test="paymentAmountWithoutTax != null">
#{paymentAmountWithoutTax},
</if>
<if test="writeOffId != null">
#{writeOffId},
</if>
<if test="paymentAmountTax != null">
#{paymentAmountTax},
</if>
</trim>
</insert>
<insert id="insertBatch">
insert into oms_payable_ticket_detail (payable_bill_id, ticket_plan_id, payment_time, payment_amount, payment_rate,
ticket_bill_code, create_by, create_time, update_by, update_time, remark) values
insert into oms_payable_ticket_detail (payable_bill_id, ticket_plan_id, payable_detail_type, payment_time, payment_amount, payment_rate,
ticket_bill_code, create_by, create_time, update_by, update_time, remark,
payment_amount_without_tax, write_off_id, payment_amount_tax) values
<foreach item="item" collection="list" separator=",">
(#{item.payableBillId}, #{item.ticketPlanId}, #{item.paymentTime}, #{item.paymentAmount}, #{item.paymentRate}, #{item.ticketBillCode},
#{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark})
(#{item.payableBillId}, #{item.ticketPlanId}, #{item.payableDetailType}, #{item.paymentTime}, #{item.paymentAmount}, #{item.paymentRate}, #{item.ticketBillCode},
#{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark},
#{item.paymentAmountWithoutTax}, #{item.writeOffId}, #{item.paymentAmountTax})
</foreach>
</insert>
@ -204,6 +263,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="payableBillId != null">
payable_bill_id = #{payableBillId},
</if>
<if test="payableDetailType != null and payableDetailType != ''">
payable_detail_type = #{payableDetailType},
</if>
<if test="paymentTime != null">
payment_time = #{paymentTime},
</if>
@ -231,7 +293,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remark != null and remark != ''">
remark = #{remark},
</if>
<if test="paymentAmountWithoutTax != null">
payment_amount_without_tax = #{paymentAmountWithoutTax},
</if>
<if test="writeOffId != null">
write_off_id = #{writeOffId},
</if>
<if test="paymentAmountTax != null">
payment_amount_tax = #{paymentAmountTax},
</if>
</trim>
where id = #{id}
</update>
@ -249,5 +319,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id="clearRelationPayable">
delete from oms_payable_ticket_detail where ticket_bill_code = #{code}
</delete>
<delete id="deleteByWriteOffIds">
DELETE FROM oms_payable_ticket_detail WHERE write_off_id IN
<foreach collection="array" item="item" open="(" separator="," close=")" index="">
#{item}
</foreach>
</delete>
</mapper>

View File

@ -43,6 +43,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="ticketBillCode != null and ticketBillCode != ''">
and ticket_bill_code = #{ticketBillCode}
</if>
<if test="ticketBillCodeList != null and ticketBillCodeList.size>0">
and ticket_bill_code in <foreach item="item" collection="ticketBillCodeList" separator="," open="(" close=")" index="">
#{item}
</foreach>
</if>
<if test="ticketType != null and ticketType != ''">
and ticket_type = #{ticketType}
@ -388,6 +393,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
where ticket_bill_code = #{ticketBillCode}
</update>
<update id="updateReturnWriteOffBatch">
<foreach collection="list" item="item" separator=";">
update oms_ticket_bill
set
ticket_status=#{item.ticketStatus},
approve_status=#{item.approveStatus},
approve_time=null,
update_time=now()
where id = #{item.id}
</foreach>
</update>
<delete id="deleteOmsTicketBillById" parameterType="Long">
delete from oms_ticket_bill where id = #{id}
@ -478,5 +494,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</where>
</select>
<select id="selectOmsTicketBillByCode" resultType="com.ruoyi.sip.domain.OmsTicketBill">
<include refid="selectOmsTicketBillVo"/>
where ticket_bill_code = #{ticketBillCode}</select>
</mapper>