增值税发票保存

This commit is contained in:
hjc
2019-11-22 20:42:09 +08:00
parent e07c0b02f5
commit ff25047310
9 changed files with 249 additions and 48 deletions
@@ -38,7 +38,7 @@ public class BssGoods implements Serializable {
private BigDecimal detailAmount;
// 税额
@Column(name = "tax_amount")
private BigDecimal taxAmount;
private BigDecimal goodTaxAmount;
// 税率
@Column(name = "tax_rate")
private String taxRate;
@@ -12,6 +12,9 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@@ -33,32 +36,42 @@ public class BssVatInvoice implements Serializable {
private Long id;
// 发票代码
@Column(name = "invoice_code")
@NotEmpty(message = "发票代码不能为空")
private String invoiceCode;
// 发票号码
@Column(name = "invoice_no")
@NotEmpty(message = "发票号码不能为空")
private String invoiceNo;
// 发票日期
@Column(name = "invoice_date")
@NotEmpty(message = "发票日期不能为空")
@Pattern(regexp = "[0-9]{4}-[0-9]{2}-[0-9]{2}", message = "日期格式不正确")
private String invoiceDate;
// 校验码
@Column(name = "check_code")
@NotEmpty(message = "校验码不能为空")
private String checkCode;
// 发票金额
@Column(name = "invoice_money")
@NotNull(message = "发票金额不能为空")
private BigDecimal invoiceMoney;
// 税额
@Column(name = "tax_amount")
@NotNull(message = "税额不能为空")
private BigDecimal taxAmount;
// 总金额
@Column(name = "total_amount")
@NotNull(message = "总金额不能为空")
private BigDecimal totalAmount;
// 总金额(大写)
@Column(name = "total_amount_cn")
@NotEmpty(message = "总金额(大写)不能为空")
private String totalAmountCn;
//发票类型
//增值税普通发票 0; 增值税专用发票 1
@Column(name = "invoice_type")
@NotNull(message = "发票类型不能为空")
private Integer invoiceType;
// 备注
@@ -73,7 +86,6 @@ public class BssVatInvoice implements Serializable {
@JsonIgnore
private BssTaxinfo buyTaxInfo;
// 销售方纳税人信息
// 购买方纳税人信息
@OneToOne(fetch=FetchType.LAZY)
@NotFound(action= NotFoundAction.IGNORE)
@JoinColumn(name="saler_tax_info_id")
@@ -91,4 +103,10 @@ public class BssVatInvoice implements Serializable {
// 更新时间
@LastModifiedDate
private Date updateDate;
@Transient
private Long buyTaxInfoId;
@Transient
private Long salerTaxInfoId;
}
@@ -8,4 +8,5 @@ import com.cwhelp.modules.system.repository.BaseRepository;
* @date 2019/08/16
*/
public interface BssTaxinfoRepository extends BaseRepository<BssTaxinfo, Long> {
BssTaxinfo getByTaxNo(String taxNo);
}
@@ -38,4 +38,9 @@ public interface BssTaxinfoService {
*/
@Transactional
Boolean updateStatus(StatusEnum statusEnum, List<Long> idList);
/**
* 根据纳税人识别号查询数据
*/
BssTaxinfo getByTaxNo(String taxNo);
}
@@ -24,6 +24,11 @@ public class BssTaxinfoServiceImpl implements BssTaxinfoService {
@Autowired
private BssTaxinfoRepository bssTaxinfoRepository;
@Override
public BssTaxinfo getByTaxNo(String taxNo) {
return bssTaxinfoRepository.getByTaxNo(taxNo);
}
/**
* 根据ID查询数据
* @param id 主键ID