|
@@ -1,16 +1,12 @@
|
|
|
package com.malk.jiuyousimu.service.Impl;
|
|
package com.malk.jiuyousimu.service.Impl;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
-import com.malk.jiuyousimu.entity.basic.FNumber;
|
|
|
|
|
-import com.malk.jiuyousimu.entity.basic.BillTypeID;
|
|
|
|
|
|
|
+import com.malk.jiuyousimu.entity.basic.*;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
|
import com.kingdee.bos.webapi.entity.RepoRet;
|
|
import com.kingdee.bos.webapi.entity.RepoRet;
|
|
|
import com.kingdee.bos.webapi.sdk.K3CloudApi;
|
|
import com.kingdee.bos.webapi.sdk.K3CloudApi;
|
|
|
-import com.malk.jiuyousimu.entity.basic.Audit;
|
|
|
|
|
-import com.malk.jiuyousimu.entity.basic.Save;
|
|
|
|
|
-import com.malk.jiuyousimu.entity.basic.Submit;
|
|
|
|
|
import com.malk.jiuyousimu.entity.payment.PaymentDetail;
|
|
import com.malk.jiuyousimu.entity.payment.PaymentDetail;
|
|
|
import com.malk.jiuyousimu.entity.payment.PaymentMain;
|
|
import com.malk.jiuyousimu.entity.payment.PaymentMain;
|
|
|
import com.malk.jiuyousimu.entity.reimbursement.CostDetail;
|
|
import com.malk.jiuyousimu.entity.reimbursement.CostDetail;
|
|
@@ -86,6 +82,50 @@ public class DocumentServiceImpl implements DocumentService {
|
|
|
ALL_ENUM.put("支付宝", "JSFS32_SYS");
|
|
ALL_ENUM.put("支付宝", "JSFS32_SYS");
|
|
|
ALL_ENUM.put("供应链票据", "JSFS36_SYS");
|
|
ALL_ENUM.put("供应链票据", "JSFS36_SYS");
|
|
|
}
|
|
}
|
|
|
|
|
+ private static final Map<String,String> HISTORY_DEPTID2 = new HashMap<>();
|
|
|
|
|
+ static {
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000001", "老板");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000002", "龙颖公司");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000003", "投资部");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000004", "市场部");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000005", "大中台");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000006", "投行部");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000007", "行政人事部");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000008", "财务部");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000009", "国际部");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000010", "中台风控部");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000011", "通泰张江基地");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000012", "宿州基地");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000013", "兰州基地");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000014", "盱眙基地");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000015", "萧县基地");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000016", "蚌埠基地");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000017", "张家口基地");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000018", "成都基地");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000019", "培训部");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000020", "统筹");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000021", "总办");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000022", "IT部");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000023", "驾驶班");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000024", "凤阳基地");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000026", "定远基地");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000027", "技术部");
|
|
|
|
|
+ HISTORY_DEPTID2.put("BM000028", "产业转化中心");
|
|
|
|
|
+ }
|
|
|
|
|
+ private static final Map<String,String> HISTORY_DEPTID = new HashMap<>();
|
|
|
|
|
+ static {
|
|
|
|
|
+ HISTORY_DEPTID.put("投资部", "BM000003");
|
|
|
|
|
+ HISTORY_DEPTID.put("行政人事部", "BM000007");
|
|
|
|
|
+ HISTORY_DEPTID.put("财务部", "BM000008");
|
|
|
|
|
+ HISTORY_DEPTID.put("兰州基地", "BM000013");
|
|
|
|
|
+ HISTORY_DEPTID.put("盱眙基地", "BM000014");
|
|
|
|
|
+ HISTORY_DEPTID.put("萧县基地", "BM000015");
|
|
|
|
|
+ HISTORY_DEPTID.put("张家口基地", "BM000017");
|
|
|
|
|
+ HISTORY_DEPTID.put("总办", "BM000021");
|
|
|
|
|
+ HISTORY_DEPTID.put("IT部", "BM000022");
|
|
|
|
|
+ HISTORY_DEPTID.put("市场运营管理部", "BM000028");
|
|
|
|
|
+ HISTORY_DEPTID.put("上海久有私募基金管理有限公司", "1069359193");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 差旅费报销单
|
|
* 差旅费报销单
|
|
@@ -97,58 +137,94 @@ public class DocumentServiceImpl implements DocumentService {
|
|
|
public McR saveTrip(Map processData) {
|
|
public McR saveTrip(Map processData) {
|
|
|
String userId = String.valueOf(processData.get("originatorUserId"));
|
|
String userId = String.valueOf(processData.get("originatorUserId"));
|
|
|
String userDeptId = String.valueOf(processData.get("originatorDeptId"));
|
|
String userDeptId = String.valueOf(processData.get("originatorDeptId"));
|
|
|
|
|
+ String userDeptName = String.valueOf(processData.get("originatorDeptName"));
|
|
|
|
|
+
|
|
|
List<Map> formComponentValues = (List<Map>) processData.get("formComponentValues");
|
|
List<Map> formComponentValues = (List<Map>) processData.get("formComponentValues");
|
|
|
Map<String, Object> mainData = new HashMap<>();
|
|
Map<String, Object> mainData = new HashMap<>();
|
|
|
List<CostDetail> costDetails = new ArrayList<>();
|
|
List<CostDetail> costDetails = new ArrayList<>();
|
|
|
List<TripDetail> tripDetails = new ArrayList<>();
|
|
List<TripDetail> tripDetails = new ArrayList<>();
|
|
|
- formComponentValues.forEach(e->{
|
|
|
|
|
- String name = e.get("name").toString();
|
|
|
|
|
- if ("TableField".equals(e.get("componentType"))) {
|
|
|
|
|
- Object parse = JSON.parse(e.get("value").toString());
|
|
|
|
|
- JSONArray jsonArray = JSON.parseArray(parse.toString());
|
|
|
|
|
- for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
|
|
- JSONObject jsonObject = (JSONObject) jsonArray.get(i);
|
|
|
|
|
- Object rowValue = jsonObject.get("rowValue");
|
|
|
|
|
- JSONArray array = JSON.parseArray(rowValue.toString());
|
|
|
|
|
- for (int i1 = 0; i1 < array.size(); i1++) {
|
|
|
|
|
- jsonObject = (JSONObject) array.get(i1);
|
|
|
|
|
- if ("差旅费信息".equals(jsonObject.get("label"))){
|
|
|
|
|
- if (jsonObject.containsKey("extendValue")){
|
|
|
|
|
- rowValue = jsonObject.get("extendValue");
|
|
|
|
|
- jsonObject = JSONObject.parseObject(rowValue.toString());
|
|
|
|
|
- rowValue = jsonObject.get("list");
|
|
|
|
|
- JSONArray array1 = JSON.parseArray(rowValue.toString());
|
|
|
|
|
- for (int i2 = 0; i2 < array1.size(); i2++) {
|
|
|
|
|
- jsonObject = (JSONObject) array1.get(i2);
|
|
|
|
|
- if (jsonObject.containsKey("rowValue")){
|
|
|
|
|
- rowValue = jsonObject.get("rowValue");
|
|
|
|
|
- JSONArray array2 = JSON.parseArray(rowValue.toString());
|
|
|
|
|
- TripDetail tripDetail = new TripDetail();
|
|
|
|
|
- for (int l = 0; l < array2.size(); l++) {
|
|
|
|
|
- jsonObject = (JSONObject) array2.get(l);
|
|
|
|
|
- switch (jsonObject.get("label").toString()){
|
|
|
|
|
- case "开始日期": tripDetail.setFTravelStartDate(jsonObject.get("value").toString().substring(0,9));break;
|
|
|
|
|
- case "结束日期": tripDetail.setFTravelEndDate(jsonObject.get("value").toString().substring(0,9));break;
|
|
|
|
|
- case "费用承担部门": tripDetail.setFExpenseDeptEntryID(new FNumber(UtilMap.getString(jsonObject,"value")));break;
|
|
|
|
|
- case "科目编号": tripDetail.setFExpID(new FNumber(UtilMap.getString(jsonObject,"value")));break;
|
|
|
|
|
|
|
+ formComponentValues.forEach(e-> {
|
|
|
|
|
+ if (!"TextNote".equals(e.get("componentType"))){
|
|
|
|
|
+ String name = e.get("name").toString();
|
|
|
|
|
+ if ("TableField".equals(e.get("componentType")) && "差旅费信息".equals(name)) {
|
|
|
|
|
+ Object parse = JSON.parse(e.get("value").toString());
|
|
|
|
|
+ JSONArray jsonArray = JSON.parseArray(parse.toString());
|
|
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
|
|
+ JSONObject jsonObject = (JSONObject) jsonArray.get(i);
|
|
|
|
|
+ if (jsonObject.containsKey("rowValue")){
|
|
|
|
|
+ Object rowValue = jsonObject.get("rowValue");
|
|
|
|
|
+ JSONArray array = JSON.parseArray(rowValue.toString());
|
|
|
|
|
+ TripDetail tripDetail = new TripDetail();
|
|
|
|
|
+ String type = "";
|
|
|
|
|
+ for (int i1 = 0; i1 < array.size(); i1++) {
|
|
|
|
|
+ jsonObject = (JSONObject) array.get(i1);
|
|
|
|
|
+ String sonLabel = jsonObject.get("label").toString();
|
|
|
|
|
+ if ("报销类别".equals(sonLabel)){
|
|
|
|
|
+ type = jsonObject.get("value").toString();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ for (int i1 = 0; i1 < array.size(); i1++) {
|
|
|
|
|
+ jsonObject = (JSONObject) array.get(i1);
|
|
|
|
|
+ String sonLabel = jsonObject.get("label").toString();
|
|
|
|
|
+ if (jsonObject.containsKey("extendValue")){
|
|
|
|
|
+ rowValue = jsonObject.get("extendValue");
|
|
|
|
|
+ }else {
|
|
|
|
|
+ rowValue = jsonObject;
|
|
|
|
|
+ }
|
|
|
|
|
+ Object parse1 = JSON.parse(rowValue.toString());
|
|
|
|
|
+ if (parse1 instanceof JSONObject){
|
|
|
|
|
+ jsonObject = JSONObject.parseObject(rowValue.toString());
|
|
|
|
|
+ } else if (parse1 instanceof JSONArray) {
|
|
|
|
|
+ jsonObject = (JSONObject) JSONObject.parseArray(rowValue.toString()).get(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ switch (sonLabel){
|
|
|
|
|
+ case "开始日期":
|
|
|
|
|
+ tripDetail.setFTravelStartDate(jsonObject.get("value").toString().substring(0,10));
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "结束日期":
|
|
|
|
|
+ tripDetail.setFTravelEndDate(jsonObject.get("value").toString().substring(0,10));
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "费用承担部门":
|
|
|
|
|
+ if (HISTORY_DEPTID.containsKey(UtilMap.getString(jsonObject,"name"))){
|
|
|
|
|
+ tripDetail.setFExpenseDeptEntryID(new FNumber(HISTORY_DEPTID.get(UtilMap.getString(jsonObject,"name"))));
|
|
|
|
|
+ }else {
|
|
|
|
|
+ tripDetail.setFExpenseDeptEntryID(new FNumber(UtilMap.getString(jsonObject,"id")));
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "金蝶科目编号":
|
|
|
|
|
+ tripDetail.setFExpID(new FNumber(UtilMap.getString(jsonObject, "value")));
|
|
|
|
|
+ break;
|
|
|
// case "税率": tripDetail.setFTaxRate(UtilMap.getDouble(jsonObject,"value"));break;
|
|
// case "税率": tripDetail.setFTaxRate(UtilMap.getDouble(jsonObject,"value"));break;
|
|
|
- case "天数": tripDetail.setFDays(UtilMap.getString(jsonObject,"value"));break;
|
|
|
|
|
- case "发票类型": tripDetail.setFInvoiceType(UtilMap.getString(jsonObject,"value"));break;
|
|
|
|
|
|
|
+ case "天数":
|
|
|
|
|
+ tripDetail.setFDays(UtilMap.getString(jsonObject, "value"));
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "发票类型":
|
|
|
|
|
+ tripDetail.setFInvoiceType(UtilMap.getString(jsonObject, "label"));
|
|
|
|
|
+ break;
|
|
|
// case "税额": tripDetail.setFTaxAmt(UtilMap.getDouble(jsonObject,"value"));break;
|
|
// case "税额": tripDetail.setFTaxAmt(UtilMap.getDouble(jsonObject,"value"));break;
|
|
|
// case "非税金额": tripDetail.setFTaxSubmitAmt(UtilMap.getDouble(jsonObject,"value"));break;
|
|
// case "非税金额": tripDetail.setFTaxSubmitAmt(UtilMap.getDouble(jsonObject,"value"));break;
|
|
|
- case "申请报销金额": tripDetail.setFExpenseAmount(UtilMap.getDouble(jsonObject,"value"));
|
|
|
|
|
- tripDetail.setFTaxSubmitAmt(UtilMap.getDouble(jsonObject,"value"));break;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ case "申请报销金额":
|
|
|
|
|
+ Double amt = UtilMap.getDouble(jsonObject, "value");
|
|
|
|
|
+ tripDetail.setFExpenseAmount(amt);
|
|
|
|
|
+ tripDetail.setFTaxSubmitAmt(amt);
|
|
|
|
|
+ if ("住宿费".equals(type)){
|
|
|
|
|
+ tripDetail.setFLodgingFee(amt);
|
|
|
|
|
+ } else if ("交通费".equals(type)) {
|
|
|
|
|
+ tripDetail.setFOtherTraAmount(amt);
|
|
|
|
|
+ } else if ("餐饮费".equals(type)) {
|
|
|
|
|
+ tripDetail.setFOtherExpense(amt);
|
|
|
|
|
+ } else if ("出差补助".equals(type)) {
|
|
|
|
|
+ tripDetail.setFTravelSubsidy(amt);
|
|
|
}
|
|
}
|
|
|
- tripDetails.add(tripDetail);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ tripDetails.add(tripDetail);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ } else {
|
|
|
|
|
+ mainData.put(name, e.get("value"));
|
|
|
}
|
|
}
|
|
|
- }else {
|
|
|
|
|
- mainData.put(name, e.get("value"));
|
|
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
tripDetails.forEach(e->{
|
|
tripDetails.forEach(e->{
|
|
@@ -157,27 +233,34 @@ public class DocumentServiceImpl implements DocumentService {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
Save save = new Save();
|
|
Save save = new Save();
|
|
|
|
|
+ save.setSubSystemId("ER");
|
|
|
|
|
+ save.setIsAutoAdjustField(true);
|
|
|
|
|
|
|
|
TripMain tripMain = new TripMain();
|
|
TripMain tripMain = new TripMain();
|
|
|
|
|
|
|
|
- tripMain.setFBillTypeID(new BillTypeID("0050569440d0b9d111e346dc2d05234a"));
|
|
|
|
|
- tripMain.setFDATE(LocalDate.parse(UtilMap.getString(mainData,"申请日期").substring(0,9)));
|
|
|
|
|
|
|
+ tripMain.setFBillTypeID(new BillTypeID("CLFBX001_SYS"));
|
|
|
|
|
+ tripMain.setFDATE(LocalDate.parse(UtilMap.getString(mainData,"申请日期").substring(0,10)));
|
|
|
tripMain.setFCurrencyID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"币别"))));
|
|
tripMain.setFCurrencyID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"币别"))));
|
|
|
tripMain.setFOrgID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
|
|
tripMain.setFOrgID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
|
|
|
tripMain.setFCausa(UtilMap.getString(mainData,"报销事由"));
|
|
tripMain.setFCausa(UtilMap.getString(mainData,"报销事由"));
|
|
|
- tripMain.setFProposerID(new FNumber(userId));
|
|
|
|
|
- tripMain.setFRequestDeptID(new FNumber(userDeptId));
|
|
|
|
|
|
|
+ tripMain.setFProposerID(new FSTAFFNUMBER(userId));
|
|
|
|
|
+ if (HISTORY_DEPTID.containsKey(userDeptName)){
|
|
|
|
|
+ tripMain.setFRequestDeptID(new FNumber(HISTORY_DEPTID.get(userDeptName)));//正式
|
|
|
|
|
+ tripMain.setFExpenseDeptID(new FNumber(HISTORY_DEPTID.get(userDeptName)));
|
|
|
|
|
+ }else {
|
|
|
|
|
+ tripMain.setFRequestDeptID(new FNumber(userDeptId));//正式
|
|
|
|
|
+ tripMain.setFExpenseDeptID(new FNumber(userDeptId));
|
|
|
|
|
+ }
|
|
|
tripMain.setFExpenseOrgId(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
|
|
tripMain.setFExpenseOrgId(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
|
|
|
- tripMain.setFExpenseDeptID(new FNumber(userDeptId));
|
|
|
|
|
tripMain.setFCONTACTUNITTYPE("BD_Empinfo");
|
|
tripMain.setFCONTACTUNITTYPE("BD_Empinfo");
|
|
|
tripMain.setFCONTACTUNIT(new FNumber(userId));
|
|
tripMain.setFCONTACTUNIT(new FNumber(userId));
|
|
|
- tripMain.setFLocCurrencyID(new FNumber("1"));
|
|
|
|
|
- tripMain.setFExchangeTypeID(new FNumber("1"));
|
|
|
|
|
|
|
+ tripMain.setFLocCurrencyID(new FNumber("PRE001"));
|
|
|
|
|
+ tripMain.setFExchangeTypeID(new FNumber("HLTX01_SYS"));
|
|
|
tripMain.setFPayOrgId(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
|
|
tripMain.setFPayOrgId(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
|
|
|
tripMain.setFPaySettlleTypeID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"结算方式"))));
|
|
tripMain.setFPaySettlleTypeID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"结算方式"))));
|
|
|
- tripMain.setFRefundBankAccount(UtilMap.getString(mainData,"银行开户行"));
|
|
|
|
|
- tripMain.setFBankBranchT(UtilMap.getString(mainData,"账户名称"));
|
|
|
|
|
- tripMain.setFBankAccountNameT(UtilMap.getString(mainData,"收款账号"));
|
|
|
|
|
|
|
+ tripMain.setFBankAccountT(UtilMap.getString(mainData,"收款账号"));
|
|
|
|
|
+ tripMain.setFBankBranchT(UtilMap.getString(mainData,"银行开户行"));
|
|
|
|
|
+ tripMain.setFBankAccountNameT(UtilMap.getString(mainData,"账户名称"));
|
|
|
tripMain.setFEntity(tripDetails);
|
|
tripMain.setFEntity(tripDetails);
|
|
|
|
|
|
|
|
save.setModel(tripMain);
|
|
save.setModel(tripMain);
|
|
@@ -226,77 +309,96 @@ public class DocumentServiceImpl implements DocumentService {
|
|
|
public McR saveCost(Map processData) {
|
|
public McR saveCost(Map processData) {
|
|
|
String userId = String.valueOf(processData.get("originatorUserId"));
|
|
String userId = String.valueOf(processData.get("originatorUserId"));
|
|
|
String userDeptId = String.valueOf(processData.get("originatorDeptId"));
|
|
String userDeptId = String.valueOf(processData.get("originatorDeptId"));
|
|
|
|
|
+ String userDeptName = String.valueOf(processData.get("originatorDeptName"));
|
|
|
|
|
+
|
|
|
List<Map> formComponentValues = (List<Map>) processData.get("formComponentValues");
|
|
List<Map> formComponentValues = (List<Map>) processData.get("formComponentValues");
|
|
|
Map<String, Object> mainData = new HashMap<>();
|
|
Map<String, Object> mainData = new HashMap<>();
|
|
|
List<CostDetail> costDetails = new ArrayList<>();
|
|
List<CostDetail> costDetails = new ArrayList<>();
|
|
|
formComponentValues.forEach(e->{
|
|
formComponentValues.forEach(e->{
|
|
|
- String name = e.get("name").toString();
|
|
|
|
|
- if ("TableField".equals(e.get("componentType"))) {
|
|
|
|
|
- Object parse = JSON.parse(e.get("value").toString());
|
|
|
|
|
- JSONArray jsonArray = JSON.parseArray(parse.toString());
|
|
|
|
|
- for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
|
|
- JSONObject jsonObject = (JSONObject) jsonArray.get(i);
|
|
|
|
|
- Object rowValue = jsonObject.get("rowValue");
|
|
|
|
|
- JSONArray array = JSON.parseArray(rowValue.toString());
|
|
|
|
|
- for (int i1 = 0; i1 < array.size(); i1++) {
|
|
|
|
|
- jsonObject = (JSONObject) array.get(i1);
|
|
|
|
|
- if (jsonObject.containsKey("extendValue")){
|
|
|
|
|
- rowValue = jsonObject.get("extendValue");
|
|
|
|
|
- jsonObject = JSONObject.parseObject(rowValue.toString());
|
|
|
|
|
- rowValue = jsonObject.get("list");
|
|
|
|
|
- JSONArray array1 = JSON.parseArray(rowValue.toString());
|
|
|
|
|
- for (int i2 = 0; i2 < array1.size(); i2++) {
|
|
|
|
|
- jsonObject = (JSONObject) array1.get(i2);
|
|
|
|
|
- if (jsonObject.containsKey("rowValue")){
|
|
|
|
|
- rowValue = jsonObject.get("rowValue");
|
|
|
|
|
- JSONArray array2 = JSON.parseArray(rowValue.toString());
|
|
|
|
|
- CostDetail costDetail = new CostDetail();
|
|
|
|
|
-
|
|
|
|
|
- for (int l = 0; l < array2.size(); l++) {
|
|
|
|
|
- jsonObject = (JSONObject) array2.get(l);
|
|
|
|
|
- switch (jsonObject.get("label").toString()){
|
|
|
|
|
- case "费用日期": costDetail.setFPAYDATE(jsonObject.get("value").toString().substring(0,9));break;
|
|
|
|
|
- case "费用承担部门": costDetail.setFExpenseDeptEntryID(new FNumber(UtilMap.getString(jsonObject,"value")));break;
|
|
|
|
|
- case "科目编号": costDetail.setFExpID(new FNumber(UtilMap.getString(jsonObject,"value")));break;
|
|
|
|
|
- case "税率": costDetail.setFTaxRate(UtilMap.getDouble(jsonObject,"value"));break;
|
|
|
|
|
- case "发票类型": costDetail.setFInvoiceType(UtilMap.getString(jsonObject,"value"));break;
|
|
|
|
|
- case "税额": costDetail.setFTaxAmt(UtilMap.getDouble(jsonObject,"value"));break;
|
|
|
|
|
- case "非税金额": costDetail.setFTaxSubmitAmt(UtilMap.getDouble(jsonObject,"value"));break;
|
|
|
|
|
- case "申请报销金额": costDetail.setFExpenseAmount(UtilMap.getDouble(jsonObject,"value"));break;
|
|
|
|
|
|
|
+ if (!"TextNote".equals(e.get("componentType"))){
|
|
|
|
|
+ String name = e.get("name").toString();
|
|
|
|
|
+ if ("TableField".equals(e.get("componentType"))) {
|
|
|
|
|
+ Object parse = JSON.parse(e.get("value").toString());
|
|
|
|
|
+ JSONArray jsonArray = JSON.parseArray(parse.toString());
|
|
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
|
|
+ JSONObject jsonObject = (JSONObject) jsonArray.get(i);
|
|
|
|
|
+ if (jsonObject.containsKey("rowValue")){
|
|
|
|
|
+ Object rowValue = jsonObject.get("rowValue");
|
|
|
|
|
+ JSONArray array = JSON.parseArray(rowValue.toString());
|
|
|
|
|
+ CostDetail costDetail = new CostDetail();
|
|
|
|
|
+ for (int i1 = 0; i1 < array.size(); i1++) {
|
|
|
|
|
+ jsonObject = (JSONObject) array.get(i1);
|
|
|
|
|
+ String sonLabel = jsonObject.get("label").toString();
|
|
|
|
|
+ if (jsonObject.containsKey("extendValue")){
|
|
|
|
|
+ rowValue = jsonObject.get("extendValue");
|
|
|
|
|
+ }else {
|
|
|
|
|
+ rowValue = jsonObject;
|
|
|
|
|
+ }
|
|
|
|
|
+ Object parse1 = JSON.parse(rowValue.toString());
|
|
|
|
|
+ if (parse1 instanceof JSONObject){
|
|
|
|
|
+ jsonObject = JSONObject.parseObject(rowValue.toString());
|
|
|
|
|
+ } else if (parse1 instanceof JSONArray) {
|
|
|
|
|
+ jsonObject = (JSONObject) JSONObject.parseArray(rowValue.toString()).get(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ switch (sonLabel){
|
|
|
|
|
+ case "费用日期": costDetail.setFPAYDATE(jsonObject.get("value").toString().substring(0,10));break;
|
|
|
|
|
+ case "费用承担部门":
|
|
|
|
|
+ if (HISTORY_DEPTID.containsKey(UtilMap.getString(jsonObject,"name"))){
|
|
|
|
|
+ costDetail.setFExpenseDeptEntryID(new FNumber(HISTORY_DEPTID.get(UtilMap.getString(jsonObject,"name"))));
|
|
|
|
|
+ }else {
|
|
|
|
|
+ costDetail.setFExpenseDeptEntryID(new FNumber(UtilMap.getString(jsonObject,"id")));
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- costDetails.add(costDetail);
|
|
|
|
|
|
|
+ break;
|
|
|
|
|
+// case "预算所属部门": costDetail.setFExpenseDeptEntryID(new FNumber("1069359193"));break;
|
|
|
|
|
+ case "金蝶科目编号": costDetail.setFExpID(new FNumber(UtilMap.getString(jsonObject,"value")));break;
|
|
|
|
|
+ case "税率": costDetail.setFTaxRate(UtilMap.getDouble(jsonObject,"value"));break;
|
|
|
|
|
+ case "发票类型": costDetail.setFInvoiceType(UtilMap.getString(jsonObject,"label"));break;
|
|
|
|
|
+ case "税额": costDetail.setFTaxAmt(UtilMap.getDouble(jsonObject,"value"));break;
|
|
|
|
|
+ case "非税金额": costDetail.setFTaxSubmitAmt(UtilMap.getDouble(jsonObject,"value"));break;
|
|
|
|
|
+ case "申请报销金额": costDetail.setFExpenseAmount(UtilMap.getDouble(jsonObject,"value"));break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ costDetails.add(costDetail);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ }else {
|
|
|
|
|
+ mainData.put(name, e.get("value"));
|
|
|
}
|
|
}
|
|
|
- }else {
|
|
|
|
|
- mainData.put(name, e.get("value"));
|
|
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
Save save = new Save();
|
|
Save save = new Save();
|
|
|
|
|
+ save.setSubSystemId("ER");
|
|
|
|
|
+ save.setIsAutoAdjustField(true);
|
|
|
|
|
|
|
|
CostMain costMain = new CostMain();
|
|
CostMain costMain = new CostMain();
|
|
|
|
|
|
|
|
- costMain.setFBillTypeID(new BillTypeID("000ffecf2c6f97f311e32b0998d51004"));
|
|
|
|
|
- costMain.setFDATE(LocalDate.parse(UtilMap.getString(mainData,"申请日期").substring(0,9)));
|
|
|
|
|
|
|
+ costMain.setFBillTypeID(new BillTypeID("FYBXD001_SYS"));
|
|
|
|
|
+ costMain.setFDATE(LocalDate.parse(UtilMap.getString(mainData,"申请日期").substring(0,10)));
|
|
|
costMain.setFCurrencyID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"币别"))));
|
|
costMain.setFCurrencyID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"币别"))));
|
|
|
costMain.setFOrgID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
|
|
costMain.setFOrgID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
|
|
|
costMain.setFCausa(UtilMap.getString(mainData,"报销事由"));
|
|
costMain.setFCausa(UtilMap.getString(mainData,"报销事由"));
|
|
|
- costMain.setFProposerID(new FNumber(userId));
|
|
|
|
|
- costMain.setFRequestDeptID(new FNumber(userDeptId));
|
|
|
|
|
|
|
+ costMain.setFProposerID(new FSTAFFNUMBER(userId));
|
|
|
|
|
+ if (HISTORY_DEPTID.containsKey(userDeptName)){
|
|
|
|
|
+ costMain.setFRequestDeptID(new FNumber(HISTORY_DEPTID.get(userDeptName)));//正式
|
|
|
|
|
+ costMain.setFExpenseDeptID(new FNumber(HISTORY_DEPTID.get(userDeptName)));
|
|
|
|
|
+ }else {
|
|
|
|
|
+ costMain.setFRequestDeptID(new FNumber(userDeptId));//正式
|
|
|
|
|
+ costMain.setFExpenseDeptID(new FNumber(userDeptId));
|
|
|
|
|
+ }
|
|
|
|
|
+// costMain.setFProposerID(new FNumber("0062"));
|
|
|
|
|
+// costMain.setFRequestDeptID(new FNumber("1069359193"));//测试
|
|
|
|
|
+// costMain.setFExpenseDeptID(new FNumber("1069359193"));//测试
|
|
|
costMain.setFExpenseOrgId(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
|
|
costMain.setFExpenseOrgId(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
|
|
|
- costMain.setFExpenseDeptID(new FNumber(userDeptId));
|
|
|
|
|
costMain.setFCONTACTUNITTYPE("BD_Empinfo");
|
|
costMain.setFCONTACTUNITTYPE("BD_Empinfo");
|
|
|
costMain.setFCONTACTUNIT(new FNumber(userId));
|
|
costMain.setFCONTACTUNIT(new FNumber(userId));
|
|
|
- costMain.setFLocCurrencyID(new FNumber("1"));
|
|
|
|
|
- costMain.setFExchangeTypeID(new FNumber("1"));
|
|
|
|
|
|
|
+ costMain.setFLocCurrencyID(new FNumber("PRE001"));
|
|
|
|
|
+ costMain.setFExchangeTypeID(new FNumber("HLTX01_SYS"));
|
|
|
costMain.setFPayOrgId(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
|
|
costMain.setFPayOrgId(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
|
|
|
costMain.setFPaySettlleTypeID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"结算方式"))));
|
|
costMain.setFPaySettlleTypeID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"结算方式"))));
|
|
|
- costMain.setFRefundBankAccount(UtilMap.getString(mainData,"银行开户行"));
|
|
|
|
|
- costMain.setFBankBranchT(UtilMap.getString(mainData,"账户名称"));
|
|
|
|
|
- costMain.setFBankAccountNameT(UtilMap.getString(mainData,"收款账号"));
|
|
|
|
|
|
|
+// costMain.setFRefundBankAccount(new FNumber(UtilMap.getString(mainData,"收款账号")));
|
|
|
|
|
+ costMain.setFBankAccountT(UtilMap.getString(mainData,"收款账号"));
|
|
|
|
|
+ costMain.setFBankBranchT(UtilMap.getString(mainData,"银行开户行"));
|
|
|
|
|
+ costMain.setFBankAccountNameT(UtilMap.getString(mainData,"账户名称"));
|
|
|
costMain.setFEntity(costDetails);
|
|
costMain.setFEntity(costDetails);
|
|
|
|
|
|
|
|
save.setModel(costMain);
|
|
save.setModel(costMain);
|
|
@@ -345,103 +447,134 @@ public class DocumentServiceImpl implements DocumentService {
|
|
|
List<Map> formComponentValues = (List<Map>) processData.get("formComponentValues");
|
|
List<Map> formComponentValues = (List<Map>) processData.get("formComponentValues");
|
|
|
Map<String, Object> mainData = new HashMap<>();
|
|
Map<String, Object> mainData = new HashMap<>();
|
|
|
List<PaymentDetail> paymentDetails = new ArrayList<>();
|
|
List<PaymentDetail> paymentDetails = new ArrayList<>();
|
|
|
|
|
+ PaymentMain paymentMain = new PaymentMain();
|
|
|
formComponentValues.forEach(e->{
|
|
formComponentValues.forEach(e->{
|
|
|
- String name = e.get("name").toString();
|
|
|
|
|
- if ("TableField".equals(e.get("componentType"))) {
|
|
|
|
|
- Object parse = JSON.parse(e.get("value").toString());
|
|
|
|
|
- JSONArray jsonArray = JSON.parseArray(parse.toString());
|
|
|
|
|
- for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
|
|
- JSONObject jsonObject = (JSONObject) jsonArray.get(i);
|
|
|
|
|
- Object rowValue = jsonObject.get("rowValue");
|
|
|
|
|
- JSONArray array = JSON.parseArray(rowValue.toString());
|
|
|
|
|
- for (int i1 = 0; i1 < array.size(); i1++) {
|
|
|
|
|
- jsonObject = (JSONObject) array.get(i1);
|
|
|
|
|
- if (jsonObject.containsKey("extendValue")){
|
|
|
|
|
- rowValue = jsonObject.get("extendValue");
|
|
|
|
|
- jsonObject = JSONObject.parseObject(rowValue.toString());
|
|
|
|
|
- rowValue = jsonObject.get("list");
|
|
|
|
|
- JSONArray array1 = JSON.parseArray(rowValue.toString());
|
|
|
|
|
- for (int i2 = 0; i2 < array1.size(); i2++) {
|
|
|
|
|
- jsonObject = (JSONObject) array1.get(i2);
|
|
|
|
|
- if (jsonObject.containsKey("rowValue")){
|
|
|
|
|
- rowValue = jsonObject.get("rowValue");
|
|
|
|
|
- JSONArray array2 = JSON.parseArray(rowValue.toString());
|
|
|
|
|
- PaymentDetail paymentDetail = new PaymentDetail();
|
|
|
|
|
- paymentDetail.setFPriceQty(1);
|
|
|
|
|
- for (int l = 0; l < array2.size(); l++) {
|
|
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
|
|
- jsonObject = (JSONObject) array2.get(l);
|
|
|
|
|
-
|
|
|
|
|
- switch (jsonObject.get("label").toString()){
|
|
|
|
|
- case "科目编号": paymentDetail.setFCOSTID(new FNumber(jsonObject.get("value").toString()));break;
|
|
|
|
|
- case "税率": paymentDetail.setFEntryTaxRate(UtilMap.getDouble(jsonObject,"value"));break;
|
|
|
|
|
- case "税额": paymentDetail.setFNoTaxAmountFor_D(UtilMap.getDouble(jsonObject,"value"));break;
|
|
|
|
|
- case "金额(非税)": paymentDetail.setFALLAMOUNTFOR_D(UtilMap.getDouble(jsonObject,"value"));break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- paymentDetails.add(paymentDetail);
|
|
|
|
|
|
|
+ if (!"TextNote".equals(e.get("componentType"))) {
|
|
|
|
|
+ String name = e.get("name").toString();
|
|
|
|
|
+ if ("TableField".equals(e.get("componentType"))) {
|
|
|
|
|
+ Object parse = JSON.parse(e.get("value").toString());
|
|
|
|
|
+ JSONArray jsonArray = JSON.parseArray(parse.toString());
|
|
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
|
|
+ JSONObject jsonObject = (JSONObject) jsonArray.get(i);
|
|
|
|
|
+ if (jsonObject.containsKey("rowValue")) {
|
|
|
|
|
+ Object rowValue = jsonObject.get("rowValue");
|
|
|
|
|
+ JSONArray array = JSON.parseArray(rowValue.toString());
|
|
|
|
|
+ PaymentDetail paymentDetail = new PaymentDetail();
|
|
|
|
|
+ for (int i1 = 0; i1 < array.size(); i1++) {
|
|
|
|
|
+ jsonObject = (JSONObject) array.get(i1);
|
|
|
|
|
+ String sonLabel = jsonObject.get("label").toString();
|
|
|
|
|
+ if (jsonObject.containsKey("extendValue")) {
|
|
|
|
|
+ rowValue = jsonObject.get("extendValue");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ rowValue = jsonObject;
|
|
|
|
|
+ }
|
|
|
|
|
+ Object parse1 = JSON.parse(rowValue.toString());
|
|
|
|
|
+ if (parse1 instanceof JSONObject) {
|
|
|
|
|
+ jsonObject = JSONObject.parseObject(rowValue.toString());
|
|
|
|
|
+ } else if (parse1 instanceof JSONArray) {
|
|
|
|
|
+ jsonObject = (JSONObject) JSONObject.parseArray(rowValue.toString()).get(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ switch (sonLabel) {
|
|
|
|
|
+ case "金蝶科目编号":
|
|
|
|
|
+ paymentDetail.setFCOSTID(new FNumber(jsonObject.get("value").toString()));
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "税率":
|
|
|
|
|
+ paymentDetail.setFEntryTaxRate(UtilMap.getDouble(jsonObject, "value"));
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "税额":
|
|
|
|
|
+ paymentDetail.setFNoTaxAmountFor_D(UtilMap.getDouble(jsonObject, "value"));
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "金额(非税)":
|
|
|
|
|
+ paymentDetail.setFALLAMOUNTFOR_D(UtilMap.getDouble(jsonObject, "value"));
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ paymentDetails.add(paymentDetail);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }else {
|
|
|
|
|
- mainData.put(name, e.get("value"));
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- Save save = new Save();
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- PaymentMain paymentMain = new PaymentMain();
|
|
|
|
|
- paymentMain.setFBillTypeID(new BillTypeID("YFD02_SYS"));
|
|
|
|
|
- paymentMain.setFDATE(LocalDate.parse(UtilMap.getString(mainData,"业务日期").substring(0,9)));
|
|
|
|
|
- paymentMain.setFENDDATE_H(LocalDate.parse(UtilMap.getString(mainData,"付款到期日").substring(0,9)));
|
|
|
|
|
- paymentMain.setFDOCUMENTSTATUS("A");//单据状态为创建
|
|
|
|
|
- paymentMain.setFSUPPLIERID(new FNumber(UtilMap.getString(mainData,"供应商编号")));
|
|
|
|
|
- paymentMain.setFCURRENCYID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"币别"))));
|
|
|
|
|
- paymentMain.setFPAYORGID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
|
|
|
|
|
- paymentMain.setFSETTLEORGID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
|
|
|
|
|
- paymentMain.setFPURCHASEDEPTID(new FNumber(userDeptId));
|
|
|
|
|
-// paymentMain.setFPURCHASERID(new FNumber());
|
|
|
|
|
- paymentMain.setFEntityDetail(paymentDetails);
|
|
|
|
|
-
|
|
|
|
|
- save.setModel(paymentMain);
|
|
|
|
|
- System.out.println(save);
|
|
|
|
|
-
|
|
|
|
|
- try{
|
|
|
|
|
- K3CloudApi client = new K3CloudApi(kingDeeService.initIden());
|
|
|
|
|
- //业务对象标识
|
|
|
|
|
- String formId = "AP_Payable";
|
|
|
|
|
- //调用接口
|
|
|
|
|
- String resultJson = client.save(formId,JSONObject.toJSONString(save));
|
|
|
|
|
- //用于记录结果
|
|
|
|
|
- Gson gson = new Gson();
|
|
|
|
|
- //对返回结果进行解析和校验
|
|
|
|
|
- RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class);
|
|
|
|
|
|
|
+ else if ("FormRelateField".equals(e.get("componentType"))) {
|
|
|
|
|
+ JSONObject root = JSON.parseObject(UtilMap.getString(e,"extValue"));
|
|
|
|
|
|
|
|
- if (kingDeeService.isTrue(repoRet)){
|
|
|
|
|
- String id = repoRet.getResult().getId();
|
|
|
|
|
|
|
+ // 获取 list 数组,并取第一个元素(假设只有一个)
|
|
|
|
|
+ JSONArray list = root.getJSONArray("list");
|
|
|
|
|
+ if (list == null || list.isEmpty()) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ JSONObject firstItem = list.getJSONObject(0);
|
|
|
|
|
|
|
|
- Submit submit = new Submit();
|
|
|
|
|
- submit.setIds(id);
|
|
|
|
|
- //提交
|
|
|
|
|
- String resultJson2 = client.submit(formId, JSONObject.toJSONString(submit));
|
|
|
|
|
- RepoRet repoRet2 = gson.fromJson(resultJson2, RepoRet.class);
|
|
|
|
|
- kingDeeService.isTrue(repoRet2);
|
|
|
|
|
|
|
+ // 获取 rowValue 数组
|
|
|
|
|
+ JSONArray rowValues = firstItem.getJSONArray("rowValue");
|
|
|
|
|
+ if (rowValues == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- if (kingDeeService.isTrue(repoRet2)){
|
|
|
|
|
- Audit audit = new Audit();
|
|
|
|
|
- audit.setIds(id);
|
|
|
|
|
- //审核
|
|
|
|
|
- String resultJson3 = client.audit(formId,JSONObject.toJSONString(audit));
|
|
|
|
|
- RepoRet repoRet3 = gson.fromJson(resultJson3, RepoRet.class);
|
|
|
|
|
- kingDeeService.isTrue(repoRet3);
|
|
|
|
|
|
|
+ // 遍历查找 label 为 "供应商编号" 的项
|
|
|
|
|
+ for (int i = 0; i < rowValues.size(); i++) {
|
|
|
|
|
+ JSONObject field = rowValues.getJSONObject(i);
|
|
|
|
|
+ String label = field.getString("label");
|
|
|
|
|
+ if ("供应商编号".equals(label)) {
|
|
|
|
|
+ paymentMain.setFSUPPLIERID(new FNumber(field.getString("value")));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ mainData.put(name, e.get("value"));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
|
|
- McR.errorUnknown(e.getMessage());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ });
|
|
|
|
|
+ Save save = new Save();
|
|
|
|
|
+
|
|
|
|
|
+ paymentMain.setFBUSINESSTYPE("FY");
|
|
|
|
|
+ paymentMain.setFBillTypeID(new BillTypeID("YFD02_SYS"));
|
|
|
|
|
+ paymentMain.setFDATE(LocalDate.parse(UtilMap.getString(mainData,"业务日期").substring(0,10)));
|
|
|
|
|
+ paymentMain.setFENDDATE_H(LocalDate.parse(UtilMap.getString(mainData,"付款到期日").substring(0,10)));
|
|
|
|
|
+ paymentMain.setFDOCUMENTSTATUS("A");//单据状态为创建
|
|
|
|
|
+ paymentMain.setFCURRENCYID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"币别"))));
|
|
|
|
|
+ paymentMain.setFPAYORGID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
|
|
|
|
|
+ paymentMain.setFSETTLEORGID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
|
|
|
|
|
+ paymentMain.setFPURCHASEDEPTID(new FNumber(userDeptId));
|
|
|
|
|
+ paymentMain.setFAP_Remark(UtilMap.getString(mainData,"备注"));
|
|
|
|
|
+// paymentMain.setFPURCHASERID(new FNumber());
|
|
|
|
|
+ paymentMain.setFEntityDetail(paymentDetails);
|
|
|
|
|
+
|
|
|
|
|
+ save.setModel(paymentMain);
|
|
|
|
|
+ System.out.println(save);
|
|
|
|
|
+
|
|
|
|
|
+ try{
|
|
|
|
|
+ K3CloudApi client = new K3CloudApi(kingDeeService.initIden());
|
|
|
|
|
+ //业务对象标识
|
|
|
|
|
+ String formId = "AP_Payable";
|
|
|
|
|
+ //调用接口
|
|
|
|
|
+ String resultJson = client.save(formId,JSONObject.toJSONString(save));
|
|
|
|
|
+ //用于记录结果
|
|
|
|
|
+ Gson gson = new Gson();
|
|
|
|
|
+ //对返回结果进行解析和校验
|
|
|
|
|
+ RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class);
|
|
|
|
|
+
|
|
|
|
|
+ if (kingDeeService.isTrue(repoRet)){
|
|
|
|
|
+ String id = repoRet.getResult().getId();
|
|
|
|
|
+
|
|
|
|
|
+ Submit submit = new Submit();
|
|
|
|
|
+ submit.setIds(id);
|
|
|
|
|
+ //提交
|
|
|
|
|
+ String resultJson2 = client.submit(formId, JSONObject.toJSONString(submit));
|
|
|
|
|
+ RepoRet repoRet2 = gson.fromJson(resultJson2, RepoRet.class);
|
|
|
|
|
+ kingDeeService.isTrue(repoRet2);
|
|
|
|
|
+
|
|
|
|
|
+ if (kingDeeService.isTrue(repoRet2)){
|
|
|
|
|
+ Audit audit = new Audit();
|
|
|
|
|
+ audit.setIds(id);
|
|
|
|
|
+ //审核
|
|
|
|
|
+ String resultJson3 = client.audit(formId,JSONObject.toJSONString(audit));
|
|
|
|
|
+ RepoRet repoRet3 = gson.fromJson(resultJson3, RepoRet.class);
|
|
|
|
|
+ kingDeeService.isTrue(repoRet3);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ McR.errorUnknown(e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- return McR.success();
|
|
|
|
|
|
|
+ return McR.success();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-}
|
|
|