|
|
@@ -5,9 +5,13 @@ import com.malk.server.aliwork.YDConf;
|
|
|
import com.malk.server.aliwork.YDParam;
|
|
|
import com.malk.server.common.McR;
|
|
|
import com.malk.service.aliwork.YDClient;
|
|
|
+import com.malk.service.dingtalk.DDClient;
|
|
|
+import com.malk.service.dingtalk.DDClient_Contacts;
|
|
|
+import com.malk.service.dingtalk.DDClient_Personnel;
|
|
|
import com.malk.siku.service.SikuService;
|
|
|
import com.malk.siku.utils.MkBxUtil;
|
|
|
import com.malk.siku.utils.MkYpUtil;
|
|
|
+import com.malk.utils.UtilHttp;
|
|
|
import com.malk.utils.UtilMap;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.logging.log4j.util.Strings;
|
|
|
@@ -34,6 +38,9 @@ public class SikuServiceImpl implements SikuService {
|
|
|
@Value(value = "${mk.downloadUrl}")
|
|
|
private String downloadUrl;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private DDClient ddClient;
|
|
|
+
|
|
|
@Override
|
|
|
public McR saveTradingPartner(Map map) {
|
|
|
String formInstId = UtilMap.getString(map, "formInstId");
|
|
|
@@ -142,8 +149,26 @@ public class SikuServiceImpl implements SikuService {
|
|
|
application.put("clientBizCode",UtilMap.getString(formData,"textField_mkxpe3fj"));//收票方bizCode(客户的业务编码(云票系统内维护的))与收票方开票信息字段二选一必填
|
|
|
application.put("clientLegalEntityBizCode",UtilMap.getString(formData,"textField_mkddjwys"));//收票方抬头code,如果不传默认第一个(云票系统内维护的)
|
|
|
|
|
|
- application.put("submitterBizCode","18857526310");//提交人工号,单据状态为审批中时必填 todo 暂时固定 周漂
|
|
|
- application.put("applicantBizCode","18857526310");//开票申请人工号 todo 暂时固定 周漂
|
|
|
+
|
|
|
+ String jobNumber = UtilMap.getString(formData, "textField_mo0x02kw");//申请人工号
|
|
|
+
|
|
|
+ List<Map> allEmployee = MkYpUtil.getAllEmployee();
|
|
|
+ boolean flag = false;
|
|
|
+ for (Map employee : allEmployee) {
|
|
|
+ String employeeId = UtilMap.getString(employee, "employeeId");
|
|
|
+ if (jobNumber.equals(employeeId)){
|
|
|
+ application.put("submitterBizCode",employeeId);//提交人工号,单据状态为审批中时必填
|
|
|
+ application.put("applicantBizCode",employeeId);//开票申请人工号
|
|
|
+
|
|
|
+ flag = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!flag){
|
|
|
+ application.put("submitterBizCode","18857526310");//提交人工号,单据状态为审批中时必填 周漂
|
|
|
+ application.put("applicantBizCode","18857526310");//开票申请人工号 周漂
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/*Map clientLegalEntityOaDto = new HashMap();//收票方开票信息(不在云票系统内维护的)与收票方bizCode(客户的业务编码)二选一必填且优先级高于收票方bizCode(客户的业务编码)(也就是当两字段都有值时,忽略客户的业务编码)
|
|
|
clientLegalEntityOaDto.put("invoiceTitle",UtilMap.getString(formData,"selectField_mkxmix7e"));//名称
|
|
|
@@ -1399,39 +1424,28 @@ public class SikuServiceImpl implements SikuService {
|
|
|
List<Map> budgets = new ArrayList<>();
|
|
|
|
|
|
if ("冻结".equals(type)){
|
|
|
- //客户报价(汇总)
|
|
|
- List<Map> list = UtilMap.getList(formData, "tableField_mmveqhwl");
|
|
|
-
|
|
|
- for (Map map1 : list) {
|
|
|
- Map budget = new HashMap();
|
|
|
- budget.put("budgetOrgBizCode",projectCode);
|
|
|
- budget.put("budgetSubjectBizCode",UtilMap.getString(map1, "textField_mmvgh1zv"));
|
|
|
-
|
|
|
- Map budgetUnit = new HashMap();
|
|
|
- budgetUnit.put("periodNum",month);
|
|
|
- budgetUnit.put("budgetAmount",0);//置零 相当于冻结
|
|
|
- budget.put("budgetUnits",Arrays.asList(budgetUnit));
|
|
|
-
|
|
|
- budgets.add(budget);
|
|
|
- }
|
|
|
- }else {
|
|
|
- //释放
|
|
|
- //客户报价(汇总对照)
|
|
|
- List<Map> list = UtilMap.getList(formData, "tableField_mncsu1ef");
|
|
|
-
|
|
|
- for (Map map1 : list) {
|
|
|
- Map budget = new HashMap();
|
|
|
- budget.put("budgetOrgBizCode",projectCode);
|
|
|
- budget.put("budgetSubjectBizCode",UtilMap.getString(map1, "textField_mncsu1ee"));
|
|
|
- Double amt = UtilMap.getDouble(map1, "numberField_mncsu1ea");
|
|
|
-
|
|
|
- Map budgetUnit = new HashMap();
|
|
|
- budgetUnit.put("periodNum",month);
|
|
|
- budgetUnit.put("budgetAmount",amt);
|
|
|
- budget.put("budgetUnits",Arrays.asList(budgetUnit));
|
|
|
-
|
|
|
- budgets.add(budget);
|
|
|
- }
|
|
|
+ Map budget = new HashMap();
|
|
|
+ budget.put("budgetOrgBizCode",projectCode);
|
|
|
+// budget.put("budgetSubjectBizCode","");
|
|
|
+
|
|
|
+ Map budgetUnit = new HashMap();
|
|
|
+ budgetUnit.put("periodNum",month);
|
|
|
+ budgetUnit.put("budgetAmount",0);//置零 相当于冻结
|
|
|
+ budget.put("budgetUnits",Arrays.asList(budgetUnit));
|
|
|
+
|
|
|
+ budgets.add(budget);
|
|
|
+ }else {//释放
|
|
|
+ Map budget = new HashMap();
|
|
|
+ budget.put("budgetOrgBizCode",projectCode);
|
|
|
+// budget.put("budgetSubjectBizCode","");
|
|
|
+ Double amt = UtilMap.getDouble(formData, "numberField_mkga10nj");
|
|
|
+
|
|
|
+ Map budgetUnit = new HashMap();
|
|
|
+ budgetUnit.put("periodNum",month);
|
|
|
+ budgetUnit.put("budgetAmount",amt);
|
|
|
+ budget.put("budgetUnits",Arrays.asList(budgetUnit));
|
|
|
+
|
|
|
+ budgets.add(budget);
|
|
|
}
|
|
|
|
|
|
body.put("budgets",budgets);
|
|
|
@@ -1630,6 +1644,407 @@ public class SikuServiceImpl implements SikuService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void invoiceWriteBack6(Map map) {
|
|
|
+ String formCode = UtilMap.getString(map, "formCode");//单据号
|
|
|
+
|
|
|
+ Map formData = UtilMap.getMap(map, "formData");
|
|
|
+
|
|
|
+ String formSubTypeBizCode = getMkStrValue(formData, "formSubTypeBizCode");//单据类型业务编码
|
|
|
+
|
|
|
+ Map ydFormData = new HashMap();
|
|
|
+
|
|
|
+ switch (formSubTypeBizCode){
|
|
|
+ case "FT210319434976347227"://押金/保证金支付单
|
|
|
+ String isProject = getMkStrValue(formData, "CF32");//是否项目相关
|
|
|
+
|
|
|
+ if (!"是".equals(isProject)) return;
|
|
|
+
|
|
|
+ String loanName = getMkStrValue(formData, "loanName");//事由
|
|
|
+ double payableAmount = Double.parseDouble(getMkStrValue(formData, "payableAmount"));//借款金额
|
|
|
+ String legalEntity = getMkStrValue(formData, "legalEntity");//所属公司
|
|
|
+
|
|
|
+ Map loanUser = getMkListValue(formData, "loanUser").get(0);//借款人
|
|
|
+ String employeeName = UtilMap.getString(loanUser, "text");//借款人姓名
|
|
|
+ List<String> loanDdUser = getDdUserId(employeeName);
|
|
|
+
|
|
|
+ Map cf0 = getMkMapValue(formData, "CF0");
|
|
|
+ String projectCode = UtilMap.getString(cf0, "businessCode");//项目流水号
|
|
|
+ String projectName = UtilMap.getString(cf0, "text");//项目名称
|
|
|
+
|
|
|
+ Long expectRepayDate = getMkDateValue(formData, "expectRepayDate");//预计归还时间
|
|
|
+
|
|
|
+ String loanDepartment = getMkStrValue(formData, "loanDepartment");//借款部门
|
|
|
+
|
|
|
+ Map payeeAccount = getMkMapValue(formData, "payeeAccount");
|
|
|
+ String bankAcctNumber = UtilMap.getString(payeeAccount, "bankAcctNumber");//收款账户
|
|
|
+
|
|
|
+ ydFormData.put("textField_mnsm4ozj",legalEntity);
|
|
|
+ ydFormData.put("textField_mnsm4p09",projectName);
|
|
|
+ ydFormData.put("textField_mnsm4ozk",formCode);
|
|
|
+ ydFormData.put("textareaField_mnsm4ozp",loanName);
|
|
|
+ ydFormData.put("employeeField_mnsm4ozu",loanDdUser);
|
|
|
+ ydFormData.put("textField_mnsm4ozv",loanDepartment);
|
|
|
+ ydFormData.put("numberField_mnsm4p00",payableAmount);
|
|
|
+ ydFormData.put("dateField_mnsm4p01",expectRepayDate);
|
|
|
+ ydFormData.put("textField_mnsm4p07",bankAcctNumber);
|
|
|
+ ydFormData.put("textField_mnwtck7h","押金/保证金支付单");
|
|
|
+ ydFormData.put("textField_mnwtwu9z",projectCode);
|
|
|
+ break;
|
|
|
+ case "FT203800208910336098"://借款单(项目)
|
|
|
+ String loanName2 = getMkStrValue(formData, "loanName");//事由
|
|
|
+ double payableAmount2 = Double.parseDouble(getMkStrValue(formData, "payableAmount"));//借款金额
|
|
|
+ String legalEntity2 = getMkStrValue(formData, "legalEntity");//所属公司
|
|
|
+
|
|
|
+ Map loanUser2 = getMkListValue(formData, "loanUser").get(0);//借款人
|
|
|
+ String employeeName2 = UtilMap.getString(loanUser2, "text");//借款人姓名
|
|
|
+ List<String> loanDdUser2 = getDdUserId(employeeName2);
|
|
|
+
|
|
|
+ Map cf0_2 = getMkMapValue(formData, "CF0");
|
|
|
+ String projectCode2 = UtilMap.getString(cf0_2, "businessCode");//项目流水号
|
|
|
+ String projectName2 = UtilMap.getString(cf0_2, "text");//项目名称
|
|
|
+
|
|
|
+ Long expectRepayDate2 = getMkDateValue(formData, "expectRepayDate");//预计归还时间
|
|
|
+
|
|
|
+ String loanDepartment2 = getMkStrValue(formData, "loanDepartment");//借款部门
|
|
|
+
|
|
|
+ Map payeeAccount2 = getMkMapValue(formData, "payeeAccount");
|
|
|
+ String bankAcctNumber2 = UtilMap.getString(payeeAccount2, "bankAcctNumber");//收款账户
|
|
|
+
|
|
|
+ String comments = getMkStrValue(formData, "comments");//备用金用途
|
|
|
+
|
|
|
+ ydFormData.put("textField_mnsm4ozj",legalEntity2);
|
|
|
+ ydFormData.put("textField_mnsm4p09",projectName2);
|
|
|
+ ydFormData.put("textField_mnsm4ozk",formCode);
|
|
|
+ ydFormData.put("textareaField_mnsm4ozp",loanName2);
|
|
|
+ ydFormData.put("employeeField_mnsm4ozu",loanDdUser2);
|
|
|
+ ydFormData.put("textField_mnsm4ozv",loanDepartment2);
|
|
|
+ ydFormData.put("numberField_mnsm4p00",payableAmount2);
|
|
|
+ ydFormData.put("dateField_mnsm4p01",expectRepayDate2);
|
|
|
+ ydFormData.put("textField_mnsm4p07",bankAcctNumber2);
|
|
|
+ ydFormData.put("textField_mnwtck7h","借款单(项目)");
|
|
|
+ ydFormData.put("textField_mnwtwu9z",projectCode2);
|
|
|
+ ydFormData.put("textareaField_mnsm4p0c",comments);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formUuid("FORM-204D3E39C2EB49FEA4121D73E8A71F796A2U")
|
|
|
+ .formDataJson(JSONObject.toJSONString(ydFormData))
|
|
|
+ .build(), YDConf.FORM_OPERATION.create);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void invoiceWriteBack7(Map map) {
|
|
|
+ String formDataCode = UtilMap.getString(map, "formDataCode");//单据类型
|
|
|
+ String formCode = UtilMap.getString(map, "formCode");//单据号
|
|
|
+
|
|
|
+ Map formData = UtilMap.getMap(map, "formData");
|
|
|
+
|
|
|
+ String repaymentName = getMkStrValue(formData, "repaymentName");//事由
|
|
|
+ double repayAmount = Double.parseDouble(getMkStrValue(formData, "repayAmount"));//还款金额
|
|
|
+ String legalEntity = getMkStrValue(formData, "legalEntity");//所属公司
|
|
|
+
|
|
|
+ Map repayUser = getMkListValue(formData, "repayUser").get(0);//责任人
|
|
|
+ String employeeName = UtilMap.getString(repayUser, "text");//责任人姓名
|
|
|
+ List<String> repayDdUser = getDdUserId(employeeName);
|
|
|
+
|
|
|
+// Long repaymentDate = getMkDateValue(formData, "repaymentDate");//还款日期
|
|
|
+
|
|
|
+ String repayDept = getMkStrValue(formData, "repayDept");//责任人部门
|
|
|
+
|
|
|
+ String comments = getMkStrValue(formData, "comments");//备注
|
|
|
+
|
|
|
+ List<Map> loanDeductionList = getMkListValue(formData, "loanDeductionList");//核销借款
|
|
|
+
|
|
|
+ List<Map> ydLoanDeductionList = new ArrayList<>();
|
|
|
+
|
|
|
+ for (Map loanDeduction : loanDeductionList) {
|
|
|
+ Map ydLoanDeduction = new HashMap();
|
|
|
+
|
|
|
+ Double deductionAmount = UtilMap.getDouble(loanDeduction, "deductionAmount");//核销金额
|
|
|
+ String loanFormCode = UtilMap.getString(loanDeduction, "loanFormCode");//借款单单据号
|
|
|
+
|
|
|
+ //借款单详情
|
|
|
+ Map loanDetailInfo = MkBxUtil.loanDetailInfo(loanFormCode);
|
|
|
+ Map customObject = UtilMap.getMap(loanDetailInfo, "customObject");
|
|
|
+
|
|
|
+ Map cf0 = UtilMap.getMap(customObject, "CF0");
|
|
|
+ String projectCode = UtilMap.getString(cf0, "detailBusinessCode");//项目流水号
|
|
|
+ String projectName = UtilMap.getString(cf0, "text");//项目名称
|
|
|
+
|
|
|
+ String loanName = UtilMap.getString(loanDetailInfo, "loanName");//事由
|
|
|
+
|
|
|
+ ydLoanDeduction.put("textField_mnsmfo6t",loanName);
|
|
|
+ ydLoanDeduction.put("textField_mnxzo8la",loanFormCode);
|
|
|
+ ydLoanDeduction.put("textField_mnwlnnmz",projectName);
|
|
|
+ ydLoanDeduction.put("textField_mnwtwu9z",projectCode);
|
|
|
+ ydLoanDeduction.put("numberField_mnxzo8l8",deductionAmount);
|
|
|
+
|
|
|
+ ydLoanDeductionList.add(ydLoanDeduction);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map ydFormData = new HashMap();
|
|
|
+ ydFormData.put("textField_mnsmfo6f",legalEntity);
|
|
|
+
|
|
|
+ ydFormData.put("textField_mnxzo8l5",formCode);
|
|
|
+ ydFormData.put("textareaField_mnsmfo6k",repaymentName);
|
|
|
+ ydFormData.put("employeeField_mnsmfo6l",repayDdUser);
|
|
|
+ ydFormData.put("textField_mnsmfo6m",repayDept);
|
|
|
+ ydFormData.put("numberField_mnsmfo6s",repayAmount);
|
|
|
+ ydFormData.put("textareaField_mnsmfo70",comments);
|
|
|
+ ydFormData.put("textField_mnwtck7h","还款/退款单");
|
|
|
+ ydFormData.put("tableField_mnxzo8l6",ydLoanDeductionList);
|
|
|
+
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formUuid("FORM-D8589EE237894F4E9FF9B1A0D4BDCABFKNYM")
|
|
|
+ .formDataJson(JSONObject.toJSONString(ydFormData))
|
|
|
+ .build(), YDConf.FORM_OPERATION.create);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void invoiceWriteBack8(Map map) {
|
|
|
+ String formCode = UtilMap.getString(map, "formCode");//单据号
|
|
|
+
|
|
|
+ Map formData = UtilMap.getMap(map, "formData");
|
|
|
+
|
|
|
+ String formSubTypeBizCode = getMkStrValue(formData, "formSubTypeBizCode");//单据类型业务编码
|
|
|
+
|
|
|
+ Map ydFormData = new HashMap();
|
|
|
+
|
|
|
+ switch (formSubTypeBizCode){
|
|
|
+ case "FT204655110165381205"://项目报销单(个人)
|
|
|
+ String reimburseName = getMkStrValue(formData, "reimburseName");//事由
|
|
|
+ String legalEntity = getMkStrValue(formData, "legalEntity");//公司抬头
|
|
|
+
|
|
|
+ Map coverUser = getMkListValue(formData, "coverUser").get(0);//承担人
|
|
|
+ String coverUserName = UtilMap.getString(coverUser, "text");//承担人姓名
|
|
|
+ List<String> coverDdUser = getDdUserId(coverUserName);//承担人钉钉id
|
|
|
+
|
|
|
+ String coverDepartment = getMkStrValue(formData, "coverDepartment");//承担部门
|
|
|
+
|
|
|
+ Map cf0 = getMkMapValue(formData, "CF0");
|
|
|
+ String projectCode = UtilMap.getString(cf0, "businessCode");//项目流水号
|
|
|
+ String projectName = UtilMap.getString(cf0, "text");//项目名称
|
|
|
+
|
|
|
+ String cf31 = getMkStrValue(formData, "CF31");//代垫付
|
|
|
+
|
|
|
+ Map payeeAccount = getMkMapValue(formData, "payeeAccount");
|
|
|
+ String bankAcctNumber = UtilMap.getString(payeeAccount, "bankAcctNumber");//收款账户
|
|
|
+
|
|
|
+ List<Map> expenseList = getMkListValue(formData, "expenseList");
|
|
|
+
|
|
|
+ List<Map> ydExpenseList = new ArrayList<>();
|
|
|
+
|
|
|
+ double totalAmt = 0d;
|
|
|
+
|
|
|
+ for (Map expense : expenseList) {
|
|
|
+ String expenseType = getMkStrValue(expense, "expenseTypeCode");//费用类型
|
|
|
+ double acceptAmount = Double.parseDouble(getMkStrValue(expense, "acceptAmount"));//收款金额
|
|
|
+ String comments = getMkStrValue(expense, "comments");//用途
|
|
|
+ long consumeTime = getMkDateValue(expense, "consumeTime");//消费日期
|
|
|
+
|
|
|
+ Map expenseMap = new HashMap();
|
|
|
+ expenseMap.put("textField_mnwlpiwc",expenseType);
|
|
|
+ expenseMap.put("numberField_mnwlpiwd",acceptAmount);
|
|
|
+ expenseMap.put("textareaField_mnwlpiwh",comments);
|
|
|
+ expenseMap.put("dateField_mnwlpiwe",consumeTime);
|
|
|
+
|
|
|
+ ydExpenseList.add(expenseMap);
|
|
|
+
|
|
|
+ totalAmt += acceptAmount;
|
|
|
+ }
|
|
|
+
|
|
|
+ ydFormData.put("textField_mnwtck7h","项目报销单(个人)");
|
|
|
+ ydFormData.put("textField_mnwtwu9z",projectCode);
|
|
|
+ ydFormData.put("textField_mnwlpivn",projectName);
|
|
|
+ ydFormData.put("textareaField_mnwlpivb",reimburseName);
|
|
|
+ ydFormData.put("textField_mnwlpivg",legalEntity);
|
|
|
+ ydFormData.put("textField_mnwlpivi",coverDepartment);
|
|
|
+ ydFormData.put("employeeField_mnwlpivh",coverDdUser);
|
|
|
+ ydFormData.put("textField_mnwlpiw6",bankAcctNumber);
|
|
|
+ ydFormData.put("textField_mnwlpivq",cf31);
|
|
|
+ ydFormData.put("tableField_mnwlpiwb",ydExpenseList);
|
|
|
+ ydFormData.put("numberField_mo007gcg",totalAmt);
|
|
|
+
|
|
|
+ break;
|
|
|
+ case "FT212801282906280987"://打车(企业支付)
|
|
|
+ String cf36 = getMkStrValue(formData, "CF36");//是否有项目
|
|
|
+
|
|
|
+ if (!"是".equals(cf36)) return;
|
|
|
+
|
|
|
+ String reimburseName2 = getMkStrValue(formData, "reimburseName");//事由
|
|
|
+ String legalEntity2 = getMkStrValue(formData, "legalEntity");//公司抬头
|
|
|
+
|
|
|
+ Map coverUser2 = getMkListValue(formData, "coverUser").get(0);//承担人
|
|
|
+ String coverUserName2 = UtilMap.getString(coverUser2, "text");//承担人姓名
|
|
|
+ List<String> coverDdUser2 = getDdUserId(coverUserName2);//承担人钉钉id
|
|
|
+
|
|
|
+ String coverDepartment2 = getMkStrValue(formData, "coverDepartment");//承担部门
|
|
|
+
|
|
|
+ Map cf0_2 = getMkMapValue(formData, "CF0");
|
|
|
+ String projectCode2 = UtilMap.getString(cf0_2, "businessCode");//项目流水号
|
|
|
+ String projectName2 = UtilMap.getString(cf0_2, "text");//项目名称
|
|
|
+
|
|
|
+ String cf31_2 = getMkStrValue(formData, "CF31");//代垫付
|
|
|
+
|
|
|
+ Map payeeAccount2 = getMkMapValue(formData, "payeeAccount");
|
|
|
+ String bankAcctNumber2 = UtilMap.getString(payeeAccount2, "bankAcctNumber");//收款账户
|
|
|
+
|
|
|
+ List<Map> expenseList2 = getMkListValue(formData, "expenseList");
|
|
|
+
|
|
|
+ List<Map> ydExpenseList2 = new ArrayList<>();
|
|
|
+
|
|
|
+ double totalAmt2 = 0d;
|
|
|
+
|
|
|
+ for (Map expense : expenseList2) {
|
|
|
+ String expenseType = getMkStrValue(expense, "expenseTypeCode");//费用类型
|
|
|
+ double acceptAmount = Double.parseDouble(getMkStrValue(expense, "acceptAmount"));//收款金额
|
|
|
+ String comments = getMkStrValue(expense, "comments");//用途
|
|
|
+ long consumeTime = getMkDateValue(expense, "consumeTime");//消费日期
|
|
|
+
|
|
|
+ Map expenseMap = new HashMap();
|
|
|
+ expenseMap.put("textField_mnwlpiwc",expenseType);
|
|
|
+ expenseMap.put("numberField_mnwlpiwd",acceptAmount);
|
|
|
+ expenseMap.put("textareaField_mnwlpiwh",comments);
|
|
|
+ expenseMap.put("dateField_mnwlpiwe",consumeTime);
|
|
|
+
|
|
|
+ ydExpenseList2.add(expenseMap);
|
|
|
+
|
|
|
+ totalAmt2 += acceptAmount;
|
|
|
+ }
|
|
|
+
|
|
|
+ ydFormData.put("textField_mnwtck7h","打车(企业支付)");
|
|
|
+ ydFormData.put("textField_mnwtwu9z",projectCode2);
|
|
|
+ ydFormData.put("textField_mnwlpivn",projectName2);
|
|
|
+ ydFormData.put("textareaField_mnwlpivb",reimburseName2);
|
|
|
+ ydFormData.put("textField_mnwlpivg",legalEntity2);
|
|
|
+ ydFormData.put("textField_mnwlpivi",coverDepartment2);
|
|
|
+ ydFormData.put("employeeField_mnwlpivh",coverDdUser2);
|
|
|
+ ydFormData.put("textField_mnwlpiw6",bankAcctNumber2);
|
|
|
+ ydFormData.put("textField_mnwlpivq",cf31_2);
|
|
|
+ ydFormData.put("tableField_mnwlpiwb",ydExpenseList2);
|
|
|
+ ydFormData.put("numberField_mo007gcg",totalAmt2);
|
|
|
+
|
|
|
+ break;
|
|
|
+ case "FT204524106635297811"://项目差旅报销单
|
|
|
+ String reimburseName3 = getMkStrValue(formData, "reimburseName");//事由
|
|
|
+ String legalEntity3 = getMkStrValue(formData, "legalEntity");//公司抬头
|
|
|
+
|
|
|
+ Map coverUser3 = getMkListValue(formData, "coverUser").get(0);//承担人
|
|
|
+ String coverUserName3 = UtilMap.getString(coverUser3, "text");//承担人姓名
|
|
|
+ List<String> coverDdUser3 = getDdUserId(coverUserName3);//承担人钉钉id
|
|
|
+
|
|
|
+ String coverDepartment3 = getMkStrValue(formData, "coverDepartment");//承担部门
|
|
|
+
|
|
|
+ Map cf0_3 = getMkMapValue(formData, "CF0");
|
|
|
+ String projectCode3 = UtilMap.getString(cf0_3, "businessCode");//项目流水号
|
|
|
+ String projectName3 = UtilMap.getString(cf0_3, "text");//项目名称
|
|
|
+
|
|
|
+ String cf31_3 = getMkStrValue(formData, "CF31");//代垫付
|
|
|
+
|
|
|
+ Map payeeAccount3 = getMkMapValue(formData, "payeeAccount");
|
|
|
+ String bankAcctNumber3 = UtilMap.getString(payeeAccount3, "bankAcctNumber");//收款账户
|
|
|
+
|
|
|
+ List<Map> expenseList3 = getMkListValue(formData, "expenseList");
|
|
|
+
|
|
|
+ List<Map> ydExpenseList3 = new ArrayList<>();
|
|
|
+
|
|
|
+ double totalAmt3 = 0d;
|
|
|
+
|
|
|
+ for (Map expense : expenseList3) {
|
|
|
+ String expenseType = getMkStrValue(expense, "expenseTypeCode");//费用类型
|
|
|
+ double acceptAmount = Double.parseDouble(getMkStrValue(expense, "acceptAmount"));//收款金额
|
|
|
+ String comments = getMkStrValue(expense, "comments");//用途
|
|
|
+ long consumeTime = getMkDateValue(expense, "consumeTime");//消费日期
|
|
|
+
|
|
|
+ Map expenseMap = new HashMap();
|
|
|
+ expenseMap.put("textField_mnwlpiwc",expenseType);
|
|
|
+ expenseMap.put("numberField_mnwlpiwd",acceptAmount);
|
|
|
+ expenseMap.put("textareaField_mnwlpiwh",comments);
|
|
|
+ expenseMap.put("dateField_mnwlpiwe",consumeTime);
|
|
|
+
|
|
|
+ ydExpenseList3.add(expenseMap);
|
|
|
+
|
|
|
+ totalAmt3 += acceptAmount;
|
|
|
+ }
|
|
|
+
|
|
|
+ ydFormData.put("textField_mnwtck7h","项目差旅报销单");
|
|
|
+ ydFormData.put("textField_mnwtwu9z",projectCode3);
|
|
|
+ ydFormData.put("textField_mnwlpivn",projectName3);
|
|
|
+ ydFormData.put("textareaField_mnwlpivb",reimburseName3);
|
|
|
+ ydFormData.put("textField_mnwlpivg",legalEntity3);
|
|
|
+ ydFormData.put("textField_mnwlpivi",coverDepartment3);
|
|
|
+ ydFormData.put("employeeField_mnwlpivh",coverDdUser3);
|
|
|
+ ydFormData.put("textField_mnwlpiw6",bankAcctNumber3);
|
|
|
+ ydFormData.put("textField_mnwlpivq",cf31_3);
|
|
|
+ ydFormData.put("tableField_mnwlpiwb",ydExpenseList3);
|
|
|
+ ydFormData.put("numberField_mo007gcg",totalAmt3);
|
|
|
+
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formUuid("FORM-4F0DF576764A472AA6CF4AC0E26061559AR4")
|
|
|
+ .formDataJson(JSONObject.toJSONString(ydFormData))
|
|
|
+ .build(), YDConf.FORM_OPERATION.create);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static String getMkStrValue(Map formData, String entityName) {
|
|
|
+ Map title = UtilMap.getMap(formData, entityName);
|
|
|
+ Map value = UtilMap.getMap(title, "value");
|
|
|
+ String text = UtilMap.getString(value, "text");
|
|
|
+
|
|
|
+ return text;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static Map getMkMapValue(Map formData, String entityName) {
|
|
|
+ Map title = UtilMap.getMap(formData, entityName);
|
|
|
+ Map value = UtilMap.getMap(title, "value");
|
|
|
+
|
|
|
+ return value;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static List<Map> getMkListValue(Map formData, String entityName) {
|
|
|
+ Map title = UtilMap.getMap(formData, entityName);
|
|
|
+ List<Map> value = UtilMap.getList(title, "value");
|
|
|
+
|
|
|
+ return value;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static Long getMkDateValue(Map formData, String entityName) {
|
|
|
+ Map title = UtilMap.getMap(formData, entityName);
|
|
|
+ Map value = UtilMap.getMap(title, "value");
|
|
|
+
|
|
|
+ long currentTime = UtilMap.getLong(value, "currentTime");
|
|
|
+
|
|
|
+ return currentTime;
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据员工名字匹配员工id
|
|
|
+ private List<String> getDdUserId(String Name){
|
|
|
+ HashMap body = new HashMap();
|
|
|
+
|
|
|
+ body.put("queryWord", Name);
|
|
|
+ body.put("offset",0);
|
|
|
+ body.put("size",1);
|
|
|
+
|
|
|
+ String s1 = UtilHttp.doPost("https://api.dingtalk.com/v1.0/contact/users/search", ddClient.initTokenHeader(), null, body);
|
|
|
+
|
|
|
+ List<String> list = JSONObject.parseObject(s1).getJSONArray("list").toJavaList(String.class);
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
//更新宜搭采购已退回金额
|
|
|
private void updateYdRepay(String formCode, Double amount) {
|
|
|
String[] split = formCode.split("-");
|