Commit 5b5678a2 authored by zhangfeng's avatar zhangfeng

feat(wealth): 收款单,银行收款明细

parent 24d94c20
......@@ -29,4 +29,24 @@ SET approval_time = update_time
WHERE approval_time IS NULL AND `status` = 1;
# 刷新银行明细审核核销币种
UPDATE ecw_receipt_item SET write_off_currency_id = 1 WHERE write_off_currency_id IS NULL
\ No newline at end of file
UPDATE ecw_receipt_item SET write_off_currency_id = 1 WHERE write_off_currency_id IS NULL;
UPDATE ecw_receipt SET generate_path = 0;
# 刷新应收款优惠金额
UPDATE ecw_receivable er
SET er.discount_total = 0 WHERE er.discount_total IS NULL;
# 刷新应收款汇率
UPDATE ecw_receivable er
SET er.exchange_rate = (SELECT eer.currency_rate FROM ecw_exchange_rate eer WHERE eer.source_currency_id = er.currency_id AND eer.target_currency_id = er.base_currency_id )
WHERE er.exchange_rate IS NULL AND er.receipt_id IS NOT NULL;
UPDATE ecw_receivable er
SET er.exchange_rate = 1 WHERE er.exchange_rate IS NULL AND er.receipt_id IS NOT NULL;
# 刷新应收款基准金额
UPDATE ecw_receivable er
SET er.base_amount = er.exchange_rate * (er.tax_amount - er.discount_total)
WHERE er.base_amount IS NULL AND er.receipt_id IS NOT NULL AND er.exchange_rate IS NOT NULL;
......@@ -50,4 +50,6 @@ public interface ReceivableConvert {
* @return
*/
PageResult<ReceivableBackVO> convertPage(PageResult<ReceivableDO> page);
List<ReceivableInItemVO> convertToItemVOList(List<ReceivableDO> receivableDOS);
}
......@@ -104,4 +104,8 @@ public class ReceiptItemDO extends BaseDO {
* 审核通过时间
*/
private Date approvalTime;
/**
* 备注
*/
private String remark;
}
......@@ -19,6 +19,6 @@ public class ReceiptItemWriteOffListener {
*/
@EventListener(ReceiptItemWriteOffEvent.class)
public void onReceiptItemWriteOff(ReceiptItemWriteOffEvent event) {
receiptItemService.verification(event.getId());
receiptItemService.verification(event.getId(), event.getBpmResult());
}
}
......@@ -14,4 +14,8 @@ public class ReceiptItemWriteOffEvent {
* 主键
*/
private Long id;
/**
* 审核结果
*/
private Integer bpmResult;
}
......@@ -226,41 +226,41 @@ public class FinanceReceiptApproveService {
receiptMapper.updateById(updateReceipt);
} else if (StrUtil.equals(WorkFlowEmus.FINANCE_RECEIPT_ITEM_WRITE_OFF.getKey(), bmpKey)) {
//收款单明细核销审核
if (null == receiptApprovalDO.getReceiptItemId()) {
throw exception(RECEIPT_ITEM_NOT_FOUND);
}
ReceiptItemDO receiptItemDO = receiptItemMapper.selectById(receiptApprovalDO.getReceiptItemId());
if (null == receiptItemDO) {
throw exception(RECEIPT_ITEM_NOT_FOUND);
}
ReceiptItemDO updateReceiptItem = new ReceiptItemDO();
updateReceiptItem.setId(receiptItemDO.getId());
updateReceiptItem.setBmpStatus(result);
if (result == BpmProcessInstanceResultEnum.APPROVE.getResult()) {
updateReceiptItem.setStatus(ReceiptItemStatusEnum.WRITE_OFF.getValue());
updateReceiptItem.setApprovalTime(new Date());
//判断收款单状态如果是待核销状态-变成部分核销状态,其它 状态不变
ReceiptDO receiptDO = receiptMapper.selectById(receiptItemDO.getReceiptId());
if (null != receiptDO && receiptDO.getState().equals(ReceiptStatusEnum.WRITE_OFF_WAITING.getValue())) {
ReceiptDO updateReceipt = new ReceiptDO();
updateReceipt.setId(receiptDO.getId());
updateReceipt.setState(ReceiptStatusEnum.WRITE_OFF_PART_ING.getValue());
receiptMapper.updateById(updateReceipt);
//更新收该收款单下的应收为收款中状态
LambdaUpdateWrapper<ReceivableDO> lambdaUpdateWrapper = new LambdaUpdateWrapper();
lambdaUpdateWrapper.eq(ReceivableDO::getReceiptId, receiptDO.getId());
lambdaUpdateWrapper.set(ReceivableDO::getState, 1);
receivableService.update(lambdaUpdateWrapper);
}
receiptService.updateReceiptItemStatus(receiptItemDO.getReceiptId());
} else if (result == BpmProcessInstanceResultEnum.REJECT.getResult()) {
updateReceiptItem.setStatus(ReceiptItemStatusEnum.WRITE_OFF_APPROVE_REJECT.getValue());
} else if (result == BpmProcessInstanceResultEnum.CANCEL.getResult()) {
updateReceiptItem.setStatus(ReceiptItemStatusEnum.DRAFT.getValue());
}
receiptItemMapper.updateById(updateReceiptItem);
applicationContext.publishEvent(new ReceiptItemWriteOffEvent(updateReceiptItem.getId()));
//if (null == receiptApprovalDO.getReceiptItemId()) {
// throw exception(RECEIPT_ITEM_NOT_FOUND);
//}
//ReceiptItemDO receiptItemDO = receiptItemMapper.selectById(receiptApprovalDO.getReceiptItemId());
//if (null == receiptItemDO) {
// throw exception(RECEIPT_ITEM_NOT_FOUND);
//}
//ReceiptItemDO updateReceiptItem = new ReceiptItemDO();
//updateReceiptItem.setId(receiptItemDO.getId());
//updateReceiptItem.setBmpStatus(result);
//if (result == BpmProcessInstanceResultEnum.APPROVE.getResult()) {
// updateReceiptItem.setStatus(ReceiptItemStatusEnum.WRITE_OFF.getValue());
// updateReceiptItem.setApprovalTime(new Date());
// //判断收款单状态如果是待核销状态-变成部分核销状态,其它 状态不变
// ReceiptDO receiptDO = receiptMapper.selectById(receiptItemDO.getReceiptId());
// if (null != receiptDO && receiptDO.getState().equals(ReceiptStatusEnum.WRITE_OFF_WAITING.getValue())) {
// ReceiptDO updateReceipt = new ReceiptDO();
// updateReceipt.setId(receiptDO.getId());
// updateReceipt.setState(ReceiptStatusEnum.WRITE_OFF_PART_ING.getValue());
// receiptMapper.updateById(updateReceipt);
//
// //更新收该收款单下的应收为收款中状态
// LambdaUpdateWrapper<ReceivableDO> lambdaUpdateWrapper = new LambdaUpdateWrapper();
// lambdaUpdateWrapper.eq(ReceivableDO::getReceiptId, receiptDO.getId());
// lambdaUpdateWrapper.set(ReceivableDO::getState, 1);
// receivableService.update(lambdaUpdateWrapper);
// }
// receiptService.updateReceiptItemStatus(receiptItemDO.getReceiptId());
//} else if (result == BpmProcessInstanceResultEnum.REJECT.getResult()) {
// updateReceiptItem.setStatus(ReceiptItemStatusEnum.WRITE_OFF_APPROVE_REJECT.getValue());
//} else if (result == BpmProcessInstanceResultEnum.CANCEL.getResult()) {
// updateReceiptItem.setStatus(ReceiptItemStatusEnum.DRAFT.getValue());
//}
//receiptItemMapper.updateById(updateReceiptItem);
applicationContext.publishEvent(new ReceiptItemWriteOffEvent(receiptApprovalDO.getId(), result));
} else if (StrUtil.equals(WorkFlowEmus.FINANCE_RECEIPT_ITEM_WRITE_OFF_NO.getKey(), bmpKey)) {
//收款单明细核销反审核
if (null == receiptApprovalDO.getReceiptItemId()) {
......
......@@ -153,7 +153,9 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
*/
private void createInvoice(ReceiptInvoiceCreateReqVO receiptInvoiceCreateReqVO, ReceiptDO receipt) {
ReceiptInvoiceDO receiptInvoiceDO = ReceiptInvoiceConvert.INSTANCE.convertInvoiceCreateReqVO(receiptInvoiceCreateReqVO);
receiptInvoiceDO.setApplyUserId(SecurityFrameworkUtils.getLoginUserId());
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
receiptInvoiceDO.setApplyUserId(loginUser.getId());
receiptInvoiceDO.setApplyUserName(loginUser.getUsername());
receiptInvoiceDO.setInvoiceHeader(receiptInvoiceCreateReqVO.getInvoice());
receiptInvoiceDO.setInvoiceAddress(receiptInvoiceCreateReqVO.getAddressPhone());
receiptInvoiceDO.setInvoiceItem(receiptInvoiceCreateReqVO.getProjectName());
......@@ -194,10 +196,6 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
receivableDO.setReceiptNo(receipt.getReceiptNo());
receivableDO.setReceiptId(receipt.getId());
receivableDO.setState(1);
ExchangeRateRespDTO currencyRate = currencyApi.getCurrencyRate(receipt.getCurrencyId(), receivableDO.getBaseCurrencyId());
receivableDO.setExchangeRate(currencyRate.getCurrencyRate());
BigDecimal actualAmount = receivableDO.getTaxAmount().subtract(receivableDO.getDiscountTotal() == null ? BigDecimal.ZERO : receivableDO.getDiscountTotal());
receivableDO.setBaseAmount(actualAmount.multiply(currencyRate.getCurrencyRate()));
return receivableDO;
}).collect(Collectors.toList());
receivableService.updateBatchById(receivableDOList);
......@@ -366,6 +364,7 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
LambdaQueryWrapper<ReceivableDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ReceivableDO::getReceiptId, updateReqVO.getId());
List<ReceivableDO> allReceivable = receivableService.list(lambdaQueryWrapper);
// TODO 校验删除的应收明细是否已收款
for (ReceivableDO receivableDO : allReceivable) {
if (receivableUpdateReqVOList.stream().noneMatch(w -> Objects.equals(w.getId(), receivableDO.getId()))) {
LambdaUpdateWrapper<ReceivableDO> update = new LambdaUpdateWrapper<>();
......@@ -1027,6 +1026,9 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
if (receiptDO.getInvoiceId() != null) {
ReceiptInvoiceDO receiptInvoiceDO = receiptInvoiceMapper.selectById(receiptDO.getInvoiceId());
InvoiceInReceiptRespVO invoiceInReceiptRespVO = ReceiptInvoiceConvert.INSTANCE.convertRespVO(receiptInvoiceDO);
if (receiptInvoiceDO.getInvoicerId() != null) {
invoiceInReceiptRespVO.setInvoicerName(adminUserApi.getUserName(receiptInvoiceDO.getInvoicerId().toString()));
}
invoiceInReceiptRespVO.setInvoice(receiptInvoiceDO.getInvoiceHeader());
invoiceInReceiptRespVO.setAddressPhone(receiptInvoiceDO.getInvoiceAddress());
invoiceInReceiptRespVO.setProjectName(receiptInvoiceDO.getInvoiceItem());
......
......@@ -273,7 +273,7 @@ public class ReceiptInvoiceServiceImpl extends AbstractService<ReceiptInvoiceMap
receiptDO.setInvoicingStatus(CANCELLED.getValue());
receiptMapper.updateById(receiptDO);
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
receiptInvoiceDO.setApplyUserId(loginUser.getId());
receiptInvoiceDO.setCancelUserId(loginUser.getId());
receiptInvoiceDO.setCancelTime(new Date());
receiptInvoiceMapper.updateById(receiptInvoiceDO);
recordLog(receiptInvoiceDO.getId(), InvoicingLinkEnum.CANCEL_INVOICE, reqVO.getRemark(), null);
......
......@@ -6,6 +6,7 @@ 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.receiptAccount.ReceiptItemBatchCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptItemBatchRespVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemBackVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemUpdateReqVO;
......@@ -62,11 +63,11 @@ public interface ReceiptItemService extends IService<ReceiptItemDO> {
/**
* 核销
* 处理审批结果
*
* @param id
*/
void verification(Long id);
void verification(Long id,Integer bpmResult);
/**
* 批量核销
......@@ -123,4 +124,6 @@ public interface ReceiptItemService extends IService<ReceiptItemDO> {
BigDecimal getWriteOffAmountByReceiptId( Long receiptId);
List<ReceiptItemBatchRespVO> receiptItemImport(List<ReceiptItemBatchCreateReqVO> list, Boolean ignoreItem);
ReceiptItemBackVO getReceiptItemDetail(Long id);
}
......@@ -16,10 +16,13 @@ import cn.iocoder.yudao.module.ecw.api.currency.dto.CurrencyRespDTO;
import cn.iocoder.yudao.module.ecw.api.currency.dto.ExchangeRateRespDTO;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.wealth.convert.receiptItem.ReceiptItemConvert;
import cn.iocoder.yudao.module.wealth.convert.receivable.ReceivableConvert;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receipt.ReceiptDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptApproval.ReceiptApprovalDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptItem.ReceiptItemDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receivable.ReceivableDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receivable.ReceivableWriteOffRecord;
import cn.iocoder.yudao.module.wealth.dal.mysql.receipt.ReceiptMapper;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem.ReceiptItemMapper;
import cn.iocoder.yudao.module.wealth.enums.ReceiptItemStatusEnum;
import cn.iocoder.yudao.module.wealth.enums.ReceiptLinkEnum;
......@@ -32,8 +35,10 @@ 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.receiptAccount.ReceiptItemBatchCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptItemBatchRespVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemBackVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemUpdateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableInItemVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableWriteOffReqVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
......@@ -71,6 +76,8 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
@Resource
private ReceiptService receiptService;
@Resource
private ReceiptMapper receiptMapper;
@Resource
private ReceivableService receivableService;
@Resource
private DictDataApi dictDataApi;
......@@ -199,58 +206,57 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
@Override
@Transactional(rollbackFor = Exception.class)
public void verification(Long id) {
ReceiptItemDO receiptItemDO = this.getReceiptItem(id);
if (receiptItemDO == null) {
throw exception(RECEIPTITEM_NOT_EXISTS);
public void verification(Long id, Integer bpmResult) {
//收款单明细核销审核
if (null == id) {
throw exception(RECEIPT_ITEM_NOT_FOUND);
}
ReceiptItemDO receiptItemDO = receiptItemMapper.selectById(id);
if (null == receiptItemDO) {
throw exception(RECEIPT_ITEM_NOT_FOUND);
}
if (receiptItemDO.getStatus() != 0) {
throw exception(RECEIPTITEM_VERIFICATION);
}
ReceiptItemDO updateReceiptItemDO = new ReceiptItemDO();
updateReceiptItemDO.setId(receiptItemDO.getId());
updateReceiptItemDO.setStatus(1);
this.updateById(updateReceiptItemDO);
if (null == receiptItemDO.getReceiptId()) {
throw exception(RECEIPT_NOT_EXISTS);
}
ReceiptDO receiptDO = receiptService.getById(receiptItemDO.getReceiptId());
if (null == receiptDO) {
throw exception(RECEIPT_NOT_EXISTS);
}
if (receiptDO.getState() == 0) {
throw exception(RECEIPT_STATUS_NOT_WRITE_OFF);
receiptItemDO.setBmpStatus(bpmResult);
// 核销通过
if (Objects.equals(bpmResult, BpmProcessInstanceResultEnum.APPROVE.getResult())) {
receiptItemDO.setStatus(ReceiptItemStatusEnum.WRITE_OFF.getValue());
receiptItemDO.setApprovalTime(new Date());
// 更新收款单
ReceiptDO receiptDO = receiptMapper.selectById(receiptItemDO.getReceiptId());
//判断收款单状态如果是待核销状态-变成部分核销状态,其它 状态不变
if (null != receiptDO && receiptDO.getState().equals(ReceiptStatusEnum.WRITE_OFF_WAITING.getValue())) {
receiptDO.setState(ReceiptStatusEnum.WRITE_OFF_PART_ING.getValue());
}
// TODO 是否更新核销金额,核销比例
BigDecimal writeOffAmount = receiptItemMapper.getWriteOffAmountByReceiptId(receiptDO.getId());
if (null != receiptDO.getReceivableTotalAmount() && receiptDO.getReceivableTotalAmount().compareTo(BigDecimal.ZERO) == 1) {
receiptDO.setWriteOffProportion(writeOffAmount.divide(receiptDO.getReceivableTotalAmount(), 8, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(6, BigDecimal.ROUND_HALF_UP));
}
receiptService.updateById(receiptDO);
//更新应收明细
List<ReceivableDO> receivableDOS = receivableService.selectList("receipt_id", receiptItemDO.getReceiptId());
for (ReceivableDO receivableDO : receivableDOS) {
receivableDO.setState(1);
ReceivableWriteOffRecord receivableWriteOffRecord = receivableService.getReceivableWriteOffRecord(receivableDO.getId(), receiptItemDO.getId());
if (null != receivableWriteOffRecord) {
receivableDO.setWriteOffAmount(receivableDO.getWriteOffAmount().add(receivableWriteOffRecord.getWriteOffAmount()));
}
}
receivableService.updateBatchById(receivableDOS);
receiptService.updateReceiptItemStatus(receiptItemDO.getReceiptId());
}
//设置应收明细为收款中
LambdaUpdateWrapper<ReceivableDO> lambdaReceivableUpdateWrapper = new LambdaUpdateWrapper();
lambdaReceivableUpdateWrapper.set(ReceivableDO::getState, 1);
lambdaReceivableUpdateWrapper.eq(ReceivableDO::getReceiptId, receiptDO.getId());
lambdaReceivableUpdateWrapper.eq(ReceivableDO::getState, 0);
receivableService.update(lambdaReceivableUpdateWrapper);
//需要计算出核销比例
BigDecimal writeOffAmount = receiptItemMapper.getWriteOffAmountByReceiptId(receiptDO.getId());
ReceiptDO updateReceiptDO = new ReceiptDO();
updateReceiptDO.setId(receiptDO.getId());
//需要计算出核销比例
if (receiptDO.getState() == 2) {
updateReceiptDO.setState(3);
// 审核拒绝
else if (Objects.equals(bpmResult, BpmProcessInstanceResultEnum.REJECT.getResult())) {
receiptItemDO.setStatus(ReceiptItemStatusEnum.WRITE_OFF_APPROVE_REJECT.getValue());
}
if (null != receiptDO.getReceivableTotalAmount() && receiptDO.getReceivableTotalAmount().compareTo(BigDecimal.ZERO) == 1) {
updateReceiptDO.setWriteOffProportion(writeOffAmount.divide(receiptDO.getReceivableTotalAmount(), 8, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(6, BigDecimal.ROUND_HALF_UP));
// 取消审核
else if (Objects.equals(bpmResult, BpmProcessInstanceResultEnum.CANCEL.getResult())) {
receiptItemDO.setStatus(ReceiptItemStatusEnum.DRAFT.getValue());
}
receiptService.updateById(updateReceiptDO);
receiptItemMapper.updateById(receiptItemDO);
}
@Override
......@@ -590,6 +596,26 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
return respVOS;
}
@Override
public ReceiptItemBackVO getReceiptItemDetail(Long id) {
ReceiptItemDO receiptItemDO = receiptItemMapper.selectById(id);
if (null == receiptItemDO) {
throw exception(RECEIPT_ITEM_NOT_FOUND);
}
ReceiptItemBackVO itemBackVO = ReceiptItemConvert.INSTANCE.convert(receiptItemDO);
List<ReceivableDO> receivableDOS = receivableService.selectList("receipt_id", itemBackVO.getReceiptId());
List<ReceivableInItemVO> receivableInItemVOS = ReceivableConvert.INSTANCE.convertToItemVOList(receivableDOS);
for (ReceivableInItemVO receivableInItemVO : receivableInItemVOS) {
ReceivableWriteOffRecord receivableWriteOffRecord = receivableService.getReceivableWriteOffRecord(receivableInItemVO.getId(), id);
if (null == receivableWriteOffRecord) {
receivableInItemVO.setWriteOffInCurrentItem(BigDecimal.ZERO);
}
receivableInItemVO.setWriteOffInCurrentItem(receivableWriteOffRecord.getWriteOffAmount());
}
itemBackVO.setReceivableList(receivableInItemVOS);
return itemBackVO;
}
private ReceiptItemBatchRespVO validateBatchReceiptItem(ReceiptItemBatchCreateReqVO batchCreateReqVO, Boolean ignoreItem, ArrayList<ReceiptItemCreateReqVO> receiptItemCreateReqVOS) {
// 校验单个字段合法性
ReceiptItemBatchRespVO commonFieldRes = validateBatchReceiptItemCommonField(batchCreateReqVO);
......
......@@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptItem.ReceiptItemDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receivable.ReceivableDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receivable.ReceivableWriteOffRecord;
import cn.iocoder.yudao.module.wealth.vo.receivable.*;
import javax.validation.Valid;
......@@ -271,4 +272,6 @@ public interface ReceivableService extends IService<ReceivableDO> {
Long getDestCountryCurrencyId(Long orderId);
void createWriteOffRecord(ReceivableWriteOffReqVO receivableWriteOffReqVO, ReceiptItemDO receiptItem);
ReceivableWriteOffRecord getReceivableWriteOffRecord(Long receivableId, Long receiptItemId);
}
......@@ -313,10 +313,16 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
receivableBackVO.setWriteOffAmount(BigDecimal.ZERO);
}
receivableBackVO.setNotWriteOffAmount(receivableBackVO.getActualAmount().subtract(receivableBackVO.getWriteOffAmount()));
// TODO 核销/未核销美元暂时默认为0,待计算
receivableBackVO.setWriteOffAmountUsd(BigDecimal.ZERO);
receivableBackVO.setNotWriteOffAmountUsd(BigDecimal.ZERO);
receivableBackVO.setBaseAmount(BigDecimal.ZERO);
if (receivableBackVO.getExchangeRate() != null) {
receivableBackVO.setWriteOffAmountUsd(receivableBackVO.getWriteOffAmount().multiply(receivableBackVO.getExchangeRate()));
receivableBackVO.setNotWriteOffAmountUsd(receivableBackVO.getNotWriteOffAmount().multiply(receivableBackVO.getExchangeRate()));
} else {
receivableBackVO.setWriteOffAmountUsd(BigDecimal.ZERO);
receivableBackVO.setNotWriteOffAmountUsd(BigDecimal.ZERO);
}
if (receivableBackVO.getBaseAmount() == null) {
receivableBackVO.setBaseAmount(BigDecimal.ZERO);
}
// 核销比例 = 已核销金额 / 实际金额,保留两位小数字符串
receivableBackVO.setWriteOffProportion(receivableBackVO.getWriteOffAmount().divide(receivableBackVO.getActualAmount(), 2, RoundingMode.HALF_UP).toString());
});
......@@ -584,4 +590,9 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
.build();
receivableWriteOffRecordMapper.insert(writeOffRecord);
}
@Override
public ReceivableWriteOffRecord getReceivableWriteOffRecord(Long receivableId, Long receiptItemId) {
return receivableWriteOffRecordMapper.selectOne("receivable_id", receivableId, "receipt_item_id", receiptItemId);
}
}
\ No newline at end of file
package cn.iocoder.yudao.module.wealth.vo.receipt;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -8,6 +9,8 @@ import lombok.NoArgsConstructor;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
@Builder
@NoArgsConstructor
......@@ -33,6 +36,7 @@ public class ReceiptLogBackVO {
private String bpmStatus;
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date createTime;
}
......@@ -23,6 +23,12 @@ public class InvoiceInReceiptRespVO {
@ApiModelProperty(value = "纳税人识别号")
private String taxpayer;
@ApiModelProperty(value = "开户行")
private String accountBank;
@ApiModelProperty(value = "开户账号")
private String accountName;
@ApiModelProperty(value = "税率")
private java.math.BigDecimal taxRate;
......@@ -50,6 +56,9 @@ public class InvoiceInReceiptRespVO {
@ApiModelProperty(value = "开发票人id")
private Long invoicerId;
@ApiModelProperty(value = "开发票人")
private String invoicerName;
@ApiModelProperty(value = "开票时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date invoiceTime;
......
package cn.iocoder.yudao.module.wealth.vo.receiptItem;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableInItemVO;
import com.alibaba.excel.annotation.ExcelProperty;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
......@@ -123,4 +126,10 @@ public class ReceiptItemBackVO {
@ApiModelProperty(value = "审核通过时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date approvalTime;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "收款明细列表")
private List<ReceivableInItemVO> receivableList;
}
......@@ -67,4 +67,6 @@ public class ReceiptItemBaseVO {
@ApiModelProperty(value = "核销金额")
private java.math.BigDecimal writeOffAmount;
@ApiModelProperty(value = "备注")
private String remark;
}
package cn.iocoder.yudao.module.wealth.vo.receivable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 银行收款明细中的应收明细 Response VO
*/
@Data
@ApiModel("管理后台 - 银行收款明细中的应收明细 Response VO")
public class ReceivableInItemVO {
@ApiModelProperty(value = "主键", required = true)
private Long id;
@ApiModelProperty(value = "收款单id")
private Long receiptId;
@ApiModelProperty(value = "费用类型(字典 receivable_fee_type)")
private Integer feeType;
@ApiModelProperty(value = "汇率")
private BigDecimal exchangeRate;
@ApiModelProperty(value = "货币id")
private Long currencyId;
@ApiModelProperty(value = "总金额")
private BigDecimal totalAmount;
@ApiModelProperty(value = "收款状态(0未收款,1收款中,2已收款)")
private Integer state;
@ApiModelProperty(value = "费用来源:1 订单计算 2 费用申请 3 特需费用")
private Integer feeSource;
@ApiModelProperty(value = "未核销金额")
private BigDecimal notWriteOffAmount;
@ApiModelProperty(value = "核销比例")
private String writeOffProportion;
@ApiModelProperty(value = "基准金额")
private BigDecimal baseAmount;
@ApiModelProperty(value = "实际金额")
private BigDecimal actualAmount;
@ApiModelProperty(value = "核销金额")
private BigDecimal writeOffAmountUsd;
@ApiModelProperty(value = "未核销金额")
private BigDecimal notWriteOffAmountUsd;
@ApiModelProperty(value = "基准币种id")
private Long baseCurrencyId;
@ApiModelProperty(value = "本次核销金额")
private BigDecimal writeOffInCurrentItem;
}
......@@ -95,15 +95,11 @@ public class ReceiptItemController {
@GetMapping("/get")
@ApiOperation("获得收款明细详情")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
public CommonResult<ReceiptItemBackVO> getReceiptItem(@RequestParam("id") Long id) {
ReceiptItemDO receiptItem = receiptItemService.getReceiptItem(id);
ReceiptItemBackVO v = ReceiptItemConvert.INSTANCE.convert(receiptItem);
//计算剩余金额
//BigDecimal p = receiptItemService.getWriteOffAmountByReceiptId(id);
//BigDecimal t = receiptAccountMapper.getWriteOffAmountByReceiptId(id);
getSY(v, v.getReceiptId());
SetData(v);
return success(v);
public CommonResult<ReceiptItemBackVO> getReceiptItemDetail(@RequestParam("id") Long id) {
ReceiptItemBackVO receiptItemVO = receiptItemService.getReceiptItemDetail(id);
getSY(receiptItemVO, receiptItemVO.getReceiptId());
SetData(receiptItemVO);
return success(receiptItemVO);
}
private void SetData(ReceiptItemBackVO v) {
......
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