demand: TMS系统 - 客户账单管理 - 业务销账申请 - 申请校验运单累计销账金额不能超过账单金额 TMS系统 - 客户账单管理 - 财务中心销账审核 - 财务审核通过后生成运单、账单收款明细 TMS系统 - 客户账单管理 - 现金账单核销/月结账单核销增加校验业务销账申请收款金额不允许撤销收款
committer: heyu
This commit is contained in:
parent
20a9c5a5e7
commit
b9d0d02764
@ -42,6 +42,8 @@ public class EmisSettlePayRecord extends BaseEntity
|
||||
private Long id;
|
||||
/* 支付序号 */
|
||||
private String payId;
|
||||
/* 销账申请编号,关联的销账申请编号 */
|
||||
private String writeoffApplyNo;
|
||||
/* 收款来源 1-微信支付2支付宝 3-对公 */
|
||||
private String payType;
|
||||
/* 收付类型 1-收款 2-退款 */
|
||||
|
||||
@ -91,6 +91,10 @@ public class EmisWriteoffApply extends BaseEntity {
|
||||
@Excel(name = "申请说明")
|
||||
private String applyMemo;
|
||||
|
||||
/* 收款记录支付ID,财务中心审核通过后关联的收款记录ID */
|
||||
@Excel(name = "收款记录ID")
|
||||
private String payId;
|
||||
|
||||
/* 中心审核状态 0-未审核 1-审核通过 2-审核拒绝 3-已撤销 */
|
||||
@Excel(name = "中心审核状态")
|
||||
private String blCenterConfirmed;
|
||||
|
||||
@ -30,7 +30,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
public interface EmisSettlePayRecordMapper extends BaseMapper<EmisSettlePayRecord> {
|
||||
/**
|
||||
* 主键查询
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ -92,6 +92,14 @@ public interface EmisSettlePayRecordMapper extends BaseMapper<EmisSettlePayRecor
|
||||
*/
|
||||
public int deleteEmisSettlePayRecordByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据支付ID软删除收款记录
|
||||
*
|
||||
* @param payId 支付ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisSettlePayRecordByPayId(String payId);
|
||||
|
||||
/**
|
||||
* 按天统计已收款金额
|
||||
*
|
||||
|
||||
@ -15,11 +15,8 @@ import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
@ -610,6 +607,13 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "收款单不存在!");
|
||||
}
|
||||
|
||||
// 检查收款记录是否来自销账申请
|
||||
if (StringUtils.isNotBlank(payRecordOld.getWriteoffApplyNo())) {
|
||||
String errorMsg = String.format("收款记录通过销账申请编号 %s 收款,退款需在财务中心销账审核界面操作", payRecordOld.getWriteoffApplyNo());
|
||||
log.warn(errorMsg);
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, errorMsg);
|
||||
}
|
||||
|
||||
// 删除收款记录
|
||||
emisSettlePayRecordMapper.deleteEmisSettlePayRecordById(id);
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ import com.xdadan.erp.emis.domain.enumtype.WriteoffApplyStatus;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.mapper.*;
|
||||
import com.xdadan.erp.emis.service.*;
|
||||
import com.xdadan.erp.emis.utils.WaybillHelper;
|
||||
import jodd.util.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
@ -59,9 +60,17 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm
|
||||
@Autowired
|
||||
private EmisSettleBillMapper emisSettleBillMapper;
|
||||
|
||||
// 以下Mapper用于关联业务数据处理,暂时注释避免编译警告
|
||||
// @Autowired
|
||||
// private EmisSettlePayRecordMapper emisSettlePayRecordMapper;
|
||||
@Autowired
|
||||
private EmisSettlePayRecordMapper emisSettlePayRecordMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisSettlePayBillRelMapper emisSettlePayBillRelMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisSettlePayInvoiceRelMapper emisSettlePayInvoiceRelMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisSettlePayRelMapper emisSettlePayRelMapper;
|
||||
|
||||
@Autowired
|
||||
private IEmisCreditCustomerService emisCreditCustomerService;
|
||||
@ -135,13 +144,22 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm
|
||||
? detail.getEmisSettleSubBill().getRecedMoney()
|
||||
: BigDecimal.ZERO;
|
||||
|
||||
// 验证:申请金额 + 已收金额 <= 运单应收金额
|
||||
// 必须有子账单信息以获取账单应收金额
|
||||
if (detail.getEmisSettleSubBill() == null) {
|
||||
throw new EmisBizError("运单号 " + detail.getBillCode() + " 的子账单信息为空");
|
||||
}
|
||||
BigDecimal recMoney = detail.getEmisSettleBill().getRecMoney();
|
||||
if (recMoney == null) {
|
||||
throw new EmisBizError("运单号 " + detail.getBillCode() + " 的账单应收金额为空");
|
||||
}
|
||||
|
||||
// 验证:申请金额 + 已收金额 <= 账单应收金额
|
||||
BigDecimal totalAmount = detail.getApplyMoney().add(receivedAmount);
|
||||
// if (totalAmount.compareTo(detail.getEmisWaybill().getFreight()) > 0) {
|
||||
// throw new EmisBizError("运单号 " + detail.getBillCode() + " 的申请金额(" +
|
||||
// detail.getApplyMoney() + ") + 已收金额(" + receivedAmount + ") = " +
|
||||
// totalAmount + " 超过运单应收金额(" + detail.getEmisWaybill().getFreight() + ")");
|
||||
// }
|
||||
if (totalAmount.compareTo(recMoney) > 0) {
|
||||
throw new EmisBizError("运单号 " + detail.getBillCode() + " 的申请金额(" + detail.getApplyMoney()
|
||||
+ ") + 已收金额(" + receivedAmount + ") = " + totalAmount + " 超过账单应收金额("
|
||||
+ recMoney + ")");
|
||||
}
|
||||
}
|
||||
|
||||
// 验证总销账金额
|
||||
@ -355,12 +373,16 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm
|
||||
// 更新相关开票记录的收款金额和付款状态
|
||||
updateInvoiceRecordPaymentStatus(existingApply, detailList, true);
|
||||
|
||||
// 创建收款记录
|
||||
String payId = createSettlePayRecord(existingApply, detailList);
|
||||
|
||||
// 所有业务数据更新成功后,再更新审核状态
|
||||
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
|
||||
emisWriteoffApply.setBlCenterConfirmed(WriteoffApplyStatus.CENTER_APPROVED.statusCode);
|
||||
emisWriteoffApply.setCenterConfirmManCode(currentUser.getEmpCode());
|
||||
emisWriteoffApply.setCenterConfirmManName(currentUser.getEmpName());
|
||||
emisWriteoffApply.setCenterConfirmDate(new Date());
|
||||
emisWriteoffApply.setPayId(payId); // 保存收款记录支付ID
|
||||
|
||||
// 更新申请状态
|
||||
int result = emisWriteoffApplyMapper.auditCenterPass(emisWriteoffApply);
|
||||
@ -500,6 +522,9 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm
|
||||
// 更新相关开票记录的收款金额和付款状态(回退)
|
||||
updateInvoiceRecordPaymentStatus(existingApply, detailList, false);
|
||||
|
||||
// 删除收款记录
|
||||
deleteSettlePayRecord(existingApply);
|
||||
|
||||
// 所有业务数据回退成功后,再更新审核状态
|
||||
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
|
||||
emisWriteoffApply.setBlHeadquartersConfirmed(WriteoffApplyStatus.HEADQUARTERS_REJECTED.statusCode);
|
||||
@ -1189,7 +1214,7 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm
|
||||
|
||||
log.info("销账申请通知发送成功,申请编号:{},操作类型:{}", apply.getApplyNo(), actionType);
|
||||
} catch (Exception e) {
|
||||
log.error("发送销账申请通知失败,申请编号:{},操作类型:{}", apply.getApplyNo(), actionType, e);
|
||||
log.error("发送销账申请通知失败,申请编号:{},操作类型:{}", (apply != null ? apply.getApplyNo() : null), actionType, e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1401,4 +1426,173 @@ public class EmisWriteoffApplyServiceImpl extends EmisBaseService implements IEm
|
||||
// 不抛出异常,避免影响主流程
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建收款记录
|
||||
* 参考EmisSettlePayRecordServiceImpl.insertEmisSettlePayRecord逻辑
|
||||
* 创建收款记录及其关联关系
|
||||
* 一个支付ID对应一条收款记录,多个结算账单号用逗号分隔
|
||||
*
|
||||
* @param apply 销账申请
|
||||
* @param detailList 申请明细列表
|
||||
* @return 生成的支付ID
|
||||
*/
|
||||
private String createSettlePayRecord(EmisWriteoffApply apply, List<EmisWriteoffApplyDetail> detailList)
|
||||
throws EmisBizError {
|
||||
try {
|
||||
log.info("开始创建收款记录,申请ID: {}", apply.getId());
|
||||
|
||||
if (CollectionUtils.isEmpty(detailList)) {
|
||||
log.warn("申请明细为空,无法创建收款记录,申请ID: {}", apply.getId());
|
||||
return null;
|
||||
}
|
||||
|
||||
// 收集所有结算账单号(去重)
|
||||
Set<String> settleBillNoSet = detailList.stream()
|
||||
.filter(detail -> StringUtil.isNotBlank(detail.getSettleBillNo()))
|
||||
.map(EmisWriteoffApplyDetail::getSettleBillNo)
|
||||
.collect(java.util.stream.Collectors.toSet());
|
||||
|
||||
if (settleBillNoSet.isEmpty()) {
|
||||
log.warn("没有有效的结算账单号,无法创建收款记录,申请ID: {}", apply.getId());
|
||||
return null;
|
||||
}
|
||||
|
||||
// 计算总申请金额
|
||||
BigDecimal totalApplyMoney = detailList.stream()
|
||||
.map(EmisWriteoffApplyDetail::getApplyMoney)
|
||||
.filter(Objects::nonNull)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
// 将结算账单号用逗号连接
|
||||
String settleBillNos = String.join(",", settleBillNoSet);
|
||||
|
||||
// 创建收款记录(一个支付ID对应一条记录)
|
||||
String payId = createPayRecordForApply(apply, settleBillNos, totalApplyMoney, detailList);
|
||||
|
||||
log.info("收款记录创建完成,申请ID: {}, 支付ID: {}, 结算账单号: {}, 总金额: {}",
|
||||
apply.getId(), payId, settleBillNos, totalApplyMoney);
|
||||
|
||||
return payId;
|
||||
} catch (Exception e) {
|
||||
log.error("创建收款记录失败,申请ID: {}", apply.getId(), e);
|
||||
throw new EmisBizError("创建收款记录失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 为销账申请创建收款记录
|
||||
* 一个支付ID对应一条收款记录,多个结算账单号用逗号分隔
|
||||
*
|
||||
* @param apply 销账申请
|
||||
* @param settleBillNos 结算账单号(多个用逗号分隔)
|
||||
* @param totalApplyMoney 总申请金额
|
||||
* @param detailList 申请明细列表
|
||||
* @return 生成的支付ID
|
||||
*/
|
||||
private String createPayRecordForApply(EmisWriteoffApply apply, String settleBillNos,
|
||||
BigDecimal totalApplyMoney, List<EmisWriteoffApplyDetail> detailList) throws EmisBizError {
|
||||
try {
|
||||
// 生成支付ID
|
||||
String payId = WaybillHelper.genPayId();
|
||||
|
||||
// 获取当前用户信息
|
||||
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
|
||||
|
||||
// 创建收款记录主表
|
||||
EmisSettlePayRecord payRecord = new EmisSettlePayRecord();
|
||||
payRecord.setPayId(payId);
|
||||
payRecord.setWriteoffApplyNo(apply.getApplyNo()); // 设置销账申请编号
|
||||
payRecord.setPayType("7"); // 销账收款类型
|
||||
payRecord.setRecType("1"); // 收款类型
|
||||
payRecord.setPayMan(apply.getApplyManName());
|
||||
payRecord.setPayManCode(apply.getApplyManCode());
|
||||
payRecord.setSettleBillNo(settleBillNos); // 多个账单号用逗号分隔
|
||||
payRecord.setBlAudit("1"); // 已审核
|
||||
payRecord.setAuditDate(new Date());
|
||||
payRecord.setAuditManCode(currentUser.getEmpCode());
|
||||
payRecord.setAuditSiteCode(currentUser.getDeptId().toString());
|
||||
|
||||
// 设置客户信息(从第一个明细中获取)
|
||||
if (!detailList.isEmpty() && detailList.get(0).getEmisWaybill() != null) {
|
||||
EmisWaybill waybill = detailList.get(0).getEmisWaybill();
|
||||
payRecord.setCustomerCode(waybill.getCustomerCode());
|
||||
payRecord.setCustomerName(waybill.getCustomerName());
|
||||
}
|
||||
|
||||
payRecord.setPayMoney(totalApplyMoney);
|
||||
payRecord.setPayStatus("2"); // 支付成功
|
||||
payRecord.setPayStatusDesc("销账收款成功");
|
||||
payRecord.setSettleType("1"); // 现金结算
|
||||
payRecord.setTradeDate(new Date());
|
||||
payRecord.setRecManCode(currentUser.getEmpCode());
|
||||
|
||||
// 插入收款记录主表
|
||||
emisSettlePayRecordMapper.insertEmisSettlePayRecord(payRecord);
|
||||
|
||||
// 创建收款账单关联关系(为每个结算账单创建关联)
|
||||
String[] settleBillNoArray = settleBillNos.split(",");
|
||||
for (String settleBillNo : settleBillNoArray) {
|
||||
if (StringUtil.isNotBlank(settleBillNo.trim())) {
|
||||
EmisSettlePayBillRel payBillRel = new EmisSettlePayBillRel();
|
||||
payBillRel.setPayId(payId);
|
||||
payBillRel.setSettleBillNo(settleBillNo.trim());
|
||||
emisSettlePayBillRelMapper.insertEmisSettlePayBillRel(payBillRel);
|
||||
}
|
||||
}
|
||||
|
||||
// 创建收款运单关联关系
|
||||
for (EmisWriteoffApplyDetail detail : detailList) {
|
||||
if (StringUtil.isNotBlank(detail.getBillCode())) {
|
||||
EmisSettlePayRel payRel = new EmisSettlePayRel();
|
||||
payRel.setPayId(payId);
|
||||
payRel.setBillNo(detail.getBillCode());
|
||||
payRel.setPayMoney(detail.getApplyMoney());
|
||||
emisSettlePayRelMapper.insertEmisSettlePayRel(payRel);
|
||||
}
|
||||
}
|
||||
|
||||
log.info("销账申请收款记录创建成功,申请ID: {}, 支付ID: {}, 结算账单号: {}, 总金额: {}",
|
||||
apply.getId(), payId, settleBillNos, totalApplyMoney);
|
||||
|
||||
return payId;
|
||||
} catch (Exception e) {
|
||||
log.error("创建销账申请收款记录失败,申请ID: {}", apply.getId(), e);
|
||||
throw new EmisBizError("创建销账申请收款记录失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除收款记录
|
||||
* 删除销账申请对应的收款记录及其关联关系
|
||||
* 根据payId精确软删除对应的收款记录
|
||||
*
|
||||
* @param apply 销账申请
|
||||
*/
|
||||
private void deleteSettlePayRecord(EmisWriteoffApply apply) throws EmisBizError {
|
||||
try {
|
||||
log.info("开始删除收款记录,申请ID: {}, payId: {}", apply.getId(), apply.getPayId());
|
||||
|
||||
// 如果没有payId,则无法删除收款记录
|
||||
if (StringUtil.isBlank(apply.getPayId())) {
|
||||
log.warn("申请没有关联的payId,无法删除收款记录,申请ID: {}", apply.getId());
|
||||
return;
|
||||
}
|
||||
|
||||
// 根据payId软删除收款记录主表
|
||||
int deleteCount = emisSettlePayRecordMapper.deleteEmisSettlePayRecordByPayId(apply.getPayId());
|
||||
|
||||
if (deleteCount > 0) {
|
||||
log.info("收款记录软删除成功,支付ID: {}, 删除记录数: {}", apply.getPayId(), deleteCount);
|
||||
} else {
|
||||
log.warn("未找到对应的收款记录进行删除,支付ID: {}", apply.getPayId());
|
||||
}
|
||||
|
||||
log.info("收款记录删除完成,申请ID: {}, payId: {}", apply.getId(), apply.getPayId());
|
||||
} catch (Exception e) {
|
||||
log.error("删除收款记录失败,申请ID: {}", apply.getId(), e);
|
||||
throw new EmisBizError("删除收款记录失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<resultMap type="EmisSettlePayRecord" id="EmisSettlePayRecordResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="payId" column="pay_id" />
|
||||
<result property="writeoffApplyNo" column="writeoff_apply_no" />
|
||||
<result property="payType" column="pay_type" />
|
||||
<result property="recType" column="rec_type" />
|
||||
<result property="payMan" column="pay_man" />
|
||||
@ -87,7 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<sql id="selectEmisSettlePayRecordVo">
|
||||
select
|
||||
a.id, a.pay_id, a.pay_type, a.rec_type, a.pay_man, a.pay_man_code, a.settle_bill_no,
|
||||
a.id, a.pay_id, a.writeoff_apply_no, a.pay_type, a.rec_type, a.pay_man, a.pay_man_code, a.settle_bill_no,
|
||||
a.bl_audit, a.audit_date, a.audit_man_code, a.audit_site_code, a.customer_code,
|
||||
a.customer_name, a.pay_money, a.pay_status, a.pay_status_desc, a.break_type,
|
||||
a.break_reason, a.break_emp_code, a.rec_man_code, a.settle_type, a.refund_date,
|
||||
@ -302,7 +303,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="selectSettlePayRecordListBySettleBillNo" parameterType="String" resultMap="EmisSettlePayRecordResult">
|
||||
select id, pay_id, pay_type, rec_type, pay_man, pay_man_code, settle_bill_no, bl_audit, audit_date, audit_man_code, audit_site_code, customer_code, customer_name, pay_money, pay_status, pay_status_desc, break_type, break_reason, break_emp_code, rec_man_code, settle_type, refund_date, refund_man_code, refund_seq, refund_mode, refund_money, refund_reason, refund_remark, refund_op_man_code, refund_register_site_code, refund_register_man_code, satisfy_money, satisfy_reason, allowance_money, allowance_reason, deduction_money, deduction_reason, other_money, other_reason, trade_date, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
select id, pay_id, writeoff_apply_no, pay_type, rec_type, pay_man, pay_man_code, settle_bill_no, bl_audit, audit_date, audit_man_code, audit_site_code, customer_code, customer_name, pay_money, pay_status, pay_status_desc, break_type, break_reason, break_emp_code, rec_man_code, settle_type, refund_date, refund_man_code, refund_seq, refund_mode, refund_money, refund_reason, refund_remark, refund_op_man_code, refund_register_site_code, refund_register_man_code, satisfy_money, satisfy_reason, allowance_money, allowance_reason, deduction_money, deduction_reason, other_money, other_reason, trade_date, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_settle_pay_record a
|
||||
where del_flag='0' and pay_id in(
|
||||
select pay_id from emis_settle_pay_bill_rel espbr where espbr.del_flag='0' and espbr.settle_bill_no = #{settleBillNo}
|
||||
@ -425,13 +426,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="selectEmisSettlePayRecordById" parameterType="Long" resultMap="EmisSettlePayRecordResult">
|
||||
select id, pay_id, pay_type, rec_type, pay_man, pay_man_code, settle_bill_no, bl_audit, audit_date, audit_man_code, audit_site_code, customer_code, customer_name, pay_money, pay_status, pay_status_desc, break_type, break_reason, break_emp_code, rec_man_code, settle_type, refund_date, refund_man_code, refund_seq, refund_mode, refund_money, refund_reason, refund_remark, refund_op_man_code, refund_register_site_code, refund_register_man_code, satisfy_money, satisfy_reason, allowance_money, allowance_reason, deduction_money, deduction_reason, other_money, other_reason, trade_date, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
select id, pay_id, writeoff_apply_no, pay_type, rec_type, pay_man, pay_man_code, settle_bill_no, bl_audit, audit_date, audit_man_code, audit_site_code, customer_code, customer_name, pay_money, pay_status, pay_status_desc, break_type, break_reason, break_emp_code, rec_man_code, settle_type, refund_date, refund_man_code, refund_seq, refund_mode, refund_money, refund_reason, refund_remark, refund_op_man_code, refund_register_site_code, refund_register_man_code, satisfy_money, satisfy_reason, allowance_money, allowance_reason, deduction_money, deduction_reason, other_money, other_reason, trade_date, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_settle_pay_record a
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectEmisSettlePayRecordByPayId" parameterType="Long" resultMap="EmisSettlePayRecordResult">
|
||||
select id, pay_id, pay_type, rec_type, pay_man, pay_man_code, settle_bill_no, bl_audit, audit_date, audit_man_code, audit_site_code, customer_code, customer_name, pay_money, pay_status, pay_status_desc, break_type, break_reason, break_emp_code, rec_man_code, settle_type, refund_date, refund_man_code, refund_seq, refund_mode, refund_money, refund_reason, refund_remark, refund_op_man_code, refund_register_site_code, refund_register_man_code, satisfy_money, satisfy_reason, allowance_money, allowance_reason, deduction_money, deduction_reason, other_money, other_reason, trade_date, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
select id, pay_id, writeoff_apply_no, pay_type, rec_type, pay_man, pay_man_code, settle_bill_no, bl_audit, audit_date, audit_man_code, audit_site_code, customer_code, customer_name, pay_money, pay_status, pay_status_desc, break_type, break_reason, break_emp_code, rec_man_code, settle_type, refund_date, refund_man_code, refund_seq, refund_mode, refund_money, refund_reason, refund_remark, refund_op_man_code, refund_register_site_code, refund_register_man_code, satisfy_money, satisfy_reason, allowance_money, allowance_reason, deduction_money, deduction_reason, other_money, other_reason, trade_date, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_settle_pay_record a
|
||||
where a.pay_id = #{payId} and a.del_flag='0'
|
||||
</select>
|
||||
@ -441,6 +442,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="payId != null and payId != ''">pay_id,</if>
|
||||
<if test="writeoffApplyNo != null and writeoffApplyNo != ''">writeoff_apply_no,</if>
|
||||
<if test="payType != null and payType != ''">pay_type,</if>
|
||||
<if test="recType != null and recType != ''">rec_type,</if>
|
||||
<if test="payMan != null and payMan != ''">pay_man,</if>
|
||||
@ -491,6 +493,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="payId != null and payId != ''">#{payId},</if>
|
||||
<if test="writeoffApplyNo != null and writeoffApplyNo != ''">#{writeoffApplyNo},</if>
|
||||
<if test="payType != null and payType != ''">#{payType},</if>
|
||||
<if test="recType != null and recType != ''">#{recType},</if>
|
||||
<if test="payMan != null and payMan != ''">#{payMan},</if>
|
||||
@ -544,6 +547,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
update emis_settle_pay_record
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="payId != null and payId != ''">pay_id = #{payId},</if>
|
||||
<if test="writeoffApplyNo != null and writeoffApplyNo != ''">writeoff_apply_no = #{writeoffApplyNo},</if>
|
||||
<if test="payType != null and payType != ''">pay_type = #{payType},</if>
|
||||
<if test="recType != null and recType != ''">rec_type = #{recType},</if>
|
||||
<if test="payMan != null and payMan != ''">pay_man = #{payMan},</if>
|
||||
@ -605,6 +609,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEmisSettlePayRecordByPayId" parameterType="String">
|
||||
update emis_settle_pay_record set del_flag='1' where pay_id = #{payId}
|
||||
</delete>
|
||||
|
||||
<select id="calculateRecedMoney" resultType="java.util.Map">
|
||||
SELECT
|
||||
DATE_FORMAT(trade_date, '%Y-%m-%d') as tradeDay,
|
||||
|
||||
@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="tradeDate" column="trade_date" />
|
||||
<result property="recipient" column="recipient" />
|
||||
<result property="applyMemo" column="apply_memo" />
|
||||
<result property="payId" column="pay_id" />
|
||||
<result property="blCenterConfirmed" column="bl_center_confirmed" />
|
||||
<result property="centerConfirmManCode" column="center_confirm_man_code" />
|
||||
<result property="centerConfirmManName" column="center_confirm_man_name" />
|
||||
@ -44,12 +45,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmisWriteoffApplyVo">
|
||||
select id, apply_no, apply_man_code, apply_man_name, apply_site_code, apply_site_name, apply_date, writeoff_amount, pay_type, trade_date, recipient, apply_memo, bl_center_confirmed, center_confirm_man_code, center_confirm_man_name, center_confirm_date, center_confirm_note, center_reject_reason, bl_headquarters_confirmed, headquarters_confirm_man_code, headquarters_confirm_man_name, headquarters_confirm_date, headquarters_confirm_note, headquarters_reject_reason, revoke_date, revoke_man_code, revoke_man_name, revoke_reason, del_flag, create_by, create_time, update_by, update_time, remark from emis_writeoff_apply
|
||||
select id, apply_no, apply_man_code, apply_man_name, apply_site_code, apply_site_name, apply_date, writeoff_amount, pay_type, trade_date, recipient, apply_memo, pay_id, bl_center_confirmed, center_confirm_man_code, center_confirm_man_name, center_confirm_date, center_confirm_note, center_reject_reason, bl_headquarters_confirmed, headquarters_confirm_man_code, headquarters_confirm_man_name, headquarters_confirm_date, headquarters_confirm_note, headquarters_reject_reason, revoke_date, revoke_man_code, revoke_man_name, revoke_reason, del_flag, create_by, create_time, update_by, update_time, remark from emis_writeoff_apply
|
||||
</sql>
|
||||
|
||||
<select id="selectEmisWriteoffApplyList" parameterType="EmisWriteoffApply" resultMap="EmisWriteoffApplyResult">
|
||||
select distinct wa.id, wa.apply_no, wa.apply_man_code, wa.apply_man_name, wa.apply_site_code, wa.apply_site_name,
|
||||
wa.apply_date, wa.writeoff_amount, wa.pay_type, wa.trade_date, wa.recipient, wa.apply_memo,
|
||||
wa.apply_date, wa.writeoff_amount, wa.pay_type, wa.trade_date, wa.recipient, wa.apply_memo, wa.pay_id,
|
||||
wa.bl_center_confirmed, wa.center_confirm_man_code, wa.center_confirm_man_name, wa.center_confirm_date,
|
||||
wa.center_confirm_note, wa.center_reject_reason, wa.bl_headquarters_confirmed, wa.headquarters_confirm_man_code,
|
||||
wa.headquarters_confirm_man_name, wa.headquarters_confirm_date, wa.headquarters_confirm_note,
|
||||
@ -126,6 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="tradeDate != null">trade_date,</if>
|
||||
<if test="recipient != null and recipient != ''">recipient,</if>
|
||||
<if test="applyMemo != null and applyMemo != ''">apply_memo,</if>
|
||||
<if test="payId != null and payId != ''">pay_id,</if>
|
||||
<if test="blCenterConfirmed != null and blCenterConfirmed != ''">bl_center_confirmed,</if>
|
||||
<if test="centerConfirmManCode != null and centerConfirmManCode != ''">center_confirm_man_code,</if>
|
||||
<if test="centerConfirmManName != null and centerConfirmManName != ''">center_confirm_man_name,</if>
|
||||
@ -161,6 +163,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="tradeDate != null">#{tradeDate},</if>
|
||||
<if test="recipient != null and recipient != ''">#{recipient},</if>
|
||||
<if test="applyMemo != null and applyMemo != ''">#{applyMemo},</if>
|
||||
<if test="payId != null and payId != ''">#{payId},</if>
|
||||
<if test="blCenterConfirmed != null and blCenterConfirmed != ''">#{blCenterConfirmed},</if>
|
||||
<if test="centerConfirmManCode != null and centerConfirmManCode != ''">#{centerConfirmManCode},</if>
|
||||
<if test="centerConfirmManName != null and centerConfirmManName != ''">#{centerConfirmManName},</if>
|
||||
@ -197,6 +200,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="applyDate != null">apply_date = #{applyDate},</if>
|
||||
<if test="writeoffAmount != null">writeoff_amount = #{writeoffAmount},</if>
|
||||
<if test="applyMemo != null and applyMemo != ''">apply_memo = #{applyMemo},</if>
|
||||
<if test="payId != null and payId != ''">pay_id = #{payId},</if>
|
||||
<if test="blCenterConfirmed != null and blCenterConfirmed != ''">bl_center_confirmed = #{blCenterConfirmed},</if>
|
||||
<if test="centerConfirmManCode != null and centerConfirmManCode != ''">center_confirm_man_code = #{centerConfirmManCode},</if>
|
||||
<if test="centerConfirmManName != null and centerConfirmManName != ''">center_confirm_man_name = #{centerConfirmManName},</if>
|
||||
@ -240,6 +244,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
center_confirm_man_name = #{centerConfirmManName},
|
||||
center_confirm_date = #{centerConfirmDate},
|
||||
center_confirm_note = #{centerConfirmNote},
|
||||
pay_id = #{payId},
|
||||
update_by = #{updateBy},
|
||||
update_time = #{updateTime}
|
||||
where id = #{id}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user