wzy 3 ay önce
ebeveyn
işleme
57f361fba7

+ 80 - 0
mjava-jinlun/pom.xml

@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.2.0.RELEASE</version> <!-- 使用最新的稳定版或其他适用版本 -->
+        <relativePath/> <!-- lookup parent from repository -->
+    </parent>
+
+    <groupId>com.malk.jinlun</groupId>
+    <artifactId>mjava-jinlun</artifactId>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.malk</groupId>
+            <artifactId>base</artifactId>
+            <version>1.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.example</groupId>
+            <artifactId>k3cloud</artifactId>
+            <version>8.0.6</version>
+        </dependency>
+        <dependency>
+            <groupId>com.example</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.8.0</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <finalName>jinlun</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <version>3.1</version>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                    <encoding>UTF-8</encoding>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <executable>true</executable>
+                    <includeSystemScope>true</includeSystemScope>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 17 - 0
mjava-jinlun/src/main/java/com/malk/jinlun/JinlunApplication.java

@@ -0,0 +1,17 @@
+package com.malk.jinlun;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+@SpringBootApplication(scanBasePackages = {"com.malk"})
+@EnableScheduling
+public class JinlunApplication {
+    public static void main(String[] args) {
+        try {
+            SpringApplication.run(JinlunApplication.class,args);
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+    }
+}

+ 24 - 0
mjava-jinlun/src/main/java/com/malk/jinlun/config/KDWebApiConf.java

@@ -0,0 +1,24 @@
+package com.malk.jinlun.config;
+
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Data
+@Component
+@ConfigurationProperties(prefix = "kingdee")
+@Slf4j
+public class KDWebApiConf {
+
+    private String XKDApiAcctID;
+
+    private String XKDApiUserName;
+
+    private String XKDApiAppID;
+
+    private String XKDApiAppSec;
+
+    private String XKDApiServerUrl;
+
+}

+ 29 - 0
mjava-jinlun/src/main/java/com/malk/jinlun/config/KDWebApiConfig.java

@@ -0,0 +1,29 @@
+package com.malk.jinlun.config;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+public class KDWebApiConfig {
+    private Properties properties = new Properties();
+
+    public KDWebApiConfig(String filePath) throws IOException {
+        try (FileInputStream input = new FileInputStream(filePath)) {
+            properties.load(input);
+        }
+    }
+
+    public String getProperty(String key) {
+        return properties.getProperty(key);
+    }
+
+    public static void main(String[] args) {
+        try {
+            KDWebApiConfig config = new KDWebApiConfig("mjava-jianhui/src/main/resources/application-dev.yml");
+            System.out.println("AcctID: " + config.getProperty("X-KDApi-AcctID"));
+            // 打印其他属性...
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 20 - 0
mjava-jinlun/src/main/java/com/malk/jinlun/controller/JinlunController.java

@@ -0,0 +1,20 @@
+package com.malk.jinlun.controller;
+
+import com.malk.jinlun.service.JinlunService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class JinlunController {
+    @Autowired
+    private JinlunService jinlunService;
+
+    public void test(){
+        try {
+            jinlunService.test();
+        }catch (Exception e){
+
+        }
+
+    }
+}

+ 18 - 0
mjava-jinlun/src/main/java/com/malk/jinlun/entity/BillQuery.java

@@ -0,0 +1,18 @@
+package com.malk.jinlun.entity;
+
+import lombok.Data;
+
+import java.util.List;
+import java.util.Map;
+
+@Data
+public class BillQuery {
+    private String FormId;
+    private String FieldKeys;
+    private List<Map> FilterString;
+    private String OrderString;
+    private int TopRowCount;
+    private int StartRow;
+    private int Limit;
+    private String SubSystemId;
+}

+ 5 - 0
mjava-jinlun/src/main/java/com/malk/jinlun/service/JinlunService.java

@@ -0,0 +1,5 @@
+package com.malk.jinlun.service;
+
+public interface JinlunService {
+    void test() throws Exception;
+}

+ 62 - 0
mjava-jinlun/src/main/java/com/malk/jinlun/service/impl/JinlunServiceImpl.java

@@ -0,0 +1,62 @@
+package com.malk.jinlun.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.kingdee.bos.webapi.entity.IdentifyInfo;
+import com.kingdee.bos.webapi.sdk.K3CloudApi;
+import com.malk.jinlun.config.KDWebApiConf;
+import com.malk.jinlun.entity.BillQuery;
+import com.malk.jinlun.service.JinlunService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class JinlunServiceImpl implements JinlunService {
+    @Autowired
+    private KDWebApiConf kdWebApiConf;
+
+    @Override
+    public void test() throws Exception {
+        K3CloudApi client = new K3CloudApi(initIden());
+
+        List<Map> result = new ArrayList<>();
+        List<Map> customerList = new ArrayList<>();
+
+        int startRow = 0;
+        int limit = 100;
+
+        BillQuery billQuery = new BillQuery();
+        billQuery.setFormId("BD_MATERIAL");
+        billQuery.setFieldKeys("FNumber,FName");
+        /*List<Map> filterString = new ArrayList<>();
+        //修改时间为昨天到今天
+        filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FModifyDate","265","1","","","0"));
+//            filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FModifyDate","39","2025-03-06 00:00:00","","","0"));
+        billQuery.setFilterString(filterString);*/
+        billQuery.setLimit(limit);
+        billQuery.setStartRow(startRow);
+
+        String s = client.billQuery(JSONObject.toJSONString(billQuery));
+        result = (List<Map>)JSONObject.parse(s);
+
+        System.out.println("111");
+    }
+
+    private IdentifyInfo initIden(){
+        //注意 1:此处不再使用参数形式传入用户名及密码等敏感信息,改为在登录配置文件中设置。
+        //注意 2:必须先配置第三方系统登录授权信息后,再进行业务操作,详情参考各语言版本SDK介绍中的登录配置文件说明。
+        //读取配置,初始化SDK
+        IdentifyInfo iden = new IdentifyInfo();
+        iden.setUserName(kdWebApiConf.getXKDApiUserName());
+        iden.setAppId(kdWebApiConf.getXKDApiAppID());
+        iden.setdCID(kdWebApiConf.getXKDApiAcctID());
+        iden.setAppSecret(kdWebApiConf.getXKDApiAppSec());
+        iden.setServerUrl(kdWebApiConf.getXKDApiServerUrl());
+
+        return iden;
+    }
+
+}

+ 47 - 0
mjava-jinlun/src/main/resources/application-dev.yml

@@ -0,0 +1,47 @@
+server:
+  port: 9035
+  servlet:
+    context-path: /jinlun
+
+enable:
+  scheduling: false
+logging:
+  config: classpath:logback-spring.xml
+  path: d:\\jinlun_cloudpure\logs\
+  level:
+    com.malk.*: debug
+
+# dingtalk
+dingtalk:
+  agentId: 3366214854
+  appKey: dingntvkzjzxdx8h2m1s
+  appSecret: YfaV5mYOL4F--P8P_G9aD8DP_a8_IgM6dBILsSaTb4LeUZYSntacol55O1tJuqcU
+  corpId: ding923faa53d9d45937acaaa37764f94726
+  aesKey:
+  token:
+  operator: 344749020127590108
+
+aliwork:
+  appType: APP_XPPVVMG6HA0GNDPJV4C1
+  systemToken: 8R7668D1P92RSNTS7OKZG5UR9P333QA7GAJ4MTG
+
+kingdee:
+# 第三方系统登录授权的账套ID
+  X-KDApi-AcctID: 66816d8a115ffc
+  # 第三方系统登录授权的用户
+  X-KDApi-UserName: Administrator
+  # 第三方系统登录授权的应用ID
+  X-KDApi-AppID: 295561_7e1I0bHHVqGaSZxJ7Z4pVxxs7L5bxMMI
+  # 第三方系统登录授权的应用密钥
+  X-KDApi-AppSec: 0f51467e39764b548ec3d75159dfbd2b
+  # 服务Url地址(公有云统一走网关sdk底层已处理,无需传X-KDApi-ServerUrl,下面这行需要注释)
+  X-KDApi-ServerUrl: http://192.168.0.87/k3Cloud/
+  # 账套语系,默认2052
+  # X-KDApi-LCID: 2052
+  # 组织编码,启用多组织时配置对应的组织编码才有效
+  # X-KDApi-OrgNum: 100
+  # 允许的最大连接延时,单位为秒
+  # X-KDApi-ConnectTimeout: 120
+  # 允许的最大读取延时,单位为秒
+  # X-KDApi-RequestTimeout: 120
+

+ 47 - 0
mjava-jinlun/src/main/resources/application-prod.yml

@@ -0,0 +1,47 @@
+server:
+  port: 9035
+  servlet:
+    context-path: /jinlun
+
+enable:
+  scheduling: false
+logging:
+  config: classpath:logback-spring.xml
+  path: d:\\jinlun_cloudpure\logs\
+  level:
+    com.malk.*: INFO
+
+# dingtalk
+dingtalk:
+  agentId: 3366214854
+  appKey: dingntvkzjzxdx8h2m1s
+  appSecret: YfaV5mYOL4F--P8P_G9aD8DP_a8_IgM6dBILsSaTb4LeUZYSntacol55O1tJuqcU
+  corpId: ding923faa53d9d45937acaaa37764f94726
+  aesKey:
+  token:
+  operator: 344749020127590108
+
+aliwork:
+  appType: APP_XPPVVMG6HA0GNDPJV4C1
+  systemToken: 8R7668D1P92RSNTS7OKZG5UR9P333QA7GAJ4MTG
+
+kingdee:
+  # 第三方系统登录授权的账套ID
+  X-KDApi-AcctID: 66816d8a115ffc
+  # 第三方系统登录授权的用户
+  X-KDApi-UserName: Administrator
+  # 第三方系统登录授权的应用ID
+  X-KDApi-AppID: 295561_7e1I0bHHVqGaSZxJ7Z4pVxxs7L5bxMMI
+  # 第三方系统登录授权的应用密钥
+  X-KDApi-AppSec: 0f51467e39764b548ec3d75159dfbd2b
+  # 服务Url地址(公有云统一走网关sdk底层已处理,无需传X-KDApi-ServerUrl,下面这行需要注释)
+  X-KDApi-ServerUrl: http://192.168.0.87/k3Cloud/
+  # 账套语系,默认2052
+  # X-KDApi-LCID: 2052
+  # 组织编码,启用多组织时配置对应的组织编码才有效
+  # X-KDApi-OrgNum: 100
+  # 允许的最大连接延时,单位为秒
+  # X-KDApi-ConnectTimeout: 120
+  # 允许的最大读取延时,单位为秒
+  # X-KDApi-RequestTimeout: 120
+

+ 15 - 0
mjava-jinlun/src/main/resources/application.yml

@@ -0,0 +1,15 @@
+spring:
+  profiles:
+    active: dev
+  servlet:
+    multipart:
+      max-file-size: 100MB
+      max-request-size: 100MB
+  http:
+    enabled: false
+
+#  configuration:
+#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+  global-config:
+    db-config:
+      id-type: auto

+ 61 - 0
mjava-jinlun/src/main/resources/logback-spring.xml

@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration debug="false" scan="false" scanPeriod="60 seconds">
+    <springProperty scope="context" name="LOG_HOME" source="logging.path" defaultValue="d:\\jianhui_cloudpure\logs\"/>
+    <property name="FileNamePattern" value="${LOG_HOME}%d{yyyyMM}/%d{dd}"/>
+
+    <!-- 定义控制台输出 -->
+    <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
+        <layout class="ch.qos.logback.classic.PatternLayout">
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} - [%thread] - %-5level - %logger{50} - %msg%n</pattern>
+        </layout>
+    </appender>
+
+    <appender name="appLogAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <!-- 指定日志文件的名称 -->
+        <!--<file>${FileNamePattern}/info.log</file>-->
+
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>${FileNamePattern}/info-%i.log</fileNamePattern>
+            <MaxHistory>30</MaxHistory>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <MaxFileSize>30MB</MaxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+
+        <layout class="ch.qos.logback.classic.PatternLayout">
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [ %thread ] - [ %-5level ] [ %logger{50} : %line ] - %msg%n</pattern>
+        </layout>
+    </appender>
+
+    <appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender">
+        <discriminator>
+            <Key>processid</Key>
+            <DefaultValue>sys</DefaultValue>
+        </discriminator>
+        <sift>
+            <appender name="FILE-${processid}"
+                      class="ch.qos.logback.core.rolling.RollingFileAppender">
+                <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+                    <FileNamePattern>
+                        ${FileNamePattern}/${processid}.log
+                    </FileNamePattern>
+                </rollingPolicy>
+                <layout class="ch.qos.logback.classic.PatternLayout">
+                    <Pattern>
+                        %d{yyyyMMdd:HH:mm:ss.SSS} [%thread] %-5level %msg%n
+                    </Pattern>
+                </layout>
+            </appender>
+        </sift>
+    </appender>
+
+
+    <!-- 日志输出级别 -->
+    <logger name="org.springframework" level="debug"  additivity="false"/>
+    <logger name="com.malk.connecter" level="debug"/>
+    <root level="INFO">
+        <appender-ref ref="stdout"/>
+        <appender-ref ref="appLogAppender"/>
+        <appender-ref ref="SIFT"/>
+    </root>
+</configuration>

+ 26 - 0
mjava-jinlun/src/test/java/com/malk/jinlun/DdTest.java

@@ -0,0 +1,26 @@
+package com.malk.jinlun;
+
+import com.malk.jinlun.service.JinlunService;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@Slf4j
+@SpringBootTest
+@RunWith(SpringRunner.class)
+public class DdTest {
+    @Autowired
+    private JinlunService jinlunService;
+
+
+    @Test
+    public void test() throws Exception {
+
+        jinlunService.test();
+
+    }
+
+}

+ 15 - 0
mjava-jiuan/src/main/resources/application.yml

@@ -0,0 +1,15 @@
+spring:
+  profiles:
+    active: dev
+  servlet:
+    multipart:
+      max-file-size: 100MB
+      max-request-size: 100MB
+  http:
+    enabled: false
+
+#  configuration:
+#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+  global-config:
+    db-config:
+      id-type: auto