invoice fixed

This commit is contained in:
刘鹏 2024-08-30 20:09:46 +08:00
parent b7f3a037fc
commit 8fdec7b0b4
6 changed files with 59 additions and 24 deletions

View File

@ -150,5 +150,9 @@ public class AppflgConstant {
* 系统主机端口
*/
public static final String KINGDEE_HOST = "kingdee_host";
/**
* 发票类型
*/
public static final String INVOICETYPE = "invoiceType";
}

View File

@ -2,6 +2,7 @@
* Copyright 2024 bejson.com
*/
package shkd.fi.fi.common.orc;
import java.math.BigDecimal;
import java.util.Date;
/**
@ -19,7 +20,8 @@ public class DetailList {
/**
* 金额
*/
private String totalAmount;
private BigDecimal totalAmount;
private BigDecimal amountTax;
/**
* 税率
*/
@ -51,10 +53,10 @@ public class DetailList {
return unitPrice;
}
public void setTotalAmount(String totalAmount) {
public void setTotalAmount(BigDecimal totalAmount) {
this.totalAmount = totalAmount;
}
public String getTotalAmount() {
public BigDecimal getTotalAmount() {
return totalAmount;
}
@ -100,4 +102,11 @@ public class DetailList {
return commodityName;
}
public BigDecimal getAmountTax() {
return amountTax;
}
public void setAmountTax(BigDecimal amountTax) {
this.amountTax = amountTax;
}
}

View File

@ -38,7 +38,7 @@ public class Response {
/**
* 合计税额:飞机燃油附加费
*/
private double totalTax;
private BigDecimal totalTax;
/**
* 发票联次 eg:第一联
*/
@ -105,7 +105,7 @@ public class Response {
* 校验码
*/
private String checkCode;
private double totalAmount;
private BigDecimal totalAmount;
/**
* 购买方税号
*/
@ -171,11 +171,11 @@ public class Response {
return issuer;
}
public void setTotalTax(double totalTax) {
public void setTotalTax(BigDecimal totalTax) {
this.totalTax = totalTax;
}
public double getTotalTax() {
public BigDecimal getTotalTax() {
return totalTax;
}
@ -323,11 +323,11 @@ public class Response {
return checkCode;
}
public void setTotalAmount(double totalAmount) {
public void setTotalAmount(BigDecimal totalAmount) {
this.totalAmount = totalAmount;
}
public double getTotalAmount() {
public BigDecimal getTotalAmount() {
return totalAmount;
}

View File

@ -88,12 +88,13 @@ public class UploadAttachmentsFormPlugin extends AbstractFormPlugin {
//财务应付单号
String billno = formShowParameter.getCustomParam("billno");
//往来户
String asstactName = formShowParameter.getCustomParam("asstactName");
//结算组织
String orgName = formShowParameter.getCustomParam("orgName");
//财务应付单
DynamicObject ap_finapbill = BusinessDataServiceHelper.loadSingle(id, "ap_finapbill");
DynamicObject org = ap_finapbill.getDynamicObject("org");
String asstactName = ap_finapbill.getDynamicObject("receivingsupplierid").getString("name");
log.info("asstactName:"+asstactName);
String uniformsocialcreditcode = org.getString("uniformsocialcreditcode");//统一社会信用代码
if(StringUtils.isEmpty(uniformsocialcreditcode)){
this.getView().showMessage("当前结算组织未维护统一社会信用代码,请先维护");
@ -216,8 +217,9 @@ public class UploadAttachmentsFormPlugin extends AbstractFormPlugin {
List<Response> responseList = ocrRetureData.getResponse();
Response response = responseList.get(0);
String saleName = response.getSaleName();//开票公司
log.info("开票公司:"+saleName);
if (StringUtils.isNotEmpty(saleName) && !StringUtil.equals(asstactName, saleName)) {
this.getView().showMessage("发票开票单位和当前单据上结算供应商不一致");
this.getView().showMessage("发票开票单位["+saleName+"]和当前单据上收款供应商["+asstactName+"]不一致");
return;
}
String purchaserName = response.getPurchaserName();//收票公司
@ -243,12 +245,15 @@ public class UploadAttachmentsFormPlugin extends AbstractFormPlugin {
//add 处理接口 end 0822 1.识别2.处理3.验真
List<DetailList> detailList = response.getDetailList();
BigDecimal shkd_tax = BigDecimal.ZERO;//税额
BigDecimal shkd_amount = BigDecimal.ZERO;//金额
for (DetailList list : detailList) {
shkd_tax = shkd_tax.add(new BigDecimal(list.getTax()));
shkd_amount = shkd_amount.add(new BigDecimal(list.getTotalAmount()));
}
BigDecimal shkd_tax = response.getTotalTax();//税额
BigDecimal hanshuijia = response.getAmountTax();//含税价
BigDecimal buhanshuijia = response.getTotalAmount();//不含税价
// for (DetailList list : detailList) {
// shkd_tax = shkd_tax.add(new BigDecimal(list.getTax()));
// buhanshuijia = buhanshuijia.add(list.getTotalAmount());
// hanshuijia = hanshuijia.add(null==list.getAmountTax()?BigDecimal.ZERO:list.getAmountTax());
// }
DetailList detailList1 = detailList.get(0);
//2.1.发票合规查验接口请求头
@ -265,8 +270,14 @@ public class UploadAttachmentsFormPlugin extends AbstractFormPlugin {
checkCode = checkCode.substring(checkCode.length() - 6);
}
compliancecollectBody.put("CheckCode_6", checkCode);// checkCode后6位数
compliancecollectBody.put("TotalAmount", response.getAmountTax().setScale(2, RoundingMode.HALF_UP));
Date invoiceDate = response.getInvoiceDate();
String invoiceType = response.getInvoiceType();
if(paramsMap.get(AppflgConstant.INVOICETYPE).contains(invoiceType)){//云税发票类型invoiceType 为100,103,107,200,201时传不含税价
compliancecollectBody.put("TotalAmount", buhanshuijia);
}else{
if(null!=hanshuijia&&BigDecimal.ZERO.compareTo(hanshuijia)!=0){
compliancecollectBody.put("TotalAmount", hanshuijia);
}
} Date invoiceDate = response.getInvoiceDate();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String format = simpleDateFormat.format(invoiceDate);
compliancecollectBody.put("BillingDate", format);//invoiceDate
@ -296,7 +307,7 @@ public class UploadAttachmentsFormPlugin extends AbstractFormPlugin {
//2.5.发票合规查验接口调用成功 生成发票识别单据
DynamicObject shkd_invoicereceipt = BusinessDataServiceHelper.newDynamicObject("shkd_invoicereceipt");
shkd_invoicereceipt.set("billno", String.valueOf(System.currentTimeMillis()));
String invoiceType = response.getInvoiceType();
String invoiceTypeNumber = null;
if ("103".equals(invoiceType)) {
@ -319,7 +330,7 @@ public class UploadAttachmentsFormPlugin extends AbstractFormPlugin {
shkd_invoicereceipt.set("shkd_pricetaxtotal", response.getAmountTax());//价税合计
shkd_invoicereceipt.set("shkd_taxrate1", detailList1.getTaxRate());//税率(%)
shkd_invoicereceipt.set("shkd_tax", shkd_tax);//税额
shkd_invoicereceipt.set("shkd_amount", shkd_amount);//金额
shkd_invoicereceipt.set("shkd_amount", buhanshuijia);//金额
shkd_invoicereceipt.set("shkd_asstactname", response.getSaleName());//开票公司 销售方
shkd_invoicereceipt.set("shkd_buyername", response.getPurchaserName());//收票公司 购买方
shkd_invoicereceipt.set("shkd_istaxdeduction", null);//可抵扣 是否???
@ -408,6 +419,9 @@ public class UploadAttachmentsFormPlugin extends AbstractFormPlugin {
if (shkd_taxrate1.contains("%")) {
shkd_taxrate1 = shkd_taxrate1.substring(0, shkd_taxrate1.indexOf("%"));
}
if(shkd_taxrate1.contains("免税")){
shkd_taxrate1="0";
}
addNew.set("shkd_i_taxrate", shkd_taxrate1);
addNew.set("shkd_i_tax", dynamicObject.get("shkd_tax"));
addNew.set("shkd_i_amount", dynamicObject.get("shkd_amount"));

View File

@ -382,6 +382,12 @@ public class SynchronizaSapOPPlugin extends AbstractOperationServicePlugIn {
if(StringUtils.isNotEmpty(shkd_sap_sup_num)){
LIFNR = shkd_sap_sup_num;
}
//如果科目上维护了SAP默认订单则以科目维护的为准
String shkd_sap_order = account.getString("shkd_sap_order");
String AUFNR = "";
if(StringUtils.isNotEmpty(shkd_sap_order)){
AUFNR = shkd_sap_order;
}
items1.setDOCID(docid);
items1.setITEMNO(seq);
@ -406,7 +412,7 @@ public class SynchronizaSapOPPlugin extends AbstractOperationServicePlugIn {
items1.setGSBER("");
items1.setKUNNR(KUNNR);
items1.setLIFNR(LIFNR);
items1.setAUFNR("");
items1.setAUFNR(AUFNR);
items1.setVALUT("");
items1.setXREF1("");
items1.setXREF2("");

View File

@ -1,5 +1,6 @@
package shkd.fi.fi.sso;
import kd.bos.context.RequestContext;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.utils.ObjectUtils;
import kd.bos.dc.api.model.Account;
@ -48,8 +49,9 @@ public class OtherSysSSOAuth implements ThirdSSOAuthHandler {
@Override
public void callTrdSSOLogin(HttpServletRequest request, HttpServletResponse response, String s) {
//用户需要登录的地址
String requestURL = URLEncoder.encode(request.getRequestURL().toString()) ;
String loginUrl = "http://10.13.11.210/ierp/login.html?redirect="+requestURL;
RequestContext requestContext = RequestContext.get();
String loginUrl = requestContext+"login.html";
logger.info("loginUrl:"+loginUrl);
try {
response.sendRedirect(loginUrl);
} catch (IOException e) {