销售发票接口-代码优化和数量金额取值调整

This commit is contained in:
mzr 2025-04-18 15:55:11 +08:00
parent 784a3a17c9
commit 37ac4a1ba7
1 changed files with 37 additions and 20 deletions

View File

@ -63,6 +63,13 @@ public class IAPISaleInvMaitainImpl {
return deepCloneTool;
}
/**
* 蓝字发票保存提交
*
* @param jobject BIP合同平台传参
* @return
* @throws Exception
*/
public JSONString saveBlue(JSONObject jobject) throws Exception {
JSONObject ufinterfaceObj = jsonObjectAss(jobject);
String tsType = ufinterfaceObj.getString("tsType");
@ -96,7 +103,7 @@ public class IAPISaleInvMaitainImpl {
content = sendResultArray.getJSONObject(0).getString("content");
}
}
if (content == null || content.equals("")) {
if (content == null || content.isEmpty()) {
return r != null
? ResultMessageUtil.toJSON(r.getDesc(), "0")
: ResultMessageUtil.exceptionToJSON(new NullPointerException("未知异常"));
@ -141,6 +148,13 @@ public class IAPISaleInvMaitainImpl {
}
}
/**
* 红字发票保存接口
*
* @param jobject BIP合同平台传参
* @return
* @throws Exception
*/
public JSONString saveRed(JSONObject jobject) throws Exception {
/**
* 销售发票红冲
@ -309,7 +323,6 @@ public class IAPISaleInvMaitainImpl {
String taxcodeStr = getTaxcode(item.getString("ntaxrate"));
// taxcodeStr 放入 bodyMap
itemDetails.put("ctaxcodeid", taxcodeStr);// 税码
itemDetails.put("nnum", item.getString("nastnum"));// Ö÷ÊýÁ¿
itemDetails.put("ftaxtypeflag", 1);// 扣税类别
itemDetails.put("pk_group", "00");// 集团
itemDetails.put("pk_org", originalJson.getJSONObject("billhead").getString("pk_org"));// 开票组织
@ -363,6 +376,9 @@ public class IAPISaleInvMaitainImpl {
// 税额
ntax = ntaxmny.subtract(nmny).setScale(2, RoundingMode.HALF_UP);
UFDouble nastnum1 = new UFDouble(item.getString("nastnum"));
itemDetails.put("nnum", nastnum1);// 主数量
itemDetails.put("nqtorigprice", nqtorigprice);// 无税单价
itemDetails.put("norigprice", nqtorigprice);// 主无税单价
itemDetails.put("norigmny", norigmny);// 无税金额
@ -395,6 +411,7 @@ public class IAPISaleInvMaitainImpl {
resultJson.put("ufinterface", ufinterface);
return resultJson;
} catch (Exception e) {
Logger.error("saveCommit-jsonObjectAss-exp: ", e);
return (JSONObject) ResultMessageUtil.exceptionToJSON(e);
}
}
@ -420,24 +437,6 @@ public class IAPISaleInvMaitainImpl {
return value2;
}
private String getString_TrimAsNull(Object value) {
if ((value == null) || (value.toString().trim().isEmpty())) {
return "";
}
return value.toString().trim();
}
private UFDouble getUFDouble_NullAsZero(Object value) {
if ((value == null) || (value.toString().trim().isEmpty()) || (value.toString().trim().equals("~")))
return UFDouble.ONE_DBL;
if ((value instanceof UFDouble))
return (UFDouble) value;
if ((value instanceof BigDecimal)) {
return new UFDouble((BigDecimal) value);
}
return new UFDouble(value.toString().trim());
}
/**
* 根据主键查询销售发票
*
@ -685,4 +684,22 @@ public class IAPISaleInvMaitainImpl {
return (Map<String, Object>) queryBS.executeQuery(sql, new MapProcessor());
}
private String getString_TrimAsNull(Object value) {
if ((value == null) || (value.toString().trim().isEmpty())) {
return "";
}
return value.toString().trim();
}
private UFDouble getUFDouble_NullAsZero(Object value) {
if ((value == null) || (value.toString().trim().isEmpty()) || (value.toString().trim().equals("~")))
return UFDouble.ONE_DBL;
if ((value instanceof UFDouble))
return (UFDouble) value;
if ((value instanceof BigDecimal)) {
return new UFDouble((BigDecimal) value);
}
return new UFDouble(value.toString().trim());
}
}