package foundation.ai.dao; import com.alibaba.fastjson.JSONObject; import foundation.json.IJSONProvider; import foundation.json.IJSONWriter; public class InvoiceVerificationDetailDao implements IJSONProvider { private String lineNo; private String code; private String name; private String productCode; private String productName; private String spec; private String unit; private String qty; private String price; private String taxRate; private String amtBeforeTax; private String amtTax; private String amtAfterTax; private String classifyCodeTax; private boolean isBelong; public void parse(JSONObject jsonObject) { name = jsonObject.getString("goodsName"); code = jsonObject.getString("goodsCode"); spec = jsonObject.getString("specModel"); unit = jsonObject.getString("unit"); qty = jsonObject.getString("num"); price = jsonObject.getString("unitPrice"); taxRate = jsonObject.getString("taxRate"); amtBeforeTax = jsonObject.getString("detailAmount"); amtTax = jsonObject.getString("taxAmount"); double amtAfterTaxValue = jsonObject.getDoubleValue("amtTax") + jsonObject.getDoubleValue("detailAmount"); amtAfterTax = Double.toString(amtAfterTaxValue); classifyCodeTax = jsonObject.getString("classifyCodeTax"); } public String getLineNo() { return lineNo; } public void setLineNo(String lineNo) { this.lineNo = lineNo; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getSpec() { return spec; } public void setSpec(String spec) { this.spec = spec; } public String getUnit() { return unit; } public void setUnit(String unit) { this.unit = unit; } public String getQty() { return qty; } public void setQty(String qty) { this.qty = qty; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public String getTaxRate() { return taxRate; } public void setTaxRate(String taxRate) { this.taxRate = taxRate; } public String getAmtBeforeTax() { return amtBeforeTax; } public void setAmtBeforeTax(String amtBeforeTax) { this.amtBeforeTax = amtBeforeTax; } public String getAmtTax() { return amtTax; } public void setAmtTax(String amtTax) { this.amtTax = amtTax; } public String getAmtAfterTax() { return amtAfterTax; } public void setAmtAfterTax(String amtAfterTax) { this.amtAfterTax = amtAfterTax; } public String getClassifyCodeTax() { return classifyCodeTax; } public void setClassifyCodeTax(String classifyCodeTax) { this.classifyCodeTax = classifyCodeTax; } public boolean isBelong() { return isBelong; } public void setBelong(boolean isBelong) { this.isBelong = isBelong; } public String getProductCode() { return productCode; } public String getProductName() { return productName; } @Override public void writeJSON(IJSONWriter writer) { writer.beginObject(); writer.write("line_no", lineNo); writer.write("name", name); writer.write("code", code); writer.write("spec", spec); writer.write("unit", unit); writer.write("qty", qty); writer.write("price", price); writer.write("tax_rate", taxRate); writer.write("amt_before_tax", amtBeforeTax); writer.write("amt_tax", amtTax); writer.write("amt_after_tax", amtAfterTax); writer.write("classifycode_tax", classifyCodeTax); writer.write("is_belong", isBelong); writer.endObject(); } }