|
@@ -12,8 +12,11 @@ import com.rockstar.util.StringUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import nccloud.open.api.auto.token.cur.utils.APICurUtils;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
|
|
|
@Slf4j
|
|
|
public class InvoiceUtil {
|
|
@@ -43,7 +46,8 @@ public class InvoiceUtil {
|
|
|
/**
|
|
|
* 自定义档案列表编码
|
|
|
*/
|
|
|
- public static final String pk_defdoclist = "CJ21";
|
|
|
+ public static final String pk_defdoclist_build = "CJ19";
|
|
|
+ public static final String pk_defdoclist_room = "CJ21";
|
|
|
|
|
|
public static final String bank_number = "2019219219212323";
|
|
|
|
|
@@ -54,19 +58,35 @@ public class InvoiceUtil {
|
|
|
String roomNumber = "";
|
|
|
String name = "";
|
|
|
String def13 = "222";
|
|
|
-// InvoiceUtil.informerQuery();
|
|
|
// 收款单接口-新增提交
|
|
|
-// InvoiceUtil.gatheringbillAdd("F2-Cxx-06","1001I91000000003V3S0");
|
|
|
+// InvoiceUtil.gatheringbillAdd("F2-Cxx-09","1001I91000000003V3S3");
|
|
|
// 收款单接口-转账单
|
|
|
// InvoiceUtil.gatheringbillTurn(nature,roomNumber);
|
|
|
// 收款单接口-换票
|
|
|
// InvoiceUtil.gatheringbillInvoice(nature,name,def13);
|
|
|
+ // 收款单接口-划拨单
|
|
|
+// InvoiceUtil.gatheringbillTransfer("F2-Cxx-09","1001I91000000003V3S3");
|
|
|
// 付款单接口_退款单
|
|
|
// InvoiceUtil.paybillAdd();
|
|
|
// 收款单接口 删除
|
|
|
// InvoiceUtil.gatheringbillDelete();
|
|
|
// 应收接口-收入结转单 新增
|
|
|
// InvoiceUtil.recbillAdd();
|
|
|
+ // 楼栋或房间查询
|
|
|
+// InvoiceUtil.defdocView("CJ19");
|
|
|
+ // 楼栋或房间新增
|
|
|
+// InvoiceUtil.defdocAdd("41号楼",pk_defdoclist_build);
|
|
|
+ // 到账通知认领查询
|
|
|
+// InvoiceUtil.informerQuery();
|
|
|
+ BigDecimal one = new BigDecimal("14475.20");
|
|
|
+ BigDecimal two = new BigDecimal("19670.88");
|
|
|
+ BigDecimal three = new BigDecimal("18304.08");
|
|
|
+ List<BigDecimal> list = Arrays.asList(one, two, three);
|
|
|
+ BigDecimal zero = BigDecimal.ZERO;
|
|
|
+ for (BigDecimal bigDecimal : list){
|
|
|
+ zero= zero.add(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
+ System.out.println(zero);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -83,25 +103,41 @@ public class InvoiceUtil {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 房间新增
|
|
|
+ * 楼栋或房间新增 pk_defdoclist 楼栋传CJ19 房间传CJ21
|
|
|
*
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
- public static void defdocAdd() throws Exception {
|
|
|
+ public static void defdocAdd(String name,String pk_defdoclist) throws Exception {
|
|
|
APICurUtils util = new APICurUtils();
|
|
|
String token = InvoiceUtil.getToken(util);
|
|
|
util.setApiUrl("nccloud/api/wxyy/uapbd/defdoc/add");
|
|
|
JSONObject json = new JSONObject();
|
|
|
- json.put("srcsystemid", "1300419721555869696");
|
|
|
- json.put("code", "1300419721555869696");
|
|
|
- json.put("name", "天鹅湖花园-一期-41-101");
|
|
|
+ json.put("srcsystemid", "7b5a4022df7e4ae0a0a9bd4d77409920");
|
|
|
+ json.put("code", "7b5a4022df7e4ae0a0a9bd4d77409920");
|
|
|
+ json.put("name", name);
|
|
|
json.put("pk_org", pk_org);
|
|
|
json.put("pk_defdoclist", pk_defdoclist);
|
|
|
String result = util.getAPIRetrun(token, json.toJSONString());
|
|
|
+ log.info("楼栋或房间新增:{}", result);
|
|
|
+ }
|
|
|
|
|
|
- log.info("房间新增:{}", result);
|
|
|
+ /**
|
|
|
+ * 楼栋或房间新增 pk_defdoclist 楼栋传CJ19 房间传CJ21
|
|
|
+ * @param pk_defdoclist
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ public static void defdocView(String pk_defdoclist) throws Exception {
|
|
|
+ APICurUtils util = new APICurUtils();
|
|
|
+ String token = InvoiceUtil.getToken(util);
|
|
|
+ util.setApiUrl("nccloud/api/wxyy/uapbd/defdoc/query");
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
+ json.put("pk_org", pk_org);
|
|
|
+ json.put("code", pk_defdoclist);
|
|
|
+ String result = util.getAPIRetrun(token, json.toJSONString());
|
|
|
+ log.info("房间查看:{}", result);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 客户新增
|
|
|
*
|
|
@@ -202,7 +238,7 @@ public class InvoiceUtil {
|
|
|
String srcsystemid = IdUtil.simpleUUID();
|
|
|
String billdate = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, new Date());
|
|
|
ar_recbill.put("srcsystemid", srcsystemid); //外系统标识,必选
|
|
|
- ar_recbill.put("pk_tradetype", "F3-Cxx-05"); //交易类型,必选
|
|
|
+ ar_recbill.put("pk_tradetype", "F0-Cxx-05"); //交易类型,必选
|
|
|
ar_recbill.put("pk_org", pk_org); //组织编码,必选
|
|
|
ar_recbill.put("billdate", billdate); //单据日期
|
|
|
ar_recbill.put("def2", srcsystemid); //外系统单据号,必填,
|
|
@@ -218,14 +254,14 @@ public class InvoiceUtil {
|
|
|
ar_recitemJson.put("scomment", ""); //摘要,非必选
|
|
|
ar_recitemJson.put("objtype", "0"); //0=客户,1=供应商--判断customer和supplier是否必填,必选
|
|
|
ar_recitemJson.put("customer", "tyxydm00002"); //客商的纳税人识别号
|
|
|
- ar_recitemJson.put("money_de", "100"); //金额,必选
|
|
|
+ ar_recitemJson.put("money_de", "-100"); //金额,必选
|
|
|
ar_recitemJson.put("taxrate", "16"); //税率,必选,无税传0
|
|
|
ar_recitemJson.put("pk_subjcode", "AJ003"); //收支项目编码,非必选
|
|
|
- ar_recitemJson.put("def11", "1300419721555869696"); //转出前房号编码,收除了诚意金之外的首期等需要选
|
|
|
+ ar_recitemJson.put("def11", "100"); //转出前房号编码,收除了诚意金之外的首期等需要选
|
|
|
ar_recitemJson.put("def9", "001"); //业态,必选,看云文档业态
|
|
|
ar_recitemJson.put("def7", "AJ001"); //房产工程项目,必选,看云文档
|
|
|
- ar_recitemJson.put("def8", "CJ19"); //楼栋,必选,看云文档
|
|
|
- ar_recitemJson.put("material", "XXX"); //物料
|
|
|
+ ar_recitemJson.put("def8", "1300419721555869696"); //楼栋,必选,看云文档
|
|
|
+ ar_recitemJson.put("material", "mwjyB"); //物料
|
|
|
ar_recitem.add(ar_recitemJson);
|
|
|
json.put("ar_recitem", ar_recitem);
|
|
|
|
|
@@ -270,11 +306,11 @@ public class InvoiceUtil {
|
|
|
ar_gatheritemJson.put("recaccount", bank_number); //收款银行账号,必填
|
|
|
// ar_gatheritemJson.put("invoiceno","fphm"); //发票号码,非必选
|
|
|
ar_gatheritemJson.put("scomment", "小二"); //客户名称,必选
|
|
|
- ar_gatheritemJson.put("pk_subjcode", "AJ022"); //收款类型
|
|
|
+ ar_gatheritemJson.put("pk_subjcode", "AJ015"); //收款类型
|
|
|
ar_gatheritemJson.put("checktype", "5"); //票据类型,必选,看云文档票据类型
|
|
|
ar_gatheritemJson.put("checkno", number); //票据号,必选
|
|
|
ar_gatheritemJson.put("def9", "001"); //业态,必选,看云文档业态
|
|
|
- ar_gatheritemJson.put("def11", "1300419721555869696"); //转出前房号编码,收除了诚意金之外的首期等需要选
|
|
|
+ ar_gatheritemJson.put("def11", "100"); //转出前房号编码,收除了诚意金之外的首期等需要选
|
|
|
ar_gatheritemJson.put("def10", "mwjyAdk"); //项目档案编码,看云文档项目档案对照
|
|
|
ar_gatheritemJson.put("top_billid", pk_informer); //到账通知生单时,(银行流水中返回的id,见5.2.10到账通知认领查询pk_informer字段)
|
|
|
ar_gatheritem.add(ar_gatheritemJson);
|
|
@@ -429,7 +465,12 @@ public class InvoiceUtil {
|
|
|
log.info("单据提交——换票单:{}", result);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 划拨单
|
|
|
+ * @param nature
|
|
|
+ * @param pk_informer
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
public static void gatheringbillTransfer(String nature,String pk_informer) throws Exception {
|
|
|
|
|
|
APICurUtils util = new APICurUtils();
|
|
@@ -462,8 +503,6 @@ public class InvoiceUtil {
|
|
|
// ar_gatheritemJson.put("invoiceno","fphm"); //发票号码,非必选
|
|
|
ar_gatheritemJson.put("scomment", "小二"); //客户名称,必选
|
|
|
ar_gatheritemJson.put("pk_subjcode", "AJ015"); //收款类型
|
|
|
- // TODO: 2024/10/30 没有
|
|
|
- ar_gatheritemJson.put("def3", ""); //产品类型,必选
|
|
|
ar_gatheritemJson.put("checktype", "5"); //票据类型,必选,看云文档票据类型
|
|
|
ar_gatheritemJson.put("checkno", number); //票据号,必选
|
|
|
ar_gatheritemJson.put("def9", "001"); //业态,必选,看云文档业态
|