Commit 6c6e1e23 authored by chengwenlong's avatar chengwenlong

用友项目查询接口

parent 9c45f24e
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.system.common.ReturnResult;
import com.ruoyi.system.constant.ApiConstant;
import com.ruoyi.system.listener.ExcelListener;
import com.ruoyi.system.mapper.WagesDetailsMapper;
import com.ruoyi.system.mapper.WagesMapper;
......@@ -152,21 +153,27 @@ public class WagesServiceImpl implements WagesService {
if (index >= 0) {
String lbname = sourceOfExpenses.substring(index + 1);
String lbname2 = "项目";
//用友接口取数
CustomDocRequestModel docRequest = new CustomDocRequestModel();
docRequest.setPageIndex(Long.valueOf(1L));
docRequest.setPageSize(Long.valueOf(500L));
docRequest.setName(lbname);
String codeFromCustomDoc = "";
JSONArray customDoc = getCustomDoc(docRequest);
//如果用友返回不为空
if (customDoc != null) {
codeFromCustomDoc = getCodeFromCustomDoc(customDoc, lbname2);
if (codeFromCustomDoc != null) {
jsonObject1.put("auxiliary_item_b", lbname2 + ":" + codeFromCustomDoc + "/" + lbname);
}
//用友项目接口查询
String xmCode = getCodeByName(lbname,"010101");
if(xmCode!=null){
jsonObject1.put("auxiliary_item_b", lbname2 + ":" + xmCode + "/" + lbname);
}
// //用友接口取数
// CustomDocRequestModel docRequest = new CustomDocRequestModel();
// docRequest.setPageIndex(Long.valueOf(1L));
// docRequest.setPageSize(Long.valueOf(500L));
// docRequest.setName(lbname);
// String codeFromCustomDoc = "";
// JSONArray customDoc = getCustomDoc(docRequest);
// //如果用友返回不为空
// if (customDoc != null) {
// codeFromCustomDoc = getCodeFromCustomDoc(customDoc, lbname2);
// if (codeFromCustomDoc != null) {
// jsonObject1.put("auxiliary_item_b", lbname2 + ":" + codeFromCustomDoc + "/" + lbname);
// }
//
// }
}
}
......@@ -255,4 +262,24 @@ public class WagesServiceImpl implements WagesService {
}
return code;
}
//用友接口获取项目
private String getCodeByName( String name,String mineId) {
String code = null;
JSONObject jsonObject = new JSONObject();
jsonObject.put("pageIndex",1L);
jsonObject.put("pageSize",1000L);
jsonObject.put("name",name);
ReturnResult accSubject = VoucherUtils.callVoucherQuery( jsonObject , ApiConstant.YFXM_URL);
JSONObject data = (JSONObject) accSubject.getData().get(0);
JSONArray recordList= data.getJSONArray("recordList");
for (Object o : recordList) {
JSONObject object = (JSONObject)o;
String orgid_code = object.getString("orgid_code");
if (orgid_code.equals(mineId)) {
code = object.getString("code");
break;
}
}
return code;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment