From d78176c580b16385181dccbaf27ecc6a16e2d6ae Mon Sep 17 00:00:00 2001
From: wangxuanran <3055088966@qq.com>
Date: Thu, 4 May 2023 14:34:40 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=A4=87=E4=BB=BD?=
=?UTF-8?q?=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../controller/OtherSystemToOAController.java | 66 ++
.../sso/mapper/OtherSystemToOAMapper.java | 44 +
.../sso/service/OtherSystemToOAService.java | 49 ++
.../impl/OtherSystemToOAServiceImpl.java | 97 +++
.../BatchCreateWorkFlowController.java | 2 +-
.../shyl/controller/GetStudentsClass.java | 2 +-
.../service/BatchCreateWorkflowService.java | 4 +-
.../controller/EmailOutSendController.java | 45 +
.../email/entity/EmailOutConfigDetail.java | 17 +
.../email/entity/EmailOutConfigMain.java | 21 +
.../email/mapper/EmailOutSendMapper.java | 42 +
.../email/service/EmailOutSendService.java | 17 +
.../service/impl/EmailOutSendServiceImpl.java | 120 +++
.../wang/common/mapper/CommonMapper.java | 9 +
.../xuanran/wang/common/util/CommonUtil.java | 52 ++
.../xuanran/wang/common/util/CusData2OA.java | 99 +++
.../xuanran/wang/cssc/cms/WorkflowToCms.java | 153 ++++
.../wang/cssc/cms/entity/CusSuccess.java | 27 +
.../cms/service/WorkflowToCmsService.java | 14 +
.../impl/WorkFlowToCmsServiceImpl.java | 73 ++
.../cssc/cms/util/RequestMasterPlate.java | 80 ++
.../sap/action/WorkflowToSap.java | 53 ++
.../entity/eneity/DetailRequestConfig.java | 41 +
.../sap/entity/eneity/MainRequestConfig.java | 47 ++
.../sap/service/WorkflowToSapService.java | 16 +
.../impl/WorkflowToSapServiceImpl.java | 49 ++
.../sap/util/ReadConfigUtil.java | 565 +++++++++++++
.../service/WorkFlowToVmsAndMQService.java | 39 +-
.../sh_bigdata/common/entity/CusSuccess.java | 3 +-
.../common/service/CusDataDecipher.java | 15 +
.../common/util/RequestMasterPlate.java | 10 +-
.../common/util/SendTodoTaskUtil.java | 19 +-
.../sh_bigdata/common/util/ShBigDataUtil.java | 69 +-
.../sh_bigdata/common/util/TokenUtil.java | 40 +-
.../OrganizationHrmSyncFromOtherSys.java | 37 +
.../annotations/CusOrgHrmAsyncConvert.java | 16 +
.../entity/OrgHrmAsyncCache.java | 43 +
.../entity/OrgHrmAsyncConfigDetail.java | 30 +
.../entity/OrgHrmAsyncConfigMain.java | 39 +
.../entity/OtherSysDepartment.java | 23 +-
.../job/OrganizationHrmSyncJob.java | 146 ++++
.../mapper/OrgHrmAsyncMapper.java | 86 +-
.../service/OrgHrmAsyncApiService.java | 15 +-
.../service/OrgHrmAsyncService.java | 17 +-
.../impl/OrgHrmAsyncApiServiceImpl.java | 45 +-
.../impl/OrgHrmAsyncEntityServiceImpl.java | 265 ++++++
.../service/impl/OrgHrmAsyncServiceImpl.java | 775 +++++++++++++++---
.../org_hrm_async/util/OrgHrmAsyncUtil.java | 102 +++
.../org_hrm_async/util/ValueRuleMethod.java | 178 ++++
.../org_hrm_async/util/ValueRuleMethodNo.java | 19 +
.../task_async/entity/CusDoneTask.java | 2 +-
.../task_async/entity/CusTodoTask.java | 2 +-
.../service/impl/SendTodoTaskServiceImpl.java | 3 +-
.../shyl/dataasync/entity/StudentClass.java | 2 +
.../shyl/dataasync/job/CusDataAsyncJob.java | 36 +-
.../service/CusDataAsyncService.java | 38 +
.../wang/shyl_mq/mapper/ConsumerMapper.java | 4 +-
.../shyl_mq/service/impl/OrgServiceImpl.java | 2 +-
.../wang/shyl_mq/util/RocketConsumerUtil.java | 1 +
.../prop/prop2map/ShBigdataConf.properties | 54 +-
.../xuanran/wang/big_data/BigDataTest.java | 400 +++++++++
src/test/java/xuanran/wang/cssc/FileTest.java | 204 +++++
.../wang/eighty_five_degreec/SAPTest.java | 52 ++
.../java/xuanran/wang/immc/Kafka/MQTest.java | 8 +
.../wang/traffic_bank/EmailOutSendTest.java | 45 +
65 files changed, 4477 insertions(+), 211 deletions(-)
create mode 100644 src/main/java/com/api/xuanran/wang/sh_bigdata/sso/controller/OtherSystemToOAController.java
create mode 100644 src/main/java/com/api/xuanran/wang/sh_bigdata/sso/mapper/OtherSystemToOAMapper.java
create mode 100644 src/main/java/com/api/xuanran/wang/sh_bigdata/sso/service/OtherSystemToOAService.java
create mode 100644 src/main/java/com/api/xuanran/wang/sh_bigdata/sso/service/impl/OtherSystemToOAServiceImpl.java
create mode 100644 src/main/java/com/api/xuanran/wang/traffic_bank/email/controller/EmailOutSendController.java
create mode 100644 src/main/java/com/api/xuanran/wang/traffic_bank/email/entity/EmailOutConfigDetail.java
create mode 100644 src/main/java/com/api/xuanran/wang/traffic_bank/email/entity/EmailOutConfigMain.java
create mode 100644 src/main/java/com/api/xuanran/wang/traffic_bank/email/mapper/EmailOutSendMapper.java
create mode 100644 src/main/java/com/api/xuanran/wang/traffic_bank/email/service/EmailOutSendService.java
create mode 100644 src/main/java/com/api/xuanran/wang/traffic_bank/email/service/impl/EmailOutSendServiceImpl.java
create mode 100644 src/main/java/weaver/xuanran/wang/common/util/CusData2OA.java
create mode 100644 src/main/java/weaver/xuanran/wang/cssc/cms/WorkflowToCms.java
create mode 100644 src/main/java/weaver/xuanran/wang/cssc/cms/entity/CusSuccess.java
create mode 100644 src/main/java/weaver/xuanran/wang/cssc/cms/service/WorkflowToCmsService.java
create mode 100644 src/main/java/weaver/xuanran/wang/cssc/cms/service/impl/WorkFlowToCmsServiceImpl.java
create mode 100644 src/main/java/weaver/xuanran/wang/cssc/cms/util/RequestMasterPlate.java
create mode 100644 src/main/java/weaver/xuanran/wang/eighty_five_degreec/sap/action/WorkflowToSap.java
create mode 100644 src/main/java/weaver/xuanran/wang/eighty_five_degreec/sap/entity/eneity/DetailRequestConfig.java
create mode 100644 src/main/java/weaver/xuanran/wang/eighty_five_degreec/sap/entity/eneity/MainRequestConfig.java
create mode 100644 src/main/java/weaver/xuanran/wang/eighty_five_degreec/sap/service/WorkflowToSapService.java
create mode 100644 src/main/java/weaver/xuanran/wang/eighty_five_degreec/sap/service/impl/WorkflowToSapServiceImpl.java
create mode 100644 src/main/java/weaver/xuanran/wang/eighty_five_degreec/sap/util/ReadConfigUtil.java
create mode 100644 src/main/java/weaver/xuanran/wang/sh_bigdata/common/service/CusDataDecipher.java
create mode 100644 src/main/java/weaver/xuanran/wang/sh_bigdata/org_hrm_async/annotations/CusOrgHrmAsyncConvert.java
create mode 100644 src/main/java/weaver/xuanran/wang/sh_bigdata/org_hrm_async/entity/OrgHrmAsyncCache.java
create mode 100644 src/main/java/weaver/xuanran/wang/sh_bigdata/org_hrm_async/entity/OrgHrmAsyncConfigDetail.java
create mode 100644 src/main/java/weaver/xuanran/wang/sh_bigdata/org_hrm_async/entity/OrgHrmAsyncConfigMain.java
create mode 100644 src/main/java/weaver/xuanran/wang/sh_bigdata/org_hrm_async/job/OrganizationHrmSyncJob.java
create mode 100644 src/main/java/weaver/xuanran/wang/sh_bigdata/org_hrm_async/service/impl/OrgHrmAsyncEntityServiceImpl.java
create mode 100644 src/main/java/weaver/xuanran/wang/sh_bigdata/org_hrm_async/util/OrgHrmAsyncUtil.java
create mode 100644 src/main/java/weaver/xuanran/wang/sh_bigdata/org_hrm_async/util/ValueRuleMethod.java
create mode 100644 src/main/java/weaver/xuanran/wang/sh_bigdata/org_hrm_async/util/ValueRuleMethodNo.java
create mode 100644 src/test/java/xuanran/wang/big_data/BigDataTest.java
create mode 100644 src/test/java/xuanran/wang/cssc/FileTest.java
create mode 100644 src/test/java/xuanran/wang/eighty_five_degreec/SAPTest.java
create mode 100644 src/test/java/xuanran/wang/traffic_bank/EmailOutSendTest.java
diff --git a/src/main/java/com/api/xuanran/wang/sh_bigdata/sso/controller/OtherSystemToOAController.java b/src/main/java/com/api/xuanran/wang/sh_bigdata/sso/controller/OtherSystemToOAController.java
new file mode 100644
index 0000000..076bda2
--- /dev/null
+++ b/src/main/java/com/api/xuanran/wang/sh_bigdata/sso/controller/OtherSystemToOAController.java
@@ -0,0 +1,66 @@
+package com.api.xuanran.wang.sh_bigdata.sso.controller;
+
+import aiyh.utils.Util;
+import aiyh.utils.excention.CustomerException;
+import com.alibaba.fastjson.JSONObject;
+import com.api.xuanran.wang.sh_bigdata.sso.service.OtherSystemToOAService;
+import com.api.xuanran.wang.sh_bigdata.sso.service.impl.OtherSystemToOAServiceImpl;
+import com.sun.jersey.api.view.Viewable;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.log4j.Logger;
+import weaver.integration.util.SessionUtil;
+import weaver.xuanran.wang.sh_bigdata.common.util.ShBigDataUtil;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.Context;
+import java.util.Map;
+
+/**
+ *
第三方系统登录oa
+ *
+ * @author xuanran.wang
+ * @date 2023/4/17 14:22
+ */
+@Path("/wxr/sh_big_data/sso")
+public class OtherSystemToOAController {
+
+ private final Logger log = Util.getLogger();
+ private final OtherSystemToOAService service = new OtherSystemToOAServiceImpl();
+ @Path("/login/{appId}")
+ @GET
+ public Viewable login(@PathParam("appId") String appId,
+ @Context HttpServletRequest request,
+ @Context HttpServletResponse response) {
+ try {
+ log.info("appId : " + appId);
+ String code = Util.null2DefaultStr(request.getParameter("code"),"");
+ log.info("sso login code : " + code);
+ if(StringUtils.isBlank(code)){
+ throw new CustomerException("code is null!");
+ }
+ // 获取重定向地址和secret
+ Map redirectUrlAndCorpsecret = service.getRedirectUrlAndCorpsecret(appId);
+ String redirectUrl = Util.null2DefaultStr(redirectUrlAndCorpsecret.get("REDIRECTURL"),"");
+ log.info("successSendRedirectUrl : " + redirectUrl);
+ if(StringUtils.isBlank(redirectUrl)){
+ throw new CustomerException("redirectUrl is null! " + JSONObject.toJSONString(redirectUrlAndCorpsecret));
+ }
+ int userId = service.getUserFromOtherSys(code, redirectUrlAndCorpsecret);
+ SessionUtil.createSession(userId + "", request, response);
+ response.sendRedirect(redirectUrl);
+ }catch (Exception e){
+ log.error("sso error : " + e.getMessage());
+ log.error(Util.getErrString(e));
+ try {
+ response.sendRedirect(Util.null2DefaultStr(ShBigDataUtil.getPropertiesValByKey("loginErrorSendRedirectUrl"),"/login/login.jsp"));
+ }catch (Exception ec){
+ log.error("sendRedirect error " + ec.getMessage());
+ }
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/com/api/xuanran/wang/sh_bigdata/sso/mapper/OtherSystemToOAMapper.java b/src/main/java/com/api/xuanran/wang/sh_bigdata/sso/mapper/OtherSystemToOAMapper.java
new file mode 100644
index 0000000..f3c4884
--- /dev/null
+++ b/src/main/java/com/api/xuanran/wang/sh_bigdata/sso/mapper/OtherSystemToOAMapper.java
@@ -0,0 +1,44 @@
+package com.api.xuanran.wang.sh_bigdata.sso.mapper;
+
+import aiyh.utils.annotation.recordset.ParamMapper;
+import aiyh.utils.annotation.recordset.Select;
+import aiyh.utils.annotation.recordset.SqlMapper;
+
+import java.util.Map;
+
+/**
+ * 第三方系统登录oa mapper
+ *
+ * @author xuanran.wang
+ * @date 2023/4/18 09:54
+ */
+@SqlMapper
+public interface OtherSystemToOAMapper {
+ /**
+ * 根据outKey查oa ID
+ * @author xuanran.wang
+ * @dateTime 2023/4/20 11:46
+ * @param outKey 外键id
+ * @return oa ID
+ **/
+ @Select("select id from hrmresource where outkey = #{outKey}")
+ int selectUserIdByOutKey(@ParamMapper("outKey") String outKey);
+ /**
+ * 根据appId 查跳转的地址
+ * @author xuanran.wang
+ * @dateTime 2023/4/20 11:47
+ * @param appId appId
+ * @return 跳转的地址
+ **/
+ @Select("select zydz from uf_AppPortal where zcsjbs = #{appId}")
+ String selectRedirectUrlByAppId(@ParamMapper("appId") String appId);
+ /**
+ * 根据appId 查跳转的地址
+ * @author xuanran.wang
+ * @dateTime 2023/4/20 11:47
+ * @param appId appId
+ * @return 跳转的地址
+ **/
+ @Select("select zydz redirectUrl, secret from uf_AppPortal where zcsjbs = #{appId}")
+ Map selectRedirectUrlAndSecretByAppId(@ParamMapper("appId") String appId);
+}
diff --git a/src/main/java/com/api/xuanran/wang/sh_bigdata/sso/service/OtherSystemToOAService.java b/src/main/java/com/api/xuanran/wang/sh_bigdata/sso/service/OtherSystemToOAService.java
new file mode 100644
index 0000000..7f736c4
--- /dev/null
+++ b/src/main/java/com/api/xuanran/wang/sh_bigdata/sso/service/OtherSystemToOAService.java
@@ -0,0 +1,49 @@
+package com.api.xuanran.wang.sh_bigdata.sso.service;
+
+import weaver.xuanran.wang.sh_bigdata.common.entity.CusSuccess;
+
+import java.util.Map;
+
+/**
+ * 第三方系统登录oa
+ *
+ * @author xuanran.wang
+ * @date 2023/4/17 14:27
+ */
+public interface OtherSystemToOAService {
+ /**
+ * 发请求根据code获取第三方系统用户id
+ * @author xuanran.wang
+ * @dateTime 2023/4/18 13:29
+ * @param url 请求地址
+ * @param params 参数
+ * @param headers 请求头
+ * @param cusSuccess 自定义接口成功/失败标识
+ * @return 接口响应字段
+ **/
+ int getUserIdByCode(String url, Map params, Map headers, CusSuccess cusSuccess, Map redirectUrlSecret);
+ /**
+ * 根据第三方系统人员code匹配oa人员id
+ * @author xuanran.wang
+ * @dateTime 2023/4/18 13:30
+ * @param code 第三方系统人员code
+ * @return oa人员id
+ **/
+ int getUserFromOtherSys(String code, Map redirectUrlSecret);
+ /**
+ * 根据appId获取oa地址
+ * @author xuanran.wang
+ * @dateTime 2023/4/20 11:14
+ * @param appId 建模appId
+ * @return 跳转应用地址
+ **/
+ String getLoginSuccessSendRedirectUrl(String appId);
+ /**
+ * 根据appId获取跳转地址和corpsecret
+ * @author xuanran.wang
+ * @dateTime 2023/4/20 11:14
+ * @param appId 建模appId
+ * @return 跳转应用地址
+ **/
+ Map getRedirectUrlAndCorpsecret(String appId);
+}
diff --git a/src/main/java/com/api/xuanran/wang/sh_bigdata/sso/service/impl/OtherSystemToOAServiceImpl.java b/src/main/java/com/api/xuanran/wang/sh_bigdata/sso/service/impl/OtherSystemToOAServiceImpl.java
new file mode 100644
index 0000000..3e1581a
--- /dev/null
+++ b/src/main/java/com/api/xuanran/wang/sh_bigdata/sso/service/impl/OtherSystemToOAServiceImpl.java
@@ -0,0 +1,97 @@
+package com.api.xuanran.wang.sh_bigdata.sso.service.impl;
+
+import aiyh.utils.Util;
+import aiyh.utils.excention.CustomerException;
+import com.alibaba.fastjson.JSONObject;
+import com.api.xuanran.wang.sh_bigdata.sso.mapper.OtherSystemToOAMapper;
+import com.api.xuanran.wang.sh_bigdata.sso.service.OtherSystemToOAService;
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.log4j.Logger;
+import weaver.xuanran.wang.sh_bigdata.common.entity.CusSuccess;
+import weaver.xuanran.wang.sh_bigdata.common.util.RequestMasterPlate;
+import weaver.xuanran.wang.sh_bigdata.common.util.ShBigDataUtil;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 第三方系统登录oa
+ *
+ * @author xuanran.wang
+ * @date 2023/4/17 14:35
+ */
+public class OtherSystemToOAServiceImpl implements OtherSystemToOAService {
+
+ private final RequestMasterPlate requestMasterPlate = new RequestMasterPlate();
+ private final CusSuccess cusSuccess = CusSuccess.builder()
+ .successField("code")
+ .successValue(0)
+ .errorMsg("msg")
+ .dataKey("data.id")
+ .build();
+ private final OtherSystemToOAMapper otherSystemToOAMapper = Util.getMapper(OtherSystemToOAMapper.class);
+ private final Logger log = Util.getLogger();
+ @Override
+ public int getUserIdByCode(String url, Map params, Map headers, CusSuccess cusSuccess, Map redirectUrlSecret) {
+ String secret = Util.null2DefaultStr(redirectUrlSecret.get("SECRET"), "");
+ log.info("secret : " + secret);
+ if(StringUtils.isBlank(secret)){
+ throw new CustomerException("secret is null! " + JSONObject.toJSONString(redirectUrlSecret));
+ }
+ return requestMasterPlate.apiGet(ShBigDataUtil.addToken2Url(url, secret), params ,new HashMap<>(), cusSuccess);
+ }
+
+ @Override
+ public int getUserFromOtherSys(String code, Map redirectUrlSecret) {
+ HashMap params = new HashMap<>();
+ params.put("code", code);
+ // 获取第三方系统id
+ String getUserInfoByCodeUrl = ShBigDataUtil.getPropertiesValByKey("getUserInfoByCodeUrl");
+ int codeId;
+ try {
+ codeId = getUserIdByCode(getUserInfoByCodeUrl, params, new HashMap<>(), cusSuccess, redirectUrlSecret);
+ }catch (Exception e){
+ String getUserIdDebug = ShBigDataUtil.getPropertiesValByKey("getUserIdDebug");
+ // 开启调试模式
+ if("1".equals(getUserIdDebug)){
+ codeId = Util.getIntValue(ShBigDataUtil.getPropertiesValByKey("getUserIdDebugOutKey"), 109);
+ log.info("debug codeId : " + codeId);
+ }else {
+ throw new CustomerException(e.getMessage());
+ }
+ }
+ if(codeId < 0){
+ throw new CustomerException(Util.logStr("code : {}, not found in {} .", code, getUserInfoByCodeUrl));
+ }
+ int id = otherSystemToOAMapper.selectUserIdByOutKey(codeId + "");
+ if(id < 0){
+ throw new CustomerException(Util.logStr("code : {} not found in OA!", id));
+ }
+ return id;
+ }
+
+ @Override
+ public String getLoginSuccessSendRedirectUrl(String appId) {
+ String defaultUrl = Util.null2DefaultStr(ShBigDataUtil.getPropertiesValByKey("loginSuccessSendRedirectUrl"), "/wui/index.html#/main");
+ String url = otherSystemToOAMapper.selectRedirectUrlByAppId(appId);
+ if(StringUtils.isBlank(appId) || StringUtils.isBlank(url)){
+ return defaultUrl;
+ }
+ return url;
+ }
+
+ @Override
+ public Map getRedirectUrlAndCorpsecret(String appId) {
+ Map res = otherSystemToOAMapper.selectRedirectUrlAndSecretByAppId(appId);
+ if(MapUtils.isEmpty(res)){
+ throw new CustomerException(Util.logStr("该appId在建模配置中不存在配置!"));
+ }
+ long count = res.values().stream().filter(StringUtils::isBlank).count();
+ if(count > 0){
+ throw new CustomerException(Util.logStr("该appId查询重定向地址或secret数据为空!: {}", JSONObject.toJSONString(res)));
+ }
+ return res;
+ }
+
+}
diff --git a/src/main/java/com/api/xuanran/wang/shyl/controller/BatchCreateWorkFlowController.java b/src/main/java/com/api/xuanran/wang/shyl/controller/BatchCreateWorkFlowController.java
index 94abd03..01dc790 100644
--- a/src/main/java/com/api/xuanran/wang/shyl/controller/BatchCreateWorkFlowController.java
+++ b/src/main/java/com/api/xuanran/wang/shyl/controller/BatchCreateWorkFlowController.java
@@ -71,7 +71,7 @@ public class BatchCreateWorkFlowController {
return ApiResult.success(service.batchCreateWorkflow(user, workflows));
}catch (Exception e){
log.error(Util.logStr("batchCreate error : {}", e.getMessage()));
- return ApiResult.error(500,"批量创建流程接口发生异常! 异常信息 :[ " + e.getMessage() + " ]");
+ return ApiResult.error(500, e.getMessage());
}
}
diff --git a/src/main/java/com/api/xuanran/wang/shyl/controller/GetStudentsClass.java b/src/main/java/com/api/xuanran/wang/shyl/controller/GetStudentsClass.java
index 10b720f..3e58125 100644
--- a/src/main/java/com/api/xuanran/wang/shyl/controller/GetStudentsClass.java
+++ b/src/main/java/com/api/xuanran/wang/shyl/controller/GetStudentsClass.java
@@ -16,7 +16,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
/**
- *
+ * <学员接口/h1>
*
* @author xuanran.wang
* @date 2023/3/1 10:56
diff --git a/src/main/java/com/api/xuanran/wang/shyl/service/BatchCreateWorkflowService.java b/src/main/java/com/api/xuanran/wang/shyl/service/BatchCreateWorkflowService.java
index 7621447..998cd6e 100644
--- a/src/main/java/com/api/xuanran/wang/shyl/service/BatchCreateWorkflowService.java
+++ b/src/main/java/com/api/xuanran/wang/shyl/service/BatchCreateWorkflowService.java
@@ -37,9 +37,7 @@ public class BatchCreateWorkflowService {
private final Logger log = Util.getLogger();
private static final String CUSTOM_ID = "customId";
-
// private final MeetingMapper meetingTransMapper = Util.getTransMapper(MeetingMapper.class);
-
private final MeetingService meetingService = new MeetingService();
/**
* 取消会议 支持多个
@@ -97,7 +95,7 @@ public class BatchCreateWorkflowService {
}
}
if(errors.size() > 0){
- throw new CustomerException("创建流程失败!错误参数流程 : \n" + JSONObject.toJSONString(errors));
+ throw new CustomerException(JSONObject.toJSONString(errors));
}
return res;
}catch (Exception e){
diff --git a/src/main/java/com/api/xuanran/wang/traffic_bank/email/controller/EmailOutSendController.java b/src/main/java/com/api/xuanran/wang/traffic_bank/email/controller/EmailOutSendController.java
new file mode 100644
index 0000000..f0e59ac
--- /dev/null
+++ b/src/main/java/com/api/xuanran/wang/traffic_bank/email/controller/EmailOutSendController.java
@@ -0,0 +1,45 @@
+package com.api.xuanran.wang.traffic_bank.email.controller;
+
+import aiyh.utils.ApiResult;
+import aiyh.utils.Util;
+import com.alibaba.fastjson.JSONObject;
+import com.api.xuanran.wang.traffic_bank.email.service.EmailOutSendService;
+import com.api.xuanran.wang.traffic_bank.email.service.impl.EmailOutSendServiceImpl;
+import io.swagger.v3.oas.annotations.parameters.RequestBody;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import java.util.Map;
+
+/**
+ * 交银理财邮件外发
+ *
+ * @author xuanran.wang
+ * @date 2023/4/18 14:11
+ */
+@Path("/wxr/traffic_bank/email")
+public class EmailOutSendController {
+
+ private final EmailOutSendService service = new EmailOutSendServiceImpl();
+
+ @Path("/send")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ @Consumes(MediaType.APPLICATION_JSON)
+ public String sendEmail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Map param) {
+ try {
+ service.sendEmail(param);
+ return ApiResult.success(null);
+ }catch (Exception e){
+ Util.getLogger().error("EmailOutSendController error " + e.getMessage());
+ Util.getLogger().error(Util.getErrString(e));
+ return ApiResult.error("发送邮件异常 : " + e.getMessage());
+ }
+ }
+}
diff --git a/src/main/java/com/api/xuanran/wang/traffic_bank/email/entity/EmailOutConfigDetail.java b/src/main/java/com/api/xuanran/wang/traffic_bank/email/entity/EmailOutConfigDetail.java
new file mode 100644
index 0000000..f636e5c
--- /dev/null
+++ b/src/main/java/com/api/xuanran/wang/traffic_bank/email/entity/EmailOutConfigDetail.java
@@ -0,0 +1,17 @@
+package com.api.xuanran.wang.traffic_bank.email.entity;
+
+import lombok.Data;
+
+/**
+ * 邮件外发配置表明细
+ *
+ * @author xuanran.wang
+ * @date 2023/4/18 14:23
+ */
+@Data
+public class EmailOutConfigDetail {
+ private String interfaceField;
+ private String fieldName;
+ private String cusStyleClass;
+ private int mergeCell;
+}
diff --git a/src/main/java/com/api/xuanran/wang/traffic_bank/email/entity/EmailOutConfigMain.java b/src/main/java/com/api/xuanran/wang/traffic_bank/email/entity/EmailOutConfigMain.java
new file mode 100644
index 0000000..7004a09
--- /dev/null
+++ b/src/main/java/com/api/xuanran/wang/traffic_bank/email/entity/EmailOutConfigMain.java
@@ -0,0 +1,21 @@
+package com.api.xuanran.wang.traffic_bank.email.entity;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 邮件外发配置表主表
+ *
+ * @author xuanran.wang
+ * @date 2023/4/18 14:17
+ */
+@Data
+public class EmailOutConfigMain {
+ private int transType;
+ private String templatePath;
+ private String emailAddressCusSql;
+ private int enable;
+ private String titleField;
+ private List configDetailList;
+}
diff --git a/src/main/java/com/api/xuanran/wang/traffic_bank/email/mapper/EmailOutSendMapper.java b/src/main/java/com/api/xuanran/wang/traffic_bank/email/mapper/EmailOutSendMapper.java
new file mode 100644
index 0000000..f295e6d
--- /dev/null
+++ b/src/main/java/com/api/xuanran/wang/traffic_bank/email/mapper/EmailOutSendMapper.java
@@ -0,0 +1,42 @@
+package com.api.xuanran.wang.traffic_bank.email.mapper;
+
+import aiyh.utils.annotation.recordset.*;
+import com.api.xuanran.wang.traffic_bank.email.entity.EmailOutConfigDetail;
+import com.api.xuanran.wang.traffic_bank.email.entity.EmailOutConfigMain;
+import weaver.xuanran.wang.sh_bigdata.org_hrm_async.entity.OrgHrmAsyncConfigDetail;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 邮件外发mapper
+ *
+ * @author xuanran.wang
+ * @date 2023/4/18 14:26
+ */
+@SqlMapper
+public interface EmailOutSendMapper {
+
+ @Select("select * from uf_email_out_config where trans_type = #{transType}")
+ @CollectionMappings({
+ @CollectionMapping(property = "configDetailList",
+ column = "id",
+ id = @Id(value = Integer.class, methodId = 1))
+ })
+ EmailOutConfigMain selectConfigByTypeId(@ParamMapper("transType") int transType);
+
+ /**
+ * 查询配置表明细表信息
+ * @author xuanran.wang
+ * @dateTime 2023/3/1 16:39
+ * @param mainId 主表数据id
+ * @return 配置集合
+ **/
+ @Select("select * from uf_email_out_config_dt1 where mainid = #{mainId}")
+ @CollectionMethod(1)
+ List selectConfigDetail(@ParamMapper("mainId") int mainId);
+
+ @Select(custom = true)
+ String selectCustomerSql(@SqlString String sql, Map map);
+
+}
diff --git a/src/main/java/com/api/xuanran/wang/traffic_bank/email/service/EmailOutSendService.java b/src/main/java/com/api/xuanran/wang/traffic_bank/email/service/EmailOutSendService.java
new file mode 100644
index 0000000..376a617
--- /dev/null
+++ b/src/main/java/com/api/xuanran/wang/traffic_bank/email/service/EmailOutSendService.java
@@ -0,0 +1,17 @@
+package com.api.xuanran.wang.traffic_bank.email.service;
+
+import com.api.xuanran.wang.traffic_bank.email.entity.EmailOutConfigMain;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 邮件外发
+ *
+ * @author xuanran.wang
+ * @date 2023/4/18 14:15
+ */
+public interface EmailOutSendService {
+ EmailOutConfigMain selectConfigByTransType(int type);
+ void sendEmail(Map params);
+}
diff --git a/src/main/java/com/api/xuanran/wang/traffic_bank/email/service/impl/EmailOutSendServiceImpl.java b/src/main/java/com/api/xuanran/wang/traffic_bank/email/service/impl/EmailOutSendServiceImpl.java
new file mode 100644
index 0000000..0ebcd22
--- /dev/null
+++ b/src/main/java/com/api/xuanran/wang/traffic_bank/email/service/impl/EmailOutSendServiceImpl.java
@@ -0,0 +1,120 @@
+package com.api.xuanran.wang.traffic_bank.email.service.impl;
+
+import aiyh.utils.Util;
+import aiyh.utils.excention.CustomerException;
+import com.alibaba.fastjson.JSONObject;
+import com.api.xuanran.wang.traffic_bank.email.entity.EmailOutConfigDetail;
+import com.api.xuanran.wang.traffic_bank.email.entity.EmailOutConfigMain;
+import com.api.xuanran.wang.traffic_bank.email.mapper.EmailOutSendMapper;
+import com.api.xuanran.wang.traffic_bank.email.service.EmailOutSendService;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.log4j.Logger;
+import org.springframework.util.Assert;
+import org.springframework.util.CollectionUtils;
+import weaver.email.EmailWorkRunnable;
+
+import java.util.*;
+
+/**
+ * 邮件外发业务方法
+ *
+ * @author xuanran.wang
+ * @date 2023/4/18 14:33
+ */
+public class EmailOutSendServiceImpl implements EmailOutSendService {
+ private final EmailOutSendMapper emailOutSendMapper = Util.getMapper(EmailOutSendMapper.class);
+ private final Logger log = Util.getLogger();
+ @Override
+ public EmailOutConfigMain selectConfigByTransType(int type) {
+ EmailOutConfigMain configMain = emailOutSendMapper.selectConfigByTypeId(type);
+ Assert.notNull(configMain, Util.logStr("type= {}, not found config in uf_email_out_config!", type));
+ List configDetailList = configMain.getConfigDetailList();
+ Assert.notEmpty(configDetailList, Util.logStr("type= {}, not found config in uf_email_out_config_dt1!", type));
+ return configMain;
+ }
+
+ @Override
+ public void sendEmail(Map param) {
+ int type = Util.getIntValue(Util.null2DefaultStr(param.get("type"), ""), -1);
+ EmailOutConfigMain outConfigMain = selectConfigByTransType(type);
+ List