From 7f5087a6ee996e585b0f0663fec0ee5b03911c76 Mon Sep 17 00:00:00 2001
From: wangxuanran <3055088966@qq.com>
Date: Mon, 10 Jul 2023 15:56:24 +0800
Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=9B=B4=E6=96=B0=E9=97=AE?=
=?UTF-8?q?=E9=A2=98=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../aiyh/utils/recordset/RecordsetUtil.java | 6 +-
.../getlog/controller/GetLogController.java | 33 ++-
.../common/getlog/service/GetLogService.java | 30 ++-
.../common/getlog/util/GetLogUtil.java | 4 +-
.../util/EyCusModelFieldValueRuleMethod.java | 5 +-
.../shyl/service/UserUpdateToMQService.java | 2 +-
.../shyl/service/impl/UpdateHrmInfoAop.java | 54 ++--
.../action/ChildWorkFlowSplitAction.java | 107 ++++++++
.../mapper/ChildWorkFlowSplitMapper.java | 52 ++++
.../common/entity/CusResponseSuccess.java | 38 +++
.../wang/common/mapper/CommonMapper.java | 24 ++
.../xuanran/wang/common/util/TokenUtil.java | 11 +
.../xuanran/wang/cssc/cms/WorkflowToCms.java | 17 ++
.../wang/cssc/cms/entity/CusSuccess.java | 2 +
.../cms/service/WorkflowToCmsService.java | 6 +-
.../impl/WorkFlowToCmsServiceImpl.java | 42 ++-
.../cssc/cms/util/RequestMasterPlate.java | 83 +++++-
.../sh_bigdata/common/entity/CusSuccess.java | 2 +-
.../common/util/SendTodoTaskUtil.java | 26 +-
.../task_async/entity/CusDoneTask.java | 1 +
.../task_async/entity/CusTodoLeaderTask.java | 17 --
.../task_async/entity/CusTodoTask.java | 1 +
.../entity/CusTodoTaskToOADetail.java | 5 +
.../task_async/mapper/SendTodoTaskMapper.java | 4 +-
.../service/impl/SendTodoTaskServiceImpl.java | 6 +-
.../wang/shyl_mq/mapper/ConsumerMapper.java | 11 +
.../service/impl/PassWordServiceImpl.java | 14 +-
src/test/java/xuanran/wang/ajx/TestA.java | 85 +++++++
.../xuanran/wang/big_data/BigDataTest.java | 6 -
.../xuanran/wang/common/test/ServiceTest.java | 10 +
.../http_test/rest_test/CusRestTemplate.java | 240 ++++++++++++++++++
.../xuanran/wang/http_test/rest_test/Stu.java | 19 ++
.../xuanran/wang/http_test/test/TestMain.java | 57 +++++
.../java/xuanran/wang/immc/Kafka/MQTest.java | 24 +-
.../wang/shyl/dataasync/TestPassword.java | 56 +++-
35 files changed, 970 insertions(+), 130 deletions(-)
create mode 100644 src/main/java/weaver/xuanran/wang/ajx/work_flow_split/action/ChildWorkFlowSplitAction.java
create mode 100644 src/main/java/weaver/xuanran/wang/ajx/work_flow_split/mapper/ChildWorkFlowSplitMapper.java
create mode 100644 src/main/java/weaver/xuanran/wang/common/entity/CusResponseSuccess.java
delete mode 100644 src/main/java/weaver/xuanran/wang/sh_bigdata/task_async/entity/CusTodoLeaderTask.java
create mode 100644 src/test/java/xuanran/wang/ajx/TestA.java
create mode 100644 src/test/java/xuanran/wang/http_test/rest_test/CusRestTemplate.java
create mode 100644 src/test/java/xuanran/wang/http_test/rest_test/Stu.java
create mode 100644 src/test/java/xuanran/wang/http_test/test/TestMain.java
diff --git a/src/main/java/aiyh/utils/recordset/RecordsetUtil.java b/src/main/java/aiyh/utils/recordset/RecordsetUtil.java
index e810df1..46a7653 100644
--- a/src/main/java/aiyh/utils/recordset/RecordsetUtil.java
+++ b/src/main/java/aiyh/utils/recordset/RecordsetUtil.java
@@ -14,6 +14,7 @@ import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
/**
@@ -64,7 +65,10 @@ public class RecordsetUtil implements InvocationHandler {
private Object invokeDefault(int type, String sql, boolean custom, RecordSet rs, Method method, Object[] args) {
SqlHandler sqlHandler = new SqlHandler();
ResultMapper resultMapper = new ResultMapper();
- PrepSqlResultImpl handler = sqlHandler.handler(sql, custom, method, args);
+ PrepSqlResultImpl handler = null;
+ if(Arrays.asList(1,2,3,4).contains(type)){
+ handler = sqlHandler.handler(sql, custom, method, args);
+ }
String invokeMethod = method.getDeclaringClass().getName() + ":" + method.getName() + " : ";
switch (type) {
case 1: {
diff --git a/src/main/java/com/api/ebu7dev1/common/getlog/controller/GetLogController.java b/src/main/java/com/api/ebu7dev1/common/getlog/controller/GetLogController.java
index 094f782..1987755 100644
--- a/src/main/java/com/api/ebu7dev1/common/getlog/controller/GetLogController.java
+++ b/src/main/java/com/api/ebu7dev1/common/getlog/controller/GetLogController.java
@@ -2,9 +2,11 @@ package com.api.ebu7dev1.common.getlog.controller;
import aiyh.utils.ApiResult;
import aiyh.utils.Util;
+import aiyh.utils.excention.CustomerException;
import com.alibaba.fastjson.JSONObject;
import com.api.ebu7dev1.common.getlog.service.GetLogService;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
+import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
@@ -12,13 +14,12 @@ import weaver.interfaces.schedule.IpSelectUtil;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
+import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import javax.ws.rs.core.StreamingOutput;
+import java.io.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -52,6 +53,30 @@ public class GetLogController {
return ApiResult.error("获取ip节点出错!");
}
}
+
+ @GET
+ @Path("/down")
+ @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ public Response downloadZip(@Context HttpServletRequest request,
+ @Context HttpServletResponse response){
+ try {
+ String zipPath = request.getParameter("zipPath");
+ String fileName = request.getParameter("fileName");
+ if(StringUtils.isBlank(zipPath) || StringUtils.isBlank(fileName)){
+ throw new CustomerException("zipPath or fileName can not be null!");
+ }
+ response.setHeader("Access-Control-Allow-Origin", "*");
+ response.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE");
+ response.setHeader("Access-Control-Allow-Headers", "Content-Type");
+ String ecPath = request.getRealPath("/");
+ StreamingOutput output = service.downloadZip(ecPath + File.separator + zipPath);
+ return Response.ok(output, MediaType.APPLICATION_OCTET_STREAM).header("Content-Disposition", "attachment; filename*=UTF-8''" + fileName).build();
+ }catch (Exception e){
+ log.error("下载zip文件异常 : ");
+ log.error(Util.getErrString(e));
+ return null;
+ }
+ }
@GET
@Path("get")
diff --git a/src/main/java/com/api/ebu7dev1/common/getlog/service/GetLogService.java b/src/main/java/com/api/ebu7dev1/common/getlog/service/GetLogService.java
index 02152c8..51d4d73 100644
--- a/src/main/java/com/api/ebu7dev1/common/getlog/service/GetLogService.java
+++ b/src/main/java/com/api/ebu7dev1/common/getlog/service/GetLogService.java
@@ -13,8 +13,8 @@ import weaver.hrm.User;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.io.File;
-import java.io.FileNotFoundException;
+import javax.ws.rs.core.StreamingOutput;
+import java.io.*;
import java.util.*;
import static net.qiyuesuo.sdk.bean.template.MimeType.zip;
@@ -78,6 +78,32 @@ public class GetLogService {
return ipList;
}
+ public StreamingOutput downloadZip(String zipPath){
+ log.info("压缩文件路径 : [ " + zipPath + " ]");
+ return outputStream -> {
+ FileInputStream inputStream = null;
+ BufferedInputStream bufferedInputStream = null;
+ try {
+ byte[] buffer = new byte[1024];
+ int bytesRead;
+ inputStream = new FileInputStream(zipPath);
+ bufferedInputStream = new BufferedInputStream(inputStream);
+ while ((bytesRead = bufferedInputStream.read(buffer)) != -1) {
+ outputStream.write(buffer, 0, bytesRead);
+ }
+ }catch (IOException e){
+ throw new IOException(e);
+ }finally {
+ if(bufferedInputStream != null){
+ bufferedInputStream.close();
+ }
+ if(inputStream != null){
+ inputStream.close();
+ }
+ }
+ };
+ }
+
/**
*
<收集全部节点日志/h1>
* @author xuanran.wang
diff --git a/src/main/java/com/api/ebu7dev1/common/getlog/util/GetLogUtil.java b/src/main/java/com/api/ebu7dev1/common/getlog/util/GetLogUtil.java
index ca0b6fb..185545c 100644
--- a/src/main/java/com/api/ebu7dev1/common/getlog/util/GetLogUtil.java
+++ b/src/main/java/com/api/ebu7dev1/common/getlog/util/GetLogUtil.java
@@ -292,7 +292,8 @@ public class GetLogUtil {
e.printStackTrace();
}
String innerIp = getInnerIp();
- String zipFile = File.separator + innerIp + "_downLog.zip";
+ String fileName = innerIp + "_downLog.zip";
+ String zipFile = File.separator + fileName;
String outLogPath = outFile + zipFile;
res = res + zipFile;
fos = new FileOutputStream(outLogPath);
@@ -332,6 +333,7 @@ public class GetLogUtil {
}
result.put("ip", innerIp);
result.put("zipPath", res);
+ result.put("fileName", fileName);
return result;
}
diff --git a/src/main/java/com/api/nonstandardext/model_field_async/util/EyCusModelFieldValueRuleMethod.java b/src/main/java/com/api/nonstandardext/model_field_async/util/EyCusModelFieldValueRuleMethod.java
index 857fba8..4f789f2 100644
--- a/src/main/java/com/api/nonstandardext/model_field_async/util/EyCusModelFieldValueRuleMethod.java
+++ b/src/main/java/com/api/nonstandardext/model_field_async/util/EyCusModelFieldValueRuleMethod.java
@@ -7,7 +7,6 @@ import com.api.nonstandardext.model_field_async.interfaces.TriFunction;
import com.api.nonstandardext.model_field_async.mapper.ModelFieldAsyncMapper;
import com.google.common.base.Strings;
import org.apache.log4j.Logger;
-import weaver.xuanran.wang.eny.data_async.service.convert.CusAsyncConvert;
import com.api.nonstandardext.model_field_async.service.convert.CusModelFieldAsyncConvert;
import java.lang.reflect.InvocationTargetException;
@@ -84,8 +83,8 @@ public class EyCusModelFieldValueRuleMethod {
}
try {
Class> clazz = Class.forName(cusText);
- if(!CusAsyncConvert.class.isAssignableFrom(clazz)){
- throw new CustomerException(cusText + " not implements getLogFilePath.api.nonstandardext.model_field_async.service.convert");
+ if(!CusModelFieldAsyncConvert.class.isAssignableFrom(clazz)){
+ throw new CustomerException(cusText + " not implements com.api.nonstandardext.model_field_async.service.convert.CusModelFieldAsyncConvert");
}
CusModelFieldAsyncConvert o = (CusModelFieldAsyncConvert) clazz.newInstance();
Map pathParam = Util.parseCusInterfacePathParam(cusText);
diff --git a/src/main/java/com/api/xuanran/wang/shyl/service/UserUpdateToMQService.java b/src/main/java/com/api/xuanran/wang/shyl/service/UserUpdateToMQService.java
index 04556e1..51b9a65 100644
--- a/src/main/java/com/api/xuanran/wang/shyl/service/UserUpdateToMQService.java
+++ b/src/main/java/com/api/xuanran/wang/shyl/service/UserUpdateToMQService.java
@@ -80,7 +80,7 @@ public class UserUpdateToMQService {
logger.error(Util.logStr("userId:{}, 生成json为空!",id));
return;
}
- if("1".equals(debug)){
+ if(!"1".equals(debug)){
logger.info("update user json : \n" + JSONObject.toJSONString(param));
return;
}
diff --git a/src/main/java/com/customization/shyl/service/impl/UpdateHrmInfoAop.java b/src/main/java/com/customization/shyl/service/impl/UpdateHrmInfoAop.java
index 1a21a89..faf2c94 100644
--- a/src/main/java/com/customization/shyl/service/impl/UpdateHrmInfoAop.java
+++ b/src/main/java/com/customization/shyl/service/impl/UpdateHrmInfoAop.java
@@ -38,22 +38,31 @@ public class UpdateHrmInfoAop {
*/
@WeaReplaceBefore(value = "/api/hrm/password/changePassword", order = 1, description = "人员信息修改前 进行拦截")
public void passwordUpdateBefore(WeaBeforeReplaceParam weaBeforeReplaceParam) {
- Map paramMap = weaBeforeReplaceParam.getParamMap();
- String newPassword = Util.null2DefaultStr(paramMap.get("passwordnew"),"");
- if(StringUtils.isBlank(newPassword)){
- Util.getLogger().error("下发队列新密码不能为空!");
- return;
+ try {
+ Map paramMap = weaBeforeReplaceParam.getParamMap();
+ HttpServletRequest request = weaBeforeReplaceParam.getRequest();
+ String newPassword = Util.null2DefaultStr(paramMap.get("passwordnew"),"");
+ if(StringUtils.isBlank(newPassword)){
+ Util.getLogger().error("下发队列新密码不能为空!");
+ return;
+ }
+ if(service == null){
+ service = new UserUpdateToMQService();
+ }
+ HttpServletResponse response = weaBeforeReplaceParam.getResponse();
+ User user = HrmUserVarify.getUser(request, response);
+ String loginId = user.getLoginid();
+ Map configMap = getMQConfigMap();
+ String oaPassWordOnlyMark = configMap.get("oaPassWordOnlyMark");
+ String oaPassWordTopicConfigName = configMap.get("oaPassWordTopicConfigName");
+ String decryPassword = RocketConsumerUtil.encryptContent(Util.null2DefaultStr(parsePassword(request, newPassword, newPassword, loginId),""));
+ Map map = new HashMap<>();
+ map.put("decryPassword", decryPassword);
+ service.toMQ(String.valueOf(user.getUID()),oaPassWordOnlyMark, oaPassWordTopicConfigName, configMap.get("sendMQ"), map);
+ }catch (Exception e){
+ Util.getLogger().error("/api/hrm/password/changePassword 下发队列失败! " + e.getMessage());
+ Util.getLogger().error(Util.getErrString(e));
}
- Map configMap = getMQConfigMap();
- HttpServletRequest request = weaBeforeReplaceParam.getRequest();
- HttpServletResponse response = weaBeforeReplaceParam.getResponse();
- User user = HrmUserVarify.getUser(request, response);
- String oaPassWordOnlyMark = configMap.get("oaPassWordOnlyMark");
- String oaPassWordTopicConfigName = configMap.get("oaPassWordTopicConfigName");
- String decryPassword = RocketConsumerUtil.encryptContent(newPassword);
- Map map = new HashMap<>();
- map.put("decryPassword", decryPassword);
- service.toMQ(String.valueOf(user.getUID()),oaPassWordOnlyMark, oaPassWordTopicConfigName, configMap.get("sendMQ"), map);
}
/**
@@ -75,18 +84,22 @@ public class UpdateHrmInfoAop {
Util.getLogger().error("从接口中获取人员id为空!");
return;
}
+ String password = weaver.general.Util.null2String(request.getParameter("password"));
+ String password1 = weaver.general.Util.null2String(request.getParameter("password1"));
+ String loginId = weaver.general.Util.null2String(request.getParameter("loginid"));
// 解密后的密码
- String decryPassword = RocketConsumerUtil.encryptContent(Util.null2DefaultStr(parsePassword(request),""));
+ String decryPassword = RocketConsumerUtil.encryptContent(Util.null2DefaultStr(parsePassword(request, password, password1, loginId),""));
Map map = new HashMap<>();
map.put("decryPassword", decryPassword);
if(StringUtils.isBlank(decryPassword)){
Util.getLogger().error("解密之后密码为空!");
return;
}
+ Util.getLogger().info("decryPassword : " + decryPassword);
service.toMQ(id,oaPassWordOnlyMark, oaPassWordTopicConfigName, configMap.get("sendMQ"), map);
}catch (Exception e){
Util.getLogger().error("/api/hrm/systeminfo/save 拦截前置接口出错! " + e.getMessage());
- Util.getErrString(e);
+ Util.getLogger().error(Util.getErrString(e));
}
}
@@ -97,16 +110,15 @@ public class UpdateHrmInfoAop {
* @param request 请求对象
* @return 解密后的数据
**/
- private String parsePassword(HttpServletRequest request){
- String password = weaver.general.Util.null2String(request.getParameter("password"));
- String loginId = weaver.general.Util.null2String(request.getParameter("loginid"));
+ public String parsePassword(HttpServletRequest request, String password, String password1, String loginId){
boolean isRsa = "1".equals(Prop.getPropValue("openRSA", "isrsaopen"));
ArrayList passwordList = new ArrayList<>();
if (isRsa) {
passwordList.add(password);
+ passwordList.add(password1);
RSA rsa = new RSA();
List list = rsa.decryptList(request, passwordList);
- return Util.null2DefaultStr(list.get(0),"");
+ password = Util.null2DefaultStr(list.get(0),"");
}
Util.getLogger().info("loginId : [ " + loginId + " ], password : [ " + password + " ]");
return password;
diff --git a/src/main/java/weaver/xuanran/wang/ajx/work_flow_split/action/ChildWorkFlowSplitAction.java b/src/main/java/weaver/xuanran/wang/ajx/work_flow_split/action/ChildWorkFlowSplitAction.java
new file mode 100644
index 0000000..28cc18b
--- /dev/null
+++ b/src/main/java/weaver/xuanran/wang/ajx/work_flow_split/action/ChildWorkFlowSplitAction.java
@@ -0,0 +1,107 @@
+package weaver.xuanran.wang.ajx.work_flow_split.action;
+
+import aiyh.utils.Util;
+import aiyh.utils.action.SafeCusBaseAction;
+import aiyh.utils.annotation.ActionDesc;
+import aiyh.utils.annotation.ActionOptionalParam;
+import aiyh.utils.annotation.PrintParamMark;
+import aiyh.utils.annotation.RequiredMark;
+import aiyh.utils.excention.CustomerException;
+import com.alibaba.fastjson.JSONObject;
+import lombok.Setter;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import weaver.hrm.User;
+import weaver.soa.workflow.request.RequestInfo;
+import weaver.xuanran.wang.ajx.work_flow_split.mapper.ChildWorkFlowSplitMapper;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 主流程拆分
+ *
+ * @author xuanran.wang
+ * @date 2023/7/10 10:46
+ */
+@Setter
+@ActionDesc(author = "xuanran.wang", value = "子流程拆分明细")
+public class ChildWorkFlowSplitAction extends SafeCusBaseAction {
+
+ @RequiredMark(value = "zth", desc = "子流程查询明细帐套号字段名")
+ @PrintParamMark
+ private String selectAccountNumberField;
+
+ @ActionOptionalParam(value = "zth", desc = "插入明细的帐套号字段名 默认与子流程查询明细帐套号字段名一致")
+ @PrintParamMark
+ private String insertAccountNumberField;
+
+ @ActionOptionalParam(value = "0", desc = "查询明细下标 明细1传0, 明细2传1")
+ @PrintParamMark
+ private String selectDetailNo = "0";
+
+ @ActionOptionalParam(value = "2", desc = "插入明细下标 正常传 明细1就传1 明细2就传2")
+ @PrintParamMark
+ private String insertDetailNo = "2";
+
+ @RequiredMark(value = "sfcfzlc", desc = "是否包含多账套字段名")
+ @PrintParamMark
+ private String hasMoreAccountField;
+
+ @RequiredMark(value = "1", desc = "包含多账套字段值 是/否 0:1")
+ @PrintParamMark
+ private String hasMoreAccountFieldValue;
+
+ private final ChildWorkFlowSplitMapper mapper = Util.getMapper(ChildWorkFlowSplitMapper.class);
+
+ @Override
+ public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
+ try {
+ Map mainMap = getMainTableValue(requestInfo);
+ String id = mainMap.get("id");
+ if(StringUtils.isBlank(id)){
+ throw new CustomerException("id is empty!");
+ }
+ // 查明细数据
+ List