From 6b34fa2d7667101ddf60184b88f1eeb6de06b7ba Mon Sep 17 00:00:00 2001
From: wangxuanran <3055088966@qq.com>
Date: Wed, 19 Jul 2023 11:31:27 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=8E=B7=E5=8F=96?=
=?UTF-8?q?=E4=B8=8B=E4=B8=80=E4=B8=AA=E9=83=A8=E9=97=A8/=E4=BA=BA?=
=?UTF-8?q?=E5=91=98=E6=96=B9=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/main/java/aiyh/utils/Util.java | 33 +++++++++++++++++++
.../definitions/HrmresourceDefinition.java | 22 -------------
.../HrmDepartmentRowDefinition.java} | 9 ++---
3 files changed, 35 insertions(+), 29 deletions(-)
delete mode 100644 src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/HrmresourceDefinition.java
rename src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/{HrmDepartmentDefinition.java => row/HrmDepartmentRowDefinition.java} (84%)
diff --git a/src/main/java/aiyh/utils/Util.java b/src/main/java/aiyh/utils/Util.java
index 16c18ea..19081a2 100644
--- a/src/main/java/aiyh/utils/Util.java
+++ b/src/main/java/aiyh/utils/Util.java
@@ -4092,6 +4092,39 @@ public class Util extends weaver.general.Util {
Util.getLogger().error(getErrString(e));
}
}
+
+ /**
+ *
获取下一个人员id
+ * @author xuanran.wang
+ * @dateTime 2023/7/19 11:24
+ * @return 部门id
+ **/
+ public static int getNextDepartmentId(){
+ RecordSet insertRs = new RecordSet();
+ char separator = weaver.general.Util.getSeparator();
+ String para = "" + separator + "" + separator +
+ "" + separator + "" + separator + "3" + separator + "" + separator + "";
+ insertRs.executeProc("HrmDepartment_Insert", para);
+ if(insertRs.next()){
+ return insertRs.getInt(1);
+ }
+ return -1;
+ }
+
+ /**
+ * 获取下一个人员id
+ * @author xuanran.wang
+ * @dateTime 2023/4/12 13:24
+ * @return 人员id
+ **/
+ public static int getNextHrmId(){
+ RecordSet procRs = new RecordSet();
+ procRs.executeProc("HrmResourceMaxId_Get", "");
+ if (procRs.next()) {
+ return procRs.getInt(1);
+ }
+ return -1;
+ }
}
diff --git a/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/HrmresourceDefinition.java b/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/HrmresourceDefinition.java
deleted file mode 100644
index 69a94cc..0000000
--- a/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/HrmresourceDefinition.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.api.xuanran.wang.xk_hospital.data_async.definitions;
-
-import aiyh.utils.response_deal.entity.RowDefinition;
-import aiyh.utils.response_deal.intfaces.RowDefinitionCallback;
-
-/**
- *
- *
- * @author xuanran.wang
- * @date 2023/7/18 11:13
- */
-public class HrmresourceDefinition implements RowDefinitionCallback {
- @Override
- public void rowHandle(RowDefinition rowDefinition) {
-
- }
-
- @Override
- public boolean judgmentRepetition(RowDefinition rowDefinition) {
- return false;
- }
-}
diff --git a/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/HrmDepartmentDefinition.java b/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/row/HrmDepartmentRowDefinition.java
similarity index 84%
rename from src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/HrmDepartmentDefinition.java
rename to src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/row/HrmDepartmentRowDefinition.java
index 872ea51..8492899 100644
--- a/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/HrmDepartmentDefinition.java
+++ b/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/row/HrmDepartmentRowDefinition.java
@@ -1,17 +1,13 @@
package com.api.xuanran.wang.xk_hospital.data_async.definitions;
import aiyh.utils.Util;
-import aiyh.utils.excention.CustomerException;
-import aiyh.utils.response_deal.entity.FieldDefinition;
import aiyh.utils.response_deal.entity.RowDefinition;
import aiyh.utils.response_deal.intfaces.RowDefinitionCallback;
import aiyh.utils.response_deal.mapper.ConfigMapper;
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
-import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import java.util.HashMap;
-import java.util.List;
/**
*
@@ -25,7 +21,6 @@ public class HrmDepartmentDefinition implements RowDefinitionCallback {
@Override
public void rowHandle(RowDefinition rowDefinition) {
-
}
@Override
@@ -36,14 +31,14 @@ public class HrmDepartmentDefinition implements RowDefinitionCallback {
if(StrUtil.isBlank(dataId)){
RecordSet insertRs = new RecordSet();
char separator = weaver.general.Util.getSeparator();
- //使用存储过程新增分部
String para = "" + separator + "" + separator +
- "" + separator + "" + separator + "1" + separator + "";
+ "" + separator + "" + separator + "3" + separator + "" + separator + "";
insertRs.executeProc("HrmDepartment_Insert", para);
if (insertRs.next()) {
int depId = insertRs.getInt(1);
rowDefinition.setDataId(depId);
rowDefinition.getWhereParam().put("id", depId);
+ rowDefinition.setConditionScript(" id = #{whereItem.id}");
}
}
return true;
From 92503d432523416baa950f036d120cbe3851c76d Mon Sep 17 00:00:00 2001
From: wangxuanran <3055088966@qq.com>
Date: Wed, 19 Jul 2023 13:28:32 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/main/java/aiyh/utils/Util.java | 20 +++-
.../XkHospitalCommonDefinition.java | 105 ++++++++++++++++++
.../row/HrmDepartmentRowDefinition.java | 35 +++---
.../table/HrmDepartmentTableDefinition.java | 53 +++++++++
.../mapper/XkHospitalDataAsyncMapper.java | 24 ++++
.../XkHospitalCommonDataAsyncServiceImpl.java | 27 +++--
.../wang/xk_hospital/test/XkHospitalTest.java | 27 ++---
7 files changed, 247 insertions(+), 44 deletions(-)
create mode 100644 src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/XkHospitalCommonDefinition.java
create mode 100644 src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/table/HrmDepartmentTableDefinition.java
create mode 100644 src/main/java/com/api/xuanran/wang/xk_hospital/data_async/mapper/XkHospitalDataAsyncMapper.java
diff --git a/src/main/java/aiyh/utils/Util.java b/src/main/java/aiyh/utils/Util.java
index 19081a2..136bd19 100644
--- a/src/main/java/aiyh/utils/Util.java
+++ b/src/main/java/aiyh/utils/Util.java
@@ -4094,16 +4094,28 @@ public class Util extends weaver.general.Util {
}
/**
- * 获取下一个人员id
+ * 获取下一个部门id
* @author xuanran.wang
* @dateTime 2023/7/19 11:24
* @return 部门id
**/
public static int getNextDepartmentId(){
+ return getNextDepartmentId(1);
+ }
+
+ /**
+ * 获取下一个部门id
+ * @author xuanran.wang
+ * @dateTime 2023/7/19 11:24
+ * @param subId 分部id
+ * @return 部门id
+ **/
+ public static int getNextDepartmentId(int subId){
RecordSet insertRs = new RecordSet();
char separator = weaver.general.Util.getSeparator();
- String para = "" + separator + "" + separator +
- "" + separator + "" + separator + "3" + separator + "" + separator + "";
+ String uuid = UUID.randomUUID().toString();
+ String para = uuid + separator +uuid + separator +
+ "" + separator + "" + separator + subId + separator + 1 + separator + "";
insertRs.executeProc("HrmDepartment_Insert", para);
if(insertRs.next()){
return insertRs.getInt(1);
@@ -4111,6 +4123,8 @@ public class Util extends weaver.general.Util {
return -1;
}
+
+
/**
* 获取下一个人员id
* @author xuanran.wang
diff --git a/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/XkHospitalCommonDefinition.java b/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/XkHospitalCommonDefinition.java
new file mode 100644
index 0000000..477ed90
--- /dev/null
+++ b/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/XkHospitalCommonDefinition.java
@@ -0,0 +1,105 @@
+package com.api.xuanran.wang.xk_hospital.data_async.definitions;
+
+import aiyh.utils.ThreadPoolConfig;
+import aiyh.utils.Util;
+import aiyh.utils.response_deal.mapper.ConfigMapper;
+import com.api.xuanran.wang.xk_hospital.data_async.mapper.XkHospitalDataAsyncMapper;
+import com.engine.common.service.impl.ThemeServiceImpl;
+import org.apache.log4j.Logger;
+import weaver.hrm.company.DepartmentComInfo;
+import weaver.hrm.resource.ResourceComInfo;
+import weaver.matrix.MatrixUtil;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+
+/**
+ *
+ *
+ * @author xuanran.wang
+ * @date 2023/7/19 10:22
+ */
+public class XkHospitalCommonDefinition {
+ /**
+ * 部门表名
+ **/
+ public static final String DEPARTMENT = "hrmdepartment";
+ /**
+ * 人员表名
+ **/
+ public static final String HRM_RESOURCE = "hrmresource";
+ /**
+ * 日志对象
+ **/
+ protected static final Logger log = Util.getLogger();
+ /**
+ * 数据同步mapper
+ **/
+ protected final XkHospitalDataAsyncMapper dataAsyncMapper = Util.getMapper(XkHospitalDataAsyncMapper.class);
+ /**
+ * 执行自定义sql
+ **/
+ protected final ConfigMapper configMapper = Util.getMapper(ConfigMapper.class);
+ /**
+ * 线程池对象
+ **/
+ protected final ExecutorService threadPoolInstance = ThreadPoolConfig.createThreadPoolInstance();
+ /**
+ * 部门缓存
+ **/
+ protected static final DepartmentComInfo DEPARTMENT_COM_INFO = new DepartmentComInfo();
+ /**
+ * 人员缓存
+ **/
+ protected static ResourceComInfo RESOURCE_COM_INFO = null;
+ /**
+ * 系统主题接口
+ **/
+ protected static final ThemeServiceImpl THEME_SERVICE = new ThemeServiceImpl();
+ static {
+ try {
+ RESOURCE_COM_INFO = new ResourceComInfo();
+ }catch (Exception e){
+ log.error("人员缓存类初始化失败! " + e.getMessage());
+ Util.logErrorStr(e);
+ }
+ }
+
+ /**
+ * 同步系统缓存
+ * @param table 表名
+ * @param idList 数据id集合
+ */
+ protected void synCache(String table, List idList){
+ if (DEPARTMENT.equals(table)) {
+ threadPoolInstance.execute(()->{
+ try {
+ DEPARTMENT_COM_INFO.removeCache();
+ MatrixUtil.sysDepartmentData();
+ }catch (Exception e){
+ log.error("同步系统部门缓存error : " + e.getMessage());
+ Util.logErrorStr(e);
+ }
+ });
+ }else if(HRM_RESOURCE.equals(table)){
+ try {
+ List