From 0c8f05baa3f26c51ec0038eafee636ad650d72b3 Mon Sep 17 00:00:00 2001 From: wangxuanran <3055088966@qq.com> Date: Tue, 18 Jul 2023 15:10:48 +0800 Subject: [PATCH] =?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 --- .../definitions/HrmDepartmentDefinition.java | 51 +++++++++++++++++++ .../definitions/HrmresourceDefinition.java | 22 ++++++++ .../data_async/entity/XkDataAsyncConfig.java | 15 ++++++ .../entity/XkDataAsyncConfigDetail.java | 15 ++++++ .../XkHospitalCommonDataAsyncService.java | 14 +++++ .../XkHospitalCommonDataAsyncServiceImpl.java | 39 ++++++++++++++ .../wang/xk_hospital/test/XkHospitalTest.java | 48 +++++++++++++++++ 7 files changed, 204 insertions(+) create mode 100644 src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/HrmDepartmentDefinition.java create mode 100644 src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/HrmresourceDefinition.java create mode 100644 src/main/java/com/api/xuanran/wang/xk_hospital/data_async/entity/XkDataAsyncConfig.java create mode 100644 src/main/java/com/api/xuanran/wang/xk_hospital/data_async/entity/XkDataAsyncConfigDetail.java create mode 100644 src/main/java/com/api/xuanran/wang/xk_hospital/data_async/service/XkHospitalCommonDataAsyncService.java create mode 100644 src/main/java/com/api/xuanran/wang/xk_hospital/data_async/service/impl/XkHospitalCommonDataAsyncServiceImpl.java create mode 100644 src/test/java/xuanran/wang/xk_hospital/test/XkHospitalTest.java 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/HrmDepartmentDefinition.java new file mode 100644 index 0000000..872ea51 --- /dev/null +++ b/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/HrmDepartmentDefinition.java @@ -0,0 +1,51 @@ +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; + +/** + *
+ * + * @author xuanran.wang + * @date 2023/7/18 11:13 + */ +public class HrmDepartmentDefinition implements RowDefinitionCallback { + + protected final ConfigMapper configMapper = Util.getMapper(ConfigMapper.class); + + @Override + public void rowHandle(RowDefinition rowDefinition) { + + } + + @Override + public boolean judgmentRepetition(RowDefinition rowDefinition) { + String conditionScript = rowDefinition.getConditionScript(); + String cusQuerySql = "select id from " + rowDefinition.getAssignTable() + " where " + conditionScript; + String dataId = this.configMapper.executeCusQuerySql(cusQuerySql, rowDefinition.getWhereParam(),new HashMap<>()); + if(StrUtil.isBlank(dataId)){ + RecordSet insertRs = new RecordSet(); + char separator = weaver.general.Util.getSeparator(); + //使用存储过程新增分部 + String para = "" + separator + "" + separator + + "" + separator + "" + separator + "1" + separator + ""; + insertRs.executeProc("HrmDepartment_Insert", para); + if (insertRs.next()) { + int depId = insertRs.getInt(1); + rowDefinition.setDataId(depId); + rowDefinition.getWhereParam().put("id", depId); + } + } + return true; + } +} 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 new file mode 100644 index 0000000..69a94cc --- /dev/null +++ b/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/definitions/HrmresourceDefinition.java @@ -0,0 +1,22 @@ +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/entity/XkDataAsyncConfig.java b/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/entity/XkDataAsyncConfig.java new file mode 100644 index 0000000..33532de --- /dev/null +++ b/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/entity/XkDataAsyncConfig.java @@ -0,0 +1,15 @@ +package com.api.xuanran.wang.xk_hospital.data_async.entity; + +/** + * + * + * @author xuanran.wang + * @date 2023/7/17 16:49 + */ +public class XkDataAsyncConfig { + private String modelTable; + private String configId; + private String tableType; + private String cusTable; + private String deleteInterface; +} diff --git a/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/entity/XkDataAsyncConfigDetail.java b/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/entity/XkDataAsyncConfigDetail.java new file mode 100644 index 0000000..e67634c --- /dev/null +++ b/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/entity/XkDataAsyncConfigDetail.java @@ -0,0 +1,15 @@ +package com.api.xuanran.wang.xk_hospital.data_async.entity; + +/** + * + * + * @author xuanran.wang + * @date 2023/7/17 16:53 + */ +public class XkDataAsyncConfigDetail { + private String interfaceField; + private int interfaceFieldType; + private String modelField; + private String cusField; + private String oaFieldType; +} diff --git a/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/service/XkHospitalCommonDataAsyncService.java b/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/service/XkHospitalCommonDataAsyncService.java new file mode 100644 index 0000000..0599fdc --- /dev/null +++ b/src/main/java/com/api/xuanran/wang/xk_hospital/data_async/service/XkHospitalCommonDataAsyncService.java @@ -0,0 +1,14 @@ +package com.api.xuanran.wang.xk_hospital.data_async.service; + + +import java.util.Map; + +/** + * + * + * @author xuanran.wang + * @date 2023/7/18 10:36 + */ +public interface XkHospitalCommonDataAsyncService { + void async(String configCode, String type, Map