Commit 16fe8194 authored by zhangfeng's avatar zhangfeng

feat(wealth): 开票管理

parent 754c27c8
......@@ -4,10 +4,7 @@ import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptInvoice.ReceiptInvoiceDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptInvoiceLog.ReceiptInvoiceLogDO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.ReceiptInvoiceLogBackVO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.ReceiptInvoicePageBackVO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.ReceiptInvoiceCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.ReceiptInvoiceUpdateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.*;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
......@@ -32,7 +29,7 @@ public interface ReceiptInvoiceConvert {
* @param bean
* @return
*/
ReceiptInvoiceDO convert(ReceiptInvoiceUpdateReqVO bean);
ReceiptInvoiceDO convert(ReceiptInvoiceUpdateDataReqVO bean);
/***
* 实体转返回VO
......@@ -56,4 +53,6 @@ public interface ReceiptInvoiceConvert {
PageResult<ReceiptInvoicePageBackVO> convertPage(PageResult<ReceiptInvoiceDO> page);
List<ReceiptInvoiceLogBackVO> logDOtoLogVOList(List<ReceiptInvoiceLogDO> invoiceLogDOs);
ReceiptInvoiceDO convert(ReceiptInvoiceUpdateInfoReqVO updateReqVO);
}
......@@ -233,7 +233,7 @@ public class ReceiptDO extends BaseDO {
private Integer invoicingStatus;
/**
* 开票明细状态
* 开票资料状态
*/
private Integer invoiceDataStatus;
}
package cn.iocoder.yudao.module.wealth.dal.dataobject.receiptInvoice;
import lombok.*;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.util.Date;
/**
* 收款单开票信息 DO
......@@ -49,9 +51,9 @@ public class ReceiptInvoiceDO extends BaseDO {
*/
private Long applyUserId;
/**
* 备注
* 开票资料备注
*/
private String remark;
private String invoiceRemark;
/**
* 申请人姓名
*/
......@@ -99,7 +101,7 @@ public class ReceiptInvoiceDO extends BaseDO {
/**
* 发票信息最后修改时间
*/
private String invoiceInfoSaveTime;
private Date invoiceInfoSaveTime;
/**
* 开发票人id
*/
......@@ -125,4 +127,19 @@ public class ReceiptInvoiceDO extends BaseDO {
*/
private String tidanNo;
/**
* 开票币种符号
*/
private Long currencyId;
/**
* 开票金额
*/
private java.math.BigDecimal invoiceMoney;
/**
* 开票信息备注
*/
private String invoiceInfoRemark;
}
......@@ -152,12 +152,14 @@ public class ReceivableDO extends BaseDO {
* 含税金额
*/
private BigDecimal taxAmount;
/**
* 核销金额
*/
private BigDecimal writeOffAmount;
/**
* 基准金额
*/
private BigDecimal baseAmount;
/**
* 备注
*/
......
......@@ -29,7 +29,7 @@ public enum InvoicingLinkEnum implements IntArrayValuable {
/**
* 驳回开票信息
*/
REJECT_INVOICE_INFO(4, "驳回开票信息", "Reject Invoice Info"),
REJECT_INVOICE_DATA(4, "驳回开票资料", "Reject Invoice Data"),
/**
* 提交开票
*/
......
......@@ -21,7 +21,7 @@ public enum InvoicingStatusEnum implements IntArrayValuable {
/**
* 已取消
*/
CANCELLED(4, "已作废", "Cancelled"),
CANCELLED(4, "已取消", "Cancelled"),
/**
* 不开票
*/
......
......@@ -26,13 +26,7 @@ public interface ReceiptInvoiceService extends IService<ReceiptInvoiceDO> {
* 更新收款单开票信息
* @param updateReqVO 更新信息
*/
void updateReceiptInvoice(@Valid ReceiptInvoiceUpdateReqVO updateReqVO);
/**
* 删除收款单开票信息
* @param id 编号
*/
void deleteReceiptInvoice(Long id);
void updateReceiptInvoiceData(@Valid ReceiptInvoiceUpdateDataReqVO updateReqVO);
/**
* 获得收款单开票信息
......@@ -64,9 +58,11 @@ public interface ReceiptInvoiceService extends IService<ReceiptInvoiceDO> {
*/
List<ReceiptInvoiceDO> getReceiptInvoiceList(ReceiptInvoiceQueryVO query);
Boolean rejectInvoiceInfo(@Valid ReceiptInvoiceOperateReqVO rejectReqVO);
Boolean rejectInvoiceInfo(@Valid ReceiptInvoiceOperateReqVO reqVO);
Boolean cancelInvoice(@Valid ReceiptInvoiceOperateReqVO reqVO);
Boolean cancelInvoice(@Valid ReceiptInvoiceOperateReqVO rejectReqVO);
Boolean deleteInvoiceInfo(@Valid ReceiptInvoiceOperateReqVO reqVO);
Boolean deleteInvoice(@Valid ReceiptInvoiceOperateReqVO rejectReqVO);
void updateReceiptInvoiceInfo(@Valid ReceiptInvoiceUpdateInfoReqVO updateReqVO);
}
......@@ -161,7 +161,7 @@ public interface ReceivableService extends IService<ReceivableDO> {
List<ReceivableBackVO> receivableList(List<Long> ids);
/**
* 根据付款单ID得到付款单明细列表
* 根据收款单ID得到应收明细列表
*
* @param id
* @return
......
......@@ -40,6 +40,7 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
......@@ -284,7 +285,21 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
@Override
public List<ReceivableBackVO> getReceivableListByReceiptId(Long id) {
return receivableMapper.getReceivableBackVoListByReceiptId(id);
List<ReceivableBackVO> receivableBackVOList = receivableMapper.getReceivableBackVoListByReceiptId(id);
receivableBackVOList.forEach(receivableBackVO -> {
if (receivableBackVO.getDiscountTotal() == null) {
receivableBackVO.setDiscountTotal(BigDecimal.ZERO);
}
receivableBackVO.setNotIncludedTaxAmount(receivableBackVO.getTotalAmount());
receivableBackVO.setActualAmount(receivableBackVO.getTaxAmount().subtract(receivableBackVO.getDiscountTotal()));
if (receivableBackVO.getWriteOffAmount() == null) {
receivableBackVO.setWriteOffAmount(BigDecimal.ZERO);
}
receivableBackVO.setNotWriteOffAmount(receivableBackVO.getActualAmount().subtract(receivableBackVO.getWriteOffAmount()));
// 核销比例 = 已核销金额 / 实际金额,保留两位小数字符串
receivableBackVO.setWriteOffProportion(receivableBackVO.getWriteOffAmount().divide(receivableBackVO.getActualAmount(), 2, RoundingMode.HALF_UP).toString());
});
return receivableBackVOList;
}
@Override
......
......@@ -12,6 +12,9 @@ import java.math.BigDecimal;
@ApiModel("管理后台 - 收款单开票信息创建 Request VO")
public class ReceiptInvoiceCreateReqVO {
@ApiModelProperty(value = "收款单id", required = true)
private Long receiptId;
@ApiModelProperty(value = "发票抬头")
private String invoiceHeader;
......
package cn.iocoder.yudao.module.wealth.vo.receiptInvoice;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableBackVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.WealthMoneyAmountVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -13,26 +14,38 @@ import java.util.List;
public class ReceiptInvoiceDetailVO {
//订单信息/基础信息
@ApiModelProperty(value = "开票编号")
private String invoiceNo;
@ApiModelProperty(value = "收款单id")
private Long receiptId;
@ApiModelProperty(value = "收款单号(例:SKD001)")
private String receiptNo;
@ApiModelProperty(value = "订单id")
private Long orderId;
@ApiModelProperty(value = "客户id")
private Long customerId;
@ApiModelProperty(value = "客户名称")
private String customerName;
@ApiModelProperty(value = "应收总金额/已收总金额统计")
private List<WealthMoneyAmountVO> receiptAmount;
@ApiModelProperty(value = "应收总美元")
private java.math.BigDecimal receivableTotalAmountUsd;
@ApiModelProperty(value = "订单号(NG2414248L)")
private String orderNo;
@ApiModelProperty(value = "已收总美元")
private java.math.BigDecimal writeOffAmountUsd;
@ApiModelProperty(value = "应收金额(多币种换行,应该从应收明细中取)")
private Integer receivableTotalAmount;
@ApiModelProperty(value = "总核销比例")
private String writeOffProportion;
@ApiModelProperty(value = "开票状态")
private Integer invoicingStatus;
@ApiModelProperty(value = "开票编号")
private String invoiceNo;
@ApiModelProperty(value = "开票资料状态")
private Integer invoiceDataStatus;
@ApiModelProperty(value = "开票类型(字典表 invoicing_type)")
private Integer invoiceTypeId;
......@@ -62,13 +75,21 @@ public class ReceiptInvoiceDetailVO {
@ApiModelProperty(value = "发票号码")
private String invoiceNumber;
@ApiModelProperty(value = "开票备注")
@ApiModelProperty(value = "开票资料备注")
private String invoiceRemark;
@ApiModelProperty(value = "开票金额(暂时不知道从哪拿)")
// TODO 暂时不知道从哪拿
@ApiModelProperty(value = "开票金额")
private java.math.BigDecimal invoiceMoney;
@ApiModelProperty(value = "开票币种")
private Long currencyId;
@ApiModelProperty(value = "开票币种符号")
private String currencySymbol;
@ApiModelProperty(value = "开票信息备注")
private String invoiceInfoRemark;
@ApiModelProperty(value = "开发票人id")
private Long invoicerId;
......@@ -86,4 +107,19 @@ public class ReceiptInvoiceDetailVO {
@ApiModelProperty(value = "日志")
private List<ReceiptInvoiceLogBackVO> invoiceLog;
@ApiModelProperty(value = "收款人")
// TODO 待确认
private String payee;
@ApiModelProperty(value = "核销人")
// TODO 待确认
private String writeOffUser;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "创建人")
private String creator;
@ApiModelProperty(value = "更新人")
private String updater;
}
......@@ -8,10 +8,10 @@ import lombok.ToString;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
@ApiModel("管理后台 - 收款单开票信息更新 Request VO")
@ApiModel("管理后台 - 收款单开票资料更新 Request VO")
@Data
@ToString(callSuper = true)
public class ReceiptInvoiceUpdateReqVO {
public class ReceiptInvoiceUpdateDataReqVO {
@ApiModelProperty(value = "主键", required = true)
@NotNull(message = "主键不能为空")
......@@ -42,6 +42,6 @@ public class ReceiptInvoiceUpdateReqVO {
private String invoiceAddress;
@ApiModelProperty(value = "备注")
private String remark;
private String invoiceRemark;
}
package cn.iocoder.yudao.module.wealth.vo.receiptInvoice;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import javax.validation.constraints.NotNull;
import java.util.Date;
@ApiModel("管理后台 - 收款单开票资料更新 Request VO")
@Data
@ToString(callSuper = true)
public class ReceiptInvoiceUpdateInfoReqVO {
@ApiModelProperty(value = "主键", required = true)
@NotNull(message = "主键不能为空")
private Long id;
@ApiModelProperty(value = "发票号码")
private String invoiceNumber;
@ApiModelProperty(value = "开票类型(字典表 invoicing_type)")
private Integer invoiceTypeId;
@ApiModelProperty(value = "开票金额")
private java.math.BigDecimal invoiceMoney;
@ApiModelProperty(value = "开票币种")
private Long currencyId;
@ApiModelProperty(value = "开发票人id")
private Long invoicerId;
@ApiModelProperty(value = "开票时间")
private Date invoiceTime;
@ApiModelProperty(value = "开票信息备注")
private String invoiceInfoRemark;
}
......@@ -216,13 +216,19 @@ public class ReceivableBackVO {
@ApiModelProperty(value = "不含税金额")
private BigDecimal notIncludedTaxAmount;
@ApiModelProperty(value = "核销金额")
private BigDecimal writeOffAmount;
@ApiModelProperty(value = "未核销金额")
private BigDecimal notWriteOffAmount;
@ApiModelProperty(value = "核销比例")
private BigDecimal writeOffProportion;
private String writeOffProportion;
@ApiModelProperty(value = "基准金额")
private BigDecimal baseAmount;
@ApiModelProperty(value = "实际金额")
@ApiModelProperty(value = "实际金额")
private BigDecimal actualAmount;
}
......@@ -102,6 +102,9 @@ public class ReceivableBaseVO {
@ApiModelProperty(value = "含税金额")
private BigDecimal taxAmount;
@ApiModelProperty(value = "核销金额")
private BigDecimal writeOffAmount;
@ApiModelProperty(value = "基准金额")
private BigDecimal baseAmount;
......
package cn.iocoder.yudao.module.wealth.vo.receivable;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
import javax.validation.constraints.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.constraints.NotNull;
@ApiModel("管理后台 - 应收款更新 Request VO")
@Data
......
......@@ -25,15 +25,21 @@ public class ReceiptInvoiceController {
private ReceiptInvoiceService receiptInvoiceService;
@PostMapping("/create")
@ApiOperation("创建收款单开票信息")
@ApiOperation("申请开票")
public CommonResult<Long> createReceiptInvoice(@Valid @RequestBody ReceiptInvoiceCreateReqVO createReqVO) {
return success(receiptInvoiceService.createReceiptInvoice(createReqVO));
}
@PutMapping("/update")
@PostMapping("/update/data")
@ApiOperation("更新收款单开票资料")
public CommonResult<Boolean> updateReceiptInvoiceData(@Valid @RequestBody ReceiptInvoiceUpdateDataReqVO updateReqVO) {
receiptInvoiceService.updateReceiptInvoiceData(updateReqVO);
return success(true);
}
@PostMapping("/update/info")
@ApiOperation("更新收款单开票信息")
public CommonResult<Boolean> updateReceiptInvoice(@Valid @RequestBody ReceiptInvoiceUpdateReqVO updateReqVO) {
receiptInvoiceService.updateReceiptInvoice(updateReqVO);
public CommonResult<Boolean> updateReceiptInvoiceInfo(@Valid @RequestBody ReceiptInvoiceUpdateInfoReqVO updateReqVO) {
receiptInvoiceService.updateReceiptInvoiceInfo(updateReqVO);
return success(true);
}
......@@ -53,22 +59,22 @@ public class ReceiptInvoiceController {
@PostMapping("/reject")
@ApiOperation("驳回开票信息")
public CommonResult<Boolean> rejectInvoiceInfo(@RequestBody @Valid ReceiptInvoiceOperateReqVO rejectReqVO) {
Boolean res = receiptInvoiceService.rejectInvoiceInfo(rejectReqVO);
public CommonResult<Boolean> rejectInvoiceInfo(@RequestBody @Valid ReceiptInvoiceOperateReqVO reqVO) {
Boolean res = receiptInvoiceService.rejectInvoiceInfo(reqVO);
return success(res);
}
@PostMapping("/cancel")
@ApiOperation("取消开票")
public CommonResult<Boolean> cancelInvoice(@RequestBody @Valid ReceiptInvoiceOperateReqVO rejectReqVO) {
Boolean res = receiptInvoiceService.cancelInvoice(rejectReqVO);
public CommonResult<Boolean> cancelInvoice(@RequestBody @Valid ReceiptInvoiceOperateReqVO reqVO) {
Boolean res = receiptInvoiceService.cancelInvoice(reqVO);
return success(res);
}
@PostMapping("/delete")
@ApiOperation("删除开票")
public CommonResult<Boolean> deleteInvoice(@RequestBody @Valid ReceiptInvoiceOperateReqVO rejectReqVO) {
Boolean res = receiptInvoiceService.deleteInvoice(rejectReqVO);
public CommonResult<Boolean> deleteInvoiceInfo(@RequestBody @Valid ReceiptInvoiceOperateReqVO reqVO) {
Boolean res = receiptInvoiceService.deleteInvoiceInfo(reqVO);
return success(res);
}
......
......@@ -30,10 +30,10 @@
resultType="cn.iocoder.yudao.module.wealth.vo.receiptInvoice.ReceiptInvoiceDetailVO">
SELECT
eri.*,
er.state AS receiptState,
er.write_off_proportion,
er.receipt_no,
er.order_no
er.invoicing_status,
er.invoice_data_status,
er.customer_id,
er.customer_name
FROM ecw_receipt_invoice eri
LEFT JOIN ecw_receipt er ON eri.receipt_id = er.id
</select>
......
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