Commit 44c6d1a6 authored by zhangfeng's avatar zhangfeng

feat(wealth): 银行收款明细

parent 16fe8194
...@@ -26,6 +26,10 @@ public class ReceiptItemDO extends BaseDO { ...@@ -26,6 +26,10 @@ public class ReceiptItemDO extends BaseDO {
*/ */
@TableId @TableId
private Long id; private Long id;
/**
* 流水号
*/
private String serialNumber;
/** /**
* 收款单id * 收款单id
*/ */
......
...@@ -6,15 +6,9 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -6,15 +6,9 @@ import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
/*
*/
@Mapper @Mapper
public interface BankReceiptDetailsMapper { public interface BankReceiptDetailsMapper {
List<ReceiptItemResp> getBankReceiptDetailsList(ReceiptItemReq req); List<ReceiptItemResp> getBankReceiptDetailsList(ReceiptItemReq req);
/*
获取记录总数
*/
long GetCount(ReceiptItemReq req); long GetCount(ReceiptItemReq req);
} }
...@@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -10,6 +10,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType; import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.code.ORDER;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
...@@ -83,4 +84,8 @@ public interface ReceiptItemMapper extends AbstractMapper<ReceiptItemDO> { ...@@ -83,4 +84,8 @@ public interface ReceiptItemMapper extends AbstractMapper<ReceiptItemDO> {
"</script>" "</script>"
}) })
BigDecimal getWriteOffAmountByReceiptId(@Param("receiptId") Long receiptId); BigDecimal getWriteOffAmountByReceiptId(@Param("receiptId") Long receiptId);
@ResultType(String.class)
@Select({"select serial_number from ecw_receipt_item order by serial_number desc limit 1"})
String getCurrentMaxReceiptItemCode();
} }
...@@ -42,7 +42,7 @@ import cn.iocoder.yudao.module.wealth.enums.*; ...@@ -42,7 +42,7 @@ import cn.iocoder.yudao.module.wealth.enums.*;
import cn.iocoder.yudao.module.wealth.service.receiptAccount.ReceiptAccountService; import cn.iocoder.yudao.module.wealth.service.receiptAccount.ReceiptAccountService;
import cn.iocoder.yudao.module.wealth.service.receiptApproval.ReceiptApprovalService; import cn.iocoder.yudao.module.wealth.service.receiptApproval.ReceiptApprovalService;
import cn.iocoder.yudao.module.wealth.service.receivable.ReceivableService; import cn.iocoder.yudao.module.wealth.service.receivable.ReceivableService;
import cn.iocoder.yudao.module.wealth.util.InvoiceGenCodeUtils; import cn.iocoder.yudao.module.wealth.util.WealthGenCodeUtils;
import cn.iocoder.yudao.module.wealth.vo.receipt.*; import cn.iocoder.yudao.module.wealth.vo.receipt.*;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptAccountBatchCreateReqVO; import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptAccountBatchCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptAccountBatchRespVO; import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptAccountBatchRespVO;
...@@ -102,7 +102,7 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO ...@@ -102,7 +102,7 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
@Resource @Resource
private ReceiptInvoiceMapper receiptInvoiceMapper; private ReceiptInvoiceMapper receiptInvoiceMapper;
@Resource @Resource
private InvoiceGenCodeUtils invoiceGenCodeUtils; private WealthGenCodeUtils wealthGenCodeUtils;
@Resource @Resource
private ReceiptLogMapper receiptLogMapper; private ReceiptLogMapper receiptLogMapper;
...@@ -111,6 +111,7 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO ...@@ -111,6 +111,7 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Long createReceipt(ReceiptCreateReqVO createReqVO) { public Long createReceipt(ReceiptCreateReqVO createReqVO) {
// TODO 一个收款单是否可以关联多个订单的应收明细,校验明细的规则是什么?
if (createReqVO.getOrderId() == 0) { if (createReqVO.getOrderId() == 0) {
throw exception(ORDER_ID_NULL); throw exception(ORDER_ID_NULL);
} }
...@@ -150,7 +151,7 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO ...@@ -150,7 +151,7 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
if (createReqVO.getOpenInvoice().equals(1)) { if (createReqVO.getOpenInvoice().equals(1)) {
ReceiptInvoiceCreateReqVO receiptInvoiceCreateReqVO = createReqVO.getReceiptInvoice(); ReceiptInvoiceCreateReqVO receiptInvoiceCreateReqVO = createReqVO.getReceiptInvoice();
ReceiptInvoiceDO receiptInvoiceDO = ReceiptInvoiceConvert.INSTANCE.convert(receiptInvoiceCreateReqVO); ReceiptInvoiceDO receiptInvoiceDO = ReceiptInvoiceConvert.INSTANCE.convert(receiptInvoiceCreateReqVO);
receiptInvoiceDO.setInvoiceNo(invoiceGenCodeUtils.generateInvoiceCode()); receiptInvoiceDO.setInvoiceNo(wealthGenCodeUtils.generateInvoiceCode());
receiptInvoiceDO.setReceiptId(receipt.getId()); receiptInvoiceDO.setReceiptId(receipt.getId());
receiptInvoiceDO.setReceiptNo(receipt.getReceiptNo()); receiptInvoiceDO.setReceiptNo(receipt.getReceiptNo());
receiptInvoiceDO.setOrderId(createReqVO.getOrderId()); receiptInvoiceDO.setOrderId(createReqVO.getOrderId());
......
...@@ -21,7 +21,7 @@ import cn.iocoder.yudao.module.wealth.dal.mysql.receiptInvoiceLog.ReceiptInvoice ...@@ -21,7 +21,7 @@ import cn.iocoder.yudao.module.wealth.dal.mysql.receiptInvoiceLog.ReceiptInvoice
import cn.iocoder.yudao.module.wealth.enums.InvoicingLinkEnum; import cn.iocoder.yudao.module.wealth.enums.InvoicingLinkEnum;
import cn.iocoder.yudao.module.wealth.enums.InvoicingStatusEnum; import cn.iocoder.yudao.module.wealth.enums.InvoicingStatusEnum;
import cn.iocoder.yudao.module.wealth.service.receivable.ReceivableService; import cn.iocoder.yudao.module.wealth.service.receivable.ReceivableService;
import cn.iocoder.yudao.module.wealth.util.InvoiceGenCodeUtils; import cn.iocoder.yudao.module.wealth.util.WealthGenCodeUtils;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.*; import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.*;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableBackVO; import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableBackVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.WealthMoneyAmountVO; import cn.iocoder.yudao.module.wealth.vo.receivable.WealthMoneyAmountVO;
...@@ -63,7 +63,7 @@ public class ReceiptInvoiceServiceImpl extends AbstractService<ReceiptInvoiceMap ...@@ -63,7 +63,7 @@ public class ReceiptInvoiceServiceImpl extends AbstractService<ReceiptInvoiceMap
@Resource @Resource
private ReceivableService receivableService; private ReceivableService receivableService;
@Resource @Resource
private InvoiceGenCodeUtils invoiceGenCodeUtils; private WealthGenCodeUtils wealthGenCodeUtils;
@Resource @Resource
private CurrencyApi currencyApi; private CurrencyApi currencyApi;
...@@ -79,7 +79,7 @@ public class ReceiptInvoiceServiceImpl extends AbstractService<ReceiptInvoiceMap ...@@ -79,7 +79,7 @@ public class ReceiptInvoiceServiceImpl extends AbstractService<ReceiptInvoiceMap
checkReceiptForCreateInvoice(receiptDO); checkReceiptForCreateInvoice(receiptDO);
// 创建开票资料 // 创建开票资料
ReceiptInvoiceDO receiptInvoiceDO = ReceiptInvoiceConvert.INSTANCE.convert(createReqVO); ReceiptInvoiceDO receiptInvoiceDO = ReceiptInvoiceConvert.INSTANCE.convert(createReqVO);
receiptInvoiceDO.setInvoiceNo(invoiceGenCodeUtils.generateInvoiceCode()); receiptInvoiceDO.setInvoiceNo(wealthGenCodeUtils.generateInvoiceCode());
receiptInvoiceDO.setReceiptId(receiptDO.getId()); receiptInvoiceDO.setReceiptId(receiptDO.getId());
receiptInvoiceDO.setReceiptNo(receiptDO.getReceiptNo()); receiptInvoiceDO.setReceiptNo(receiptDO.getReceiptNo());
receiptInvoiceDO.setOrderId(receiptDO.getOrderId()); receiptInvoiceDO.setOrderId(receiptDO.getOrderId());
......
...@@ -20,9 +20,6 @@ import java.util.List; ...@@ -20,9 +20,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/*
银行收款明细列表
*/
@Service @Service
@Validated @Validated
@Slf4j @Slf4j
...@@ -31,14 +28,9 @@ public class BankReceiptDetailsImpl implements BankReceiptDetailsService { ...@@ -31,14 +28,9 @@ public class BankReceiptDetailsImpl implements BankReceiptDetailsService {
@Resource @Resource
private BankReceiptDetailsMapper bankReceiptDetailsMapper; private BankReceiptDetailsMapper bankReceiptDetailsMapper;
/*
*/
@Autowired @Autowired
private AdminUserService adminUserService; private AdminUserService adminUserService;
/*
获取分页数据
*/
public PageResult<ReceiptItemResp> getBankReceiptDetailsList(ReceiptItemReq req) { public PageResult<ReceiptItemResp> getBankReceiptDetailsList(ReceiptItemReq req) {
IPage<ReceiptItemResp> mpPage = MyBatisUtils.buildPage(req); IPage<ReceiptItemResp> mpPage = MyBatisUtils.buildPage(req);
long total = bankReceiptDetailsMapper.GetCount(req); long total = bankReceiptDetailsMapper.GetCount(req);
......
package cn.iocoder.yudao.module.wealth.service.receiptItem; package cn.iocoder.yudao.module.wealth.service.receiptItem;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptItem.ReceiptItemDO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemReq; import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemReq;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemResp; import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemResp;
import java.util.List;
/*
*/
public interface BankReceiptDetailsService { public interface BankReceiptDetailsService {
PageResult<ReceiptItemResp> getBankReceiptDetailsList(ReceiptItemReq req); PageResult<ReceiptItemResp> getBankReceiptDetailsList(ReceiptItemReq req);
......
...@@ -19,6 +19,7 @@ import cn.iocoder.yudao.module.wealth.enums.ReceiptStatusEnum; ...@@ -19,6 +19,7 @@ import cn.iocoder.yudao.module.wealth.enums.ReceiptStatusEnum;
import cn.iocoder.yudao.module.wealth.service.receipt.ReceiptService; import cn.iocoder.yudao.module.wealth.service.receipt.ReceiptService;
import cn.iocoder.yudao.module.wealth.service.receiptApproval.ReceiptApprovalService; import cn.iocoder.yudao.module.wealth.service.receiptApproval.ReceiptApprovalService;
import cn.iocoder.yudao.module.wealth.service.receivable.ReceivableService; import cn.iocoder.yudao.module.wealth.service.receivable.ReceivableService;
import cn.iocoder.yudao.module.wealth.util.WealthGenCodeUtils;
import cn.iocoder.yudao.module.wealth.vo.receipt.FinanceReceiptItemCancelVo; import cn.iocoder.yudao.module.wealth.vo.receipt.FinanceReceiptItemCancelVo;
import cn.iocoder.yudao.module.wealth.vo.receipt.FinanceReceiptItemVo; import cn.iocoder.yudao.module.wealth.vo.receipt.FinanceReceiptItemVo;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemCreateReqVO; import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemCreateReqVO;
...@@ -27,7 +28,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -27,7 +28,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
...@@ -54,28 +54,27 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R ...@@ -54,28 +54,27 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
@Resource @Resource
private ReceiptItemMapper receiptItemMapper; private ReceiptItemMapper receiptItemMapper;
@Resource @Resource
ReceiptService receiptService; private ReceiptService receiptService;
@Resource @Resource
ReceivableService receivableService; private ReceivableService receivableService;
@Resource @Resource
DictDataApi dictDataApi; private DictDataApi dictDataApi;
@Resource
@Autowired private BpmCreateServiceFactory bpmCreateServiceFactory;
BpmCreateServiceFactory bpmCreateServiceFactory; @Resource
private ReceiptApprovalService receiptApprovalService;
@Autowired @Resource
ReceiptApprovalService receiptApprovalService; private WealthGenCodeUtils wealthGenCodeUtils;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Long createReceiptItem(ReceiptItemCreateReqVO createReqVO) { public Long createReceiptItem(ReceiptItemCreateReqVO createReqVO) {
// 插入 // 插入收款明细
ReceiptItemDO receiptItem = ReceiptItemConvert.INSTANCE.convert(createReqVO); ReceiptItemDO receiptItem = ReceiptItemConvert.INSTANCE.convert(createReqVO);
receiptItem.setSerialNumber(wealthGenCodeUtils.generateReceiptItemCode());
receiptItemMapper.insert(receiptItem); receiptItemMapper.insert(receiptItem);
//创建收款明细的时候要判断收款单状态进行更新 // 创建收款明细的时候要判断收款单状态进行更新
if (null != createReqVO.getReceiptId()) { if (null != createReqVO.getReceiptId()) {
ReceiptDO receiptDO = receiptService.getReceipt(createReqVO.getReceiptId()); ReceiptDO receiptDO = receiptService.getReceipt(createReqVO.getReceiptId());
if (null != receiptDO) { if (null != receiptDO) {
...@@ -97,7 +96,9 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R ...@@ -97,7 +96,9 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
} else { } else {
throw exception(RECEIPT_NOT_EXISTS); throw exception(RECEIPT_NOT_EXISTS);
} }
// TODO 更新收款明细核销金额 // TODO 更新收款明细核销金额在创建环节还是审批环节
// receivableService.writeOffByReceiptItem(createReqVO.getReceivableWriteOffList());
// 返回 // 返回
return receiptItem.getId(); return receiptItem.getId();
} }
...@@ -108,6 +109,7 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R ...@@ -108,6 +109,7 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
this.validateReceiptItemExists(updateReqVO.getId()); this.validateReceiptItemExists(updateReqVO.getId());
// 更新 // 更新
ReceiptItemDO updateObj = ReceiptItemConvert.INSTANCE.convert(updateReqVO); ReceiptItemDO updateObj = ReceiptItemConvert.INSTANCE.convert(updateReqVO);
// TODO 是否更新明细?
receiptItemMapper.updateById(updateObj); receiptItemMapper.updateById(updateObj);
} }
...@@ -118,9 +120,7 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R ...@@ -118,9 +120,7 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
@Override @Override
public void deleteReceiptItem(Long id) { public void deleteReceiptItem(Long id) {
// 校验存在 // 校验存在
ReceiptItemDO receiptItemDO = ReceiptItemDO receiptItemDO = receiptItemMapper.selectById(id);
receiptItemMapper.selectById(id);
if (null == receiptItemDO) { if (null == receiptItemDO) {
throw exception(RECEIPT_ITEM_NOT_EXISTS); throw exception(RECEIPT_ITEM_NOT_EXISTS);
} }
...@@ -128,10 +128,8 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R ...@@ -128,10 +128,8 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
receiptItemMapper.deleteById(id); receiptItemMapper.deleteById(id);
//判断当前收款单下还有没有收款明细 //判断当前收款单下还有没有收款明细
if (null != receiptItemDO.getReceiptId()) { if (null != receiptItemDO.getReceiptId()) {
LambdaQueryWrapper<ReceiptItemDO> queryWrapper = LambdaQueryWrapper<ReceiptItemDO> queryWrapper = new LambdaQueryWrapper<>();
new LambdaQueryWrapper<>(); queryWrapper.eq(ReceiptItemDO::getReceiptId, receiptItemDO.getReceiptId());
queryWrapper.eq(ReceiptItemDO::getReceiptId,
receiptItemDO.getReceiptId());
long count = this.count(queryWrapper); long count = this.count(queryWrapper);
if (count == 0) { if (count == 0) {
ReceivableDO updateReceivableDO = new ReceivableDO(); ReceivableDO updateReceivableDO = new ReceivableDO();
...@@ -413,12 +411,8 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R ...@@ -413,12 +411,8 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
if (receiptItemDO.getStatus() == 1) { if (receiptItemDO.getStatus() == 1) {
throw exception(RECEIPT_ITEM_STATE_WRITE_OFF_SUCCESS_NOT_APPROVE); throw exception(RECEIPT_ITEM_STATE_WRITE_OFF_SUCCESS_NOT_APPROVE);
} }
//校验收款单是否核销中
//校验收款单是否在在全部核销中
validateReceipt(receiptItemDO.getReceiptId()); validateReceipt(receiptItemDO.getReceiptId());
//创建收款单明细核销流程 //创建收款单明细核销流程
ReceiptApprovalDO approvalDO = new ReceiptApprovalDO(); ReceiptApprovalDO approvalDO = new ReceiptApprovalDO();
approvalDO.setReceiptId(financeReceiptItemVo.getReceiptId()); approvalDO.setReceiptId(financeReceiptItemVo.getReceiptId());
...@@ -439,6 +433,8 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R ...@@ -439,6 +433,8 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
update.setStatus(ReceiptItemStatusEnum.WRITE_OFF_APPROVE_ING.getValue()); update.setStatus(ReceiptItemStatusEnum.WRITE_OFF_APPROVE_ING.getValue());
update.setBmpId(bpmId); update.setBmpId(bpmId);
this.updateById(update); this.updateById(update);
// TODO 判断是否符合自动审批条件
} }
@Override @Override
......
...@@ -266,4 +266,6 @@ public interface ReceivableService extends IService<ReceivableDO> { ...@@ -266,4 +266,6 @@ public interface ReceivableService extends IService<ReceivableDO> {
* @return * @return
*/ */
PageResult<BatchGenReceiptPageVO> batchGenReceiptPage(@Valid BatchGenReceiptPageQueryVO query, PageVO page); PageResult<BatchGenReceiptPageVO> batchGenReceiptPage(@Valid BatchGenReceiptPageQueryVO query, PageVO page);
void writeOffByReceiptItem(List<ReceivableWriteOffReqVO> receivableWriteOffList);
} }
...@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.wealth.service.receivable; ...@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.wealth.service.receivable;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderOperateLogEvent; import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderOperateLogEvent;
import cn.iocoder.yudao.framework.apollo.core.vo.ApplyInfoVO; import cn.iocoder.yudao.framework.apollo.core.vo.ApplyInfoVO;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.i18n.core.I18nMessage; import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
...@@ -541,4 +542,20 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec ...@@ -541,4 +542,20 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
}); });
return new PageResult<>(batchGenReceiptPageVOS, total, page.getRows(), page.getPage(), (total + page.getRows() - 1) / page.getRows()); return new PageResult<>(batchGenReceiptPageVOS, total, page.getRows(), page.getPage(), (total + page.getRows() - 1) / page.getRows());
} }
@Override
public void writeOffByReceiptItem(List<ReceivableWriteOffReqVO> receivableWriteOffList) {
if (CollectionUtil.isEmpty(receivableWriteOffList)) {
throw new ServiceException();
}
for (ReceivableWriteOffReqVO receivableWriteOffReqVO : receivableWriteOffList) {
ReceivableDO receivableDO = receivableMapper.selectById(receivableWriteOffReqVO.getId());
if (receivableDO == null) {
// 找不到对应的应收收款报错
}
receivableDO.setWriteOffAmount(receivableWriteOffReqVO.getWriteOffAmount().add(receivableDO.getWriteOffAmount()));
// TODO:是否更新汇率?是否每次更新基准金额,汇率变动时如何处理
receivableMapper.updateById(receivableDO);
}
}
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.wealth.util; ...@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.wealth.util;
import cn.iocoder.yudao.framework.redis.helper.RedisHelper; import cn.iocoder.yudao.framework.redis.helper.RedisHelper;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptInvoice.ReceiptInvoiceMapper; import cn.iocoder.yudao.module.wealth.dal.mysql.receiptInvoice.ReceiptInvoiceMapper;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem.ReceiptItemMapper;
import com.alibaba.excel.util.DateUtils; import com.alibaba.excel.util.DateUtils;
import org.redisson.api.RLock; import org.redisson.api.RLock;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
...@@ -18,7 +19,7 @@ import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.GET_LOCK_FA ...@@ -18,7 +19,7 @@ import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.GET_LOCK_FA
* 根据规则生成各种code * 根据规则生成各种code
*/ */
@Component @Component
public class InvoiceGenCodeUtils { public class WealthGenCodeUtils {
@Resource @Resource
private RedisHelper redisHelper; private RedisHelper redisHelper;
...@@ -26,6 +27,8 @@ public class InvoiceGenCodeUtils { ...@@ -26,6 +27,8 @@ public class InvoiceGenCodeUtils {
private RedissonClient redissonClient; private RedissonClient redissonClient;
@Resource @Resource
private ReceiptInvoiceMapper receiptInvoiceMapper; private ReceiptInvoiceMapper receiptInvoiceMapper;
@Resource
private ReceiptItemMapper receiptItemMapper;
/** /**
* 生成发票编号 * 生成发票编号
...@@ -64,4 +67,41 @@ public class InvoiceGenCodeUtils { ...@@ -64,4 +67,41 @@ public class InvoiceGenCodeUtils {
code.append(String.format("%04d", codeNum)); code.append(String.format("%04d", codeNum));
return code.toString(); return code.toString();
} }
/**
* 生成银行收款明细流水号
*/
public String generateReceiptItemCode() {
// YHMX+年月日+5位流水号
String key = "receiptItem:max:number";
StringBuilder code = new StringBuilder();
code.append("YHMX");
code.append(DateUtils.format(new Date(), "yyMMdd"));
Long codeNum;
if (redisHelper.hasKey(key)) {
codeNum = redisHelper.incrBy(key, 1);
} else {
RLock lock = redissonClient.getLock("next:receiptItem:code:lock");
try {
boolean lockSuccess = lock.tryLock(2, 2, TimeUnit.SECONDS);
if (!lockSuccess) {
throw exception(GET_LOCK_FAILED);
}
String currentMaxInvoiceCode = receiptItemMapper.getCurrentMaxReceiptItemCode();
if (currentMaxInvoiceCode == null){
codeNum = 1L;
} else {
codeNum = Long.parseLong(currentMaxInvoiceCode.substring(9)) + 1;
}
redisHelper.set(key, String.valueOf(codeNum),10, TimeUnit.SECONDS);
} catch (InterruptedException e) {
throw exception(GET_LOCK_FAILED);
} finally {
lock.unlock();
}
}
// 获得5位序列号,不足位前面补0
codeNum = codeNum % 100000;
code.append(String.format("%05d", codeNum));
return code.toString();
}
} }
...@@ -88,17 +88,17 @@ public class ReceiptBaseVO { ...@@ -88,17 +88,17 @@ public class ReceiptBaseVO {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date payedAt; private Date payedAt;
@ApiModelProperty(value = "发票号码") //@ApiModelProperty(value = "发票号码")
private String invoiceNumber; //private String invoiceNumber;
//
@ApiModelProperty(value = "开票类型(字典表 invoicing_type)") //@ApiModelProperty(value = "开票类型(字典表 invoicing_type)")
private Integer invoicingTypeId; //private Integer invoicingTypeId;
//
@ApiModelProperty(value = "开票类型名称") //@ApiModelProperty(value = "开票类型名称")
private String invoicingType; //private String invoicingType;
//
@ApiModelProperty(value = "开票备注") //@ApiModelProperty(value = "开票备注")
private String invoicingRemark; //private String invoicingRemark;
@ApiModelProperty(value = "通知人id") @ApiModelProperty(value = "通知人id")
private Long noticeAdminId; private Long noticeAdminId;
...@@ -106,23 +106,23 @@ public class ReceiptBaseVO { ...@@ -106,23 +106,23 @@ public class ReceiptBaseVO {
@ApiModelProperty(value = "通知人名称") @ApiModelProperty(value = "通知人名称")
private String noticeAdminName; private String noticeAdminName;
@ApiModelProperty(value = "收款人id") //@ApiModelProperty(value = "收款人id")
private Long payeeId; //private Long payeeId;
//
@ApiModelProperty(value = "收款人名称") //@ApiModelProperty(value = "收款人名称")
private String payeeName; //private String payeeName;
//
@ApiModelProperty(value = "核销人id") @ApiModelProperty(value = "核销人id")
private Long writeOffId; private Long writeOffId;
@ApiModelProperty(value = "核销人名称") @ApiModelProperty(value = "核销人名称")
private String writeOffName; private String writeOffName;
//
@ApiModelProperty(value = "开票人id") //@ApiModelProperty(value = "开票人id")
private Long issuerId; //private Long issuerId;
//
@ApiModelProperty(value = "开票人名称") //@ApiModelProperty(value = "开票人名称")
private String issuerName; //private String issuerName;
@ApiModelProperty(value = "状态: 0:草稿, 1待收款, 2待核销,3已部分核销,4已核销,5已核销待开票,6已开票") @ApiModelProperty(value = "状态: 0:草稿, 1待收款, 2待核销,3已部分核销,4已核销,5已核销待开票,6已开票")
private Integer state; private Integer state;
...@@ -131,9 +131,9 @@ public class ReceiptBaseVO { ...@@ -131,9 +131,9 @@ public class ReceiptBaseVO {
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date writeOffAt; private Date writeOffAt;
@ApiModelProperty(value = "开票时间") //@ApiModelProperty(value = "开票时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) //@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date invoicingAt; //private Date invoicingAt;
@ApiModelProperty(value = "数据来源(pc端,mobile端)") @ApiModelProperty(value = "数据来源(pc端,mobile端)")
private String source; private String source;
...@@ -142,7 +142,6 @@ public class ReceiptBaseVO { ...@@ -142,7 +142,6 @@ public class ReceiptBaseVO {
private Integer openInvoice; private Integer openInvoice;
@ApiModelProperty(value = "汇率有效期") @ApiModelProperty(value = "汇率有效期")
private Date rateValidateDate; private Date rateValidateDate;
@ApiModelProperty(value = "税点") @ApiModelProperty(value = "税点")
......
...@@ -22,6 +22,10 @@ public class ReceiptItemBackVO { ...@@ -22,6 +22,10 @@ public class ReceiptItemBackVO {
@ApiModelProperty(value = "主键", required = true) @ApiModelProperty(value = "主键", required = true)
private Long id; private Long id;
@ExcelProperty("流水号")
@ApiModelProperty(value = "流水号")
private String serialNumber;
@ExcelProperty("收款单id") @ExcelProperty("收款单id")
@ApiModelProperty(value = "收款单id") @ApiModelProperty(value = "收款单id")
private Long receiptId; private Long receiptId;
......
...@@ -17,6 +17,9 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ ...@@ -17,6 +17,9 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@Data @Data
public class ReceiptItemBaseVO { public class ReceiptItemBaseVO {
@ApiModelProperty(value = "流水号")
private String serialNumber;
@ApiModelProperty(value = "收款单id") @ApiModelProperty(value = "收款单id")
private Long receiptId; private Long receiptId;
......
...@@ -16,6 +16,9 @@ public class ReceiptItemQueryVO { ...@@ -16,6 +16,9 @@ public class ReceiptItemQueryVO {
@ApiModelProperty(value = "收款单id") @ApiModelProperty(value = "收款单id")
private Long receiptId; private Long receiptId;
@ApiModelProperty(value = "流水号")
private String serialNumber;
@ApiModelProperty(value = "收款账号") @ApiModelProperty(value = "收款账号")
private String accountNo; private String accountNo;
......
package cn.iocoder.yudao.module.wealth.vo.receiptItem; package cn.iocoder.yudao.module.wealth.vo.receiptItem;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
/*
*/
@Data @Data
@ApiModel("管理后台 - 银行收款单明细列表") @ApiModel("管理后台 - 银行收款单明细列表")
public class ReceiptItemReq extends PageParam { public class ReceiptItemReq extends PageParam {
private int start; private int start;
/* @ApiModelProperty(value = "收款单编号")
主表中的收款单编号
*/
private String receiptNo; private String receiptNo;
/* @ApiModelProperty(value = "订单编号")
订单编号
*/
private String orderNo; private String orderNo;
/* @ApiModelProperty(value = "提单编号")
提单编号
*/
private String tidanNo; private String tidanNo;
/* @ApiModelProperty(value = "创建日期开始")
创建日期
*/
private String sDate1; private String sDate1;
@ApiModelProperty(value = "创建日期结束")
private String eDate1; private String eDate1;
/* @ApiModelProperty(value = "提交审批日期开始")
提交审批日期
*/
private String sDate2; private String sDate2;
@ApiModelProperty(value = "提交审批日期结束")
private String eDate2; private String eDate2;
@ApiModelProperty(value = "审批通过日期开始")
/*
审批通过日期
*/
private String sDate3; private String sDate3;
@ApiModelProperty(value = "审批通过日期结束")
private String eDate3; private String eDate3;
@ApiModelProperty(value = "实收日期开始")
/*
实收日期
*/
private String sDate4; private String sDate4;
@ApiModelProperty(value = "实收日期结束")
private String eDate4; private String eDate4;
/* @ApiModelProperty(value = "创建人")
创建人
*/
private String creator; private String creator;
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY) @ApiModelProperty(value = "收款账户")
private Date createTime;
private String updater;
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date updateTime;
/*
收款账户
*/
private String accountNo; private String accountNo;
/* @ApiModelProperty(value = "审批状态")
审批状态
*/
private String status; private String status;
@ApiModelProperty(value = "流水号")
private String serialNumber;
} }
...@@ -24,6 +24,10 @@ public class ReceiptItemResp { ...@@ -24,6 +24,10 @@ public class ReceiptItemResp {
*/ */
@TableId @TableId
private Long id; private Long id;
/**
* 流水号
*/
private String serialNumber;
/** /**
* 收款单id * 收款单id
*/ */
......
...@@ -41,9 +41,7 @@ public class BankReceiptDetailsControl { ...@@ -41,9 +41,7 @@ public class BankReceiptDetailsControl {
@GetMapping("/list") @GetMapping("/list")
@ApiOperation("收款明细列表") @ApiOperation("收款明细列表")
public CommonResult<PageResult<ReceiptItemResp>> getBankReceiptDetailsList( public CommonResult<PageResult<ReceiptItemResp>> getBankReceiptDetailsList(ReceiptItemReq req) {
ReceiptItemReq req) {
return success(bankReceiptDetailsService.getBankReceiptDetailsList(req)); return success(bankReceiptDetailsService.getBankReceiptDetailsList(req));
} }
......
...@@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.wealth.controller.admin.receiptItem; ...@@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.wealth.controller.admin.receiptItem;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.collectors.CollectorsUtil; import cn.iocoder.yudao.framework.common.util.collectors.CollectorsUtil;
import cn.iocoder.yudao.framework.common.util.io.FileModel;
import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent; import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import cn.iocoder.yudao.module.ecw.api.currency.CurrencyApi; import cn.iocoder.yudao.module.ecw.api.currency.CurrencyApi;
import cn.iocoder.yudao.module.ecw.api.currency.dto.CurrencyRespDTO; import cn.iocoder.yudao.module.ecw.api.currency.dto.CurrencyRespDTO;
...@@ -26,14 +25,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -26,14 +25,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -55,19 +52,12 @@ public class ReceiptItemController { ...@@ -55,19 +52,12 @@ public class ReceiptItemController {
@Resource @Resource
private ReceiptItemMapper receiptItemMapper; private ReceiptItemMapper receiptItemMapper;
/*
币种
*/
@Resource @Resource
CurrencyApi currencyApi; private CurrencyApi currencyApi;
/*
*/ @Resource
@Autowired
private AdminUserService adminUserService; private AdminUserService adminUserService;
//审批信息
@Resource @Resource
private ReceiptApprovalMapper receiptApprovalMapper; private ReceiptApprovalMapper receiptApprovalMapper;
...@@ -220,8 +210,7 @@ public class ReceiptItemController { ...@@ -220,8 +210,7 @@ public class ReceiptItemController {
@PostMapping("/financeReceiptItemWriteOff") @PostMapping("/financeReceiptItemWriteOff")
@ApiOperation("收款明细核销") @ApiOperation("收款明细核销")
@Idempotent(timeout = 5) @Idempotent(timeout = 5)
public CommonResult<Boolean> createFinanceReceiptItemWriteOff( public CommonResult<Boolean> createFinanceReceiptItemWriteOff(@RequestBody FinanceReceiptItemVo financeReceiptVo) {
@RequestBody FinanceReceiptItemVo financeReceiptVo) {
receiptItemService.createFinanceReceiptItemWriteOff(financeReceiptVo); receiptItemService.createFinanceReceiptItemWriteOff(financeReceiptVo);
return success(true); return success(true);
} }
......
...@@ -61,6 +61,9 @@ ...@@ -61,6 +61,9 @@
AND p.creator in (SELECT id from system_user AND p.creator in (SELECT id from system_user
where username like concat('%',#{creator},'%')) where username like concat('%',#{creator},'%'))
</if> </if>
<if test="serialNumber != null and serialNumber != ''">
AND p.serial_number = #{serialNumber}
</if>
</where> </where>
</sql> </sql>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment