233 lines
5.6 KiB
Java
233 lines
5.6 KiB
Java
package cn.palmte.work.model;
|
||
|
||
import org.hibernate.annotations.GenericGenerator;
|
||
|
||
import javax.persistence.*;
|
||
import java.math.BigDecimal;
|
||
import java.util.Date;
|
||
|
||
@MappedSuperclass
|
||
public class ProjectBudgetCostDetailBase {
|
||
public static final int TYPE_DEVICE = 1;
|
||
public static final int TYPE_BUILD = 2;
|
||
public static final int TYPE_SERVICE = 3;
|
||
public static final int TYPE_OHTER = 4;
|
||
|
||
/**
|
||
* id
|
||
*/
|
||
@Id
|
||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||
@GenericGenerator(name = "persistenceGenerator", strategy = "increment")
|
||
private Integer id;
|
||
|
||
@Column(name = "project_id")
|
||
private int projectId;
|
||
|
||
private int type;
|
||
private int category;
|
||
|
||
private String name;
|
||
private String attr;
|
||
|
||
private String unit;
|
||
private BigDecimal amount;
|
||
private BigDecimal price;
|
||
|
||
@Column(name = "tax_rate")
|
||
private BigDecimal taxRate;
|
||
|
||
@Column(name = "contract_party")
|
||
private String contractParty;
|
||
|
||
@Column(name = "is_underwritten")
|
||
private int isUnderwritten;
|
||
|
||
@Column(name = "underwritten_amount")
|
||
private BigDecimal underwrittenAmount;
|
||
|
||
@Column(name = "pay_time")
|
||
@Temporal(TemporalType.TIMESTAMP)
|
||
private Date payTime;
|
||
|
||
private BigDecimal totalTaxInclude;
|
||
@Column(name = "pay_amount")
|
||
private BigDecimal payAmount;
|
||
|
||
@Column(name = "pay_way")
|
||
private String payWay;
|
||
|
||
@Column(name = "remark")
|
||
private String remark;
|
||
|
||
public String getAttr() {
|
||
return attr;
|
||
}
|
||
|
||
public void setAttr(String attr) {
|
||
this.attr = attr;
|
||
}
|
||
|
||
public Integer getId() {
|
||
return id;
|
||
}
|
||
|
||
public void setId(Integer id) {
|
||
this.id = id;
|
||
}
|
||
|
||
public int getProjectId() {
|
||
return projectId;
|
||
}
|
||
|
||
public void setProjectId(int projectId) {
|
||
this.projectId = projectId;
|
||
}
|
||
|
||
public int getType() {
|
||
return type;
|
||
}
|
||
|
||
public void setType(int type) {
|
||
this.type = type;
|
||
}
|
||
|
||
public int getCategory() {
|
||
return category;
|
||
}
|
||
|
||
public void setCategory(int category) {
|
||
this.category = category;
|
||
}
|
||
|
||
public String getName() {
|
||
return name;
|
||
}
|
||
|
||
public void setName(String name) {
|
||
this.name = name;
|
||
}
|
||
|
||
public String getUnit() {
|
||
return unit;
|
||
}
|
||
|
||
public void setUnit(String unit) {
|
||
this.unit = unit;
|
||
}
|
||
|
||
public BigDecimal getAmount() {
|
||
return amount;
|
||
}
|
||
|
||
public void setAmount(BigDecimal amount) {
|
||
this.amount = amount;
|
||
}
|
||
|
||
public BigDecimal getPrice() {
|
||
return price;
|
||
}
|
||
|
||
public void setPrice(BigDecimal price) {
|
||
this.price = price;
|
||
}
|
||
|
||
public BigDecimal getTaxRate() {
|
||
return taxRate;
|
||
}
|
||
|
||
public void setTaxRate(BigDecimal taxRate) {
|
||
this.taxRate = taxRate;
|
||
}
|
||
|
||
public String getContractParty() {
|
||
return contractParty;
|
||
}
|
||
|
||
public void setContractParty(String contractParty) {
|
||
this.contractParty = contractParty;
|
||
}
|
||
|
||
public int getIsUnderwritten() {
|
||
return isUnderwritten;
|
||
}
|
||
|
||
public void setIsUnderwritten(int isUnderwritten) {
|
||
this.isUnderwritten = isUnderwritten;
|
||
}
|
||
|
||
public BigDecimal getUnderwrittenAmount() {
|
||
return underwrittenAmount;
|
||
}
|
||
|
||
public void setUnderwrittenAmount(BigDecimal underwrittenAmount) {
|
||
this.underwrittenAmount = underwrittenAmount;
|
||
}
|
||
|
||
public Date getPayTime() {
|
||
return payTime;
|
||
}
|
||
|
||
public void setPayTime(Date payTime) {
|
||
this.payTime = payTime;
|
||
}
|
||
|
||
public BigDecimal getPayAmount() {
|
||
return payAmount;
|
||
}
|
||
|
||
public void setPayAmount(BigDecimal payAmount) {
|
||
this.payAmount = payAmount;
|
||
}
|
||
|
||
public String getPayWay() {
|
||
return payWay;
|
||
}
|
||
|
||
public void setPayWay(String payWay) {
|
||
this.payWay = payWay;
|
||
}
|
||
|
||
public String getRemark() {
|
||
return remark;
|
||
}
|
||
|
||
public void setRemark(String remark) {
|
||
this.remark = remark;
|
||
}
|
||
|
||
public void setTotalTaxInclude(BigDecimal totalTaxInclude) {
|
||
this.totalTaxInclude = totalTaxInclude;
|
||
}
|
||
public BigDecimal getTotalTaxInclude(){
|
||
// 之前含税总金额为单价*价格 后续更改为手动数据 兼容之前版本数据
|
||
if (totalTaxInclude!=null){
|
||
return totalTaxInclude;
|
||
}
|
||
if(null == price){
|
||
return BigDecimal.ZERO;
|
||
}
|
||
return price.multiply(amount);
|
||
}
|
||
public BigDecimal getTotalTaxExclude(){
|
||
BigDecimal totalTaxInclude = getTotalTaxInclude();
|
||
if(null == totalTaxInclude) {
|
||
return BigDecimal.ZERO;
|
||
} else if (taxRate == null){
|
||
return totalTaxInclude;
|
||
}
|
||
|
||
//不含税总金额=含税总金额/(1+税率)
|
||
return totalTaxInclude.divide(taxRate.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(1)), 2, BigDecimal.ROUND_HALF_UP);
|
||
}
|
||
|
||
public BigDecimal getTotalTax(){
|
||
BigDecimal totalTaxInclude = getTotalTaxInclude();
|
||
if(null == totalTaxInclude || taxRate == null){
|
||
return BigDecimal.ZERO;
|
||
}
|
||
|
||
//不含税总金额=含税总金额/(1+税率)
|
||
return totalTaxInclude.multiply(taxRate.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)).divide(taxRate.divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(1)), 2, BigDecimal.ROUND_HALF_UP);
|
||
}
|
||
} |