Fetch the repository succeeded.
最近工作需要对接金蝶云,逛了一番金蝶社区一直没找到对应的java sdk,算了就自己写一个吧,也许对时间紧张难得动手的同学有所帮助,并且sdk已经内置了登录功能,只要提供相应的账号密码即可。基于金蝶云的webapi抽出了K3CloudTemplate,简化操作。但是目前主要提供了表单数据查询服务,有需求的同学可以fork后自己进行改造。
无特殊架构,只是一个简单的jar,但是需要基于java8+及spring环境,具体使用的框架大致如下:
框架 | 描述 |
---|---|
java | java8+ |
spring-web | 主要使用了RestTemplate进行http请求 |
lombok | 对象简化工具 |
hutool | java实用工具集 |
源码安装
git clone xxxx
jar安装
mvn clean package -Dmaven.test.skip=true
package com.link.kingdee;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.springframework.util.StringUtils;
import com.link.kingdee.k3cloud.K3CloudTemplate;
import com.link.kingdee.k3cloud.domain.Authentication;
import com.link.kingdee.k3cloud.domain.BillQuery;
import junit.framework.TestCase;
public class AppTest extends TestCase {
// 表单数据查询服务-账簿
@Test
public void testBillQuery() {
Authentication auth = new Authentication("${账套id}", "${用户名}", "${密码}", 2052);
K3CloudTemplate template = new K3CloudTemplate("${url}", auth);
List<BillQuery> params = new ArrayList<>();
String[] fieldKeys = {"FBOOKID","FNumber","FName"};
String filter = "";
BillQuery query = new BillQuery("BD_AccountBook", StringUtils.arrayToDelimitedString(fieldKeys, ","), filter, 0, 0);
query.setTopRowCount(10000);
params.add(query);
List<?> dataList = template.executeBillQuery(params, List.class);
assertNotNull(dataList);
}
}
Sign in for post a comment
Comments ( 0 )