diff --git a/README.md b/README.md
index d0fa88e..a44a1f5 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,12 @@
-
-
# ecology开发环境
> 当前项目用于有兴趣一起协同开发的同事一起使用
>
> @author youHong.ai
+**开发文档见[开发文档](开发文档.md)**
+**其他信息可在[常用信息](常用信息.md)查看**
+
## 项目构建启动
### 项目拉取配置
@@ -74,16 +75,12 @@
切换到Modules中,点击依赖项,修改sdk版本,看是否将之前的依赖是否存在,不存在点击左上角的加号导入进来
-
-
![image-20221122114849406](static/image-20221122114849406.png)
最后点击应用(apply)后点击确认(ok)等待项目构建索引完毕
-
-
### 项目配置
将你本地demo的weaver.properties文件复制到src/main/resources/web-inf/prop文件夹中
@@ -98,6 +95,7 @@
+<<<<<<< HEAD
@@ -108,6 +106,18 @@
+=======
+
+
+
+
+
+
+
+
+
+>>>>>>> a01b7872c839238409568119a0d0980f3a799c4d
```
@@ -120,20 +130,14 @@ systemFilePath=/Users/aoey.oct.22/company/Fan_wei/code/idea/ecology9-project/fil
logPath=/Users/aoey.oct.22/company/Fan_wei/code/idea/ecology9-project/log # 修改为实际的地址
```
-
-
### 测试
找到BaseTest文件,执行`public void with()`方法,如果正常执行如下即表示成功
![image-20221122124724449](static/image-20221122124724449.png)
-
-
## 使用规范
-
-
包命名时,需要使用自己的名字作为包名称,如`com.youhong.ai`, `weaver.youhong.ai`
业务代码写在个人包下面,通用工具类单独抽出来存放在`ebu7common`包下面,即`src/mian/java/ebu7common`
@@ -142,8 +146,6 @@ logPath=/Users/aoey.oct.22/company/Fan_wei/code/idea/ecology9-project/log # 修
![image-20221122125200782](static/image-20221122125200782.png)
-
-
==注意点==
> 注意事项
@@ -155,8 +157,6 @@ logPath=/Users/aoey.oct.22/company/Fan_wei/code/idea/ecology9-project/log # 修
* 遇到代码冲突时,冲突代码需要与他人沟通后处理
* maven文件中导如依赖需要注意依赖是否会和应用产生冲突
-
-
## 依赖更换
> 当前使用的依赖是Ecology9.00.2206.03的依赖
diff --git a/javascript/youhong.ai/pcn/workflow_code_block.js b/javascript/youhong.ai/pcn/workflow_code_block.js
new file mode 100644
index 0000000..95cbb39
--- /dev/null
+++ b/javascript/youhong.ai/pcn/workflow_code_block.js
@@ -0,0 +1 @@
+// 流程代码块
diff --git a/sql/youhong.ai/common_view_sql/mysql.sql b/sql/youhong.ai/common_view_sql/mysql.sql
new file mode 100644
index 0000000..d931134
--- /dev/null
+++ b/sql/youhong.ai/common_view_sql/mysql.sql
@@ -0,0 +1,72 @@
+create or replace view workflow_type_info_view as
+select wb.id,
+ wb.workflowname,
+ wt.typename,
+ wb.workflowdesc,
+ (IF(wb.version is null, 1, wb.version)) version
+from workflow_base wb
+ RIGHT JOIN workflow_type wt on wb.workflowtype = wt.id;
+
+create or replace view workflow_table_view as
+select base.id,
+ base.workflowname,
+ base.formid,
+ bill.tablename,
+ (IF(base.version is null, 1, base.version)) version
+from workflow_bill bill
+ join workflow_base base on base.formid = bill.id;
+
+create or replace view workflow_detail_table_view as
+select CONCAT(bill.id, '-', base.id) id,
+ bill.id bill_id,
+ base.id workflow_id,
+ base.workflowname,
+ base.formid main_formid,
+ bill.tablename
+from workflow_billdetailtable bill
+ join workflow_base base on base.formid = bill.billid;
+
+create or replace view workflow_field_table_view as
+select wb.id,
+ wb.fieldname,
+ concat(ht.indexdesc, ':', wb.fieldname) indexdesc,
+ (
+ case
+ when wb.detailtable is null then (select distinct tablename from workflow_bill where id = wb.billid)
+ when wb.detailtable = ''
+ then (select distinct tablename from workflow_bill where id = wb.billid)
+ else wb.detailtable
+ end
+ ) tablename,
+ billid,
+ (
+ case
+ when wb.detailtable = '' then 'main table'
+ when wb.detailtable is null then 'main table'
+ else wb.detailtable end
+ ) showtablename,
+ (case
+ when wb.fieldhtmltype = '1' then '单行文本框'
+ when wb.FIELDHTMLTYPE = '2' then '多行文本框'
+ when wb.FIELDHTMLTYPE = '3' then '流览框'
+ when wb.FIELDHTMLTYPE = '4' then 'check框'
+ when wb.FIELDHTMLTYPE = '5' then '选择框'
+ else '附件上传' end) fieldhtmltype
+from workflow_billfield wb
+ left join htmllabelindex ht on wb.fieldlabel = ht.id;
+
+create or replace view mode_bill_info_view as
+select bill.id, bill.tablename, hti.indexdesc
+from workflow_bill bill
+ left join htmllabelindex hti on hti.id = bill.namelabel
+where bill.id < 0
+ and bill.tablename like 'uf%';
+
+create or replace view workflow_node_info_view as
+select distinct nb.id,
+ nb.nodename,
+ (case when wb.version is null then 1 else wb.version end) version,
+ fn.workflowid
+from workflow_nodebase nb
+ left join workflow_flownode fn on nb.id = fn.nodeid
+ left join workflow_base wb on wb.id = fn.workflowid;
diff --git a/sql/youhong.ai/common_view_sql/oracle.sql b/sql/youhong.ai/common_view_sql/oracle.sql
new file mode 100644
index 0000000..14e960f
--- /dev/null
+++ b/sql/youhong.ai/common_view_sql/oracle.sql
@@ -0,0 +1,79 @@
+create or replace view workflow_type_info_view as
+select wb.id,
+ wb.workflowname,
+ wt.typename,
+ wb.workflowdesc,
+ (IF(wb.version is null, 1, wb.version)) version
+from workflow_base wb
+ RIGHT JOIN workflow_type wt on wb.workflowtype = wt.id
+/
+
+create or replace view workflow_table_view as
+select base.id,
+ base.workflowname,
+ base.formid,
+ bill.tablename,
+ (IF(base.version is null, 1, base.version)) version
+from workflow_bill bill
+ join workflow_base base on base.formid = bill.id
+/
+
+create or replace view workflow_detail_table_view as
+select (bill.id || '-' || base.id) id,
+ bill.id bill_id,
+ base.id workflow_id,
+ base.workflowname,
+ base.formid main_formid,
+ bill.tablename
+from workflow_billdetailtable bill
+ join workflow_base base on base.formid = bill.billid
+/
+
+
+create or replace view workflow_field_table_view as
+select wb.id,
+ wb.fieldname,
+ (ht.indexdesc || ':' || wb.fieldname) indexdesc,
+ (
+ case
+ when wb.detailtable is null then (select distinct tablename from workflow_bill where id = wb.billid)
+ when wb.detailtable = ''
+ then (select distinct tablename from workflow_bill where id = wb.billid)
+ else wb.detailtable
+ end
+ ) tablename,
+ billid,
+ (
+ case
+ when wb.detailtable = '' then 'main table'
+ when wb.detailtable is null then 'main table'
+ else wb.detailtable end
+ ) showtablename,
+ (case
+ when wb.fieldhtmltype = '1' then '单行文本框'
+ when wb.FIELDHTMLTYPE = '2' then '多行文本框'
+ when wb.FIELDHTMLTYPE = '3' then '流览框'
+ when wb.FIELDHTMLTYPE = '4' then 'check框'
+ when wb.FIELDHTMLTYPE = '5' then '选择框'
+ else '附件上传' end) fieldhtmltype
+from workflow_billfield wb
+ left join htmllabelindex ht on wb.fieldlabel = ht.id
+/
+
+create or replace view mode_bill_info_view as
+select bill.id, bill.tablename, hti.indexdesc
+from workflow_bill bill
+ left join htmllabelindex hti on hti.id = bill.namelabel
+where bill.id < 0
+ and bill.tablename like 'uf%'
+/
+
+create or replace view workflow_node_info_view as
+select distinct nb.id,
+ nb.nodename,
+ (case when wb.version is null then 1 else wb.version end) version,
+ fn.workflowid
+from workflow_nodebase nb
+ left join workflow_flownode fn on nb.id = fn.nodeid
+ left join workflow_base wb on wb.id = fn.workflowid
+/
diff --git a/sql/youhong.ai/common_view_sql/sqlserver.sql b/sql/youhong.ai/common_view_sql/sqlserver.sql
new file mode 100644
index 0000000..98781cc
--- /dev/null
+++ b/sql/youhong.ai/common_view_sql/sqlserver.sql
@@ -0,0 +1,73 @@
+create view workflow_type_info_view as
+select wb.id,
+ wb.workflowname,
+ wt.typename,
+ wb.workflowdesc,
+ (
+IF (wb.version is null, 1, wb.version)) version from workflow_base wb
+ RIGHT JOIN workflow_type wt on wb . workflowtype = wt . id;
+
+create or replace view workflow_table_view as
+select base.id,
+ base.workflowname,
+ base.formid,
+ bill.tablename,
+ (
+IF (base.version is null, 1, base.version)) version
+ from workflow_bill bill join workflow_base base on base . formid = bill . id;
+
+create or replace view workflow_detail_table_view as
+select (bill.id + '-' + base.id) id,
+ bill.id bill_id,
+ base.id workflow_id,
+ base.workflowname,
+ base.formid main_formid,
+ bill.tablename
+from workflow_billdetailtable bill
+ join workflow_base base on base.formid = bill.billid;
+
+
+create view workflow_field_table_view as
+select wb.id,
+ wb.fieldname,
+ (ht.indexdesc + ':' + wb.fieldname) indexdesc,
+ (
+ case
+ when wb.detailtable is null then (select distinct tablename from workflow_bill where id = wb.billid)
+ when wb.detailtable = ''
+ then (select distinct tablename from workflow_bill where id = wb.billid)
+ else wb.detailtable
+ end
+ ) tablename,
+ billid,
+ (
+ case
+ when wb.detailtable = '' then 'main table'
+ when wb.detailtable is null then 'main table'
+ else wb.detailtable end
+ ) showtablename,
+ (case
+ when wb.fieldhtmltype = '1' then '单行文本框'
+ when wb.FIELDHTMLTYPE = '2' then '多行文本框'
+ when wb.FIELDHTMLTYPE = '3' then '流览框'
+ when wb.FIELDHTMLTYPE = '4' then 'check框'
+ when wb.FIELDHTMLTYPE = '5' then '选择框'
+ else '附件上传' end) fieldhtmltype
+from workflow_billfield wb
+ left join htmllabelindex ht on wb.fieldlabel = ht.id;
+
+create view mode_bill_info_view as
+select bill.id, bill.tablename, hti.indexdesc
+from workflow_bill bill
+ left join htmllabelindex hti on hti.id = bill.namelabel
+where bill.id < 0
+ and bill.tablename like 'uf%';
+
+create view workflow_node_info_view as
+select distinct nb.id,
+ nb.nodename,
+ (case when wb.version is null then 1 else wb.version end) version,
+ fn.workflowid
+from workflow_nodebase nb
+ left join workflow_flownode fn on nb.id = fn.nodeid
+ left join workflow_base wb on wb.id = fn.workflowid;
diff --git a/src/main/java/ebu7common/youhong/ai/csv/ReadCsvUtil.java b/src/main/java/ebu7common/youhong/ai/csv/ReadCsvUtil.java
new file mode 100644
index 0000000..5567d6f
--- /dev/null
+++ b/src/main/java/ebu7common/youhong/ai/csv/ReadCsvUtil.java
@@ -0,0 +1,70 @@
+package ebu7common.youhong.ai.csv;
+
+import aiyh.utils.excention.CustomerException;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ *
读取csv文件
+ *
+ * create: 2022-11-23 17:19
+ *
+ * @author youHong.ai
+ */
+
+public class ReadCsvUtil {
+
+
+ /**
+ * 读取csv文件数据
+ *
+ * @param path csv文件路径
+ * @return csv文件shave
+ */
+ public static List> readCsvFromPath(String path) {
+ try {
+ return readScvFromInputStream(new FileInputStream(path));
+ } catch (FileNotFoundException e) {
+ throw new CustomerException("[读取CSV文件,插入数据时,读取文件异常]");
+ }
+ }
+
+
+ /**
+ * 读取csv文件
+ *
+ * @param inputStream 文件流
+ * @return csv文件
+ */
+ public static List> readScvFromInputStream(InputStream inputStream) {
+ List> tableInfo = new ArrayList<>();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+ String[] fieldsArr = null;
+ String line = null;
+ try {
+ while ((line = reader.readLine()) != null) {
+ String str;
+ line += ",";
+ Pattern pCells = Pattern
+ .compile("(\"[^\"]*(\"{2})*[^\"]*\")*[^,]*,");
+ Matcher mCells = pCells.matcher(line);
+ List cells = new ArrayList<>();
+ while (mCells.find()) {
+ str = mCells.group();
+ str = str.replaceAll(
+ "(?sm)\"?([^\"]*(\"{2})*[^\"]*)\"?.*,", "$1");
+ str = str.replaceAll("(?sm)(\"(\"))", "$2");
+ cells.add(str);
+ }
+ tableInfo.add(cells);
+ }
+ } catch (IOException e) {
+ throw new CustomerException("无法读取文件数据!", e);
+ }
+ return tableInfo;
+ }
+}
diff --git a/src/main/java/ebu7common/youhong/ai/csv/entity/CsvTable.java b/src/main/java/ebu7common/youhong/ai/csv/entity/CsvTable.java
new file mode 100644
index 0000000..8e760f5
--- /dev/null
+++ b/src/main/java/ebu7common/youhong/ai/csv/entity/CsvTable.java
@@ -0,0 +1,128 @@
+package ebu7common.youhong.ai.csv.entity;
+
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * csv表信息
+ *
+ * create: 2022-11-23 17:19
+ *
+ * @author youHong.ai
+ */
+
+@Setter
+@Getter
+@ToString
+public class CsvTable {
+
+ private List csvRows = new ArrayList<>();
+
+ private CsvTableHeard csvTableHeard;
+
+ private int rowSize = 0;
+
+
+ public void setCsvTableHeard(CsvTableHeard csvTableHeard) {
+ this.csvTableHeard = csvTableHeard;
+ this.rowSize++;
+
+ }
+
+ public void addRow(CsvRow csvRow) {
+ csvRows.add(csvRow);
+ rowSize++;
+ }
+
+
+ /**
+ * csv列数据
+ *
+ * create: 2022-11-23 17:21
+ *
+ * @author youHong.ai
+ */
+
+ @Setter
+ @Getter
+ @ToString
+ static class CsvColumn {
+
+
+ }
+
+
+ /**
+ * csv表行数据
+ *
+ * create: 2022-11-23 17:21
+ *
+ * @author youHong.ai
+ */
+
+ @Setter
+ @Getter
+ @ToString
+ static class CsvRow {
+ private List csvColumns = new ArrayList<>();
+ private int rowSize = 0;
+
+ public void add(CsvColumn csvColumn) {
+ csvColumns.add(csvColumn);
+ rowSize++;
+ }
+
+
+ }
+
+
+ /**
+ * csv表头数据
+ *
+ * create: 2022-11-23 17:21
+ *
+ * @author youHong.ai
+ */
+ @ToString
+ static class CsvTableHeard {
+ private List heard;
+
+ private Map mapping;
+
+ private int heardSize = 0;
+
+ public void addHeard(String value) {
+ if (heard == null) {
+ this.heard = new ArrayList<>();
+ this.mapping = new HashMap<>();
+ }
+ mapping.put(value, heardSize++);
+ heard.add(value);
+ }
+
+ public int getHeardRow(String value) {
+ if (mapping != null) {
+ return mapping.get(value);
+ }
+ return -1;
+ }
+
+ public String getHeard(int columnIndex) {
+ if (heard != null) {
+ return this.heard.get(columnIndex);
+ }
+ return null;
+ }
+
+ }
+
+
+}
+
diff --git a/src/main/java/ebu7common/youhong/ai/sftp/SftpConnectUtil.java b/src/main/java/ebu7common/youhong/ai/sftp/SftpConnectUtil.java
index 3395123..4422314 100644
--- a/src/main/java/ebu7common/youhong/ai/sftp/SftpConnectUtil.java
+++ b/src/main/java/ebu7common/youhong/ai/sftp/SftpConnectUtil.java
@@ -1,15 +1,18 @@
package ebu7common.youhong.ai.sftp;
+import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import com.jcraft.jsch.*;
import lombok.Getter;
import lombok.NoArgsConstructor;
+import weaver.general.GCONST;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
+import java.io.*;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.util.Hashtable;
import java.util.Properties;
+import java.util.UUID;
import java.util.Vector;
/**
@@ -68,8 +71,16 @@ public class SftpConnectUtil extends ChannelSftp {
private Integer sftpTimeOut;
- public SftpConnectUtil(String userName, String prvKeyFilePath,String password, String sftpIp,
- Integer port, Integer sftpTimeOut) {
+ /**
+ * @param userName 用户姓名
+ * @param prvKeyFilePath 密钥文件地址
+ * @param password 密码 (密钥文件随便传递一个)
+ * @param sftpIp 链接ip地址
+ * @param port 端口
+ * @param sftpTimeOut 超时时间
+ * @author youHong.ai
+ */
+ public SftpConnectUtil(String userName, String prvKeyFilePath, String password, String sftpIp, Integer port, Integer sftpTimeOut) {
this.userName = userName;
this.prvKeyFilePath = prvKeyFilePath;
this.sftpIp = sftpIp;
@@ -86,8 +97,7 @@ public class SftpConnectUtil extends ChannelSftp {
* @author youHong.ai
*/
- private void login() {
-
+ private void login() {
JSch jSch = new JSch();
try {
if (prvKeyFilePath != null && !"".equals(prvKeyFilePath)) {
@@ -97,7 +107,7 @@ public class SftpConnectUtil extends ChannelSftp {
jSch.addIdentity(prvKeyFilePath);
}
} else {
- throw new RuntimeException("从sftp下载需要的ppk文件未找到");
+ throw new RuntimeException("从sftp下载需要的ppk/pem文件未找到");
}
if (port != null && port > 0) {
this.session = jSch.getSession(userName, sftpIp, port);
@@ -114,10 +124,153 @@ public class SftpConnectUtil extends ChannelSftp {
this.sftp = (ChannelSftp) channel;
this.success = true;
} catch (JSchException e) {
+ this.close();
throw new CustomerException("SFTP链接失败!", e);
}
}
+
+ /**
+ * 下载文件
+ *
+ * @param remoteFile 远程文件名(路径)
+ * @param localeFile 本地文件名
+ * @return 本地文件路径
+ * @throws IOException io异常
+ * @author youHong.ai
+ */
+ public String downFile(String remoteFile, String localeFile) throws IOException {
+ if (!isExist(remoteFile)) {
+ throw new FileNotFoundException("远程文件未找到!no search remote file");
+ }
+ try {
+ File file = new File(localeFile);
+ if (!file.exists()) {
+ boolean mkdirs = file.getParentFile().mkdirs();
+ if (!mkdirs) {
+ throw new CustomerException("无法创建目录(can not create dirs):[" + localeFile + "]");
+ }
+ } else {
+ String parent = file.getParent();
+ String name = file.getName();
+ if (null == parent) {
+ parent = GCONST.getSysFilePath();
+ }
+ if (!parent.endsWith(String.valueOf(File.separatorChar))) {
+ parent = parent + File.separatorChar;
+ }
+ localeFile = parent + System.currentTimeMillis() + UUID.randomUUID() + "_" + name;
+ }
+ this.get(remoteFile, Files.newOutputStream(Paths.get(localeFile)));
+ return localeFile;
+ } catch (SftpException e) {
+ throw new CustomerException("下载文件出错,down file error!");
+ }
+ }
+
+ /**
+ * 下载文件到系统文件目录中
+ *
+ * @param remoteFile 远程文件全路径
+ * @param localeFileName 下载后的文件名称,只需要名称
+ * @return 下载后的文件路径
+ * @throws IOException IO异常
+ */
+ public String downFileToSystemFilePath(String remoteFile, String localeFileName) throws IOException {
+ return this.downFile(remoteFile, GCONST.getSysFilePath() + localeFileName);
+ }
+
+
+ /**
+ * 下载文件到系统中,并生成docId
+ *
+ * @param remoteFile 远程文件路径
+ * @param catalogue doc目录id
+ * @param userId 文件创建者id
+ * @return docId
+ * @throws Exception 异常信息
+ */
+ public int downFileToDoc(String remoteFile, int catalogue, int userId) throws Exception {
+ if (!this.isExist(remoteFile)) {
+ throw new FileNotFoundException("远程文件未找到!no search remote file");
+ }
+ Vector ls = null;
+ try {
+ ls = this.ls(remoteFile);
+ } catch (SftpException e) {
+ throw new CustomerException("无法查询当前文件信息!can not find file info~", e);
+ }
+ if (ls.size() == 0) {
+ throw new CustomerException("无法查询当前文件信息,ls 大小为0!can not find file info~ls size is 0");
+ }
+ String fileName = null;
+// 查看远程文件文件名
+ for (int i = 0; i < ls.size(); i++) {
+ Object obj = ls.elementAt(i);
+ if (obj instanceof com.jcraft.jsch.ChannelSftp.LsEntry) {
+ LsEntry entry = (LsEntry) obj;
+ if (!entry.getAttrs().isDir()) {
+ fileName = entry.getFilename();
+ }
+ if (entry.getAttrs().isDir()) {
+ if (!entry.getFilename().equals(".") && !entry.getFilename().equals("..")) {
+ fileName = entry.getFilename();
+ }
+ }
+ }
+ }
+ if (null == fileName) {
+ throw new CustomerException("无法自动获取文件名!");
+ }
+ InputStream inputStream;
+ try {
+ inputStream = this.get(remoteFile);
+ } catch (SftpException e) {
+ throw new CustomerException("下载文件是出错!down file error", e);
+ }
+ this.get(remoteFile);
+ int docId = Util.createDoc(fileName, catalogue, inputStream, userId);
+ return docId;
+ }
+
+ /**
+ * 下载文件流
+ *
+ * @param remoteFile 远程文件路径
+ * @return 文件流
+ * @throws FileNotFoundException 文件未找到
+ */
+ public InputStream down(String remoteFile) throws FileNotFoundException {
+ if (!this.isExist(remoteFile)) {
+ throw new FileNotFoundException("远程文件未找到!no search remote file");
+ }
+ try {
+ return this.get(remoteFile);
+ } catch (SftpException e) {
+ throw new CustomerException("下载文件是出错!down file error", e);
+ }
+ }
+
+ /**
+ * 判断文件是否存在
+ *
+ * @param remotePath 远程文件路径
+ * @return 是否存在
+ */
+ public boolean isExist(String remotePath) {
+ try {
+ this.ls(remotePath);
+ return true;
+ } catch (SftpException ignore) {
+ }
+ try {
+ this.lstat(remotePath);
+ return true;
+ } catch (SftpException e) {
+ return false;
+ }
+ }
+
/**
* 关闭连接 server
*
@@ -139,7 +292,7 @@ public class SftpConnectUtil extends ChannelSftp {
/**
* 关闭链接释放资源
*/
- public void close(){
+ public void close() {
this.login();
}
@@ -149,13 +302,13 @@ public class SftpConnectUtil extends ChannelSftp {
}
@Override
- public void setBulkRequests(int bulk_requests) throws JSchException {
- this.sftp.setBulkRequests(bulk_requests);
+ public int getBulkRequests() {
+ return this.sftp.getBulkRequests();
}
@Override
- public int getBulkRequests() {
- return this.sftp.getBulkRequests();
+ public void setBulkRequests(int bulk_requests) throws JSchException {
+ this.sftp.setBulkRequests(bulk_requests);
}
@Override
@@ -168,21 +321,11 @@ public class SftpConnectUtil extends ChannelSftp {
return this.sftp.isEOF();
}
- @Override
- public void setInputStream(InputStream in) {
- this.sftp.setInputStream(in);
- }
-
@Override
public void setInputStream(InputStream in, boolean dontclose) {
this.sftp.setInputStream(in, dontclose);
}
- @Override
- public void setOutputStream(OutputStream out) {
- this.sftp.setOutputStream(out);
- }
-
@Override
public void setOutputStream(OutputStream out, boolean dontclose) {
this.sftp.setOutputStream(out, dontclose);
@@ -203,6 +346,11 @@ public class SftpConnectUtil extends ChannelSftp {
return this.sftp.getInputStream();
}
+ @Override
+ public void setInputStream(InputStream in) {
+ this.sftp.setInputStream(in);
+ }
+
@Override
public InputStream getExtInputStream() throws IOException {
return this.sftp.getExtInputStream();
@@ -213,6 +361,11 @@ public class SftpConnectUtil extends ChannelSftp {
return this.sftp.getOutputStream();
}
+ @Override
+ public void setOutputStream(OutputStream out) {
+ this.sftp.setOutputStream(out);
+ }
+
@Override
public void quit() {
this.sftp.quit();
diff --git a/src/main/java/weaver/youhong/ai/pcn/hrorganization/service/OranizationAsyncService.java b/src/main/java/weaver/youhong/ai/pcn/hrorganization/service/OrganizationAsyncService.java
similarity index 81%
rename from src/main/java/weaver/youhong/ai/pcn/hrorganization/service/OranizationAsyncService.java
rename to src/main/java/weaver/youhong/ai/pcn/hrorganization/service/OrganizationAsyncService.java
index c7313df..2776e48 100644
--- a/src/main/java/weaver/youhong/ai/pcn/hrorganization/service/OranizationAsyncService.java
+++ b/src/main/java/weaver/youhong/ai/pcn/hrorganization/service/OrganizationAsyncService.java
@@ -8,7 +8,7 @@ package weaver.youhong.ai.pcn.hrorganization.service;
* @author youHong.ai
*/
-public class OranizationAsyncService {
+public class OrganizationAsyncService {
}
diff --git a/src/main/java/weaver/youhong/ai/pcn/hrorganization/sftp/FetchDataUtil.java b/src/main/java/weaver/youhong/ai/pcn/hrorganization/sftp/FetchDataUtil.java
deleted file mode 100644
index 713f78e..0000000
--- a/src/main/java/weaver/youhong/ai/pcn/hrorganization/sftp/FetchDataUtil.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package weaver.youhong.ai.pcn.hrorganization.sftp;
-
-import ebu7common.youhong.ai.sftp.SftpConnectUtil;
-import com.jcraft.jsch.ChannelSftp;
-import com.jcraft.jsch.SftpException;
-
-import java.io.*;
-
-/**
- * 获取数据工具
- *
- * create: 2022-11-22 14:48
- *
- * HRIS_PositionExport20221119 职位文件名称
- * HRIS_EmployeeExport20210825 人员文件名称
- * HRIS_DepartmentExport20200503 部门文件名称
- *
- * @author youHong.ai
- */
-
-public class FetchDataUtil {
-
-
-
-
- public FetchDataUtil(){
-
- }
-
-
-
- public void downloadFile(SftpConnectUtil sftpConnectUtil,
- String fileName, String targetFile){
- try {
- // sftpConnectUtil.lcd(".");
- // Vector ls = sftpConnectUtil.ls(".");
- // for (Object l : ls) {
- // System.out.println(l);
- // }
- //
- File file = new File(targetFile);
- if (!file.exists()) {
- file.getParentFile().mkdirs();
- }
- sftpConnectUtil.get(fileName,new FileOutputStream(targetFile));
-
-
- } catch (SftpException e) {
- sftpConnectUtil.close();
- e.printStackTrace();
- // throw new CustomerException("下载文件出错,down file error!");
- } catch (FileNotFoundException e) {
- throw new RuntimeException(e);
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/weaver/youhong/ai/pcn/hrorganization/wesmat/SyncOrganizationForOtherAPI.java b/src/main/java/weaver/youhong/ai/pcn/hrorganization/wesmat/SyncOrganizationForOtherAPI.java
new file mode 100644
index 0000000..465d9df
--- /dev/null
+++ b/src/main/java/weaver/youhong/ai/pcn/hrorganization/wesmat/SyncOrganizationForOtherAPI.java
@@ -0,0 +1,213 @@
+package weaver.youhong.ai.pcn.hrorganization.wesmat;
+
+import aiyh.utils.Util;
+import aiyh.utils.zwl.common.ToolUtil;
+import com.weaver.esb.server.cache.ResourceComInfo;
+import weaver.hrm.company.DepartmentComInfo;
+import weaver.hrm.company.SubCompanyComInfo;
+import weaver.hrm.job.JobTitlesComInfo;
+import weaver.hrm.resource.HrmSynDAO;
+import weaver.integration.logging.Logger;
+import weaver.integration.logging.LoggerFactory;
+import weaver.interfaces.hrm.*;
+import weaver.matrix.MatrixUtil;
+import weaver.youhong.ai.pcn.hrorganization.wesmat.model.Department;
+import weaver.youhong.ai.pcn.hrorganization.wesmat.model.Employee;
+import weaver.youhong.ai.pcn.hrorganization.wesmat.model.Position;
+import weaver.youhong.ai.pcn.hrorganization.wesmat.result.GetOrganizationResult;
+import weaver.youhong.ai.pcn.hrorganization.wesmat.util.SyncOrganizationUtils;
+
+import java.util.*;
+
+
+/**
+ * @author EBU7-dev1-ayh
+ * @create 2021/7/20 0020 15:16
+ * 同步第三方系统人员组织结构
+ */
+
+
+public class SyncOrganizationForOtherAPI extends ToolUtil implements HrmSynService {
+ private final Logger log = LoggerFactory.getLogger(SyncOrganizationForOtherAPI.class);
+ private final GetOrganizationResult getOrganizationResult = new GetOrganizationResult();
+ private final SyncOrganizationUtils organizationUtils = new SyncOrganizationUtils();
+ String className = "SyncOrganizationForOtherAPI";
+ private HashMap synResult;
+
+ public SyncOrganizationForOtherAPI() {
+ this.writeDebuggerLog(className, "===========> create Object! <============");
+ this.synResult = new HashMap<>();
+ }
+
+ /**
+ * 同步到分公司(分部)
+ */
+ @Override
+ public String SynTimingToOASubCompany() {
+ this.writeDebuggerLog(className, "===========> synchronous company to OA system start <============");
+ this.synResult.put("1", null);
+ this.writeDebuggerLog(className, "===========> synchronous company to OA system end <============");
+ return null;
+ }
+
+ /**
+ * 同步到部门
+ */
+ @Override
+ public String SynTimingToOADepartment() {
+ this.writeDebuggerLog(className, "===========> synchronous department to OA system starts <============");
+ try {
+ List departmentList = getOrganizationResult.getDepartmentList();
+ Collections.sort(departmentList);
+ List