From e22366fdc5b20be7841522b800d5b4820fb7c909 Mon Sep 17 00:00:00 2001
From: "youHong.ai" <774495953@qq.com>
Date: Thu, 23 Mar 2023 16:15:32 +0800
Subject: [PATCH 1/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E9=83=A8?=
=?UTF-8?q?=E5=90=8D=E7=A7=B0=E7=94=9F=E6=88=90=E7=99=BB=E5=BD=95=E5=90=8D?=
=?UTF-8?q?=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 5 +-
.../GenerateLoginIdAction.java | 51 +++++++++++++++++--
.../mapper/GenerateLoginIdMapper.java | 11 ++++
src/test/java/youhong/ai/pcn/UtilTest.java | 38 ++++++++++++++
4 files changed, 100 insertions(+), 5 deletions(-)
diff --git a/.gitignore b/.gitignore
index a1f5db0..bfc3e78 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,6 +36,7 @@ DirectoryV2.xml
/lib/classbeanLib/ecology-dev-lib.jar
/lib/classbeanLib/web-inf-class-lib.jar
/lib/weaverLib/
+/lib/jitulib/
*.groovy
*.log
*.iml
@@ -46,5 +47,5 @@ src/test/resources/font
src/main/resources/WEB-INF/vm/outFile
target/
*.back
-src/main/old_src/
-
+src/main/aiyh_old_src/
+src/main/jitu_src/
\ No newline at end of file
diff --git a/src/main/java/weaver/youhong/ai/pcn/actioin/generateloginid/GenerateLoginIdAction.java b/src/main/java/weaver/youhong/ai/pcn/actioin/generateloginid/GenerateLoginIdAction.java
index 5732d89..8a0b35f 100644
--- a/src/main/java/weaver/youhong/ai/pcn/actioin/generateloginid/GenerateLoginIdAction.java
+++ b/src/main/java/weaver/youhong/ai/pcn/actioin/generateloginid/GenerateLoginIdAction.java
@@ -15,6 +15,7 @@ import weaver.soa.workflow.request.RequestInfo;
import weaver.youhong.ai.pcn.actioin.generateloginid.mapper.GenerateLoginIdMapper;
import java.text.NumberFormat;
+import java.util.List;
import java.util.Map;
/**
@@ -57,9 +58,11 @@ public class GenerateLoginIdAction extends SafeCusBaseAction {
Map mainTableValue = super.getMainTableValue(requestInfo);
String subCompanyName = mainTableValue.get(subCompanyTextField);
String subCompanyId = mapper.selectSubCompanyIdBySubCompanyName(subCompanyName);
- Map lastLoginIdInfo = mapper.selectLastLoginId(subCompanyName, subCompanyId, subCompanyName + "%");
- String loginIdNo = lastLoginIdInfo.get("loginIdNo");
- String loginId = prefixFill(loginIdNo, subCompanyName);
+ // Map lastLoginIdInfo = mapper.selectLastLoginId(subCompanyName, subCompanyId, subCompanyName + "%");
+ // String loginIdNo = lastLoginIdInfo.get("loginIdNo");
+ // String loginId = prefixFill(loginIdNo, subCompanyName);
+ List loginIdList = mapper.selectLoginIdList(subCompanyId);
+ String loginId = subCompanyName + formatList(loginIdList, Integer.parseInt(numberFillQuantity));
if (mapper.updateLoginId(billTable, requestId, loginId, loginIdField)) {
try {
Thread.sleep(500);
@@ -74,6 +77,48 @@ public class GenerateLoginIdAction extends SafeCusBaseAction {
}
}
+
+ /**
+ * 前缀补齐
+ *
+ * @param list 登录名编号
+ * @param length 前缀
+ * @return 登录名
+ */
+ public String formatList(List list, int length) {
+ NumberFormat format = NumberFormat.getInstance();
+ format.setMinimumIntegerDigits(length);
+ format.setGroupingUsed(false);
+ if (list == null || list.isEmpty()) {
+ return format.format(0);
+ }
+ int maxNum = 0;
+ for (String s : list) {
+ if (s != null && !s.isEmpty()) {
+ int num = 0;
+ boolean foundNum = false;
+ // 从末尾向前读取
+ for (int i = s.length() - 1; i >= 0; i--) {
+ char c = s.charAt(i);
+ if (Character.isDigit(c)) {
+ foundNum = true;
+ int digit = c - '0';
+ // 根据数字位数计算数字大小
+ num += digit * Math.pow(10, s.length() - i - 1);
+ } else if (foundNum) {
+ // 遇到非数字字符,停止读取
+ break;
+ }
+ }
+ if (num > maxNum) {
+ maxNum = num;
+ }
+ }
+ }
+
+ return format.format(maxNum + 1);
+ }
+
/**
* 前缀补齐
*
diff --git a/src/main/java/weaver/youhong/ai/pcn/actioin/generateloginid/mapper/GenerateLoginIdMapper.java b/src/main/java/weaver/youhong/ai/pcn/actioin/generateloginid/mapper/GenerateLoginIdMapper.java
index a12019d..3041419 100644
--- a/src/main/java/weaver/youhong/ai/pcn/actioin/generateloginid/mapper/GenerateLoginIdMapper.java
+++ b/src/main/java/weaver/youhong/ai/pcn/actioin/generateloginid/mapper/GenerateLoginIdMapper.java
@@ -5,6 +5,7 @@ import aiyh.utils.annotation.recordset.Select;
import aiyh.utils.annotation.recordset.SqlMapper;
import aiyh.utils.annotation.recordset.Update;
+import java.util.List;
import java.util.Map;
/**
@@ -47,6 +48,16 @@ public interface GenerateLoginIdMapper {
);
+ /**
+ * 查询分部下的所有人员登录账号
+ *
+ * @param subCompanyId 分部id
+ * @return 所有人员登录账号
+ */
+ @Select("select LOGINID from hrmresource where SUBCOMPANYID1 = #{subCompanyId}")
+ List selectLoginIdList(@ParamMapper("subCompanyId") String subCompanyId);
+
+
/**
* 更新流程中的loginId字段
*
diff --git a/src/test/java/youhong/ai/pcn/UtilTest.java b/src/test/java/youhong/ai/pcn/UtilTest.java
index f7af5c0..1c1a056 100644
--- a/src/test/java/youhong/ai/pcn/UtilTest.java
+++ b/src/test/java/youhong/ai/pcn/UtilTest.java
@@ -27,6 +27,7 @@ import youhong.ai.pcn.pojo.Student;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
+import java.text.NumberFormat;
import java.util.*;
import static com.alibaba.fastjson.JSON.parseObject;
@@ -257,5 +258,42 @@ public class UtilTest extends BaseTest {
@Test
public void testOaNum() {
+ out.println(formatList(Arrays.asList("PCN2P000001", "PCNS0000002", "PDJA000003", "PDC0000405"), 10));
}
+
+ public static String formatList(List list, int length) {
+ NumberFormat format = NumberFormat.getInstance();
+ format.setMinimumIntegerDigits(length);
+ format.setGroupingUsed(false);
+ if (list == null || list.isEmpty()) {
+ return format.format(0);
+ }
+ int maxNum = 0;
+ for (String s : list) {
+ if (s != null && !s.isEmpty()) {
+ int num = 0;
+ boolean foundNum = false;
+ // 从末尾向前读取
+ for (int i = s.length() - 1; i >= 0; i--) {
+ char c = s.charAt(i);
+ if (Character.isDigit(c)) {
+ foundNum = true;
+ int digit = c - '0';
+ // 根据数字位数计算数字大小
+ num += digit * Math.pow(10, s.length() - i - 1);
+ } else if (foundNum) {
+ // 遇到非数字字符,停止读取
+ break;
+ }
+ }
+ if (num > maxNum) {
+ maxNum = num;
+ }
+ }
+ }
+
+ return format.format(maxNum + 1);
+ }
+
+
}
From 4615e23317d81587f18ff51014674b724767a6f6 Mon Sep 17 00:00:00 2001
From: "yushun.ding" <2437588377@qq.com>
Date: Sat, 25 Mar 2023 00:26:00 +0800
Subject: [PATCH 2/8] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=A4=9A=E8=AF=AD?=
=?UTF-8?q?=E8=A8=80=E5=A4=84=E7=90=86=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 | 66 ++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/src/main/java/aiyh/utils/Util.java b/src/main/java/aiyh/utils/Util.java
index cc5f158..62322df 100644
--- a/src/main/java/aiyh/utils/Util.java
+++ b/src/main/java/aiyh/utils/Util.java
@@ -3870,4 +3870,70 @@ public class Util extends weaver.general.Util {
}
return ip;
}
+
+ /**
+ * 多语言处理
+ *
+ * @param oldName 老名字
+ * @param newName 新名字
+ * @param lanuage 要替换的语言 以 7 8 9 举例
+ */
+ public String moreLanugageHandler(String oldName, String newName, String lanuage) {
+ List languageIds = weaver.general.Util.getActiveLanguageIds();//获取系统支持的多语言
+ String newMoreLanuage = "";
+ //要按照当前系统支持的多语言id进行拼接处理
+ if (oldName.startsWith("~`~`") && oldName.endsWith("`~`~")) {
+ // 获取当前系统存在的多语言id
+ // 思路:先按照系统存在的语言进行拼接,之后判断oldname包含那些语言进行过滤,将除了lanuage的其他语言都替换成之前的
+ //多语言的中间处理
+ String tempLanuage = joinLanuage(newName, languageIds);
+ //中间处理转成map
+ Map splitMultilangData = weaver.general.Util.splitMultilangData(tempLanuage);
+ Map lanuageMap = new HashMap<>();
+ for (Object id : languageIds) {
+ String labelLanuage = "`~`" + id;
+ if (oldName.contains(labelLanuage)) {
+ //获取过滤的语言name
+ String formatLanuageName = weaver.general.Util.formatMultiLang(oldName, String.valueOf(id));
+ if (!weaver.general.StringUtil.isEmpty(formatLanuageName)) {
+ lanuageMap.put(String.valueOf(id), formatLanuageName);
+ }
+ }
+ }
+ String s = lanuageMap.get(lanuage);
+ if (weaver.general.StringUtil.isEmpty(s)) {
+ for (Map.Entry entry : lanuageMap.entrySet()) {
+ splitMultilangData.put(entry.getKey(), entry.getValue());
+ }
+ } else {
+ lanuageMap.remove(lanuage);
+ for (Map.Entry entry : lanuageMap.entrySet()) {
+ splitMultilangData.put(entry.getKey(), entry.getValue());
+ }
+ }
+ newMoreLanuage = weaver.general.Util.stitchMultilangData(splitMultilangData);
+ } else {
+ //要根据系统支持的语言进行拼接
+ newMoreLanuage = joinLanuage(newName, languageIds);
+ }
+ return newMoreLanuage;
+ }
+
+ /**
+ * 多语言拼接
+ *
+ * @param newName 新的名字
+ * @param languageIds 系统支持的语言集合
+ * @return 拼接后的字符串
+ */
+ public String joinLanuage(String newName, List languageIds) {
+ StringBuilder supportLanuage = new StringBuilder();
+ supportLanuage.append("~`~`");
+ languageIds.forEach(id -> {
+ supportLanuage.append(id).append(" ").append(newName).append("`~`");
+ });
+ supportLanuage.delete(supportLanuage.lastIndexOf("`~`"), supportLanuage.length());
+ supportLanuage.append("`~`~");
+ return supportLanuage.toString();
+ }
}
From 3c49ade7b4abc220f9a7345b367126fd5b403c2a Mon Sep 17 00:00:00 2001
From: "yushun.ding" <2437588377@qq.com>
Date: Sat, 25 Mar 2023 21:12:22 +0800
Subject: [PATCH 3/8] =?UTF-8?q?=E6=96=B9=E6=B3=95=E8=A1=A5=E5=85=85static?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/main/java/aiyh/utils/Util.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/main/java/aiyh/utils/Util.java b/src/main/java/aiyh/utils/Util.java
index 62322df..12ad673 100644
--- a/src/main/java/aiyh/utils/Util.java
+++ b/src/main/java/aiyh/utils/Util.java
@@ -3878,8 +3878,8 @@ public class Util extends weaver.general.Util {
* @param newName 新名字
* @param lanuage 要替换的语言 以 7 8 9 举例
*/
- public String moreLanugageHandler(String oldName, String newName, String lanuage) {
- List languageIds = weaver.general.Util.getActiveLanguageIds();//获取系统支持的多语言
+ public static String moreLanugageHandler(String oldName, String newName, String lanuage) {
+ List languageIds = getActiveLanguageIds();//获取系统支持的多语言
String newMoreLanuage = "";
//要按照当前系统支持的多语言id进行拼接处理
if (oldName.startsWith("~`~`") && oldName.endsWith("`~`~")) {
@@ -3888,13 +3888,13 @@ public class Util extends weaver.general.Util {
//多语言的中间处理
String tempLanuage = joinLanuage(newName, languageIds);
//中间处理转成map
- Map splitMultilangData = weaver.general.Util.splitMultilangData(tempLanuage);
+ Map splitMultilangData = splitMultilangData(tempLanuage);
Map lanuageMap = new HashMap<>();
for (Object id : languageIds) {
String labelLanuage = "`~`" + id;
if (oldName.contains(labelLanuage)) {
//获取过滤的语言name
- String formatLanuageName = weaver.general.Util.formatMultiLang(oldName, String.valueOf(id));
+ String formatLanuageName = formatMultiLang(oldName, String.valueOf(id));
if (!weaver.general.StringUtil.isEmpty(formatLanuageName)) {
lanuageMap.put(String.valueOf(id), formatLanuageName);
}
@@ -3911,7 +3911,7 @@ public class Util extends weaver.general.Util {
splitMultilangData.put(entry.getKey(), entry.getValue());
}
}
- newMoreLanuage = weaver.general.Util.stitchMultilangData(splitMultilangData);
+ newMoreLanuage = stitchMultilangData(splitMultilangData);
} else {
//要根据系统支持的语言进行拼接
newMoreLanuage = joinLanuage(newName, languageIds);
@@ -3926,7 +3926,7 @@ public class Util extends weaver.general.Util {
* @param languageIds 系统支持的语言集合
* @return 拼接后的字符串
*/
- public String joinLanuage(String newName, List languageIds) {
+ public static String joinLanuage(String newName, List languageIds) {
StringBuilder supportLanuage = new StringBuilder();
supportLanuage.append("~`~`");
languageIds.forEach(id -> {
From ee64140219bac1b2ce7115bfaa2d0a0b44694af8 Mon Sep 17 00:00:00 2001
From: "yushun.ding" <2437588377@qq.com>
Date: Mon, 27 Mar 2023 13:03:45 +0800
Subject: [PATCH 4/8] =?UTF-8?q?=E9=87=91=E9=A2=9D=E7=B1=BB=E5=9E=8B?=
=?UTF-8?q?=E5=AD=97=E6=AE=B5=20+=20-=20*=20/=20=E5=A4=84=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/main/java/aiyh/utils/AmountHandler.java | 178 ++++++++++++++++++++
1 file changed, 178 insertions(+)
create mode 100644 src/main/java/aiyh/utils/AmountHandler.java
diff --git a/src/main/java/aiyh/utils/AmountHandler.java b/src/main/java/aiyh/utils/AmountHandler.java
new file mode 100644
index 0000000..0ccdab0
--- /dev/null
+++ b/src/main/java/aiyh/utils/AmountHandler.java
@@ -0,0 +1,178 @@
+package aiyh.utils;
+
+/**
+ * @Author DYS
+ * @Date 2023/3/25 18:08
+ * @description create at weaver
+ */
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 金额类型. 支持自身的四则运算,并将this返回.
+ */
+public class AmountHandler implements Serializable {
+
+ private BigDecimal value;
+
+ /**
+ * 提供默认精度10
+ */
+ private int scale = 10;
+
+ public AmountHandler() {
+
+ }
+
+ /**
+ * double类型构造函数
+ *
+ * @param value
+ */
+ public AmountHandler(double value) {
+ this.value = new BigDecimal(Double.toString(value));
+ }
+
+ /**
+ * String类型构造函数
+ *
+ * @param value
+ */
+ public AmountHandler(String value) {
+ this.value = new BigDecimal(value);
+ }
+
+ /**
+ * 取得BigDecimal的值
+ *
+ * @return
+ */
+ public BigDecimal getValue() {
+ return this.value;
+ }
+
+ /**
+ * 两个double类型的数值相加
+ *
+ * @param v1
+ * @param v2
+ * @return
+ */
+ public double add(double v1, double v2) {
+ AmountHandler a1 = new AmountHandler(v1);
+ AmountHandler a2 = new AmountHandler(v2);
+ return add(a1, a2);
+ }
+
+ /**
+ * 两数相除
+ *
+ * @param v1
+ * @param v2
+ * @return
+ */
+ public double div(double v1, double v2) {
+ AmountHandler a1 = new AmountHandler(v1);
+ AmountHandler a2 = new AmountHandler(v2);
+ return this.divide(a1, a2);
+ }
+
+ /**
+ * 相减
+ *
+ * @param v1
+ * @param v2
+ * @return
+ */
+ public double sub(double v1, double v2) {
+ AmountHandler a1 = new AmountHandler(v1);
+ AmountHandler a2 = new AmountHandler(v2);
+ return this.subtract(a1, a2);
+ }
+
+ /**
+ * 相乘
+ *
+ * @param v1
+ * @param v2
+ * @return
+ */
+ public double mul(double v1, double v2) {
+ AmountHandler a1 = new AmountHandler(v1);
+ AmountHandler a2 = new AmountHandler(v2);
+ return this.multiply(a1, a2);
+ }
+
+ /**
+ * 两个Amount类型的数据进行相加
+ *
+ * @param v1
+ * @param v2
+ * @return
+ */
+ public double add(AmountHandler v1, AmountHandler v2) {
+ return v1.getValue().add(v2.getValue()).doubleValue();
+ }
+
+ /**
+ * 两个Amount类型变量相除
+ *
+ * @param v1
+ * @param v2
+ * @return
+ */
+ public double divide(AmountHandler v1, AmountHandler v2) {
+ if (scale < 0) {
+ throw new IllegalArgumentException("精度指定错误,请指定一个>=0的精度");
+ }
+ return v1.getValue().divide(v2.getValue(), scale,
+ BigDecimal.ROUND_HALF_UP).doubleValue();
+ }
+
+ /**
+ * 两数相乘
+ *
+ * @param v1
+ * @param v2
+ * @return
+ */
+ public double multiply(AmountHandler v1, AmountHandler v2) {
+ return v1.getValue().multiply(v2.getValue()).doubleValue();
+ }
+
+ /**
+ * 两数相减
+ *
+ * @param v1
+ * @param v2
+ * @return
+ */
+ public double subtract(AmountHandler v1, AmountHandler v2) {
+ return v1.getValue().subtract(v2.getValue()).doubleValue();
+ }
+
+ /**
+ * 返回value的浮点数值
+ *
+ * @return
+ */
+ public double doubleValue() {
+ return this.getValue().doubleValue();
+ }
+
+ /**
+ * 设置精度
+ *
+ * @param scale
+ */
+ public void setScale(int scale) {
+ this.scale = scale;
+ }
+
+ public static void main(String[] args) {
+ AmountHandler AmountHandler = new AmountHandler(5000.23);
+ AmountHandler AmountHandler1 = new AmountHandler(2033.37);
+ System.out.println(new AmountHandler().add(AmountHandler, AmountHandler1));
+ }
+}
From 9275631cd829a3ba2031c14d13867c958750dfb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=8E=8B=E5=AE=A3=E7=84=B6?=
Date: Tue, 4 Apr 2023 17:15:00 +0800
Subject: [PATCH 5/8] =?UTF-8?q?=E8=A7=A3=E5=86=B3double=E8=B6=85=E5=87=BA?=
=?UTF-8?q?=E7=B2=BE=E5=BA=A6=E8=BD=AC=E6=88=90=E7=A7=91=E5=AD=A6=E8=AE=B0?=
=?UTF-8?q?=E6=95=B0=E6=B3=95=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../config/service/DealWithMapping.java | 16 +++-
...viceImpl.java => UserServiceImplBack.java} | 2 +
.../http_test/annotations/CusPathQuery.java | 16 ----
...{CusRequest.java => CusRequestClient.java} | 2 +-
.../http_test/annotations/GetPathValue.java | 15 ----
.../wang/http_test/annotations/PostBody.java | 15 ----
...ant.java => CusRequestClientConstant.java} | 2 +-
...andle.java => CusRequestBeforeHandle.java} | 0
.../wang/http_test/handle/PostTypeHandle.java | 35 --------
.../http_test/handle/RequestHeaderHandle.java | 81 -------------------
...rseHandle.java => CusPathParseHandle.java} | 4 +-
11 files changed, 21 insertions(+), 167 deletions(-)
rename src/main/java/weaver/xuanran/wang/shyl_mq/service/impl/{UserServiceImpl.java => UserServiceImplBack.java} (98%)
delete mode 100644 src/test/java/xuanran/wang/http_test/annotations/CusPathQuery.java
rename src/test/java/xuanran/wang/http_test/annotations/{CusRequest.java => CusRequestClient.java} (86%)
delete mode 100644 src/test/java/xuanran/wang/http_test/annotations/GetPathValue.java
delete mode 100644 src/test/java/xuanran/wang/http_test/annotations/PostBody.java
rename src/test/java/xuanran/wang/http_test/constant/{RequestUtilConstant.java => CusRequestClientConstant.java} (89%)
rename src/test/java/xuanran/wang/http_test/handle/{RequestBeforeHandle.java => CusRequestBeforeHandle.java} (100%)
delete mode 100644 src/test/java/xuanran/wang/http_test/handle/PostTypeHandle.java
delete mode 100644 src/test/java/xuanran/wang/http_test/handle/RequestHeaderHandle.java
rename src/test/java/xuanran/wang/http_test/handle/path_handle/{CusFieldKeyParseHandle.java => CusPathParseHandle.java} (89%)
diff --git a/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java b/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java
index 712fc01..1219d1e 100644
--- a/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java
+++ b/src/main/java/weaver/xiao/commons/config/service/DealWithMapping.java
@@ -21,6 +21,7 @@ import weaver.zwl.common.ToolUtil;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
+import java.math.BigDecimal;
import java.security.SecureRandom;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -115,7 +116,20 @@ public class DealWithMapping extends ToolUtil {
continue;
}
if ("DECIMAL".equalsIgnoreCase(type) || "NUMERIC".equalsIgnoreCase(type)) {
- map.put(key, rs.getDouble(i));
+ /**
+ * @author xuanran.wang
+ * @data 2023-04-04
+ * @desc 解决double超出精度转成科学记数法的问题
+ */
+ String val = Util.null2String(rs.getString(i));
+ BigDecimal decimal;
+ if(StringUtils.isBlank(val)){
+ decimal = new BigDecimal("0");
+ }else {
+ decimal = new BigDecimal(val);
+ }
+ map.put(key, decimal);
+// map.put(key, rs.getDouble(i));
continue;
}
map.put(key, rs.getString(i));
diff --git a/src/main/java/weaver/xuanran/wang/shyl_mq/service/impl/UserServiceImpl.java b/src/main/java/weaver/xuanran/wang/shyl_mq/service/impl/UserServiceImplBack.java
similarity index 98%
rename from src/main/java/weaver/xuanran/wang/shyl_mq/service/impl/UserServiceImpl.java
rename to src/main/java/weaver/xuanran/wang/shyl_mq/service/impl/UserServiceImplBack.java
index 01d336e..759e1e2 100644
--- a/src/main/java/weaver/xuanran/wang/shyl_mq/service/impl/UserServiceImpl.java
+++ b/src/main/java/weaver/xuanran/wang/shyl_mq/service/impl/UserServiceImplBack.java
@@ -68,6 +68,7 @@ public class UserServiceImpl extends CusInfoActionService {
// 通过外键获取部门信息数据为空
throw new CustomerException("The department information data obtained by foreign key is empty!");
}
+ logger.info(Util.logStr("depInfoByOutKey : {}", JSONObject.toJSONString(depInfoByOutKey)));
nextHrmId = getNextHrmId();
List
**/
- @SqlFieldMapping()
+ @SqlFieldMapping
private String topic;
/**
* 消息内容操作类型
@@ -35,19 +35,19 @@ public class MQMessage {
* PASSWORD_ACTION: 修改密码
*
**/
- @SqlFieldMapping()
+ @SqlFieldMapping
private String actionType;
/**
* 消息发送时间
**/
- @SqlFieldMapping()
+ @SqlFieldMapping
private String sendTime;
/**
* 消息业务内容,json 格式,分业务(用户、机构、密码修改)
**/
- @SqlFieldMapping()
+ @SqlFieldMapping
private String content;
- @SqlFieldMapping()
+ @SqlFieldMapping
private String error;
}
diff --git a/src/main/java/weaver/xuanran/wang/shyl_mq/mapper/ConsumerMapper.java b/src/main/java/weaver/xuanran/wang/shyl_mq/mapper/ConsumerMapper.java
index 1d6bab2..e1ec671 100644
--- a/src/main/java/weaver/xuanran/wang/shyl_mq/mapper/ConsumerMapper.java
+++ b/src/main/java/weaver/xuanran/wang/shyl_mq/mapper/ConsumerMapper.java
@@ -100,7 +100,7 @@ public interface ConsumerMapper {
* @param id id
* @return true/false
**/
- @Delete("delete from hrmresource where id = #{id}")
+ @Delete("update hrmresource set status = 7 where id = #{id}")
boolean deleteHrmById(@ParamMapper("id") String id);
/**
@@ -115,4 +115,8 @@ public interface ConsumerMapper {
@Select("select count(1) from uf_mqLog where messageId = #{messageId}")
int getMainIdFromMQLogByMessageId(@ParamMapper("messageId") String messageId);
+
+ @Update("update hrmresource set loginId = #{loginId} where id = #{id}")
+ boolean updateHrmLoginIdById(@ParamMapper("id") String id,
+ @ParamMapper("loginId") String loginId);
}
diff --git a/src/main/java/weaver/xuanran/wang/shyl_mq/service/ProducerService.java b/src/main/java/weaver/xuanran/wang/shyl_mq/service/ProducerService.java
index 75c5bbc..e6ad383 100644
--- a/src/main/java/weaver/xuanran/wang/shyl_mq/service/ProducerService.java
+++ b/src/main/java/weaver/xuanran/wang/shyl_mq/service/ProducerService.java
@@ -29,7 +29,7 @@ public class ProducerService {
private final Logger logger = Util.getLogger();
private final DealWithMapping dealWithMapping = new DealWithMapping();
- private final ToolUtil toolUtil = new ToolUtil();
+
private final HttpUtils httpUtils = new HttpUtils();
{
@@ -54,7 +54,7 @@ public class ProducerService {
ChangeRequestParam changeRequestParam){
RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(onlyMark);
String selectMainSql = CommonUtil.getSelectSql(requestMappingConfig, tableName);
- logger.info("查询主表sql : " + selectMainSql);
+// logger.info("查询主表sql : " + selectMainSql);
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(selectMainSql, requestId);
Map requestParam = new HashMap<>();
@@ -69,10 +69,6 @@ public class ProducerService {
if(!Objects.isNull(changeRequestParam)){
changeRequestParam.changeRequestParam(requestParam);
}
-// logger.info(Util.logStr("requestId : {}, msg:{}", requestId, JSONObject.toJSONString(requestParam)));
- String sendMQ = Util.null2DefaultStr(toolUtil.getSystemParamValue("sendMQ"),"");
- if("1".equals(sendMQ)){
- RocketConsumerUtil.producerSendMsg(configName,JSONObject.toJSONString(requestParam), requestId);
- }
+ RocketConsumerUtil.producerSendMsg(configName, JSONObject.toJSONString(requestParam), requestId);
}
}
diff --git a/src/main/java/weaver/xuanran/wang/shyl_mq/service/impl/PassWordServiceImpl.java b/src/main/java/weaver/xuanran/wang/shyl_mq/service/impl/PassWordServiceImpl.java
index b9cf11a..4a5198c 100644
--- a/src/main/java/weaver/xuanran/wang/shyl_mq/service/impl/PassWordServiceImpl.java
+++ b/src/main/java/weaver/xuanran/wang/shyl_mq/service/impl/PassWordServiceImpl.java
@@ -42,14 +42,14 @@ public class PassWordServiceImpl extends CusInfoActionService {
String content = message.getContent();
ModifyPassWord passWord = JSONObject.parseObject(content, ModifyPassWord.class);
logger.info(Util.logStr("cusPassWordAction messageId: {},UserInfo : {} ",message.getId(),JSONObject.toJSONString(passWord)));
- String outKey = passWord.getId();
- String hrmId = consumerMapper.getHrmIdByOutKey(outKey);
- if(StringUtils.isBlank(hrmId)){
- throw new CustomerException(Util.logStr("the userId is {} , no personnel information found in oa!", outKey));
- }
- if (!consumerMapper.updatePasswordById(hrmId, Util.getEncrypt(passWord.getPassword()))) {
- throw new CustomerException("update user password error!");
- }
+// String outKey = passWord.getId();
+// String hrmId = consumerMapper.getHrmIdByOutKey(outKey);
+// if(StringUtils.isBlank(hrmId)){
+// throw new CustomerException(Util.logStr("the userId is {} , no personnel information found in oa!", outKey));
+// }
+// if (!consumerMapper.updatePasswordById(hrmId, Util.getEncrypt(passWord.getPassword()))) {
+// throw new CustomerException("update user password error!");
+// }
writeInOA(message.getId());
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
} catch (Exception e) {
diff --git a/src/main/java/weaver/xuanran/wang/shyl_mq/service/impl/UserServiceImpl.java b/src/main/java/weaver/xuanran/wang/shyl_mq/service/impl/UserServiceImpl.java
new file mode 100644
index 0000000..8a126d0
--- /dev/null
+++ b/src/main/java/weaver/xuanran/wang/shyl_mq/service/impl/UserServiceImpl.java
@@ -0,0 +1,124 @@
+package weaver.xuanran.wang.shyl_mq.service.impl;
+
+import aiyh.utils.Util;
+import aiyh.utils.excention.CustomerException;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.log4j.Logger;
+import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
+import weaver.hrm.resource.ResourceComInfo;
+import weaver.xuanran.wang.shyl_mq.entity.MQMessage;
+import weaver.xuanran.wang.shyl_mq.entity.UserInfo;
+import weaver.xuanran.wang.shyl_mq.service.CusInfoActionService;
+
+
+/**
+ * 用户业务方法
+ *
+ * @Author xuanran.wang
+ * @Date 2022/12/30 13:04
+ */
+public class UserServiceImpl extends CusInfoActionService {
+ private Logger logger = Util.getLogger("mq-consumer-user");
+
+ {
+ if(null == logger){
+ logger = Util.getLogger("mq-consumer-user");
+ }
+ }
+
+ /**
+ * 用户新增
+ * @author xuanran.wang
+ * @dateTime 2023/1/3 13:37
+ * @param message mq消息
+ * @return 成功/重试
+ **/
+ @Override
+ public ConsumeConcurrentlyStatus cusCreateAction(MQMessage message) {
+ try {
+ String content = message.getContent();
+ UserInfo userInfo = JSONObject.parseObject(content, UserInfo.class);
+ logger.info(Util.logStr("userCusCreateAction messageId: {}, UserInfo : {} ",message.getId(), JSONObject.toJSONString(userInfo)));
+ updateLoginId(userInfo);
+ writeInOA(message.getId());
+ return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
+ }catch (Exception e){
+ throw new CustomerException(Util.logStr("hrmCreateAction error : {}", e.getMessage()));
+ }
+ }
+
+ /**
+ * 用户删除
+ * @author xuanran.wang
+ * @dateTime 2023/1/3 13:38
+ * @param message mq消息
+ * @return 成功/重试
+ **/
+ @Override
+ public ConsumeConcurrentlyStatus cusDeleteAction(MQMessage message) {
+ try {
+ String content = message.getContent();
+ UserInfo userInfo = JSONObject.parseObject(content, UserInfo.class);
+ logger.info(Util.logStr("userCusDeleteAction messageId: {},UserInfo : {} ", message.getId(),JSONObject.toJSONString(userInfo)));
+ String id = Util.null2DefaultStr(userInfo.getId(),"");
+ if(StringUtils.isBlank(id)){
+ throw new CustomerException("del user id not null!");
+ }
+ if (!consumerMapper.deleteHrmById(id)) {
+ throw new CustomerException("del user sql execute error!");
+ }
+ ResourceComInfo resourceComInfo = new ResourceComInfo();
+ resourceComInfo.updateResourceInfoCache(id);
+ writeInOA(message.getId());
+ return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
+ } catch (Exception e) {
+ throw new CustomerException(Util.logStr("hrmDeleteAction execute error : [{}]!", e.getMessage()));
+ }
+ }
+
+ /**
+ * 用户更新
+ * @author xuanran.wang
+ * @dateTime 2023/1/3 13:39
+ * @param message mq消息
+ * @return 成功/重试
+ **/
+ @Override
+ public ConsumeConcurrentlyStatus cusUpdateAction(MQMessage message) {
+ try {
+ String content = message.getContent();
+ UserInfo userInfo = JSONObject.parseObject(content, UserInfo.class);
+ logger.info(Util.logStr("userCusUpdateAction messageId: {},UserInfo : {} ", message.getId(), JSONObject.toJSONString(userInfo)));
+ updateLoginId(userInfo);
+ writeInOA(message.getId());
+ return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
+ }catch (Exception e){
+ throw new CustomerException(Util.logStr("userCusUpdateAction execute error : [{}]!", e.getMessage()));
+ }
+ }
+ /**
+ * <更新登陆名/h1>
+ * @author xuanran.wang
+ * @dateTime 2023/3/28 13:07
+ * @param userInfo 用户实体
+ **/
+ public void updateLoginId(UserInfo userInfo) throws Exception {
+ String id = Util.null2DefaultStr(userInfo.getId(),"");
+ String userName = Util.null2DefaultStr(userInfo.getUserName(),"");
+ if(StringUtils.isBlank(id) || StringUtils.isBlank(userName)){
+ throw new CustomerException("create user id or userName can not null!");
+ }
+ if (!consumerMapper.updateHrmLoginIdById(id, userName)) {
+ throw new CustomerException("update loginId sql execute error!");
+ }
+ ResourceComInfo resourceComInfo = new ResourceComInfo();
+ // 清空缓存
+ resourceComInfo.updateResourceInfoCache(id);
+ }
+
+ @Override
+ public ConsumeConcurrentlyStatus cusPassWordAction(MQMessage message) {
+ return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
+ }
+}
diff --git a/src/main/java/weaver/xuanran/wang/shyl_mq/service/impl/UserServiceImplBack.java b/src/main/java/weaver/xuanran/wang/shyl_mq/service/impl/UserServiceImplBack.java
index 759e1e2..3f97c57 100644
--- a/src/main/java/weaver/xuanran/wang/shyl_mq/service/impl/UserServiceImplBack.java
+++ b/src/main/java/weaver/xuanran/wang/shyl_mq/service/impl/UserServiceImplBack.java
@@ -22,12 +22,12 @@ import java.util.List;
import java.util.Map;
/**
- * 用户业务方法
+ * 用户业务方法-废弃
*
* @Author xuanran.wang
* @Date 2022/12/30 13:04
*/
-public class UserServiceImpl extends CusInfoActionService {
+public class UserServiceImplBack extends CusInfoActionService {
private Logger logger = Util.getLogger("mq-consumer-user");
{
diff --git a/src/main/java/weaver/xuanran/wang/shyl_mq/util/RocketConsumerUtil.java b/src/main/java/weaver/xuanran/wang/shyl_mq/util/RocketConsumerUtil.java
index a27c413..c6b564d 100644
--- a/src/main/java/weaver/xuanran/wang/shyl_mq/util/RocketConsumerUtil.java
+++ b/src/main/java/weaver/xuanran/wang/shyl_mq/util/RocketConsumerUtil.java
@@ -1,4 +1,4 @@
-package weaver.xuanran.wang.shyl_mq.util;//package weaver.xuanran.wang.shyl.mq.util;
+package weaver.xuanran.wang.shyl_mq.util;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
@@ -37,15 +37,21 @@ import java.util.*;
*/
public class RocketConsumerUtil {
private static Logger log = Util.getLogger("mq-util");
+
+ private static Logger producerLog = Util.getLogger("mq-producer");
private static final ConsumerMapper consumerMapper = Util.getMapper(ConsumerMapper.class);
private static final ToolUtil tool = new ToolUtil();
private static final int ERROR_LOG_ID;
+ private static final ToolUtil toolUtil = new ToolUtil();
static {
ERROR_LOG_ID = Util.getIntValue(tool.getSystemParamValue("mqErrorLogModelId"), -1);
if(log == null){
log = Util.getLogger("mq-util");
}
+ if(producerLog == null){
+ producerLog = Util.getLogger("mq-producer");
+ }
}
/**
@@ -83,7 +89,7 @@ public class RocketConsumerUtil {
CusInfoActionService cusInfoActionService, String configName){
Map configMap = RocketMQFactory.CONFIG_MAPS.get(configName);
int maxReconsumeTimes = Util.getIntValue(Util.null2String(configMap.get("MaxReconsumeTimes")), RocketMQConstant.DEFAULT_MAX_RECONSUME_TIMES);
- MessageExt messageExt = null;
+ MessageExt messageExt;
String msgBody = "";
String mqMessageId = "";
MQMessage mqMessage = null;
@@ -143,7 +149,7 @@ public class RocketConsumerUtil {
mqMessage.setError(e.getMessage());
List ids = CusInfoToOAUtil.executeBatchByEntity(ERROR_LOG_ID, Collections.singletonList(mqMessage), "");
if(CollectionUtils.isEmpty(ids)){
- log.error("insert into mq_error_log failed!");
+ log.error(Util.logStr("messageId : {}, insert into mq_error_log failed!", mqMessageId));
}
}
log.error(Util.logStr("MQ producer error already bigger maxReconsumeTimes! messageId : {}",mqMessageId));
@@ -164,6 +170,10 @@ public class RocketConsumerUtil {
* @param requestId 请求id
**/
public static void producerSendMsg(String configName, String msg, String requestId) {
+ String sendMQ = Util.null2DefaultStr(toolUtil.getSystemParamValue("sendMQ"),"");
+ if(!"1".equals(sendMQ)){
+ return;
+ }
// 先从本地缓存中获取生产者对象
DefaultMQProducer producer = RocketMQFactory.getMQProducer(configName);
// 获取配置信息
@@ -171,9 +181,10 @@ public class RocketConsumerUtil {
// 队列名
String topic = Util.null2DefaultStr(configMap.get("Topic"), "");
// tag
- String tag = Util.null2DefaultStr(configMap.get("Tag"), "");
+// String tag = Util.null2DefaultStr(configMap.get("Tag"), "");
Message message;
try {
+ producerLog.info(Util.logStr("requestId: {}, msg: {}", requestId, msg));
message = new Message(topic, msg.getBytes(RemotingHelper.DEFAULT_CHARSET));
} catch (Exception e) {
throw new CustomerException(Util.logStr("init message error : {} !", e.getMessage()));
@@ -190,12 +201,12 @@ public class RocketConsumerUtil {
} catch (MQClientException | RemotingException | MQBrokerException | InterruptedException e) {
throw new CustomerException(Util.logStr("producer send message error!: {}", e.getMessage()));
}
- log.info(Util.logStr("requestId: {}, result : {}",requestId, JSONObject.toJSONString(result)));
+ producerLog.info(Util.logStr("requestId: {}, result : {}",requestId, JSONObject.toJSONString(result)));
SendStatus sendStatus = result.getSendStatus();
// 如果失败
if (!SendStatus.SEND_OK.equals(sendStatus)) {
String error = Util.logStr("producer send message call back status is not ok! the message is {}, the status is {}.", msg, sendStatus);
- log.error(error);
+ producerLog.error(error);
// 如果重试超过最大次数
if(count >= RocketMQConstant.SEND_MAX_COUNT){
throw new CustomerException(error + " and retry > max");
diff --git a/src/main/resources/WEB-INF/prop/prop2map/OACarTest.properties b/src/main/resources/WEB-INF/prop/prop2map/OACarTest.properties
new file mode 100644
index 0000000..516ecc6
--- /dev/null
+++ b/src/main/resources/WEB-INF/prop/prop2map/OACarTest.properties
@@ -0,0 +1,5 @@
+producerGroup=weaver-car
+serverAddr=114.115.168.220:9876
+topic=AUTH_CONSOLE_ORG_TOPIC
+tag=*
+consumerGroup=weaver-car-consumer
diff --git a/src/main/resources/WEB-INF/prop/prop2map/ShBigdataConf.properties b/src/main/resources/WEB-INF/prop/prop2map/ShBigdataConf.properties
new file mode 100644
index 0000000..448dd3f
--- /dev/null
+++ b/src/main/resources/WEB-INF/prop/prop2map/ShBigdataConf.properties
@@ -0,0 +1,24 @@
+# ???????
+corpSecret=5eab6957b4944d75acfa9cfcc8feff5a
+agentId=10000060
+corpId=wwdbb6b075752cc1b9
+# ??token???
+tokenUrl=http://ramos-develop.shdata.com:11080/uranus/cgi-bin/gettoken
+# ??????
+userInfoUrl=http://ramos-develop.shdata.com:11080/uranus/cgi-bin/request/user/get
+# ??????
+departmentInfoUrl=http://ramos-develop.shdata.com:11080/uranus/cgi-bin/request/department/list
+# ??????
+addTodoTaskUrl=http://ramos-develop.shdata.com:11080/uranus/cgi-bin/request/task/create
+# ??????
+updateTodoTaskUrl=http://ramos-develop.shdata.com:11080/uranus/cgi-bin/request/task/update
+# ?????????appId
+appId=wwdbb6b075752cc1b9
+# ????????????ID
+modelId=112
+# ???????????sql ????????outkey ??sql?? select outkey from hrmresource where id in (${ids}) ??
+hrmSenderConvertRuleSql=select lastname from hrmresource where id in (${ids})
+# ?????
+hrmReceiveConvertRuleSql=select lastname from hrmresource where id in (${ids})
+# oa token??????????
+expiryBeforeTime=5
\ No newline at end of file
diff --git a/src/main/resources/WEB-INF/prop/prop2map/VmsKafka.properties b/src/main/resources/WEB-INF/prop/prop2map/VmsKafka.properties
new file mode 100644
index 0000000..33eb23e
--- /dev/null
+++ b/src/main/resources/WEB-INF/prop/prop2map/VmsKafka.properties
@@ -0,0 +1,5 @@
+bootstrap.servers=10.184.42.41:9094,10.184.42.42:9094,10.184.42.40:9094
+acks=all
+retries=1
+key.serializer=org.apache.kafka.common.serialization.StringSerializer
+value.serializer=org.apache.kafka.common.serialization.StringSerializer
\ No newline at end of file
diff --git a/src/test/java/xuanran/wang/http_test/annotations/CusRequestClient.java b/src/test/java/xuanran/wang/http_test/annotations/CusRequestClient.java
index c1ea590..cadd360 100644
--- a/src/test/java/xuanran/wang/http_test/annotations/CusRequestClient.java
+++ b/src/test/java/xuanran/wang/http_test/annotations/CusRequestClient.java
@@ -1,5 +1,9 @@
package xuanran.wang.http_test.annotations;
+import aiyh.utils.tool.cn.hutool.core.annotation.AliasFor;
+import xuanran.wang.http_test.annotations.request_type.CusRequestType;
+import xuanran.wang.http_test.constant.CusRequestClientConstant;
+
import java.lang.annotation.*;
/**
@@ -11,5 +15,10 @@ import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Documented
+@CusRequestAddress()
public @interface CusRequestClient {
+ @AliasFor(annotation = CusRequestAddress.class, attribute = "host")
+ String host() default "";
+ @AliasFor(annotation = CusRequestAddress.class, attribute = "port")
+ int port() default 0;
}
diff --git a/src/test/java/xuanran/wang/http_test/annotations/CusRequestUrl.java b/src/test/java/xuanran/wang/http_test/annotations/CusRequestUrl.java
new file mode 100644
index 0000000..299db5e
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/annotations/CusRequestUrl.java
@@ -0,0 +1,16 @@
+package xuanran.wang.http_test.annotations;
+
+import java.lang.annotation.*;
+
+/**
+ * 请求地址
+ *
+ * @author xuanran.wang
+ * @date 2023/3/16 19:59
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD})
+@Documented
+public @interface CusRequestUrl {
+ String url();
+}
diff --git a/src/test/java/xuanran/wang/http_test/annotations/body/CusRequestBody.java b/src/test/java/xuanran/wang/http_test/annotations/body/CusRequestBody.java
new file mode 100644
index 0000000..0b72ed0
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/annotations/body/CusRequestBody.java
@@ -0,0 +1,16 @@
+package xuanran.wang.http_test.annotations.body;
+
+import java.lang.annotation.*;
+
+/**
+ * 请求体
+ *
+ * @author xuanran.wang
+ * @date 2023/3/20 21:27
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.PARAMETER)
+@Documented
+public @interface CusRequestBody {
+
+}
diff --git a/src/test/java/xuanran/wang/http_test/annotations/handle/CusHandle.java b/src/test/java/xuanran/wang/http_test/annotations/handle/CusHandle.java
new file mode 100644
index 0000000..ee01d9c
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/annotations/handle/CusHandle.java
@@ -0,0 +1,16 @@
+package xuanran.wang.http_test.annotations.handle;
+
+import java.lang.annotation.*;
+
+/**
+ * 自定义handle注解
+ *
+ * @author xuanran.wang
+ * @date 2023/3/16 15:37
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Documented
+public @interface CusHandle {
+ int order() default 0;
+}
diff --git a/src/test/java/xuanran/wang/http_test/annotations/handle/CusPreLoadHandle.java b/src/test/java/xuanran/wang/http_test/annotations/handle/CusPreLoadHandle.java
new file mode 100644
index 0000000..54e9634
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/annotations/handle/CusPreLoadHandle.java
@@ -0,0 +1,23 @@
+package xuanran.wang.http_test.annotations.handle;
+
+import aiyh.utils.tool.cn.hutool.core.annotation.AliasFor;
+import xuanran.wang.http_test.annotations.CusRequestUrl;
+import xuanran.wang.http_test.annotations.request_type.CusRequestType;
+import xuanran.wang.http_test.constant.CusRequestClientConstant;
+
+import java.lang.annotation.*;
+
+/**
+ * 请求前置加载
+ *
+ * @author xuanran.wang
+ * @date 2023/3/20 21:14
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.TYPE)
+@Documented
+@CusHandle(order = 0)
+public @interface CusPreLoadHandle {
+ @AliasFor(annotation = CusHandle.class, attribute = "order")
+ int order() default 0;
+}
diff --git a/src/test/java/xuanran/wang/http_test/annotations/handle/CusReqAfterHandleRegister.java b/src/test/java/xuanran/wang/http_test/annotations/handle/CusReqAfterHandleRegister.java
new file mode 100644
index 0000000..172c5af
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/annotations/handle/CusReqAfterHandleRegister.java
@@ -0,0 +1,19 @@
+package xuanran.wang.http_test.annotations.handle;
+
+import xuanran.wang.http_test.handle.CusRequestAfterHandle;
+import xuanran.wang.http_test.test.TestRequestAfterHandle;
+
+import java.lang.annotation.*;
+
+/**
+ *
+ *
+ * @author xuanran.wang
+ * @date 2023/3/24 14:44
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Documented
+public @interface CusReqAfterHandleRegister {
+ Class> afterHandle();
+}
diff --git a/src/test/java/xuanran/wang/http_test/annotations/handle/CusResponseSuccessHandle.java b/src/test/java/xuanran/wang/http_test/annotations/handle/CusResponseSuccessHandle.java
new file mode 100644
index 0000000..5f2755d
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/annotations/handle/CusResponseSuccessHandle.java
@@ -0,0 +1,19 @@
+package xuanran.wang.http_test.annotations.handle;
+
+import java.lang.annotation.*;
+
+/**
+ * 响应体成功失败标识
+ *
+ * @author xuanran.wang
+ * @date 2023/3/22 11:29
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.METHOD})
+@Documented
+public @interface CusResponseSuccessHandle {
+ String successKey();
+ String successCondition();
+ String errorMsg();
+ String data();
+}
diff --git a/src/test/java/xuanran/wang/http_test/annotations/request_path/CusPathQuery.java b/src/test/java/xuanran/wang/http_test/annotations/request_path/CusPathQuery.java
index c6c3706..3fc2936 100644
--- a/src/test/java/xuanran/wang/http_test/annotations/request_path/CusPathQuery.java
+++ b/src/test/java/xuanran/wang/http_test/annotations/request_path/CusPathQuery.java
@@ -14,7 +14,7 @@ import java.lang.annotation.*;
* @date 2023/3/14 22:50
*/
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD})
+@Target({ElementType.METHOD,ElementType.PARAMETER})
@Documented
public @interface CusPathQuery {
/**
diff --git a/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestDelete.java b/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestDelete.java
index a20a87a..427f25f 100644
--- a/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestDelete.java
+++ b/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestDelete.java
@@ -1,5 +1,9 @@
package xuanran.wang.http_test.annotations.request_type;
+import aiyh.utils.tool.cn.hutool.core.annotation.AliasFor;
+import xuanran.wang.http_test.annotations.CusRequestUrl;
+import xuanran.wang.http_test.constant.CusRequestClientConstant;
+
import java.lang.annotation.*;
/**
@@ -11,6 +15,12 @@ import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
@Documented
+@CusRequestUrl(url = "")
+@CusRequestType(requestType = CusRequestClientConstant.DELETE)
public @interface CusRequestDelete {
- String url() default "";
+ @AliasFor(annotation = CusRequestUrl.class, attribute = "url")
+ String url();
+
+ @AliasFor(annotation = CusRequestType.class, attribute = "requestType")
+ int requestType() default CusRequestClientConstant.DELETE;
}
diff --git a/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestGet.java b/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestGet.java
index 14a7ec2..ad1fe1d 100644
--- a/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestGet.java
+++ b/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestGet.java
@@ -1,5 +1,9 @@
package xuanran.wang.http_test.annotations.request_type;
+import aiyh.utils.tool.cn.hutool.core.annotation.AliasFor;
+import xuanran.wang.http_test.annotations.CusRequestUrl;
+import xuanran.wang.http_test.constant.CusRequestClientConstant;
+
import java.lang.annotation.*;
/**
@@ -9,8 +13,14 @@ import java.lang.annotation.*;
* @date 2023/3/10 10:15
*/
@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD})
+@Target({ElementType.METHOD, ElementType.TYPE})
@Documented
+@CusRequestUrl(url = "")
+@CusRequestType(requestType = CusRequestClientConstant.GET)
public @interface CusRequestGet{
- String url() default "";
+ @AliasFor(annotation = CusRequestUrl.class, attribute = "url")
+ String url();
+
+ @AliasFor(annotation = CusRequestType.class, attribute = "requestType")
+ int requestType() default CusRequestClientConstant.GET;
}
diff --git a/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestPost.java b/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestPost.java
index 4871a05..57f6806 100644
--- a/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestPost.java
+++ b/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestPost.java
@@ -1,5 +1,9 @@
package xuanran.wang.http_test.annotations.request_type;
+import aiyh.utils.tool.cn.hutool.core.annotation.AliasFor;
+import xuanran.wang.http_test.annotations.CusRequestUrl;
+import xuanran.wang.http_test.constant.CusRequestClientConstant;
+
import java.lang.annotation.*;
/**
@@ -11,6 +15,12 @@ import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
@Documented
+@CusRequestUrl(url = "")
+@CusRequestType(requestType = CusRequestClientConstant.POST)
public @interface CusRequestPost {
- String url() default "";
+ @AliasFor(annotation = CusRequestUrl.class, attribute = "url")
+ String url();
+
+ @AliasFor(annotation = CusRequestType.class, attribute = "requestType")
+ int requestType() default CusRequestClientConstant.POST;
}
diff --git a/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestPut.java b/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestPut.java
index 0fd5c5d..9a06cb2 100644
--- a/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestPut.java
+++ b/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestPut.java
@@ -1,5 +1,9 @@
package xuanran.wang.http_test.annotations.request_type;
+import aiyh.utils.tool.cn.hutool.core.annotation.AliasFor;
+import xuanran.wang.http_test.annotations.CusRequestUrl;
+import xuanran.wang.http_test.constant.CusRequestClientConstant;
+
import java.lang.annotation.*;
/**
@@ -11,6 +15,12 @@ import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
@Documented
+@CusRequestUrl(url = "")
+@CusRequestType(requestType = CusRequestClientConstant.PUT)
public @interface CusRequestPut {
- String url() default "";
+ @AliasFor(annotation = CusRequestUrl.class, attribute = "url")
+ String url();
+
+ @AliasFor(annotation = CusRequestType.class, attribute = "requestType")
+ int requestType() default CusRequestClientConstant.PUT;
}
diff --git a/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestType.java b/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestType.java
new file mode 100644
index 0000000..53b12a9
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/annotations/request_type/CusRequestType.java
@@ -0,0 +1,16 @@
+package xuanran.wang.http_test.annotations.request_type;
+
+import java.lang.annotation.*;
+
+/**
+ * 请求类型
+ *
+ * @author xuanran.wang
+ * @date 2023/3/16 23:07
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Documented
+public @interface CusRequestType {
+ int requestType() default 0;
+}
diff --git a/src/test/java/xuanran/wang/http_test/constant/CusRequestClientConstant.java b/src/test/java/xuanran/wang/http_test/constant/CusRequestClientConstant.java
index d368610..0d83b8d 100644
--- a/src/test/java/xuanran/wang/http_test/constant/CusRequestClientConstant.java
+++ b/src/test/java/xuanran/wang/http_test/constant/CusRequestClientConstant.java
@@ -1,5 +1,16 @@
package xuanran.wang.http_test.constant;
+import aiyh.utils.Util;
+import aiyh.utils.excention.CustomerException;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.lang3.StringUtils;
+import xuanran.wang.http_test.annotations.handle.CusResponseSuccessHandle;
+import xuanran.wang.http_test.entity.CusRequestEntity;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Function;
+
/**
* 请求工具常量
*
@@ -11,5 +22,51 @@ public class CusRequestClientConstant {
public static final int POST = 1;
public static final int DELETE = 2;
public static final int PUT = 3;
- public static final int HEADER = -1;
+ public static final int HTTP_SUCCESS_CODE = 200;
+ public static final Map> CONVERT = new HashMap<>();
+ public static final String IS_NOT_NULL = "{ is not null }";
+ public static final String EQUALS = "{ equals }";
+ public static final String EQUALS_IGNORE_CASE = "{ equalsIgnoreCase }";
+
+ static {
+ CONVERT.put(IS_NOT_NULL, cusRequest ->{
+ Map responseMap = cusRequest.getResponseMap();
+ CusResponseSuccessHandle responseSuccessHandle = cusRequest.getResponseSuccessHandle();
+ String key = responseSuccessHandle.successKey();
+ String errorMsg = responseSuccessHandle.errorMsg();
+ String successValue = Util.null2DefaultStr(Util.getValueByKeyStr(key, responseMap),"");
+ if (successValue == null) {
+ throw new CustomerException(Util.logStr("is not null check response error! the error is {}", responseMap.get(errorMsg)));
+ }
+ return JSONObject.toJSONString(responseMap.get(responseSuccessHandle.data()));
+ });
+
+ CONVERT.put(EQUALS, cusRequest ->{
+ Map responseMap = cusRequest.getResponseMap();
+ CusResponseSuccessHandle responseSuccessHandle = cusRequest.getResponseSuccessHandle();
+ String key = responseSuccessHandle.successKey();
+ String successCondition = responseSuccessHandle.successCondition();
+ String errorMsg = responseSuccessHandle.errorMsg();
+ String successValue = Util.null2DefaultStr(Util.getValueByKeyStr(key, responseMap),"");
+ String successConditionValue = successCondition.trim().replace(EQUALS, "").trim();
+ if(!successConditionValue.equals(successValue)){
+ throw new CustomerException(Util.logStr("equals check response error! the error is {}", responseMap.get(errorMsg)));
+ }
+ return JSONObject.toJSONString(responseMap.get(responseSuccessHandle.data()));
+ });
+
+ CONVERT.put(EQUALS_IGNORE_CASE, cusRequest ->{
+ Map responseMap = cusRequest.getResponseMap();
+ CusResponseSuccessHandle responseSuccessHandle = cusRequest.getResponseSuccessHandle();
+ String key = responseSuccessHandle.successKey();
+ String successCondition = responseSuccessHandle.successCondition();
+ String errorMsg = responseSuccessHandle.errorMsg();
+ String successValue = Util.null2DefaultStr(Util.getValueByKeyStr(key, responseMap),"");
+ String successConditionValue = successCondition.trim().replace(EQUALS_IGNORE_CASE, "").trim();
+ if(!successConditionValue.equalsIgnoreCase(Util.null2DefaultStr(successValue,""))){
+ throw new CustomerException(Util.logStr("equalsIgnoreCase check response error! the error is {}", responseMap.get(errorMsg)));
+ }
+ return JSONObject.toJSONString(responseMap.get(responseSuccessHandle.data()));
+ });
+ }
}
diff --git a/src/test/java/xuanran/wang/http_test/entity/CusHandleEntity.java b/src/test/java/xuanran/wang/http_test/entity/CusHandleEntity.java
new file mode 100644
index 0000000..9fe49f0
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/entity/CusHandleEntity.java
@@ -0,0 +1,16 @@
+package xuanran.wang.http_test.entity;
+
+import lombok.Data;
+
+/**
+ * 自定义handle
+ *
+ * @author xuanran.wang
+ * @date 2023/3/16 16:07
+ */
+@Data
+public class CusHandleEntity {
+ private Class> handleClass;
+ private int order;
+ private String packageName;
+}
diff --git a/src/test/java/xuanran/wang/http_test/entity/CusRequestEntity.java b/src/test/java/xuanran/wang/http_test/entity/CusRequestEntity.java
index 143ac83..67c06e9 100644
--- a/src/test/java/xuanran/wang/http_test/entity/CusRequestEntity.java
+++ b/src/test/java/xuanran/wang/http_test/entity/CusRequestEntity.java
@@ -4,7 +4,10 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
+import xuanran.wang.http_test.annotations.handle.CusResponseSuccessHandle;
+import xuanran.wang.http_test.handle.CusRequestAfterHandle;
+import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;
@@ -19,11 +22,17 @@ import java.util.function.Consumer;
@Setter
@Getter
public class CusRequestEntity{
- private String url;
- private Map headers;
- private Map pathParams;
- private Object bodyParams;
- private int requestType;
+ private String url = "";
+ private Map headers = new HashMap<>();
+ private Map pathParams = new HashMap<>();
+ private Object bodyParams = new Object();
+ private int requestType = -1;
private Consumer consumer;
- private boolean async;
+ private boolean async = false;
+ private String host = "";
+ private int port;
+ private Class> returnType;
+ private CusRequestAfterHandle cusRequestAfter;
+ private CusResponseSuccessHandle responseSuccessHandle;
+ private Map responseMap;
}
diff --git a/src/test/java/xuanran/wang/http_test/entity/CusResponseSuccess.java b/src/test/java/xuanran/wang/http_test/entity/CusResponseSuccess.java
new file mode 100644
index 0000000..3bed5a1
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/entity/CusResponseSuccess.java
@@ -0,0 +1,21 @@
+package xuanran.wang.http_test.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 接口响应成功标识对象
+ *
+ * @author xuanran.wang
+ * @date 2023/3/29 16:58
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class CusResponseSuccess {
+ private String successKey;
+ private String successCondition;
+ private String errorMsg;
+ private String data;
+}
diff --git a/src/test/java/xuanran/wang/http_test/handle/CusHandleCenter.java b/src/test/java/xuanran/wang/http_test/handle/CusHandleCenter.java
new file mode 100644
index 0000000..4bcafaa
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/handle/CusHandleCenter.java
@@ -0,0 +1,129 @@
+package xuanran.wang.http_test.handle;
+
+import aiyh.utils.Util;
+import aiyh.utils.excention.CustomerException;
+import aiyh.utils.httpUtil.ResponeVo;
+import aiyh.utils.tool.cn.hutool.core.annotation.AnnotationUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+
+import org.apache.log4j.Logger;
+import xuanran.wang.http_test.annotations.handle.CusReqAfterHandleRegister;
+import xuanran.wang.http_test.annotations.handle.CusResponseSuccessHandle;
+import xuanran.wang.http_test.annotations.request_type.CusRequestType;
+import xuanran.wang.http_test.constant.CusRequestClientConstant;
+import xuanran.wang.http_test.entity.CusHandleEntity;
+import xuanran.wang.http_test.entity.CusRequestEntity;
+import xuanran.wang.http_test.handle.path_handle.CusBodyParseHandle;
+import xuanran.wang.http_test.handle.request_handle.CusRequestGetHandle;
+import xuanran.wang.http_test.handle.request_handle.CusRequestPostHandle;
+import xuanran.wang.http_test.handle.request_handle.CusUrlHandle;
+import xuanran.wang.http_test.handle.request_handle.CusDefaultRequestAfterHandle;
+import xuanran.wang.http_test.handle.util.HandleUtil;
+import xuanran.wang.http_test.proxy.RequestUtil;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 处理器中心对象
+ *
+ * @author xuanran.wang
+ * @date 2023/3/16 22:38
+ */
+public class CusHandleCenter{
+
+ private final Logger log = Util.getLogger();
+
+ private final Queue preloadQueue = new LinkedList<>();
+ private final Map requestHandle = new HashMap<>();
+ private final CusRequestAfterHandle cusRequestAfterHandle = new CusDefaultRequestAfterHandle();
+
+ {
+ requestHandle.put(CusRequestClientConstant.GET, new CusRequestGetHandle());
+ requestHandle.put(CusRequestClientConstant.POST, new CusRequestPostHandle());
+ preloadQueue.add(new CusUrlHandle());
+ preloadQueue.add(new CusBodyParseHandle());
+ }
+
+ public void requestBeforeHandle(CusRequestEntity cusRequest, Method method, Object[] args){
+ try {
+ log.info("preloadQueue => " + JSONObject.toJSONString(preloadQueue));
+ // 前置加载处理
+ for (CusRequestBeforeHandle handle : preloadQueue) {
+ handle.handle(cusRequest, method, args);
+ }
+ // 扫描执行handle包下面的所有加了CusHandle注解的实现方法并按order进行排序 包的顺序随机
+ HashMap> scan = HandleUtil.scanHandle();
+ log.info("scan => " + JSONObject.toJSONString(scan));
+ for (Map.Entry> entry : scan.entrySet()) {
+ List value = entry.getValue();
+ List collect = value.stream().sorted(Comparator.comparingInt(CusHandleEntity::getOrder)).collect(Collectors.toList());
+ log.info("扫描到的handle : " + JSONObject.toJSONString(collect));
+ for (CusHandleEntity handle : collect) {
+ Class> handleClass = handle.getHandleClass();
+ if (CusRequestBeforeHandle.class.isAssignableFrom(handleClass)) {
+ CusRequestBeforeHandle o = (CusRequestBeforeHandle) handleClass.newInstance();
+ o.handle(cusRequest, method, args);
+ }
+ }
+ }
+ }catch (Exception e){
+ throw new CustomerException("execute requestBeforeHandle error! " + e.getMessage());
+ }
+ }
+
+ public ResponeVo requestHandle(CusRequestEntity cusRequest, Method method){
+ try {
+ CusRequestType requestType = AnnotationUtil.getSynthesizedAnnotation(method, CusRequestType.class);
+ return requestHandle.get(requestType.requestType()).execute(cusRequest);
+ }catch (Exception e){
+ throw new CustomerException("request error! " + e.getMessage());
+ }
+ }
+
+ public Object requestAfterHandle(Method method, CusRequestEntity cusRequest, ResponeVo responseVo){
+ if(cusRequest.getCusRequestAfter() == null){
+ CusReqAfterHandleRegister cusReqAfterHandleRegister = method.getDeclaredAnnotation(CusReqAfterHandleRegister.class);
+ if(cusReqAfterHandleRegister != null){
+ RequestUtil.setCusRequestAfter(cusReqAfterHandleRegister, cusRequest);
+ }
+ }
+// Type genericReturnType = method.getGenericReturnType();
+ cusRequest.setReturnType(method.getReturnType());
+ CusResponseSuccessHandle cusResponseSuccessHandle = method.getDeclaredAnnotation(CusResponseSuccessHandle.class);
+ if(cusResponseSuccessHandle != null && cusRequest.getResponseSuccessHandle() == null){
+ cusRequest.setResponseSuccessHandle(cusResponseSuccessHandle);
+ }
+ return requestAfterHandle(cusRequest, responseVo);
+ }
+
+ private Object requestAfterHandle(CusRequestEntity cusRequest, ResponeVo responseVo){
+ if(responseVo == null){
+ throw new CustomerException("CusRequestAfterHandle responseVo is null!");
+ }
+ int code = responseVo.getCode();
+ if(CusRequestClientConstant.HTTP_SUCCESS_CODE != code){
+ String url = cusRequest.getUrl();
+ log.error(Util.logStr("can not fetch [{}],this request params is [{}]," + // 构建日志字符串
+ "this request heard is [{}],but response status code is [{}]," +
+ "this response is [{}]", cusRequest.getUrl(), JSON.toJSON(cusRequest.getBodyParams()), JSON.toJSONString(cusRequest.getHeaders()), responseVo.getCode(), // 相应状态码
+ responseVo.getEntityString()));
+ throw new CustomerException(Util.logStr("can not fetch [{}]", url)); //
+ }
+ CusRequestAfterHandle handle = cusRequest.getCusRequestAfter() == null ? new CusDefaultRequestAfterHandle() : cusRequest.getCusRequestAfter();
+ cusRequest.setCusRequestAfter(handle);
+ log.info(Util.logStr("cusRequest: {}", JSONObject.toJSONString(cusRequest)));
+ Object res = handle.parseResponse(cusRequest, responseVo);
+ handle.service(cusRequest, responseVo);
+ return res;
+ }
+
+
+ public void registerPreHandle(CusRequestBeforeHandle handle){
+ preloadQueue.add(handle);
+ }
+
+}
diff --git a/src/test/java/xuanran/wang/http_test/handle/CusRequestAfterHandle.java b/src/test/java/xuanran/wang/http_test/handle/CusRequestAfterHandle.java
new file mode 100644
index 0000000..543f6b0
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/handle/CusRequestAfterHandle.java
@@ -0,0 +1,31 @@
+package xuanran.wang.http_test.handle;
+
+import aiyh.utils.httpUtil.ResponeVo;
+import xuanran.wang.http_test.entity.CusRequestEntity;
+
+
+/**
+ * 请求后处理器
+ *
+ * @author xuanran.wang
+ * @date 2023/3/16 23:57
+ */
+public interface CusRequestAfterHandle{
+ /**
+ * 解析响应方法
+ * @author xuanran.wang
+ * @dateTime 2023/3/24 15:32
+ * @param cusRequest 请求对象
+ * @param responseVo 响应对象
+ **/
+ Object parseResponse(CusRequestEntity cusRequest, ResponeVo responseVo);
+
+ /**
+ * do something
+ * @author xuanran.wang
+ * @dateTime 2023/3/24 15:32
+ * @param cusRequest 请求对象
+ * @param responseVo 响应对象
+ **/
+ void service(CusRequestEntity cusRequest, ResponeVo responseVo);
+}
diff --git a/src/test/java/xuanran/wang/http_test/handle/CusRequestBeforeHandle.java b/src/test/java/xuanran/wang/http_test/handle/CusRequestBeforeHandle.java
index 48faa20..4e0e80b 100644
--- a/src/test/java/xuanran/wang/http_test/handle/CusRequestBeforeHandle.java
+++ b/src/test/java/xuanran/wang/http_test/handle/CusRequestBeforeHandle.java
@@ -10,6 +10,6 @@ import java.lang.reflect.Method;
* @author xuanran.wang
* @date 2023/3/10 11:38
*/
-public interface RequestBeforeHandle {
- void handle(CusRequestEntity requestEntity, Method method, Object[] args);
+public interface CusRequestBeforeHandle {
+ void handle(CusRequestEntity cusRequest, Method method, Object[] args);
}
diff --git a/src/test/java/xuanran/wang/http_test/handle/CusRequestHandle.java b/src/test/java/xuanran/wang/http_test/handle/CusRequestHandle.java
new file mode 100644
index 0000000..06901f6
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/handle/CusRequestHandle.java
@@ -0,0 +1,42 @@
+package xuanran.wang.http_test.handle;
+
+import aiyh.utils.httpUtil.ResponeVo;
+import aiyh.utils.httpUtil.util.HttpUtils;
+import xuanran.wang.http_test.entity.CusRequestEntity;
+
+import java.io.IOException;
+import java.lang.reflect.Method;
+
+/**
+ * 请求参数初始化之后请求之前handle
+ *
+ * @author xuanran.wang
+ * @date 2023/3/16 23:21
+ */
+public abstract class CusRequestHandle {
+ protected HttpUtils httpUtils = new HttpUtils();
+
+ protected final ResponeVo execute(CusRequestEntity cusRequest) throws IOException{
+ String host = cusRequest.getHost();
+ int port = cusRequest.getPort();
+ String url = cusRequest.getUrl();
+ StringBuilder realRequestUrl = new StringBuilder();
+ if(url.startsWith("http:") || url.startsWith("https:")){
+ realRequestUrl.append(url);
+ }else {
+ realRequestUrl.append(host);
+ if(!host.endsWith(":")){
+ realRequestUrl.append(":");
+ }
+ realRequestUrl.append(port);
+ if(!url.endsWith("/")){
+ realRequestUrl.append("/");
+ }
+ realRequestUrl.append(url);
+ }
+ cusRequest.setUrl(realRequestUrl.toString());
+ return request(cusRequest);
+ }
+ // 执行具体的请求方法
+ protected abstract ResponeVo request(CusRequestEntity cusRequest) throws IOException;
+}
diff --git a/src/test/java/xuanran/wang/http_test/handle/header_handle/RequestHeaderHandle.java b/src/test/java/xuanran/wang/http_test/handle/header_handle/RequestHeaderHandle.java
new file mode 100644
index 0000000..7baeadb
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/handle/header_handle/RequestHeaderHandle.java
@@ -0,0 +1,84 @@
+package xuanran.wang.http_test.handle.header_handle;
+import aiyh.utils.Util;
+import aiyh.utils.excention.CustomerException;
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang3.StringUtils;
+import xuanran.wang.http_test.annotations.handle.CusHandle;
+import xuanran.wang.http_test.annotations.header.CusRequestHeader;
+import xuanran.wang.http_test.entity.CusRequestEntity;
+import xuanran.wang.http_test.handle.CusRequestBeforeHandle;
+import xuanran.wang.http_test.interfaces.CusCreateRequestHeader;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Parameter;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 请求头处理
+ *
+ * @author xuanran.wang
+ * @date 2023/3/10 14:42
+ */
+@CusHandle
+public class RequestHeaderHandle implements CusRequestBeforeHandle {
+
+ @Override
+ public void handle(CusRequestEntity cusRequest, Method method, Object[] args) {
+ CusRequestHeader methodCusRequestHeader = method.getDeclaredAnnotation(CusRequestHeader.class);
+ if(methodCusRequestHeader == null){
+ return;
+ }
+ // 数组形式
+ String[] headersArr = methodCusRequestHeader.cusHeaders();
+ HashMap headers = new HashMap<>();
+ if(headersArr != null){
+ for (String headerStr : headersArr) {
+ String[] split = headerStr.split(":");
+ String key = Util.null2DefaultStr(split[0],"").trim();
+ String val = Util.null2DefaultStr(split[1],"").trim();
+ if(StringUtils.isNotBlank(key) && StringUtils.isNotBlank(val)){
+ headers.put(key, val);
+ }
+ }
+ }
+
+ // java代码自定义
+ String path = Util.null2DefaultStr(methodCusRequestHeader.cusHeadersClassPath(),"");
+ if(StringUtils.isNotBlank(path)){
+ Class> clazz;
+ try {
+ clazz = Class.forName(path);
+ } catch (ClassNotFoundException e) {
+ throw new CustomerException(Util.logStr("自定义请求头java类文件没找到!: {}", path));
+ }
+ if(!CusCreateRequestHeader.class.isAssignableFrom(clazz)){
+ throw new CustomerException(Util.logStr("当前类路径:[{}] ,未实现CusCreateRequestHeader接口!", path));
+ }
+ CusCreateRequestHeader o;
+ try {
+ o = (CusCreateRequestHeader) clazz.newInstance();
+ }catch (InstantiationException | IllegalAccessException e) {
+ throw new CustomerException(Util.logStr("实例化 [{}] 对象失败! error:{}", path, e.getMessage()));
+ }
+ Map cusCreateHeader = o.createHeader();
+ if(MapUtils.isNotEmpty(cusCreateHeader)){
+ headers.putAll(cusCreateHeader);
+ }
+ }
+ // 参数中
+ Parameter[] parameters = method.getParameters();
+ for (int i = 0; i < parameters.length; i++) {
+ Parameter parameter = parameters[i];
+ CusRequestHeader requestHeader = parameter.getAnnotation(CusRequestHeader.class);
+ if(requestHeader != null){
+ String val = Util.null2DefaultStr(args[i], "").trim();
+ String key = requestHeader.value().trim();
+ if(StringUtils.isNotBlank(key) && StringUtils.isNotBlank(val)){
+ headers.put(key, val);
+ }
+ }
+ }
+ cusRequest.getHeaders().putAll(headers);
+ }
+}
diff --git a/src/test/java/xuanran/wang/http_test/handle/path_handle/CusBodyParseHandle.java b/src/test/java/xuanran/wang/http_test/handle/path_handle/CusBodyParseHandle.java
new file mode 100644
index 0000000..03735dd
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/handle/path_handle/CusBodyParseHandle.java
@@ -0,0 +1,39 @@
+package xuanran.wang.http_test.handle.path_handle;
+
+import aiyh.utils.excention.CustomerException;
+import aiyh.utils.tool.cn.hutool.core.annotation.AnnotationUtil;
+import org.springframework.web.bind.annotation.RequestBody;
+import xuanran.wang.http_test.annotations.CusRequestUrl;
+import xuanran.wang.http_test.annotations.body.CusRequestBody;
+import xuanran.wang.http_test.annotations.request_type.CusRequestType;
+import xuanran.wang.http_test.constant.CusRequestClientConstant;
+import xuanran.wang.http_test.entity.CusRequestEntity;
+import xuanran.wang.http_test.handle.CusRequestBeforeHandle;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Parameter;
+import java.util.Map;
+
+/**
+ * 请求体处理
+ *
+ * @author xuanran.wang
+ * @date 2023/3/20 21:21
+ */
+public class CusBodyParseHandle implements CusRequestBeforeHandle {
+ @Override
+ public void handle(CusRequestEntity cusRequest, Method method, Object[] args) {
+ Parameter[] parameters = method.getParameters();
+ for (int i = 0; i < parameters.length; i++) {
+ Parameter parameter = parameters[i];
+ CusRequestBody requestBody = parameter.getDeclaredAnnotation(CusRequestBody.class);
+ CusRequestType requestType = AnnotationUtil.getSynthesizedAnnotation(method, CusRequestType.class);
+ if(null != requestBody &&
+ null != requestType &&
+ requestType.requestType() != CusRequestClientConstant.GET){
+ cusRequest.setBodyParams(args[i]);
+ }
+ }
+ }
+}
diff --git a/src/test/java/xuanran/wang/http_test/handle/path_handle/CusPathParseHandle.java b/src/test/java/xuanran/wang/http_test/handle/path_handle/CusPathParseHandle.java
index d9cf5b8..dc874d8 100644
--- a/src/test/java/xuanran/wang/http_test/handle/path_handle/CusPathParseHandle.java
+++ b/src/test/java/xuanran/wang/http_test/handle/path_handle/CusPathParseHandle.java
@@ -2,9 +2,10 @@ package xuanran.wang.http_test.handle.path_handle;
import aiyh.utils.Util;
import org.apache.commons.lang3.StringUtils;
+import xuanran.wang.http_test.annotations.handle.CusHandle;
import xuanran.wang.http_test.annotations.request_path.CusPathQuery;
import xuanran.wang.http_test.entity.CusRequestEntity;
-import xuanran.wang.http_test.handle.RequestBeforeHandle;
+import xuanran.wang.http_test.handle.CusRequestBeforeHandle;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
@@ -16,11 +17,12 @@ import java.util.Map;
* @author xuanran.wang
* @date 2023/3/14 23:11
*/
-public class CusFieldKeyParseHandle implements RequestBeforeHandle {
+@CusHandle
+public class CusPathParseHandle implements CusRequestBeforeHandle {
@Override
- public void handle(CusRequestEntity requestEntity, Method method, Object[] args) {
+ public void handle(CusRequestEntity cusRequest, Method method, Object[] args) {
Parameter[] parameters = method.getParameters();
- String url = requestEntity.getUrl();
+ String url = cusRequest.getUrl();
for (int i = 0; i < parameters.length; i++) {
Parameter parameter = parameters[i];
CusPathQuery cusPathQuery = parameter.getDeclaredAnnotation(CusPathQuery.class);
@@ -33,11 +35,11 @@ public class CusFieldKeyParseHandle implements RequestBeforeHandle {
}else {
Class> clazz = parameter.getType();
if(clazz.isAssignableFrom(Map.class)){
- requestEntity.getPathParams().putAll((Map extends String, ? extends String>) arg);
+ cusRequest.getPathParams().putAll((Map) arg);
}
}
}
}
- requestEntity.setUrl(url);
+ cusRequest.setUrl(url);
}
}
diff --git a/src/test/java/xuanran/wang/http_test/handle/path_handle/TestHandle.java b/src/test/java/xuanran/wang/http_test/handle/path_handle/TestHandle.java
new file mode 100644
index 0000000..3133ded
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/handle/path_handle/TestHandle.java
@@ -0,0 +1,22 @@
+package xuanran.wang.http_test.handle.path_handle;
+
+import xuanran.wang.http_test.annotations.handle.CusHandle;
+import xuanran.wang.http_test.annotations.handle.CusPreLoadHandle;
+import xuanran.wang.http_test.entity.CusRequestEntity;
+import xuanran.wang.http_test.handle.CusRequestBeforeHandle;
+
+import java.lang.reflect.Method;
+
+/**
+ *
+ *
+ * @author xuanran.wang
+ * @date 2023/3/16 16:22
+ */
+@CusHandle
+public class TestHandle implements CusRequestBeforeHandle {
+ @Override
+ public void handle(CusRequestEntity cusRequest, Method method, Object[] args) {
+ System.out.println("TestHandle 111");
+ }
+}
diff --git a/src/test/java/xuanran/wang/http_test/handle/request_handle/CusDefaultRequestAfterHandle.java b/src/test/java/xuanran/wang/http_test/handle/request_handle/CusDefaultRequestAfterHandle.java
new file mode 100644
index 0000000..500e3c0
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/handle/request_handle/CusDefaultRequestAfterHandle.java
@@ -0,0 +1,47 @@
+package xuanran.wang.http_test.handle.request_handle;
+
+import aiyh.utils.Util;
+import aiyh.utils.excention.CustomerException;
+import aiyh.utils.httpUtil.ResponeVo;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.lang3.StringUtils;
+import xuanran.wang.http_test.annotations.handle.CusResponseSuccessHandle;
+import xuanran.wang.http_test.constant.CusRequestClientConstant;
+import xuanran.wang.http_test.entity.CusRequestEntity;
+import xuanran.wang.http_test.handle.CusRequestAfterHandle;
+
+import java.util.Map;
+
+/**
+ * 默认的请求后处理响应类
+ *
+ * @author xuanran.wang
+ * @date 2023/3/17 11:03
+ */
+public class CusDefaultRequestAfterHandle implements CusRequestAfterHandle {
+
+ @Override
+ public Object parseResponse(CusRequestEntity cusRequest, ResponeVo responseVo) {
+ Class> returnType = cusRequest.getReturnType();
+ if(ResponeVo.class.isAssignableFrom(returnType)) {
+ return responseVo;
+ }
+ String json = responseVo.getEntityString();
+ cusRequest.setResponseMap(responseVo.getResponseMap());
+ CusResponseSuccessHandle responseSuccessHandle = cusRequest.getResponseSuccessHandle();
+ if(responseSuccessHandle != null){
+ String successCondition = responseSuccessHandle.successCondition();
+ String str = successCondition.substring(0, successCondition.lastIndexOf("}") + 1);
+ json = Util.null2DefaultStr(CusRequestClientConstant.CONVERT
+ .get(str)
+ .apply(cusRequest),"");
+ }
+ return JSONObject.parseObject(json, returnType);
+ }
+
+ @Override
+ public void service(CusRequestEntity cusRequest, ResponeVo responeVo){
+
+ }
+
+}
diff --git a/src/test/java/xuanran/wang/http_test/handle/request_handle/CusRequestGetHandle.java b/src/test/java/xuanran/wang/http_test/handle/request_handle/CusRequestGetHandle.java
new file mode 100644
index 0000000..6d8b84c
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/handle/request_handle/CusRequestGetHandle.java
@@ -0,0 +1,21 @@
+package xuanran.wang.http_test.handle.request_handle;
+
+import aiyh.utils.httpUtil.ResponeVo;
+import xuanran.wang.http_test.entity.CusRequestEntity;
+import xuanran.wang.http_test.handle.CusRequestHandle;
+
+import java.io.IOException;
+
+/**
+ *
+ *
+ * @author xuanran.wang
+ * @date 2023/3/16 23:20
+ */
+public class CusRequestGetHandle extends CusRequestHandle {
+
+ @Override
+ protected ResponeVo request(CusRequestEntity cusRequest) throws IOException {
+ return httpUtils.apiGet(cusRequest.getUrl(), cusRequest.getPathParams(), cusRequest.getHeaders());
+ }
+}
diff --git a/src/test/java/xuanran/wang/http_test/handle/request_handle/CusRequestPostHandle.java b/src/test/java/xuanran/wang/http_test/handle/request_handle/CusRequestPostHandle.java
new file mode 100644
index 0000000..56719ea
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/handle/request_handle/CusRequestPostHandle.java
@@ -0,0 +1,21 @@
+package xuanran.wang.http_test.handle.request_handle;
+
+import aiyh.utils.httpUtil.ResponeVo;
+import xuanran.wang.http_test.entity.CusRequestEntity;
+import xuanran.wang.http_test.handle.CusRequestHandle;
+
+import java.io.IOException;
+
+/**
+ *
+ *
+ * @author xuanran.wang
+ * @date 2023/3/16 23:20
+ */
+public class CusRequestPostHandle extends CusRequestHandle {
+
+ @Override
+ protected ResponeVo request(CusRequestEntity cusRequest) throws IOException {
+ return httpUtils.apiPostObject(cusRequest.getUrl(), cusRequest.getBodyParams(), cusRequest.getHeaders());
+ }
+}
diff --git a/src/test/java/xuanran/wang/http_test/handle/request_handle/CusUrlHandle.java b/src/test/java/xuanran/wang/http_test/handle/request_handle/CusUrlHandle.java
new file mode 100644
index 0000000..d5c9edb
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/handle/request_handle/CusUrlHandle.java
@@ -0,0 +1,29 @@
+package xuanran.wang.http_test.handle.request_handle;
+
+import aiyh.utils.excention.CustomerException;
+import aiyh.utils.tool.cn.hutool.core.annotation.AnnotationUtil;
+import xuanran.wang.http_test.annotations.CusRequestUrl;
+import xuanran.wang.http_test.annotations.request_type.CusRequestType;
+import xuanran.wang.http_test.entity.CusRequestEntity;
+import xuanran.wang.http_test.handle.CusRequestBeforeHandle;
+
+import java.lang.reflect.Method;
+
+/**
+ * 方法路径拼接处理
+ *
+ * @author xuanran.wang
+ * @date 2023/3/16 19:51
+ */
+public class CusUrlHandle implements CusRequestBeforeHandle {
+ @Override
+ public void handle(CusRequestEntity cusRequest, Method method, Object[] args) {
+ CusRequestUrl requestUrl = AnnotationUtil.getSynthesizedAnnotation(method, CusRequestUrl.class);
+ if(requestUrl == null){
+ throw new CustomerException("method not found CusRequestUrl!");
+ }
+ cusRequest.setUrl(requestUrl.url());
+ Class> returnType = method.getReturnType();
+ cusRequest.setReturnType(returnType);
+ }
+}
diff --git a/src/test/java/xuanran/wang/http_test/handle/util/HandleUtil.java b/src/test/java/xuanran/wang/http_test/handle/util/HandleUtil.java
new file mode 100644
index 0000000..1590e99
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/handle/util/HandleUtil.java
@@ -0,0 +1,179 @@
+package xuanran.wang.http_test.handle.util;
+
+import aiyh.utils.excention.CustomerException;
+import ebu7common.youhong.ai.bean.Builder;
+import xuanran.wang.http_test.annotations.handle.CusHandle;
+import xuanran.wang.http_test.entity.CusHandleEntity;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.*;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+/**
+ *
+ *
+ * @author xuanran.wang
+ * @date 2023/3/16 15:42
+ */
+public class HandleUtil {
+ /**
+ * 扫描指定路径下对class文件
+ * @author xuanran.wang
+ * @dateTime 2023/3/16 16:02
+ * @return class
+ **/
+ public static HashMap> scanHandle() throws ClassNotFoundException{
+ String packageName = HandleUtil.class.getPackage().getName();
+ return scan(packageName.substring(0, packageName.lastIndexOf(".")));
+ }
+
+ /**
+ * 扫描指定路径下的类文件
+ *
+ * @param packagePath 包路径
+ */
+ private static HashMap> scan(String packagePath) throws ClassNotFoundException {
+ // 转化包路径为文件路径
+ String scanPath = packagePath.replace(".", "/");
+ // 扫描
+ ClassLoader classLoader = HandleUtil.class.getClassLoader();
+ URL resource = classLoader.getResource(scanPath);
+ Set fileNameSet = new LinkedHashSet<>();
+ if (resource == null) {
+ throw new CustomerException("package is not found! :" + packagePath);
+ }
+ String rootPath = getRootPath(resource);
+ if (isJarFile(resource.getFile())) {
+ try {
+ // 是jar包使用JarInputStream
+ JarInputStream jarInputStream = new JarInputStream(Files.newInputStream(Paths.get(rootPath)));
+ JarEntry nextJarEntry = jarInputStream.getNextJarEntry();
+ // 遍历
+ while (null != nextJarEntry) {
+ String name = nextJarEntry.getName();
+ // 如果是指定包名下的文件并且是.class结尾,那就保存它
+ if (name.startsWith(scanPath) && isClassFile(name)) {
+ fileNameSet.add(name.replace(".class", ""));
+ }
+ nextJarEntry = jarInputStream.getNextJarEntry();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ } else {
+ // 是文件夹,获取该文件夹下所有文件
+ Set allFilePath = getAllFilePath(rootPath);
+ for (String filePath : allFilePath) {
+ fileNameSet.add(transFilePathToPackagePath(filePath, scanPath));
+ }
+ }
+ HashMap> maps = new HashMap<>();
+ for (String fileName : fileNameSet) {
+ String packageName = fileName.substring(0, fileName.lastIndexOf("."));
+ Class> scanClass = Class.forName(fileName, false, HandleUtil.class.getClassLoader());
+ CusHandle annotation = scanClass.getAnnotation(CusHandle.class);
+ if(null != annotation){
+ CusHandleEntity cusHandleEntity = Builder.builder(CusHandleEntity::new)
+ .with(CusHandleEntity::setHandleClass, scanClass)
+ .with(CusHandleEntity::setOrder, annotation.order())
+ .with(CusHandleEntity::setPackageName, packageName)
+ .build();
+ List cusHandleEntities = new ArrayList<>();
+ if(maps.containsKey(packageName)){
+ cusHandleEntities = maps.get(packageName);
+ }
+ cusHandleEntities.add(cusHandleEntity);
+ maps.put(packageName, cusHandleEntities);
+ }
+ }
+ return maps;
+ }
+
+ /**
+ * 遍历获取某个文件下所有文件名称
+ *
+ * @param path path
+ * @return Set
+ */
+ private static Set getAllFilePath(String path) {
+ Set fileSet = new LinkedHashSet<>();
+ File file = new File(path);
+ return getAllFilePath(fileSet, file);
+ }
+
+ /**
+ * 递归遍历获取某个文件下所有文件名称
+ *
+ * @param fileSet fileSet
+ * @param file 源文件
+ * @return Set
+ */
+ private static Set getAllFilePath(Set fileSet, File file) {
+ if (file.isDirectory()) {
+ File[] files = file.listFiles();
+ if (files != null) {
+ for (File file1 : files) {
+ getAllFilePath(fileSet, file1);
+ }
+ }
+ } else {
+ if (isClassFile(file.getAbsolutePath())) {
+ fileSet.add(file.getAbsolutePath());
+ }
+ return fileSet;
+ }
+ return fileSet;
+ }
+
+ /**
+ * 把文件路径转为包路径
+ *
+ * @param filePath filePath
+ * @param scanPath 扫描路径
+ * @return String
+ */
+ private static String transFilePathToPackagePath(String filePath, String scanPath) {
+ filePath = filePath.replace("\\", "/");
+ String substring = filePath.substring(filePath.indexOf(scanPath), filePath.indexOf(".class"));
+ return substring.replace("\\", ".").replace("/", ".");
+ }
+
+ /**
+ * 判断一个文件是不是jar包
+ *
+ * @param fileName fileName
+ * @return true-是,false-否
+ */
+ private static boolean isJarFile(String fileName) {
+ return fileName.contains(".jar!");
+ }
+
+ /**
+ * 判断一个文件class文件
+ *
+ * @param fileName fileName
+ * @return true-是,false-否
+ */
+ private static boolean isClassFile(String fileName) {
+ return fileName.endsWith(".class");
+ }
+
+ /**
+ * 获取文件路径
+ *
+ * @param url url
+ * @return String
+ */
+ private static String getRootPath(URL url) {
+ String path = url.getFile();
+ if (path.contains("!")) {
+ return path.substring(5, path.indexOf("!"));
+ }
+ return path;
+ }
+
+}
diff --git a/src/test/java/xuanran/wang/http_test/proxy/RequestUtil.java b/src/test/java/xuanran/wang/http_test/proxy/RequestUtil.java
index f0c7cc2..169237b 100644
--- a/src/test/java/xuanran/wang/http_test/proxy/RequestUtil.java
+++ b/src/test/java/xuanran/wang/http_test/proxy/RequestUtil.java
@@ -3,30 +3,21 @@ package xuanran.wang.http_test.proxy;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import aiyh.utils.httpUtil.ResponeVo;
-import aiyh.utils.httpUtil.util.HttpUtils;
-import com.alibaba.fastjson.JSON;
+import aiyh.utils.tool.cn.hutool.core.annotation.AnnotationUtil;
import com.alibaba.fastjson.JSONObject;
import org.apache.log4j.Logger;
import xuanran.wang.http_test.annotations.*;
-import xuanran.wang.http_test.annotations.async.CusAsync;
-import xuanran.wang.http_test.annotations.request_type.CusRequestDelete;
-import xuanran.wang.http_test.annotations.request_type.CusRequestGet;
-import xuanran.wang.http_test.annotations.request_type.CusRequestPost;
-import xuanran.wang.http_test.annotations.request_type.CusRequestPut;
-import xuanran.wang.http_test.constant.RequestUtilConstant;
+import xuanran.wang.http_test.annotations.handle.CusReqAfterHandleRegister;
+import xuanran.wang.http_test.annotations.handle.CusResponseSuccessHandle;
import xuanran.wang.http_test.entity.CusRequestEntity;
-import xuanran.wang.http_test.handle.*;
-import xuanran.wang.http_test.handle.path_handle.CusFieldKeyParseHandle;
+import xuanran.wang.http_test.handle.CusHandleCenter;
+import xuanran.wang.http_test.handle.CusRequestAfterHandle;
-import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
-import java.lang.reflect.Parameter;
import java.lang.reflect.Proxy;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.function.Function;
+
/**
* 声明式发送http请求
@@ -36,57 +27,59 @@ import java.util.function.Function;
*/
public class RequestUtil implements InvocationHandler {
private CusRequestAddress cusRequestAddress = null;
- private final HttpUtils httpUtils = new HttpUtils();
private final Logger log = Util.getLogger();
- private boolean async = false;
+ private final CusHandleCenter handleCenter = new CusHandleCenter();
+ private final CusRequestEntity cusRequest = new CusRequestEntity();
public T getRequestClient(Class> clazz){
- Annotation annotation = clazz.getDeclaredAnnotation(CusRequest.class);
+ Annotation annotation = clazz.getDeclaredAnnotation(CusRequestClient.class);
if(annotation == null){
- throw new CustomerException("该类未添加CusRequest注解!");
+ throw new CustomerException(Util.logStr(clazz.getName() + " not found CusRequestClient annotation!"));
+ }
+ // 请求后处理
+ CusReqAfterHandleRegister cusReqAfterHandleRegister = clazz.getDeclaredAnnotation(CusReqAfterHandleRegister.class);
+ if(cusReqAfterHandleRegister != null){
+ setCusRequestAfter(cusReqAfterHandleRegister, cusRequest);
+ }
+ // 响应处理
+ CusResponseSuccessHandle cusResponseSuccessHandle = clazz.getDeclaredAnnotation(CusResponseSuccessHandle.class);
+ if(cusResponseSuccessHandle != null){
+ cusRequest.setResponseSuccessHandle(cusResponseSuccessHandle);
}
cusRequestAddress = clazz.getDeclaredAnnotation(CusRequestAddress.class);
- if(null != clazz.getDeclaredAnnotation(CusAsync.class)){
- async = true;
- }
+ cusRequestAddress = AnnotationUtil.getSynthesizedAnnotation(clazz, CusRequestAddress.class);
+// if(null != clazz.getDeclaredAnnotation(CusAsync.class)){
+// async = true;
+// }
return (T) Proxy.newProxyInstance(clazz.getClassLoader(), new Class[]{clazz}, this);
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) {
- StringBuilder url = new StringBuilder();
- CusRequestEntity cusRequest = new CusRequestEntity();
if(cusRequestAddress != null){
String host = Util.null2DefaultStr(cusRequestAddress.host(),"");
int port = Util.getIntValue( Util.null2DefaultStr(cusRequestAddress.port(),""),0);
- url.append(host)
- .append(":")
- .append(port);
- cusRequest.setUrl(url.toString());
+ cusRequest.setHost(host);
+ cusRequest.setPort(port);
}
- CusFieldKeyParseHandle keyParseHandle = new CusFieldKeyParseHandle();
- keyParseHandle.handle(cusRequest, method, args);
- log.info("cusRequest : \n" + JSONObject.toJSONString(cusRequest));
- return "";
+ handleCenter.requestBeforeHandle(cusRequest, method, args);
+ log.info("requestHandle : \n" + JSONObject.toJSONString(cusRequest));
+ ResponeVo responeVo = handleCenter.requestHandle(cusRequest, method);
+ return handleCenter.requestAfterHandle(method, cusRequest, responeVo);
}
- private String appendPath(StringBuilder url, String path){
- if(!path.endsWith("/")){
- url.append("/");
- }
- url.append(path);
- return url.toString();
- }
-
- public Object get(String url, Map params, Map headers) throws IOException {
- return httpUtils.apiGet(url, params, headers);
- }
-
- public static boolean isJSON(String str) {
- try {
- JSON.parse(str);
- return true;
- } catch (Exception e) {
- return false;
+ public static void setCusRequestAfter(CusReqAfterHandleRegister cusReqAfterHandleRegister,
+ CusRequestEntity cusRequest){
+ if(cusReqAfterHandleRegister != null){
+ Class> clazz = cusReqAfterHandleRegister.afterHandle();
+ if (CusRequestAfterHandle.class.isAssignableFrom(clazz)) {
+ try {
+ Object cusRequestAfter = clazz.newInstance();
+ cusRequest.setCusRequestAfter((CusRequestAfterHandle) cusRequestAfter);
+ }catch (Exception e){
+ throw new CustomerException(Util.logStr("class : {}, newInstance error!", e.getMessage()));
+ }
+ }
}
}
+
}
diff --git a/src/test/java/xuanran/wang/http_test/service/TestService.java b/src/test/java/xuanran/wang/http_test/service/TestService.java
index 00e770b..e74ea59 100644
--- a/src/test/java/xuanran/wang/http_test/service/TestService.java
+++ b/src/test/java/xuanran/wang/http_test/service/TestService.java
@@ -1,11 +1,15 @@
package xuanran.wang.http_test.service;
-import aiyh.utils.httpUtil.ResponeVo;
import xuanran.wang.http_test.annotations.*;
+import xuanran.wang.http_test.annotations.body.CusRequestBody;
+import xuanran.wang.http_test.annotations.handle.CusResponseSuccessHandle;
import xuanran.wang.http_test.annotations.header.CusRequestHeader;
+import xuanran.wang.http_test.annotations.request_path.CusPathQuery;
import xuanran.wang.http_test.annotations.request_type.CusRequestGet;
import xuanran.wang.http_test.annotations.request_type.CusRequestPost;
+import xuanran.wang.http_test.constant.CusRequestClientConstant;
+import java.util.List;
import java.util.Map;
/**
@@ -14,19 +18,20 @@ import java.util.Map;
* @author xuanran.wang
* @date 2023/3/10 12:39
*/
-@CusRequest
-@CusRequestAddress(host = "http://114.115.168.220/educate-plat/api/v1/class/getClassList/{test}", port = 8191)
+@CusRequestClient(host = "http://114.115.168.220", port = 8191)
+//@CusReqAfterHandleRegister(afterHandle = TestRequestAfterHandle.class)
public interface TestService {
-
- @CusRequestGet(url = "educate-plat/api/v1/class/getClassList/{test}")
- @CusRequestHeader(cusHeaders = {"sa: sasa", "sas:11212"})
- String getStu(Map path,
- @PostBody Map body,
- @CusRequestHeader("hsjhdsad") String test,
- @CusPathQuery("test") String test1);
-
- @CusRequestPost(url = "test/post/sas")
- @CusRequestHeader(cusHeaders = {"content-Type: application/json"}, cusHeadersClassPath = "java.fsdfds")
- String getStu(@PostBody Map body);
+ @CusRequestGet(url = "educate-plat/api/v1/class/getClassList")
+ @CusRequestHeader(cusHeaders = {"sa: sasa", "sas:11212","content-Type:application/json"})
+ @CusResponseSuccessHandle(
+ successKey = "code",
+ successCondition = CusRequestClientConstant.EQUALS + " 0 ",
+ errorMsg = "msg",
+ data = "data"
+ )
+ Map getStu(Map path,
+ @CusRequestBody Map body,
+ @CusRequestHeader("hsjhdsad") String test,
+ @CusPathQuery("test") String test1);
}
diff --git a/src/test/java/xuanran/wang/http_test/test/RequestTest.java b/src/test/java/xuanran/wang/http_test/test/RequestTest.java
index ca18084..7b3dccf 100644
--- a/src/test/java/xuanran/wang/http_test/test/RequestTest.java
+++ b/src/test/java/xuanran/wang/http_test/test/RequestTest.java
@@ -1,13 +1,18 @@
package xuanran.wang.http_test.test;
-import aiyh.utils.httpUtil.ResponeVo;
import basetest.BaseTest;
+import com.alibaba.fastjson.JSONObject;
+import com.api.doc.migrate.util.FtpUtil;
+import com.jcraft.jsch.ChannelSftp;
import org.junit.Test;
+import weaver.backup.utils.ZipUtil;
+import xuanran.wang.http_test.entity.CusHandleEntity;
+import xuanran.wang.http_test.handle.util.HandleUtil;
import xuanran.wang.http_test.proxy.CusUtil;
-import xuanran.wang.http_test.proxy.RequestUtil;
import xuanran.wang.http_test.service.TestService;
-import java.util.HashMap;
+import java.util.*;
+import java.util.stream.Collectors;
/**
*
@@ -24,7 +29,6 @@ public class RequestTest extends BaseTest {
map.put("a","1");
map.put("b","2");
HashMap body = new HashMap<>();
-
body.put("a","3");
body.put("b","4");
@@ -32,10 +36,29 @@ public class RequestTest extends BaseTest {
path.put("e","5");
path.put("f","6");
- requestClient.getStu(map, body, "a", "test1111");
+ Map stu = requestClient.getStu(map, body, "a", "test1111");
+ log.info("stu : \n" + JSONObject.toJSONString(stu));
+// String json = "{\"xuanran.wang.http_test.requestBeforeHandle.path_handle\":[{\"handleClass\":\"xuanran.wang.http_test.requestBeforeHandle.path_handle.CusPathParseHandle\",\"order\":0,\"packageName\":\"xuanran.wang.http_test.requestBeforeHandle.path_handle\"},{\"handleClass\":\"xuanran.wang.http_test.requestBeforeHandle.path_handle.TestHandle\",\"order\":99,\"packageName\":\"xuanran.wang.http_test.requestBeforeHandle.path_handle\"}],\"xuanran.wang.http_test.requestBeforeHandle.header_handle\":[{\"handleClass\":\"xuanran.wang.http_test.requestBeforeHandle.header_handle.RequestHeaderHandle\",\"order\":0,\"packageName\":\"xuanran.wang.http_test.requestBeforeHandle.header_handle\"}]}";
+// System.out.println(JSONObject.parseObject(JSONObject.toJSONString(json), Map.class));
// String stu1 = requestClient.getStu(body);
+ }
+
+ @Test
+ public void testA(){
+ try {
+ HashMap> scan = HandleUtil.scanHandle();
+ for (Map.Entry> entry : scan.entrySet()) {
+ List value = entry.getValue();
+ List collect = value.stream().sorted(Comparator.comparingInt(CusHandleEntity::getOrder)).collect(Collectors.toList());
+ log.info("collect : " + JSONObject.toJSONString(collect));
+ }
+ log.info("scan => " + JSONObject.toJSONString(scan));
+ }catch (Exception e){
+ log.info("erro => " + e.getMessage());
+ }
+
}
}
diff --git a/src/test/java/xuanran/wang/http_test/test/TestRequestAfterHandle.java b/src/test/java/xuanran/wang/http_test/test/TestRequestAfterHandle.java
new file mode 100644
index 0000000..a55804d
--- /dev/null
+++ b/src/test/java/xuanran/wang/http_test/test/TestRequestAfterHandle.java
@@ -0,0 +1,20 @@
+package xuanran.wang.http_test.test;
+
+import aiyh.utils.httpUtil.ResponeVo;
+import xuanran.wang.http_test.entity.CusRequestEntity;
+import xuanran.wang.http_test.handle.request_handle.CusDefaultRequestAfterHandle;
+
+/**
+ *
+ *
+ * @author xuanran.wang
+ * @date 2023/3/20 14:48
+ */
+public class TestRequestAfterHandle extends CusDefaultRequestAfterHandle {
+
+ @Override
+ public void service(CusRequestEntity cusRequest, ResponeVo responseVo) {
+ System.out.println("============== ceshi xia ===============");
+ }
+
+}
diff --git a/src/test/java/xuanran/wang/immc/Kafka/MQTest.java b/src/test/java/xuanran/wang/immc/Kafka/MQTest.java
new file mode 100644
index 0000000..d2d69fe
--- /dev/null
+++ b/src/test/java/xuanran/wang/immc/Kafka/MQTest.java
@@ -0,0 +1,363 @@
+package xuanran.wang.immc.Kafka;
+
+import aiyh.utils.Util;
+import aiyh.utils.excention.CustomerException;
+import basetest.BaseTest;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.sun.tools.internal.ws.wsdl.document.soap.SOAPUse;
+import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.kafka.clients.producer.RecordMetadata;
+import org.junit.Test;
+
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.concurrent.Future;
+import java.util.stream.Collectors;
+
+import org.apache.kafka.clients.producer.KafkaProducer;
+import org.apache.kafka.clients.producer.ProducerRecord;
+import org.springframework.beans.BeanUtils;
+import weaver.conn.RecordSet;
+import weaver.workflow.request.todo.RequestStatusObj;
+import weaver.xuanran.wang.common.annocation.SqlFieldMapping;
+import weaver.xuanran.wang.common.annocation.SqlUpdateWhereField;
+import weaver.xuanran.wang.common.util.CusInfoToOAUtil;
+import weaver.xuanran.wang.sh_bigdata.common.util.SendTodoTaskUtil;
+import weaver.xuanran.wang.sh_bigdata.common.util.ShBigDataUtil;
+import weaver.xuanran.wang.sh_bigdata.org_hrm_async.entity.OtherSysDepartment;
+import weaver.xuanran.wang.sh_bigdata.org_hrm_async.service.OrgHrmAsyncApiService;
+import weaver.xuanran.wang.sh_bigdata.org_hrm_async.service.impl.OrgHrmAsyncApiServiceImpl;
+import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusDoneTask;
+import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusDoneTaskOA;
+import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusTodoTask;
+import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusTodoTaskToOADetail;
+import weaver.xuanran.wang.sh_bigdata.task_async.mapper.SendTodoTaskMapper;
+
+/**
+ *
+ *
+ * @author xuanran.wang
+ * @date 2023/3/30 11:06
+ */
+public class MQTest extends BaseTest {
+
+ @Test
+ public void testProducer(){
+ // 设置Kafka生产者的配置属性
+ Properties props = new Properties();
+ props.put("bootstrap.servers", "10.184.42.41:9094,10.184.42.42:9094,10.184.42.40:9094");
+// props.put("acks", "all");
+// props.put("retries", 0);
+// props.put("batch.size", 16384);
+// props.put("linger.ms", 1);
+// props.put("buffer.memory", 33554432);
+ props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
+ props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
+ Map configMap = Util.getProperties2Map("VmsKafka");
+ if(MapUtils.isEmpty(configMap)){
+ throw new CustomerException("please check /web-inf/prop2map has VmsKafka.properties");
+ }
+ // 创建Kafka生产者实例
+ KafkaProducer producer =new KafkaProducer(configMap);
+
+ // 发送消息到指定主题
+ String topic = "oa_service_immc_topic_uat";
+ String message = "Hello, Kafka!";
+ ProducerRecord record = new ProducerRecord<>(topic, message);
+ Future send = producer.send(record);
+
+ // 关闭Kafka生产者实例
+ producer.close();
+
+
+
+ }
+
+ @Test
+ public void testA(){
+ RecordSet rs = new RecordSet();
+ rs.executeQuery("select je from formtable_main_20 where requestid = ?", 353354);
+ rs.next();
+ Map mapMapping = getMapMapping(rs);
+ System.out.println("mapMapping => " + JSONObject.toJSONString(mapMapping));
+ }
+
+ @Test
+ public void testB(){
+ String json = "{\n" +
+ " \"errcode\":0,\n" +
+ " \"errmsg\":\"ok\",\n" +
+ " \"access_token\": \"accesstoken000001\",\n" +
+ " \"expires_in\": 7200\n" +
+ "}";
+ Map map = JSONObject.parseObject(json, Map.class);
+ String dataKey = "access_token";
+ String parse = parse(map, dataKey).toString();
+ System.out.println("parse => " +JSONObject.toJSONString(parse));
+ }
+
+ public T parse(Map response, String dataKey){
+ dataKey = Util.null2DefaultStr(dataKey, "");
+ String[] split = dataKey.split("\\.");
+ int len = split.length;
+ if(len == 0 || StringUtils.isBlank(dataKey)){
+ return (T)response;
+ }
+ for (int i = 0; i < len - 1; i++) {
+ response = (Map) response.get(split[i]);
+ }
+ return (T) response.get(split[len - 1]);
+ }
+
+ private static Map getMapMapping(RecordSet rs) {
+ Map map = new HashMap<>();
+ String[] columnType = rs.getColumnTypeName();
+ int colCounts;
+ colCounts = rs.getColCounts() == 0 ? columnType.length : rs.getColCounts();
+ for (int i = 1; i <= colCounts; i++) {
+ String key;
+ String type = "varchar";
+ if (columnType != null) {
+ if (columnType.length != colCounts) {
+ type = "varchar";
+ } else {
+ type = columnType[i - 1];
+ }
+ }
+ key = rs.getColumnName(i).toLowerCase();
+ if ("int".equalsIgnoreCase(type) || "Integer".equalsIgnoreCase(type)
+ || "Long".equalsIgnoreCase(type) || "BIGINT".equalsIgnoreCase(type)
+ || "NUMBER".equalsIgnoreCase(type) || "INTEGER".equalsIgnoreCase(type)
+ || "TINYINT".equalsIgnoreCase(type) || "SMALLINT".equalsIgnoreCase(type)) {
+ map.put(key, rs.getInt(i) == -1 ? rs.getString(i) : rs.getInt(i));
+ continue;
+ }
+ if ("FLOAT".equalsIgnoreCase(type)) {
+ map.put(key, rs.getFloat(i));
+ continue;
+ }
+ if ("DATE".equalsIgnoreCase(type) || "TIMESTAMP".equalsIgnoreCase(type)
+ || "DATETIME".equalsIgnoreCase(type)) {
+ map.put(key, rs.getString(i));
+ continue;
+ }
+ if ("DOUBLE".equalsIgnoreCase(type)) {
+ map.put(key, rs.getDouble(i));
+ continue;
+ }
+ if ("DECIMAL".equalsIgnoreCase(type) || "NUMERIC".equalsIgnoreCase(type)) {
+ String val = weaver.general.Util.null2String(rs.getString(i));
+ BigDecimal decimal;
+ if(StringUtils.isBlank(val)){
+ decimal = new BigDecimal("0");
+ }else {
+ decimal = new BigDecimal(val);
+ }
+ map.put(key, decimal);
+ continue;
+ }
+ map.put(key, rs.getString(i));
+ }
+ return map;
+ }
+
+ private final OrgHrmAsyncApiService orgHrmAsyncApiService = new OrgHrmAsyncApiServiceImpl();
+ @Test
+ public void testC(){
+ String json = "[{\"id\":1,\"name\":\"上海市\",\"parentid\":-1,\"order\":100000000,\"hasChild\":1},{\"id\":2,\"name\":\"市委\",\"parentid\":1,\"order\":100000000,\"hasChild\":0},{\"id\":14,\"name\":\"市人大\",\"parentid\":1,\"order\":99999500,\"hasChild\":1},{\"id\":15,\"name\":\"市人大常委会办公厅\",\"parentid\":14,\"order\":100000000,\"hasChild\":0},{\"id\":16,\"name\":\"市政府\",\"parentid\":1,\"order\":99999000,\"hasChild\":1},{\"id\":18,\"name\":\"市政府办公厅\",\"parentid\":16,\"order\":99999500,\"hasChild\":1},{\"id\":19,\"name\":\"秘书处\",\"parentid\":18,\"order\":100000000,\"hasChild\":0},{\"id\":20,\"name\":\"督查室\",\"parentid\":18,\"order\":99999500,\"hasChild\":0},{\"id\":21,\"name\":\"建议提案处\",\"parentid\":18,\"order\":99999000,\"hasChild\":0},{\"id\":22,\"name\":\"综合处\",\"parentid\":18,\"order\":99998500,\"hasChild\":0},{\"id\":23,\"name\":\"区政处\",\"parentid\":18,\"order\":99998000,\"hasChild\":0},{\"id\":24,\"name\":\"联络处\",\"parentid\":18,\"order\":99997500,\"hasChild\":0},{\"id\":25,\"name\":\"总值班室\",\"parentid\":18,\"order\":99997000,\"hasChild\":0},{\"id\":26,\"name\":\"政务公开办公室\",\"parentid\":18,\"order\":99996500,\"hasChild\":0},{\"id\":27,\"name\":\"数据发展管理办\",\"parentid\":18,\"order\":99996000,\"hasChild\":0},{\"id\":28,\"name\":\"法律事务办\",\"parentid\":18,\"order\":99995500,\"hasChild\":0},{\"id\":29,\"name\":\"政府职能转变协调处\",\"parentid\":18,\"order\":99995000,\"hasChild\":0},{\"id\":30,\"name\":\"政务服务处\",\"parentid\":18,\"order\":99994500,\"hasChild\":0},{\"id\":31,\"name\":\"上海发布办公室\",\"parentid\":18,\"order\":99994000,\"hasChild\":0},{\"id\":32,\"name\":\"打击走私综合治理处\",\"parentid\":18,\"order\":99993500,\"hasChild\":0},{\"id\":33,\"name\":\"城运规划处\",\"parentid\":18,\"order\":99993000,\"hasChild\":0},{\"id\":34,\"name\":\"指挥协调处\",\"parentid\":18,\"order\":99992500,\"hasChild\":0},{\"id\":35,\"name\":\"党政办公室\",\"parentid\":18,\"order\":99992000,\"hasChild\":0},{\"id\":36,\"name\":\"人事处\",\"parentid\":18,\"order\":99991500,\"hasChild\":0},{\"id\":37,\"name\":\"行政处\",\"parentid\":18,\"order\":99991000,\"hasChild\":0},{\"id\":38,\"name\":\"驻办公厅纪检组\",\"parentid\":18,\"order\":99990500,\"hasChild\":0},{\"id\":39,\"name\":\"市大数据中心\",\"parentid\":18,\"order\":99990000,\"hasChild\":0},{\"id\":40,\"name\":\"文印中心\",\"parentid\":18,\"order\":99989500,\"hasChild\":0},{\"id\":41,\"name\":\"离退休干部管理服务中心\",\"parentid\":18,\"order\":99989000,\"hasChild\":0},{\"id\":42,\"name\":\"市发展改革委\",\"parentid\":16,\"order\":99999000,\"hasChild\":1},{\"id\":43,\"name\":\"委领导\",\"parentid\":42,\"order\":100000000,\"hasChild\":0},{\"id\":44,\"name\":\"内设机构\",\"parentid\":42,\"order\":99999500,\"hasChild\":0},{\"id\":45,\"name\":\"直属单位\",\"parentid\":42,\"order\":99999000,\"hasChild\":0},{\"id\":46,\"name\":\"市经济信息化委\",\"parentid\":16,\"order\":99998500,\"hasChild\":1},{\"id\":47,\"name\":\"委领导\",\"parentid\":46,\"order\":100000000,\"hasChild\":0},{\"id\":48,\"name\":\"内设机构\",\"parentid\":46,\"order\":99999500,\"hasChild\":0},{\"id\":49,\"name\":\"直属单位\",\"parentid\":46,\"order\":99999000,\"hasChild\":0},{\"id\":50,\"name\":\"市商务委\",\"parentid\":16,\"order\":99998000,\"hasChild\":1},{\"id\":51,\"name\":\"委领导\",\"parentid\":50,\"order\":100000000,\"hasChild\":0},{\"id\":52,\"name\":\"内设机构\",\"parentid\":50,\"order\":99999500,\"hasChild\":0},{\"id\":53,\"name\":\"直属单位\",\"parentid\":50,\"order\":99999000,\"hasChild\":0},{\"id\":54,\"name\":\"市教委\",\"parentid\":16,\"order\":99997500,\"hasChild\":1},{\"id\":55,\"name\":\"委领导\",\"parentid\":54,\"order\":100000000,\"hasChild\":0},{\"id\":56,\"name\":\"内设机构\",\"parentid\":54,\"order\":99999500,\"hasChild\":0},{\"id\":57,\"name\":\"直属单位\",\"parentid\":54,\"order\":99999000,\"hasChild\":0},{\"id\":58,\"name\":\"市科委\",\"parentid\":16,\"order\":99997000,\"hasChild\":1},{\"id\":59,\"name\":\"委领导\",\"parentid\":58,\"order\":100000000,\"hasChild\":0},{\"id\":60,\"name\":\"内设机构\",\"parentid\":58,\"order\":99999500,\"hasChild\":0},{\"id\":61,\"name\":\"直属单位\",\"parentid\":58,\"order\":99999000,\"hasChild\":0},{\"id\":62,\"name\":\"市民族宗教局\",\"parentid\":16,\"order\":99996500,\"hasChild\":1},{\"id\":63,\"name\":\"委领导\",\"parentid\":62,\"order\":100000000,\"hasChild\":0},{\"id\":64,\"name\":\"内设机构\",\"parentid\":62,\"order\":99999500,\"hasChild\":0},{\"id\":65,\"name\":\"直属单位\",\"parentid\":62,\"order\":99999000,\"hasChild\":0},{\"id\":66,\"name\":\"市公安局\",\"parentid\":16,\"order\":99996000,\"hasChild\":1},{\"id\":67,\"name\":\"委领导\",\"parentid\":66,\"order\":100000000,\"hasChild\":0},{\"id\":68,\"name\":\"内设机构\",\"parentid\":66,\"order\":99999500,\"hasChild\":0},{\"id\":69,\"name\":\"直属单位\",\"parentid\":66,\"order\":99999000,\"hasChild\":0},{\"id\":70,\"name\":\"市民政局\",\"parentid\":16,\"order\":99995500,\"hasChild\":1},{\"id\":71,\"name\":\"局领导\",\"parentid\":70,\"order\":100000000,\"hasChild\":0},{\"id\":72,\"name\":\"内设机构\",\"parentid\":70,\"order\":99999500,\"hasChild\":0},{\"id\":73,\"name\":\"直属单位\",\"parentid\":70,\"order\":99999000,\"hasChild\":0},{\"id\":74,\"name\":\"市司法局\",\"parentid\":16,\"order\":99995000,\"hasChild\":1},{\"id\":75,\"name\":\"局领导\",\"parentid\":74,\"order\":100000000,\"hasChild\":0},{\"id\":76,\"name\":\"内设机构\",\"parentid\":74,\"order\":99999500,\"hasChild\":0},{\"id\":77,\"name\":\"直属单位\",\"parentid\":74,\"order\":99999000,\"hasChild\":0},{\"id\":78,\"name\":\"市财政局\",\"parentid\":16,\"order\":99994500,\"hasChild\":1},{\"id\":79,\"name\":\"局领导\",\"parentid\":78,\"order\":100000000,\"hasChild\":0},{\"id\":80,\"name\":\"内设机构\",\"parentid\":78,\"order\":99999500,\"hasChild\":0},{\"id\":81,\"name\":\"直属单位\",\"parentid\":78,\"order\":99999000,\"hasChild\":0},{\"id\":82,\"name\":\"市人力资源社会保障局\",\"parentid\":16,\"order\":99994000,\"hasChild\":1},{\"id\":83,\"name\":\"局领导\",\"parentid\":82,\"order\":100000000,\"hasChild\":0},{\"id\":84,\"name\":\"内设机构\",\"parentid\":82,\"order\":99999500,\"hasChild\":0},{\"id\":85,\"name\":\"直属单位\",\"parentid\":82,\"order\":99999000,\"hasChild\":0},{\"id\":86,\"name\":\"市规划资源局\",\"parentid\":16,\"order\":99993500,\"hasChild\":1},{\"id\":87,\"name\":\"内设机构\",\"parentid\":86,\"order\":100000000,\"hasChild\":0},{\"id\":88,\"name\":\"直属单位\",\"parentid\":86,\"order\":99999500,\"hasChild\":0},{\"id\":89,\"name\":\"市生态环境局\",\"parentid\":16,\"order\":99993000,\"hasChild\":1},{\"id\":93,\"name\":\"市住房城乡建设管理委\",\"parentid\":16,\"order\":99992500,\"hasChild\":1},{\"id\":94,\"name\":\"委领导\",\"parentid\":93,\"order\":100000000,\"hasChild\":0},{\"id\":95,\"name\":\"内设机构\",\"parentid\":93,\"order\":99999500,\"hasChild\":0},{\"id\":96,\"name\":\"直属单位\",\"parentid\":93,\"order\":99999000,\"hasChild\":0},{\"id\":97,\"name\":\"市交通委\",\"parentid\":16,\"order\":99992000,\"hasChild\":1},{\"id\":98,\"name\":\"委领导\",\"parentid\":97,\"order\":100000000,\"hasChild\":0},{\"id\":99,\"name\":\"内设机构\",\"parentid\":97,\"order\":99999500,\"hasChild\":0},{\"id\":100,\"name\":\"直属单位\",\"parentid\":97,\"order\":99999000,\"hasChild\":0},{\"id\":101,\"name\":\"市农业农村委\",\"parentid\":16,\"order\":99991500,\"hasChild\":1},{\"id\":102,\"name\":\"委领导\",\"parentid\":101,\"order\":100000000,\"hasChild\":0},{\"id\":103,\"name\":\"内设机构\",\"parentid\":101,\"order\":99999500,\"hasChild\":0},{\"id\":104,\"name\":\"直属单位\",\"parentid\":101,\"order\":99999000,\"hasChild\":0},{\"id\":105,\"name\":\"市水务局\",\"parentid\":16,\"order\":99991000,\"hasChild\":1},{\"id\":107,\"name\":\"局机关\",\"parentid\":105,\"order\":100000000,\"hasChild\":1},{\"id\":108,\"name\":\"局属单位\",\"parentid\":105,\"order\":99999500,\"hasChild\":1},{\"id\":109,\"name\":\"市文化旅游局\",\"parentid\":16,\"order\":99990500,\"hasChild\":1},{\"id\":110,\"name\":\"局领导\",\"parentid\":109,\"order\":100000000,\"hasChild\":0},{\"id\":111,\"name\":\"内设机构\",\"parentid\":109,\"order\":99999500,\"hasChild\":0},{\"id\":112,\"name\":\"直属单位\",\"parentid\":109,\"order\":99999000,\"hasChild\":0},{\"id\":113,\"name\":\"市卫生健康委\",\"parentid\":16,\"order\":99990000,\"hasChild\":1},{\"id\":114,\"name\":\"委领导\",\"parentid\":113,\"order\":100000000,\"hasChild\":0},{\"id\":115,\"name\":\"内设机构\",\"parentid\":113,\"order\":99999500,\"hasChild\":0},{\"id\":116,\"name\":\"直属单位\",\"parentid\":113,\"order\":99999000,\"hasChild\":0},{\"id\":117,\"name\":\"市退役军人局\",\"parentid\":16,\"order\":99989500,\"hasChild\":1},{\"id\":119,\"name\":\"局机关\",\"parentid\":117,\"order\":100000000,\"hasChild\":1},{\"id\":120,\"name\":\"局属单位\",\"parentid\":117,\"order\":99999500,\"hasChild\":1},{\"id\":121,\"name\":\"市应急局\",\"parentid\":16,\"order\":99989000,\"hasChild\":1},{\"id\":122,\"name\":\"局领导\",\"parentid\":121,\"order\":100000000,\"hasChild\":0},{\"id\":123,\"name\":\"内设机构\",\"parentid\":121,\"order\":99999500,\"hasChild\":0},{\"id\":124,\"name\":\"直属单位\",\"parentid\":121,\"order\":99999000,\"hasChild\":0},{\"id\":125,\"name\":\"市消防救援总队\",\"parentid\":121,\"order\":99998500,\"hasChild\":0},{\"id\":126,\"name\":\"市审计局\",\"parentid\":16,\"order\":99988500,\"hasChild\":1},{\"id\":127,\"name\":\"局领导\",\"parentid\":126,\"order\":100000000,\"hasChild\":0},{\"id\":128,\"name\":\"内设机构\",\"parentid\":126,\"order\":99999500,\"hasChild\":0},{\"id\":129,\"name\":\"直属单位\",\"parentid\":126,\"order\":99999000,\"hasChild\":0},{\"id\":130,\"name\":\"市市场监管局\",\"parentid\":16,\"order\":99988000,\"hasChild\":1},{\"id\":131,\"name\":\"局领导\",\"parentid\":130,\"order\":100000000,\"hasChild\":0},{\"id\":132,\"name\":\"内设机构\",\"parentid\":130,\"order\":99999500,\"hasChild\":0},{\"id\":133,\"name\":\"直属单位\",\"parentid\":130,\"order\":99999000,\"hasChild\":0},{\"id\":134,\"name\":\"市地方金融监管局\",\"parentid\":16,\"order\":99987500,\"hasChild\":1},{\"id\":135,\"name\":\"局领导\",\"parentid\":134,\"order\":100000000,\"hasChild\":0},{\"id\":136,\"name\":\"内设机构\",\"parentid\":134,\"order\":99999500,\"hasChild\":0},{\"id\":137,\"name\":\"直属单位\",\"parentid\":134,\"order\":99999000,\"hasChild\":0},{\"id\":138,\"name\":\"市政府外办\",\"parentid\":16,\"order\":99987000,\"hasChild\":1},{\"id\":139,\"name\":\"办领导\",\"parentid\":138,\"order\":100000000,\"hasChild\":0},{\"id\":140,\"name\":\"内设机构\",\"parentid\":138,\"order\":99999500,\"hasChild\":0},{\"id\":141,\"name\":\"直属单位\",\"parentid\":138,\"order\":99999000,\"hasChild\":0},{\"id\":142,\"name\":\"市国资委\",\"parentid\":16,\"order\":99986500,\"hasChild\":1},{\"id\":144,\"name\":\"委机关\",\"parentid\":142,\"order\":100000000,\"hasChild\":1},{\"id\":145,\"name\":\"委属单位\",\"parentid\":142,\"order\":99999500,\"hasChild\":1},{\"id\":146,\"name\":\"市体育局\",\"parentid\":16,\"order\":99986000,\"hasChild\":1},{\"id\":150,\"name\":\"市统计局\",\"parentid\":16,\"order\":99985500,\"hasChild\":1},{\"id\":151,\"name\":\"局领导\",\"parentid\":150,\"order\":100000000,\"hasChild\":0},{\"id\":152,\"name\":\"内设机构\",\"parentid\":150,\"order\":99999500,\"hasChild\":0},{\"id\":153,\"name\":\"直属单位\",\"parentid\":150,\"order\":99999000,\"hasChild\":0},{\"id\":154,\"name\":\"市医保局\",\"parentid\":16,\"order\":99985000,\"hasChild\":1},{\"id\":155,\"name\":\"局领导\",\"parentid\":154,\"order\":100000000,\"hasChild\":0},{\"id\":156,\"name\":\"内设机构\",\"parentid\":154,\"order\":99999500,\"hasChild\":0},{\"id\":157,\"name\":\"直属单位\",\"parentid\":154,\"order\":99999000,\"hasChild\":0},{\"id\":158,\"name\":\"市绿化市容局\",\"parentid\":16,\"order\":99984500,\"hasChild\":1},{\"id\":159,\"name\":\"局领导\",\"parentid\":158,\"order\":100000000,\"hasChild\":0},{\"id\":160,\"name\":\"内设机构\",\"parentid\":158,\"order\":99999500,\"hasChild\":0},{\"id\":161,\"name\":\"直属单位\",\"parentid\":158,\"order\":99999000,\"hasChild\":0},{\"id\":162,\"name\":\"市机管局\",\"parentid\":16,\"order\":99984000,\"hasChild\":1},{\"id\":166,\"name\":\"市民防办\",\"parentid\":16,\"order\":99983500,\"hasChild\":1},{\"id\":170,\"name\":\"市政府合作交流办\",\"parentid\":16,\"order\":99983000,\"hasChild\":1},{\"id\":171,\"name\":\"办领导\",\"parentid\":170,\"order\":100000000,\"hasChild\":0},{\"id\":172,\"name\":\"内设机构\",\"parentid\":170,\"order\":99999500,\"hasChild\":0},{\"id\":173,\"name\":\"直属单位\",\"parentid\":170,\"order\":99999000,\"hasChild\":0},{\"id\":174,\"name\":\"市政府研究室\",\"parentid\":16,\"order\":99982500,\"hasChild\":1},{\"id\":175,\"name\":\"室领导\",\"parentid\":174,\"order\":100000000,\"hasChild\":0},{\"id\":177,\"name\":\"直属单位\",\"parentid\":174,\"order\":99999000,\"hasChild\":0},{\"id\":178,\"name\":\"市政府参事室\",\"parentid\":16,\"order\":99982000,\"hasChild\":1},{\"id\":182,\"name\":\"市知识产权局\",\"parentid\":16,\"order\":99981500,\"hasChild\":1},{\"id\":183,\"name\":\"局领导\",\"parentid\":182,\"order\":100000000,\"hasChild\":0},{\"id\":184,\"name\":\"内设机构\",\"parentid\":182,\"order\":99999500,\"hasChild\":0},{\"id\":185,\"name\":\"直属单位\",\"parentid\":182,\"order\":99999000,\"hasChild\":0},{\"id\":186,\"name\":\"市粮食物资储备局\",\"parentid\":16,\"order\":99981000,\"hasChild\":1},{\"id\":187,\"name\":\"局领导\",\"parentid\":186,\"order\":100000000,\"hasChild\":0},{\"id\":188,\"name\":\"内设机构\",\"parentid\":186,\"order\":99999500,\"hasChild\":0},{\"id\":189,\"name\":\"直属单位\",\"parentid\":186,\"order\":99999000,\"hasChild\":0},{\"id\":190,\"name\":\"市监狱管理局\",\"parentid\":16,\"order\":99980500,\"hasChild\":1},{\"id\":191,\"name\":\"局领导\",\"parentid\":190,\"order\":100000000,\"hasChild\":0},{\"id\":192,\"name\":\"内设机构\",\"parentid\":190,\"order\":99999500,\"hasChild\":0},{\"id\":193,\"name\":\"直属单位\",\"parentid\":190,\"order\":99999000,\"hasChild\":0},{\"id\":194,\"name\":\"市城管执法局\",\"parentid\":16,\"order\":99980000,\"hasChild\":1},{\"id\":195,\"name\":\"局领导\",\"parentid\":194,\"order\":100000000,\"hasChild\":0},{\"id\":196,\"name\":\"内设机构\",\"parentid\":194,\"order\":99999500,\"hasChild\":0},{\"id\":197,\"name\":\"直属单位\",\"parentid\":194,\"order\":99999000,\"hasChild\":0},{\"id\":198,\"name\":\"市房屋管理局\",\"parentid\":16,\"order\":99979500,\"hasChild\":1},{\"id\":199,\"name\":\"局领导\",\"parentid\":198,\"order\":100000000,\"hasChild\":0},{\"id\":200,\"name\":\"内设机构\",\"parentid\":198,\"order\":99999500,\"hasChild\":0},{\"id\":201,\"name\":\"直属单位\",\"parentid\":198,\"order\":99999000,\"hasChild\":0},{\"id\":202,\"name\":\"市药品监督管理局\",\"parentid\":16,\"order\":99979000,\"hasChild\":1},{\"id\":203,\"name\":\"局领导\",\"parentid\":202,\"order\":100000000,\"hasChild\":0},{\"id\":204,\"name\":\"内设机构\",\"parentid\":202,\"order\":99999500,\"hasChild\":0},{\"id\":205,\"name\":\"直属单位\",\"parentid\":202,\"order\":99999000,\"hasChild\":0},{\"id\":206,\"name\":\"市道路运输管理局\",\"parentid\":16,\"order\":99978500,\"hasChild\":1},{\"id\":207,\"name\":\"局领导\",\"parentid\":206,\"order\":100000000,\"hasChild\":0},{\"id\":208,\"name\":\"内设机构\",\"parentid\":206,\"order\":99999500,\"hasChild\":0},{\"id\":209,\"name\":\"直属单位\",\"parentid\":206,\"order\":99999000,\"hasChild\":0},{\"id\":210,\"name\":\"国家税务总局上海市税务局\",\"parentid\":16,\"order\":99978000,\"hasChild\":1},{\"id\":211,\"name\":\"局领导\",\"parentid\":210,\"order\":100000000,\"hasChild\":0},{\"id\":212,\"name\":\"内设机构\",\"parentid\":210,\"order\":99999500,\"hasChild\":0},{\"id\":213,\"name\":\"直属单位\",\"parentid\":210,\"order\":99999000,\"hasChild\":0},{\"id\":214,\"name\":\"市政府发展研究中心\",\"parentid\":16,\"order\":99977500,\"hasChild\":1},{\"id\":215,\"name\":\"中心领导\",\"parentid\":214,\"order\":100000000,\"hasChild\":0},{\"id\":216,\"name\":\"内设机构\",\"parentid\":214,\"order\":99999500,\"hasChild\":0},{\"id\":217,\"name\":\"直属单位\",\"parentid\":214,\"order\":99999000,\"hasChild\":0},{\"id\":218,\"name\":\"市政协\",\"parentid\":1,\"order\":99997500,\"hasChild\":1},{\"id\":219,\"name\":\"市政协办公厅\",\"parentid\":218,\"order\":100000000,\"hasChild\":0},{\"id\":220,\"name\":\"市法院\",\"parentid\":1,\"order\":99998500,\"hasChild\":0},{\"id\":221,\"name\":\"市检察院\",\"parentid\":1,\"order\":99998000,\"hasChild\":0},{\"id\":222,\"name\":\"各区\",\"parentid\":1,\"order\":99997000,\"hasChild\":1},{\"id\":223,\"name\":\"浦东新区\",\"parentid\":222,\"order\":100000000,\"hasChild\":1},{\"id\":224,\"name\":\"区委\",\"parentid\":223,\"order\":100000000,\"hasChild\":0},{\"id\":225,\"name\":\"区人大\",\"parentid\":223,\"order\":99999500,\"hasChild\":0},{\"id\":226,\"name\":\"区政府\",\"parentid\":223,\"order\":99999000,\"hasChild\":0},{\"id\":227,\"name\":\"区政协\",\"parentid\":223,\"order\":99998500,\"hasChild\":0},{\"id\":228,\"name\":\"区法院\",\"parentid\":223,\"order\":99998000,\"hasChild\":0},{\"id\":229,\"name\":\"区检察院\",\"parentid\":223,\"order\":99997500,\"hasChild\":0},{\"id\":230,\"name\":\"街镇\",\"parentid\":223,\"order\":99997000,\"hasChild\":0},{\"id\":231,\"name\":\"黄浦区\",\"parentid\":222,\"order\":99999500,\"hasChild\":1},{\"id\":232,\"name\":\"区委\",\"parentid\":231,\"order\":100000000,\"hasChild\":0},{\"id\":233,\"name\":\"区人大\",\"parentid\":231,\"order\":99999500,\"hasChild\":0},{\"id\":234,\"name\":\"区政府\",\"parentid\":231,\"order\":99999000,\"hasChild\":0},{\"id\":235,\"name\":\"区政协\",\"parentid\":231,\"order\":99998500,\"hasChild\":0},{\"id\":236,\"name\":\"区法院\",\"parentid\":231,\"order\":99998000,\"hasChild\":0},{\"id\":237,\"name\":\"区检察院\",\"parentid\":231,\"order\":99997500,\"hasChild\":0},{\"id\":238,\"name\":\"街道\",\"parentid\":231,\"order\":99997000,\"hasChild\":0},{\"id\":239,\"name\":\"静安区\",\"parentid\":222,\"order\":99999000,\"hasChild\":1},{\"id\":240,\"name\":\"区委\",\"parentid\":239,\"order\":100000000,\"hasChild\":0},{\"id\":241,\"name\":\"区人大\",\"parentid\":239,\"order\":99999500,\"hasChild\":0},{\"id\":242,\"name\":\"区政府\",\"parentid\":239,\"order\":99999000,\"hasChild\":0},{\"id\":243,\"name\":\"区政协\",\"parentid\":239,\"order\":99998500,\"hasChild\":0},{\"id\":244,\"name\":\"区法院\",\"parentid\":239,\"order\":99998000,\"hasChild\":0},{\"id\":245,\"name\":\"区检察院\",\"parentid\":239,\"order\":99997500,\"hasChild\":0},{\"id\":246,\"name\":\"街镇\",\"parentid\":239,\"order\":99997000,\"hasChild\":0},{\"id\":247,\"name\":\"徐汇区\",\"parentid\":222,\"order\":99998500,\"hasChild\":1},{\"id\":248,\"name\":\"区委\",\"parentid\":247,\"order\":100000000,\"hasChild\":0},{\"id\":249,\"name\":\"区人大\",\"parentid\":247,\"order\":99999500,\"hasChild\":0},{\"id\":250,\"name\":\"区政府\",\"parentid\":247,\"order\":99999000,\"hasChild\":1},{\"id\":251,\"name\":\"区政协\",\"parentid\":247,\"order\":99998500,\"hasChild\":0},{\"id\":252,\"name\":\"区法院\",\"parentid\":247,\"order\":99998000,\"hasChild\":0},{\"id\":253,\"name\":\"区检察院\",\"parentid\":247,\"order\":99997500,\"hasChild\":0},{\"id\":254,\"name\":\"街镇\",\"parentid\":247,\"order\":99997000,\"hasChild\":0},{\"id\":255,\"name\":\"长宁区\",\"parentid\":222,\"order\":99998000,\"hasChild\":1},{\"id\":256,\"name\":\"区委\",\"parentid\":255,\"order\":100000000,\"hasChild\":0},{\"id\":257,\"name\":\"区人大\",\"parentid\":255,\"order\":99999500,\"hasChild\":0},{\"id\":258,\"name\":\"区政府\",\"parentid\":255,\"order\":99999000,\"hasChild\":0},{\"id\":259,\"name\":\"区政协\",\"parentid\":255,\"order\":99998500,\"hasChild\":0},{\"id\":260,\"name\":\"区法院\",\"parentid\":255,\"order\":99998000,\"hasChild\":0},{\"id\":261,\"name\":\"区检察院\",\"parentid\":255,\"order\":99997500,\"hasChild\":0},{\"id\":262,\"name\":\"街镇\",\"parentid\":255,\"order\":99997000,\"hasChild\":0},{\"id\":263,\"name\":\"普陀区\",\"parentid\":222,\"order\":99997500,\"hasChild\":1},{\"id\":264,\"name\":\"区委\",\"parentid\":263,\"order\":100000000,\"hasChild\":0},{\"id\":265,\"name\":\"区人大\",\"parentid\":263,\"order\":99999500,\"hasChild\":0},{\"id\":266,\"name\":\"区政府\",\"parentid\":263,\"order\":99999000,\"hasChild\":0},{\"id\":267,\"name\":\"区政协\",\"parentid\":263,\"order\":99998500,\"hasChild\":0},{\"id\":268,\"name\":\"区法院\",\"parentid\":263,\"order\":99998000,\"hasChild\":0},{\"id\":269,\"name\":\"区检察院\",\"parentid\":263,\"order\":99997500,\"hasChild\":0},{\"id\":270,\"name\":\"街镇\",\"parentid\":263,\"order\":99997000,\"hasChild\":0},{\"id\":271,\"name\":\"虹口区\",\"parentid\":222,\"order\":99997000,\"hasChild\":1},{\"id\":272,\"name\":\"区委\",\"parentid\":271,\"order\":100000000,\"hasChild\":0},{\"id\":273,\"name\":\"区人大\",\"parentid\":271,\"order\":99999500,\"hasChild\":0},{\"id\":274,\"name\":\"区政府\",\"parentid\":271,\"order\":99999000,\"hasChild\":0},{\"id\":275,\"name\":\"区政协\",\"parentid\":271,\"order\":99998500,\"hasChild\":0},{\"id\":276,\"name\":\"区法院\",\"parentid\":271,\"order\":99998000,\"hasChild\":0},{\"id\":277,\"name\":\"区检察院\",\"parentid\":271,\"order\":99997500,\"hasChild\":0},{\"id\":278,\"name\":\"街镇\",\"parentid\":271,\"order\":99997000,\"hasChild\":0},{\"id\":279,\"name\":\"杨浦区\",\"parentid\":222,\"order\":99996500,\"hasChild\":1},{\"id\":280,\"name\":\"区委\",\"parentid\":279,\"order\":100000000,\"hasChild\":0},{\"id\":281,\"name\":\"区人大\",\"parentid\":279,\"order\":99999500,\"hasChild\":0},{\"id\":282,\"name\":\"区政府\",\"parentid\":279,\"order\":99999000,\"hasChild\":0},{\"id\":283,\"name\":\"区政协\",\"parentid\":279,\"order\":99998500,\"hasChild\":0},{\"id\":284,\"name\":\"区法院\",\"parentid\":279,\"order\":99998000,\"hasChild\":0},{\"id\":285,\"name\":\"区检察院\",\"parentid\":279,\"order\":99997500,\"hasChild\":0},{\"id\":286,\"name\":\"街镇\",\"parentid\":279,\"order\":99997000,\"hasChild\":0},{\"id\":287,\"name\":\"宝山区\",\"parentid\":222,\"order\":99996000,\"hasChild\":1},{\"id\":288,\"name\":\"区委\",\"parentid\":287,\"order\":100000000,\"hasChild\":0},{\"id\":289,\"name\":\"区人大\",\"parentid\":287,\"order\":99999500,\"hasChild\":0},{\"id\":290,\"name\":\"区政府\",\"parentid\":287,\"order\":99999000,\"hasChild\":0},{\"id\":291,\"name\":\"区政协\",\"parentid\":287,\"order\":99998500,\"hasChild\":0},{\"id\":292,\"name\":\"区法院\",\"parentid\":287,\"order\":99998000,\"hasChild\":0},{\"id\":293,\"name\":\"区检察院\",\"parentid\":287,\"order\":99997500,\"hasChild\":0},{\"id\":294,\"name\":\"街镇\",\"parentid\":287,\"order\":99997000,\"hasChild\":0},{\"id\":295,\"name\":\"闵行区\",\"parentid\":222,\"order\":99995500,\"hasChild\":1},{\"id\":296,\"name\":\"区委\",\"parentid\":295,\"order\":100000000,\"hasChild\":0},{\"id\":297,\"name\":\"区人大\",\"parentid\":295,\"order\":99999500,\"hasChild\":0},{\"id\":298,\"name\":\"区政府\",\"parentid\":295,\"order\":99999000,\"hasChild\":0},{\"id\":299,\"name\":\"区政协\",\"parentid\":295,\"order\":99998500,\"hasChild\":0},{\"id\":300,\"name\":\"区法院\",\"parentid\":295,\"order\":99998000,\"hasChild\":0},{\"id\":301,\"name\":\"区检察院\",\"parentid\":295,\"order\":99997500,\"hasChild\":0},{\"id\":302,\"name\":\"街镇\",\"parentid\":295,\"order\":99997000,\"hasChild\":0},{\"id\":303,\"name\":\"嘉定区\",\"parentid\":222,\"order\":99995000,\"hasChild\":1},{\"id\":304,\"name\":\"区委\",\"parentid\":303,\"order\":100000000,\"hasChild\":0},{\"id\":305,\"name\":\"区人大\",\"parentid\":303,\"order\":99999500,\"hasChild\":0},{\"id\":306,\"name\":\"区政府\",\"parentid\":303,\"order\":99999000,\"hasChild\":0},{\"id\":307,\"name\":\"区政协\",\"parentid\":303,\"order\":99998500,\"hasChild\":0},{\"id\":308,\"name\":\"区法院\",\"parentid\":303,\"order\":99998000,\"hasChild\":0},{\"id\":309,\"name\":\"区检察院\",\"parentid\":303,\"order\":99997500,\"hasChild\":0},{\"id\":310,\"name\":\"街镇\",\"parentid\":303,\"order\":99997000,\"hasChild\":0},{\"id\":311,\"name\":\"金山区\",\"parentid\":222,\"order\":99994500,\"hasChild\":1},{\"id\":312,\"name\":\"区委\",\"parentid\":311,\"order\":100000000,\"hasChild\":0},{\"id\":313,\"name\":\"区人大\",\"parentid\":311,\"order\":99999500,\"hasChild\":0},{\"id\":314,\"name\":\"区政府\",\"parentid\":311,\"order\":99999000,\"hasChild\":0},{\"id\":315,\"name\":\"区政协\",\"parentid\":311,\"order\":99998500,\"hasChild\":0},{\"id\":316,\"name\":\"区法院\",\"parentid\":311,\"order\":99998000,\"hasChild\":0},{\"id\":317,\"name\":\"区检察院\",\"parentid\":311,\"order\":99997500,\"hasChild\":0},{\"id\":318,\"name\":\"街镇\",\"parentid\":311,\"order\":99997000,\"hasChild\":0},{\"id\":319,\"name\":\"松江区\",\"parentid\":222,\"order\":99994000,\"hasChild\":1},{\"id\":320,\"name\":\"区委\",\"parentid\":319,\"order\":100000000,\"hasChild\":0},{\"id\":321,\"name\":\"区人大\",\"parentid\":319,\"order\":99999500,\"hasChild\":0},{\"id\":322,\"name\":\"区政府\",\"parentid\":319,\"order\":99999000,\"hasChild\":0},{\"id\":323,\"name\":\"区政协\",\"parentid\":319,\"order\":99998500,\"hasChild\":0},{\"id\":324,\"name\":\"区法院\",\"parentid\":319,\"order\":99998000,\"hasChild\":0},{\"id\":325,\"name\":\"区检察院\",\"parentid\":319,\"order\":99997500,\"hasChild\":0},{\"id\":326,\"name\":\"街镇\",\"parentid\":319,\"order\":99997000,\"hasChild\":0},{\"id\":327,\"name\":\"青浦区\",\"parentid\":222,\"order\":99993500,\"hasChild\":1},{\"id\":328,\"name\":\"区委\",\"parentid\":327,\"order\":100000000,\"hasChild\":0},{\"id\":329,\"name\":\"区人大\",\"parentid\":327,\"order\":99999500,\"hasChild\":0},{\"id\":330,\"name\":\"区政府\",\"parentid\":327,\"order\":99999000,\"hasChild\":0},{\"id\":331,\"name\":\"区政协\",\"parentid\":327,\"order\":99998500,\"hasChild\":0},{\"id\":332,\"name\":\"区法院\",\"parentid\":327,\"order\":99998000,\"hasChild\":0},{\"id\":333,\"name\":\"区检察院\",\"parentid\":327,\"order\":99997500,\"hasChild\":0},{\"id\":334,\"name\":\"街镇\",\"parentid\":327,\"order\":99997000,\"hasChild\":0},{\"id\":335,\"name\":\"奉贤区\",\"parentid\":222,\"order\":99993000,\"hasChild\":1},{\"id\":336,\"name\":\"区委\",\"parentid\":335,\"order\":100000000,\"hasChild\":0},{\"id\":337,\"name\":\"区人大\",\"parentid\":335,\"order\":99999500,\"hasChild\":0},{\"id\":338,\"name\":\"区政府\",\"parentid\":335,\"order\":99999000,\"hasChild\":0},{\"id\":339,\"name\":\"区政协\",\"parentid\":335,\"order\":99998500,\"hasChild\":0},{\"id\":340,\"name\":\"区法院\",\"parentid\":335,\"order\":99998000,\"hasChild\":0},{\"id\":341,\"name\":\"区检察院\",\"parentid\":335,\"order\":99997500,\"hasChild\":0},{\"id\":342,\"name\":\"街镇\",\"parentid\":335,\"order\":99997000,\"hasChild\":0},{\"id\":343,\"name\":\"崇明区\",\"parentid\":222,\"order\":99992500,\"hasChild\":1},{\"id\":344,\"name\":\"区委\",\"parentid\":343,\"order\":100000000,\"hasChild\":0},{\"id\":345,\"name\":\"区人大\",\"parentid\":343,\"order\":99999500,\"hasChild\":0},{\"id\":346,\"name\":\"区政府\",\"parentid\":343,\"order\":99999000,\"hasChild\":0},{\"id\":347,\"name\":\"区政协\",\"parentid\":343,\"order\":99998500,\"hasChild\":0},{\"id\":348,\"name\":\"区法院\",\"parentid\":343,\"order\":99998000,\"hasChild\":0},{\"id\":349,\"name\":\"区检察院\",\"parentid\":343,\"order\":99997500,\"hasChild\":0},{\"id\":350,\"name\":\"街道乡镇\",\"parentid\":343,\"order\":99997000,\"hasChild\":0},{\"id\":351,\"name\":\"业务条线\",\"parentid\":1,\"order\":99996500,\"hasChild\":1},{\"id\":352,\"name\":\"办公室和值班室系统\",\"parentid\":351,\"order\":99999500,\"hasChild\":0},{\"id\":353,\"name\":\"城运系统\",\"parentid\":351,\"order\":99999000,\"hasChild\":0},{\"id\":354,\"name\":\"网格系统\",\"parentid\":351,\"order\":99998500,\"hasChild\":0},{\"id\":355,\"name\":\"防汛防台系统\",\"parentid\":351,\"order\":99998000,\"hasChild\":0},{\"id\":356,\"name\":\"统一综合执法系统\",\"parentid\":351,\"order\":99997000,\"hasChild\":0},{\"id\":357,\"name\":\"重要会议保障\",\"parentid\":351,\"order\":99997500,\"hasChild\":0},{\"id\":358,\"name\":\"TEST-ZONE\",\"parentid\":667,\"order\":100000000,\"hasChild\":1},{\"id\":360,\"name\":\"正通过管理通讯录同时可手动编辑正\",\"parentid\":404,\"order\":100000000,\"hasChild\":1},{\"id\":362,\"name\":\"测试数据\",\"parentid\":358,\"order\":99999500,\"hasChild\":0},{\"id\":363,\"name\":\"测试数据1\",\"parentid\":358,\"order\":99993500,\"hasChild\":1},{\"id\":364,\"name\":\"测试数据2\",\"parentid\":358,\"order\":99994500,\"hasChild\":0},{\"id\":365,\"name\":\"超长部门名称测试超长部门名称测试\",\"parentid\":363,\"order\":100000000,\"hasChild\":0},{\"id\":366,\"name\":\"测试子部门\",\"parentid\":450,\"order\":99999500,\"hasChild\":0},{\"id\":368,\"name\":\"新建子部门\",\"parentid\":408,\"order\":99999000,\"hasChild\":0},{\"id\":369,\"name\":\"测试\",\"parentid\":358,\"order\":99998000,\"hasChild\":1},{\"id\":376,\"name\":\"1\",\"parentid\":450,\"order\":100000000,\"hasChild\":0},{\"id\":377,\"name\":\"23333\",\"parentid\":450,\"order\":99998500,\"hasChild\":0},{\"id\":378,\"name\":\"3\",\"parentid\":405,\"order\":100000000,\"hasChild\":1},{\"id\":380,\"name\":\"2\",\"parentid\":358,\"order\":99996000,\"hasChild\":1},{\"id\":399,\"name\":\"正在通过管理员权限\",\"parentid\":360,\"order\":100000000,\"hasChild\":0},{\"id\":400,\"name\":\"正在通过\",\"parentid\":405,\"order\":99999500,\"hasChild\":0},{\"id\":403,\"name\":\"1\",\"parentid\":358,\"order\":99996500,\"hasChild\":0},{\"id\":404,\"name\":\"21\",\"parentid\":450,\"order\":99999000,\"hasChild\":1},{\"id\":405,\"name\":\"dy测试\",\"parentid\":358,\"order\":99998500,\"hasChild\":1},{\"id\":406,\"name\":\"asdfa\",\"parentid\":408,\"order\":100000000,\"hasChild\":0},{\"id\":407,\"name\":\"asdfasdf'\",\"parentid\":408,\"order\":99998500,\"hasChild\":0},{\"id\":408,\"name\":\"dy测试22\",\"parentid\":405,\"order\":99999000,\"hasChild\":1},{\"id\":410,\"name\":\"局领导班子\",\"parentid\":107,\"order\":100000000,\"hasChild\":0},{\"id\":411,\"name\":\"二级巡视员\",\"parentid\":107,\"order\":99999500,\"hasChild\":0},{\"id\":412,\"name\":\"办公室\",\"parentid\":107,\"order\":99999000,\"hasChild\":0},{\"id\":413,\"name\":\"政策研究室\",\"parentid\":107,\"order\":99998500,\"hasChild\":0},{\"id\":414,\"name\":\"法规处\",\"parentid\":107,\"order\":99998000,\"hasChild\":0},{\"id\":415,\"name\":\"组织人事处(老干部处)\",\"parentid\":107,\"order\":99997500,\"hasChild\":0},{\"id\":416,\"name\":\"综合规划处\",\"parentid\":107,\"order\":99997000,\"hasChild\":0},{\"id\":417,\"name\":\"计划财务处\",\"parentid\":107,\"order\":99996500,\"hasChild\":0},{\"id\":418,\"name\":\"科技信息处(社会宣传处)\",\"parentid\":107,\"order\":99996000,\"hasChild\":0},{\"id\":419,\"name\":\"河长制工作处(综合督导处)\",\"parentid\":107,\"order\":99995500,\"hasChild\":0},{\"id\":420,\"name\":\"水资源管理处(上海市节约用水办公室)\",\"parentid\":107,\"order\":99995000,\"hasChild\":0},{\"id\":421,\"name\":\"建设管理处\",\"parentid\":107,\"order\":99994500,\"hasChild\":0},{\"id\":422,\"name\":\"水利管理处(水土保持处)\",\"parentid\":107,\"order\":99994000,\"hasChild\":0},{\"id\":423,\"name\":\"海域海岛管理处(海洋经济协调处)\",\"parentid\":107,\"order\":99993500,\"hasChild\":0},{\"id\":424,\"name\":\"水旱和海洋灾害防御处\",\"parentid\":107,\"order\":99993000,\"hasChild\":0},{\"id\":425,\"name\":\"设施运行管理处(安全监督处)\",\"parentid\":107,\"order\":99992500,\"hasChild\":0},{\"id\":426,\"name\":\"审计室\",\"parentid\":107,\"order\":99992000,\"hasChild\":0},{\"id\":427,\"name\":\"工会\",\"parentid\":107,\"order\":99991500,\"hasChild\":0},{\"id\":428,\"name\":\"机关党委\",\"parentid\":107,\"order\":99991000,\"hasChild\":0},{\"id\":429,\"name\":\"团委\",\"parentid\":107,\"order\":99990500,\"hasChild\":0},{\"id\":430,\"name\":\"纪检监察组\",\"parentid\":107,\"order\":99990000,\"hasChild\":0},{\"id\":431,\"name\":\"文印室\",\"parentid\":107,\"order\":99989500,\"hasChild\":0},{\"id\":432,\"name\":\"局网站编辑部\",\"parentid\":107,\"order\":99989000,\"hasChild\":0},{\"id\":433,\"name\":\"水务志编辑室\",\"parentid\":107,\"order\":99988500,\"hasChild\":0},{\"id\":434,\"name\":\"老干部活动中心\",\"parentid\":107,\"order\":99988000,\"hasChild\":0},{\"id\":435,\"name\":\"上海市水务局执法总队(中国海监上海市总队)\",\"parentid\":108,\"order\":100000000,\"hasChild\":0},{\"id\":436,\"name\":\"上海市水务局行政服务中心(上海市海洋局行政服务中心)\",\"parentid\":108,\"order\":99999500,\"hasChild\":0},{\"id\":437,\"name\":\"上海市水利管理事务中心(上海市河湖管理事务中心)\",\"parentid\":108,\"order\":99999000,\"hasChild\":0},{\"id\":438,\"name\":\"上海市供水管理事务中心(上海市节约用水促进中心)\",\"parentid\":108,\"order\":99998500,\"hasChild\":0},{\"id\":439,\"name\":\"上海市排水管理事务中心\",\"parentid\":108,\"order\":99998000,\"hasChild\":0},{\"id\":440,\"name\":\"上海市堤防泵闸建设运行中心\",\"parentid\":108,\"order\":99997500,\"hasChild\":0},{\"id\":441,\"name\":\"上海市水文总站\",\"parentid\":108,\"order\":99997000,\"hasChild\":0},{\"id\":442,\"name\":\"上海市水务规划设计研究院(上海市海洋规划设计研究院)\",\"parentid\":108,\"order\":99996500,\"hasChild\":0},{\"id\":443,\"name\":\"上海市供水调度监测中心\",\"parentid\":108,\"order\":99996000,\"hasChild\":0},{\"id\":444,\"name\":\"上海市水务建设工程安全质量监督中心站(上海市水务工程定额管理站)\",\"parentid\":108,\"order\":99995500,\"hasChild\":0},{\"id\":445,\"name\":\"上海市水旱灾害防御技术中心\",\"parentid\":108,\"order\":99995000,\"hasChild\":0},{\"id\":446,\"name\":\"上海市海洋管理事务中心\",\"parentid\":108,\"order\":99994500,\"hasChild\":0},{\"id\":447,\"name\":\"上海市海洋监测预报中心\",\"parentid\":108,\"order\":99994000,\"hasChild\":0},{\"id\":449,\"name\":\"一个部门\",\"parentid\":378,\"order\":99999000,\"hasChild\":0},{\"id\":450,\"name\":\"test\",\"parentid\":380,\"order\":99999500,\"hasChild\":1},{\"id\":453,\"name\":\"委领导\",\"parentid\":144,\"order\":100000000,\"hasChild\":0},{\"id\":454,\"name\":\"党委办公室\",\"parentid\":144,\"order\":99999500,\"hasChild\":0},{\"id\":455,\"name\":\"组织处\",\"parentid\":144,\"order\":99999000,\"hasChild\":0},{\"id\":456,\"name\":\"宣传处\",\"parentid\":144,\"order\":99998500,\"hasChild\":0},{\"id\":457,\"name\":\"企业领导人员管理处\",\"parentid\":144,\"order\":99998000,\"hasChild\":0},{\"id\":458,\"name\":\"老干部处\",\"parentid\":144,\"order\":99997500,\"hasChild\":0},{\"id\":459,\"name\":\"办公室\",\"parentid\":144,\"order\":99997000,\"hasChild\":0},{\"id\":460,\"name\":\"人事处\",\"parentid\":144,\"order\":99996500,\"hasChild\":0},{\"id\":461,\"name\":\"研究室\",\"parentid\":144,\"order\":99996000,\"hasChild\":0},{\"id\":462,\"name\":\"政策法规处\",\"parentid\":144,\"order\":99995500,\"hasChild\":0},{\"id\":463,\"name\":\"规划发展处\",\"parentid\":144,\"order\":99995000,\"hasChild\":0},{\"id\":464,\"name\":\"创新发展处\",\"parentid\":144,\"order\":99994500,\"hasChild\":0},{\"id\":465,\"name\":\"企业改革处(城镇集体资产管理处)\",\"parentid\":144,\"order\":99994000,\"hasChild\":0},{\"id\":466,\"name\":\"金融企业发展处\",\"parentid\":144,\"order\":99993500,\"hasChild\":0},{\"id\":467,\"name\":\"产权管理处(资本运营管理处)\",\"parentid\":144,\"order\":99993000,\"hasChild\":0},{\"id\":468,\"name\":\"评估管理处\",\"parentid\":144,\"order\":99992500,\"hasChild\":0},{\"id\":469,\"name\":\"审计监督处(稽查办公室)\",\"parentid\":144,\"order\":99992000,\"hasChild\":0},{\"id\":470,\"name\":\"财务评价处\",\"parentid\":144,\"order\":99991500,\"hasChild\":0},{\"id\":471,\"name\":\"业绩考核处\",\"parentid\":144,\"order\":99991000,\"hasChild\":0},{\"id\":472,\"name\":\"分配保障处\",\"parentid\":144,\"order\":99990500,\"hasChild\":0},{\"id\":473,\"name\":\"综合协调处\",\"parentid\":144,\"order\":99990000,\"hasChild\":0},{\"id\":474,\"name\":\"公司治理处\",\"parentid\":144,\"order\":99989500,\"hasChild\":0},{\"id\":475,\"name\":\"信息化管理处\",\"parentid\":144,\"order\":99989000,\"hasChild\":0},{\"id\":476,\"name\":\"信访办公室\",\"parentid\":144,\"order\":99988500,\"hasChild\":0},{\"id\":477,\"name\":\"直属机关党委\",\"parentid\":144,\"order\":99988000,\"hasChild\":0},{\"id\":478,\"name\":\"上海市国有资产监督管理委员会企业发展服务中心\",\"parentid\":145,\"order\":100000000,\"hasChild\":0},{\"id\":479,\"name\":\"上海市国资国企改革发展研究中心\",\"parentid\":145,\"order\":99999500,\"hasChild\":0},{\"id\":480,\"name\":\"上海市国有企业绩效评价中心(上海市国有资产监督管理委员会稽查事务中心)\",\"parentid\":145,\"order\":99999000,\"hasChild\":0},{\"id\":481,\"name\":\"局领导\",\"parentid\":119,\"order\":100000000,\"hasChild\":0},{\"id\":482,\"name\":\"办公室\",\"parentid\":119,\"order\":99999500,\"hasChild\":0},{\"id\":483,\"name\":\"组织人事处\",\"parentid\":119,\"order\":99999000,\"hasChild\":0},{\"id\":484,\"name\":\"政策法规处\",\"parentid\":119,\"order\":99998500,\"hasChild\":0},{\"id\":485,\"name\":\"规划财务处\",\"parentid\":119,\"order\":99998000,\"hasChild\":0},{\"id\":486,\"name\":\"思想政治和权益维护处\",\"parentid\":119,\"order\":99997500,\"hasChild\":0},{\"id\":487,\"name\":\"移交安置处(就业创业处)\",\"parentid\":119,\"order\":99997000,\"hasChild\":0},{\"id\":488,\"name\":\"军休服务管理处\",\"parentid\":119,\"order\":99996500,\"hasChild\":0},{\"id\":489,\"name\":\"拥军优抚处(褒扬纪念处)\",\"parentid\":119,\"order\":99996000,\"hasChild\":0},{\"id\":490,\"name\":\"直属机关党委\",\"parentid\":119,\"order\":99995500,\"hasChild\":0},{\"id\":491,\"name\":\"上海市双拥服务中心\",\"parentid\":120,\"order\":100000000,\"hasChild\":0},{\"id\":492,\"name\":\"上海市军队离休退休干部活动中心\",\"parentid\":120,\"order\":99999500,\"hasChild\":0},{\"id\":493,\"name\":\"上海市荣誉军人疗养院\",\"parentid\":120,\"order\":99999000,\"hasChild\":0},{\"id\":494,\"name\":\"上海市龙华烈士陵园(龙华烈士纪念馆)\",\"parentid\":120,\"order\":99998500,\"hasChild\":0},{\"id\":495,\"name\":\"上海市军队离退休干部古美休养所\",\"parentid\":120,\"order\":99998000,\"hasChild\":0},{\"id\":496,\"name\":\"上海市军供站\",\"parentid\":120,\"order\":99997500,\"hasChild\":0},{\"id\":497,\"name\":\"上海市退役军人服务中心\",\"parentid\":120,\"order\":99997000,\"hasChild\":0},{\"id\":498,\"name\":\"参事室领导\",\"parentid\":178,\"order\":100000000,\"hasChild\":0},{\"id\":499,\"name\":\"秘书处\",\"parentid\":503,\"order\":100000000,\"hasChild\":0},{\"id\":500,\"name\":\"宣传交流处\",\"parentid\":503,\"order\":99999500,\"hasChild\":0},{\"id\":501,\"name\":\"参事业务处\",\"parentid\":503,\"order\":99999000,\"hasChild\":0},{\"id\":502,\"name\":\"组织人事处\",\"parentid\":503,\"order\":99998500,\"hasChild\":0},{\"id\":503,\"name\":\"内设机构\",\"parentid\":178,\"order\":99999500,\"hasChild\":1},{\"id\":504,\"name\":\"局机关\",\"parentid\":162,\"order\":100000000,\"hasChild\":1},{\"id\":505,\"name\":\"办公室\",\"parentid\":504,\"order\":100000000,\"hasChild\":0},{\"id\":506,\"name\":\"政策法规处(研究室)\",\"parentid\":504,\"order\":99999500,\"hasChild\":0},{\"id\":507,\"name\":\"人事处(老干部处)\",\"parentid\":504,\"order\":99999000,\"hasChild\":0},{\"id\":508,\"name\":\"财务处(审计室)\",\"parentid\":504,\"order\":99998500,\"hasChild\":0},{\"id\":509,\"name\":\"国有资产管理处\",\"parentid\":504,\"order\":99998000,\"hasChild\":0},{\"id\":510,\"name\":\"办公用房与人防设施处\",\"parentid\":504,\"order\":99997500,\"hasChild\":0},{\"id\":511,\"name\":\"车辆管理处\",\"parentid\":504,\"order\":99997000,\"hasChild\":0},{\"id\":512,\"name\":\"公共机构节能管理处\",\"parentid\":504,\"order\":99996500,\"hasChild\":0},{\"id\":513,\"name\":\"服务监管处(后勤改革指导处)\",\"parentid\":504,\"order\":99996000,\"hasChild\":0},{\"id\":514,\"name\":\"住房管理处\",\"parentid\":504,\"order\":99995500,\"hasChild\":0},{\"id\":515,\"name\":\"局管单位\",\"parentid\":162,\"order\":99999000,\"hasChild\":1},{\"id\":516,\"name\":\"上海市孙中山宋庆龄文物管理委员会\",\"parentid\":515,\"order\":100000000,\"hasChild\":0},{\"id\":517,\"name\":\"上海上勤(集团)有限公司\",\"parentid\":515,\"order\":99999500,\"hasChild\":0},{\"id\":518,\"name\":\"上海展览中心(集团)有限公司\",\"parentid\":515,\"order\":99999000,\"hasChild\":0},{\"id\":519,\"name\":\"上海孙中山故居纪念馆\",\"parentid\":515,\"order\":99998500,\"hasChild\":0},{\"id\":520,\"name\":\"上海宋庆龄故居纪念馆\",\"parentid\":515,\"order\":99998000,\"hasChild\":0},{\"id\":521,\"name\":\"中华人民共和国名誉主席宋庆龄陵园管理处(上海市万国公墓管理处)\",\"parentid\":515,\"order\":99997500,\"hasChild\":0},{\"id\":522,\"name\":\"局机关\",\"parentid\":146,\"order\":100000000,\"hasChild\":1},{\"id\":523,\"name\":\"局领导\",\"parentid\":522,\"order\":100000000,\"hasChild\":0},{\"id\":524,\"name\":\"办公室\",\"parentid\":522,\"order\":99999500,\"hasChild\":0},{\"id\":525,\"name\":\"规划产业处(法规处)\",\"parentid\":522,\"order\":99999000,\"hasChild\":0},{\"id\":526,\"name\":\"人事处(外事处)\",\"parentid\":522,\"order\":99998500,\"hasChild\":0},{\"id\":527,\"name\":\"财务处(设施建设处)\",\"parentid\":522,\"order\":99998000,\"hasChild\":0},{\"id\":528,\"name\":\"群众体育处\",\"parentid\":522,\"order\":99997500,\"hasChild\":0},{\"id\":529,\"name\":\"竞技体育处\",\"parentid\":522,\"order\":99997000,\"hasChild\":0},{\"id\":530,\"name\":\"青少年体育处(科教处)\",\"parentid\":522,\"order\":99996500,\"hasChild\":0},{\"id\":531,\"name\":\"竞赛处\",\"parentid\":522,\"order\":99996000,\"hasChild\":0},{\"id\":532,\"name\":\"局属单位\",\"parentid\":146,\"order\":99999500,\"hasChild\":1},{\"id\":533,\"name\":\"上海棋院(上海市棋牌运动管理中心)\",\"parentid\":532,\"order\":100000000,\"hasChild\":0},{\"id\":534,\"name\":\"上海市第二体育运动学校(上海市体育中学)\",\"parentid\":532,\"order\":99999500,\"hasChild\":0},{\"id\":535,\"name\":\"上海市划船俱乐部\",\"parentid\":532,\"order\":99999000,\"hasChild\":0},{\"id\":536,\"name\":\"上海市竞技体育训练管理中心\",\"parentid\":532,\"order\":99998500,\"hasChild\":0},{\"id\":537,\"name\":\"上海市科技体育运动管理中心\",\"parentid\":532,\"order\":99998000,\"hasChild\":0},{\"id\":538,\"name\":\"上海市马术运动管理中心\",\"parentid\":532,\"order\":99997500,\"hasChild\":0},{\"id\":539,\"name\":\"上海市青少年训练管理中心\",\"parentid\":532,\"order\":99997000,\"hasChild\":0},{\"id\":540,\"name\":\"上海市社会体育管理中心\",\"parentid\":532,\"order\":99996500,\"hasChild\":0},{\"id\":541,\"name\":\"上海市体育彩票管理中心\",\"parentid\":532,\"order\":99996000,\"hasChild\":0},{\"id\":542,\"name\":\"上海市体育场馆设施管理中心\",\"parentid\":532,\"order\":99995500,\"hasChild\":0},{\"id\":543,\"name\":\"上海市体育发展服务中心\",\"parentid\":532,\"order\":99995000,\"hasChild\":0},{\"id\":544,\"name\":\"上海市体育宣传教育中心\",\"parentid\":532,\"order\":99994500,\"hasChild\":0},{\"id\":545,\"name\":\"上海市体育训练基地管理中心\",\"parentid\":532,\"order\":99994000,\"hasChild\":0},{\"id\":546,\"name\":\"上海市体育运动学校\",\"parentid\":532,\"order\":99993500,\"hasChild\":0},{\"id\":547,\"name\":\"上海体育科学研究所(上海市反兴奋剂中心)\",\"parentid\":532,\"order\":99993000,\"hasChild\":0},{\"id\":548,\"name\":\"上海武术院(上海市健身气功管理中心)\",\"parentid\":532,\"order\":99992500,\"hasChild\":0},{\"id\":549,\"name\":\"上海市体育发展基金会\",\"parentid\":532,\"order\":99992000,\"hasChild\":0},{\"id\":550,\"name\":\"办机关\",\"parentid\":166,\"order\":100000000,\"hasChild\":1},{\"id\":551,\"name\":\"办领导\",\"parentid\":550,\"order\":100000000,\"hasChild\":0},{\"id\":552,\"name\":\"秘书处\",\"parentid\":550,\"order\":99999500,\"hasChild\":0},{\"id\":553,\"name\":\"政策法规处(审计监督室)\",\"parentid\":550,\"order\":99999000,\"hasChild\":0},{\"id\":554,\"name\":\"指挥通信处\",\"parentid\":550,\"order\":99998500,\"hasChild\":0},{\"id\":555,\"name\":\"工程处\",\"parentid\":550,\"order\":99998000,\"hasChild\":0},{\"id\":556,\"name\":\"科技宣教处\",\"parentid\":550,\"order\":99997500,\"hasChild\":0},{\"id\":557,\"name\":\"计划财务处\",\"parentid\":550,\"order\":99997000,\"hasChild\":0},{\"id\":558,\"name\":\"组织人事处\",\"parentid\":550,\"order\":99996500,\"hasChild\":0},{\"id\":559,\"name\":\"直属单位\",\"parentid\":166,\"order\":99999500,\"hasChild\":1},{\"id\":560,\"name\":\"上海市民防监督管理事务中心\",\"parentid\":559,\"order\":100000000,\"hasChild\":0},{\"id\":561,\"name\":\"上海市民防科学研究所\",\"parentid\":559,\"order\":99999500,\"hasChild\":0},{\"id\":562,\"name\":\"上海市民防指挥信息保障中心\",\"parentid\":559,\"order\":99999000,\"hasChild\":0},{\"id\":563,\"name\":\"上海市民防特种救援中心\",\"parentid\":559,\"order\":99998500,\"hasChild\":0},{\"id\":564,\"name\":\"上海市民防教育培训中心\",\"parentid\":559,\"order\":99998000,\"hasChild\":0},{\"id\":565,\"name\":\"局机关\",\"parentid\":89,\"order\":100000000,\"hasChild\":1},{\"id\":566,\"name\":\"局领导\",\"parentid\":565,\"order\":100000000,\"hasChild\":0},{\"id\":567,\"name\":\"办公室(宣传教育处、信访办公室)\",\"parentid\":565,\"order\":99999500,\"hasChild\":0},{\"id\":568,\"name\":\"生态环境保护督察办公室 \",\"parentid\":565,\"order\":99999000,\"hasChild\":0},{\"id\":569,\"name\":\"综合规划处(区域协作处)\",\"parentid\":565,\"order\":99998500,\"hasChild\":0},{\"id\":570,\"name\":\"法规与标准处\",\"parentid\":565,\"order\":99998000,\"hasChild\":0},{\"id\":571,\"name\":\"干部人事处\",\"parentid\":565,\"order\":99997500,\"hasChild\":0},{\"id\":572,\"name\":\"科技与国际合作处\",\"parentid\":565,\"order\":99997000,\"hasChild\":0},{\"id\":573,\"name\":\"自然生态保护处 \",\"parentid\":565,\"order\":99996500,\"hasChild\":0},{\"id\":574,\"name\":\"水生态环境处\",\"parentid\":565,\"order\":99996000,\"hasChild\":0},{\"id\":575,\"name\":\"海洋生态环境处\",\"parentid\":565,\"order\":99995500,\"hasChild\":0},{\"id\":576,\"name\":\"大气生态环境处\",\"parentid\":565,\"order\":99995000,\"hasChild\":0},{\"id\":577,\"name\":\"应对气候变化处\",\"parentid\":565,\"order\":99994500,\"hasChild\":0},{\"id\":578,\"name\":\"土壤生态环境处(固体废物与化学品处)\",\"parentid\":565,\"order\":99994000,\"hasChild\":0},{\"id\":579,\"name\":\"辐射安全管理处\",\"parentid\":565,\"order\":99993500,\"hasChild\":0},{\"id\":580,\"name\":\"环境影响评价与排放管理处\",\"parentid\":565,\"order\":99993000,\"hasChild\":0},{\"id\":581,\"name\":\"生态环境监测处\",\"parentid\":565,\"order\":99992500,\"hasChild\":0},{\"id\":582,\"name\":\"生态环境执法与应急处\",\"parentid\":565,\"order\":99992000,\"hasChild\":0},{\"id\":583,\"name\":\"局属单位\",\"parentid\":89,\"order\":99999500,\"hasChild\":1},{\"id\":584,\"name\":\"上海市环境科学研究院\",\"parentid\":583,\"order\":100000000,\"hasChild\":0},{\"id\":585,\"name\":\"上海市环境监测中心\",\"parentid\":583,\"order\":99999500,\"hasChild\":0},{\"id\":586,\"name\":\"上海市生态环境局执法总队\",\"parentid\":583,\"order\":99999000,\"hasChild\":0},{\"id\":587,\"name\":\"上海市辐射环境安全技术中心\",\"parentid\":583,\"order\":99998500,\"hasChild\":0},{\"id\":588,\"name\":\"上海市固体废物与化学品管理技术中心\",\"parentid\":583,\"order\":99998000,\"hasChild\":0},{\"id\":589,\"name\":\"上海市环境保护宣传教育中心\",\"parentid\":583,\"order\":99997500,\"hasChild\":0},{\"id\":590,\"name\":\"测试部门\",\"parentid\":358,\"order\":99997500,\"hasChild\":1},{\"id\":591,\"name\":\"测试子部门\",\"parentid\":590,\"order\":99999500,\"hasChild\":0},{\"id\":592,\"name\":\"测试子部门1\",\"parentid\":590,\"order\":100000000,\"hasChild\":0},{\"id\":593,\"name\":\"测试子部门2\",\"parentid\":590,\"order\":99999000,\"hasChild\":0},{\"id\":599,\"name\":\"推送简单\",\"parentid\":358,\"order\":99997000,\"hasChild\":1},{\"id\":602,\"name\":\"推送主节点变更测试\",\"parentid\":599,\"order\":99999500,\"hasChild\":0},{\"id\":603,\"name\":\"推送子部门\",\"parentid\":675,\"order\":100000000,\"hasChild\":1},{\"id\":606,\"name\":\"导出\",\"parentid\":358,\"order\":99995500,\"hasChild\":0},{\"id\":607,\"name\":\"ces\",\"parentid\":358,\"order\":99995000,\"hasChild\":0},{\"id\":610,\"name\":\"测试10-12\",\"parentid\":380,\"order\":100000000,\"hasChild\":0},{\"id\":611,\"name\":\"上海市大数据股份有限公司\",\"parentid\":351,\"order\":100000000,\"hasChild\":1},{\"id\":612,\"name\":\"人力资源管理部门\",\"parentid\":611,\"order\":99998500,\"hasChild\":0},{\"id\":613,\"name\":\"其他一些股份制有限公司\",\"parentid\":358,\"order\":99999000,\"hasChild\":1},{\"id\":614,\"name\":\"技术研发部门\",\"parentid\":611,\"order\":99998000,\"hasChild\":1},{\"id\":615,\"name\":\"行政执行部门\",\"parentid\":611,\"order\":99999500,\"hasChild\":0},{\"id\":616,\"name\":\"总裁办公室\",\"parentid\":611,\"order\":100000000,\"hasChild\":0},{\"id\":618,\"name\":\"行业集成组\",\"parentid\":614,\"order\":99999000,\"hasChild\":0},{\"id\":619,\"name\":\"云资源管理组\",\"parentid\":614,\"order\":100000000,\"hasChild\":0},{\"id\":620,\"name\":\"网络安全与运营维护组\",\"parentid\":614,\"order\":99998000,\"hasChild\":1},{\"id\":621,\"name\":\"大数据组\",\"parentid\":614,\"order\":99997500,\"hasChild\":0},{\"id\":622,\"name\":\"局属单位\",\"parentid\":162,\"order\":99999500,\"hasChild\":1},{\"id\":623,\"name\":\"离职人员\",\"parentid\":613,\"order\":100000000,\"hasChild\":0},{\"id\":624,\"name\":\"上海市市级机关建设管理事务中心\",\"parentid\":622,\"order\":100000000,\"hasChild\":0},{\"id\":625,\"name\":\"上海市市级机关国有资产事务中心(上海市机关事务行政服务中心)\",\"parentid\":622,\"order\":99999500,\"hasChild\":0},{\"id\":626,\"name\":\"上海市机关事务管理局人防工程管理中心(上海市机关事务管理局老干部活动室)\",\"parentid\":622,\"order\":99999000,\"hasChild\":0},{\"id\":627,\"name\":\"上海市市级机关第二幼儿园\",\"parentid\":622,\"order\":99998500,\"hasChild\":0},{\"id\":628,\"name\":\"上海市政府采购中心\",\"parentid\":622,\"order\":99998000,\"hasChild\":0},{\"id\":629,\"name\":\"财务会计部门\",\"parentid\":611,\"order\":99999000,\"hasChild\":0},{\"id\":647,\"name\":\"推送23\",\"parentid\":408,\"order\":99999500,\"hasChild\":0},{\"id\":648,\"name\":\"项目管理部门\",\"parentid\":614,\"order\":99998500,\"hasChild\":0},{\"id\":649,\"name\":\"SHDATA办公平台测试部门\",\"parentid\":358,\"order\":100000000,\"hasChild\":0},{\"id\":651,\"name\":\"0313测试部门全程\",\"parentid\":653,\"order\":100000000,\"hasChild\":1},{\"id\":653,\"name\":\"0313测试子部门全称\",\"parentid\":651,\"order\":100000000,\"hasChild\":1},{\"id\":665,\"name\":\"真的有很多人\",\"parentid\":668,\"order\":100000000,\"hasChild\":1},{\"id\":666,\"name\":\"泛微网络\",\"parentid\":351,\"order\":99996500,\"hasChild\":0},{\"id\":667,\"name\":\"测试组\",\"parentid\":614,\"order\":99999500,\"hasChild\":1},{\"id\":668,\"name\":\"可能有一个人\",\"parentid\":665,\"order\":100000000,\"hasChild\":1},{\"id\":670,\"name\":\"测试推全子部门\",\"parentid\":674,\"order\":100000000,\"hasChild\":1},{\"id\":674,\"name\":\"22\",\"parentid\":670,\"order\":100000000,\"hasChild\":1},{\"id\":675,\"name\":\"推送子子部门\",\"parentid\":603,\"order\":100000000,\"hasChild\":1},{\"id\":676,\"name\":\"区政府办公厅\",\"parentid\":250,\"order\":100000000,\"hasChild\":1},{\"id\":677,\"name\":\"区大数据中心\",\"parentid\":676,\"order\":100000000,\"hasChild\":0},{\"id\":678,\"name\":\"测试组\",\"parentid\":247,\"order\":99996500,\"hasChild\":0},{\"id\":679,\"name\":\"测试部门3\",\"parentid\":620,\"order\":100000001,\"hasChild\":0},{\"id\":680,\"name\":\"测试部门2\",\"parentid\":620,\"order\":99999500,\"hasChild\":0},{\"id\":681,\"name\":\"测试部门2_1\",\"parentid\":620,\"order\":100000001,\"hasChild\":0},{\"id\":682,\"name\":\"测试部门4\",\"parentid\":620,\"order\":100000001,\"hasChild\":0},{\"id\":683,\"name\":\"测试部门5\",\"parentid\":620,\"order\":100000000,\"hasChild\":0},{\"id\":688,\"name\":\"k测试5\",\"parentid\":369,\"order\":100000000,\"hasChild\":0},{\"id\":689,\"name\":\"k测试6\",\"parentid\":369,\"order\":99999500,\"hasChild\":0},{\"id\":690,\"name\":\"d测试1\",\"parentid\":667,\"order\":99999500,\"hasChild\":0},{\"id\":691,\"name\":\"d测试2\",\"parentid\":667,\"order\":99999000,\"hasChild\":0},{\"id\":692,\"name\":\"d测试3\",\"parentid\":667,\"order\":99998500,\"hasChild\":1},{\"id\":693,\"name\":\"d测试4\",\"parentid\":692,\"order\":100000000,\"hasChild\":1},{\"id\":694,\"name\":\"d测试5\",\"parentid\":693,\"order\":100000000,\"hasChild\":1},{\"id\":695,\"name\":\"d测试6\",\"parentid\":694,\"order\":100000000,\"hasChild\":1},{\"id\":696,\"name\":\"d测试7\",\"parentid\":695,\"order\":100000000,\"hasChild\":1},{\"id\":697,\"name\":\"d测试8\",\"parentid\":696,\"order\":100000000,\"hasChild\":1},{\"id\":698,\"name\":\"d测试9\",\"parentid\":697,\"order\":100000000,\"hasChild\":1},{\"id\":699,\"name\":\"d测试10\",\"parentid\":698,\"order\":100000000,\"hasChild\":0},{\"id\":700,\"name\":\"技术支持厂商\",\"parentid\":1,\"order\":99996000,\"hasChild\":1},{\"id\":701,\"name\":\"公务之家测试单位\",\"parentid\":700,\"order\":100000000,\"hasChild\":1},{\"id\":705,\"name\":\"局领导\",\"parentid\":701,\"order\":100000000,\"hasChild\":0},{\"id\":706,\"name\":\"财务处\",\"parentid\":701,\"order\":99999500,\"hasChild\":1},{\"id\":707,\"name\":\"开发部\",\"parentid\":701,\"order\":99999000,\"hasChild\":0},{\"id\":708,\"name\":\"测试部\",\"parentid\":701,\"order\":99998500,\"hasChild\":1},{\"id\":709,\"name\":\"财务一处\",\"parentid\":706,\"order\":100000000,\"hasChild\":1},{\"id\":710,\"name\":\"会计\",\"parentid\":709,\"order\":100000000,\"hasChild\":0},{\"id\":711,\"name\":\"一部\",\"parentid\":708,\"order\":100000000,\"hasChild\":0},{\"id\":712,\"name\":\"二部\",\"parentid\":708,\"order\":99999500,\"hasChild\":0}]";
+// List list = JSONObject.parseObject(json, List.class);
+ List departmentInfo = orgHrmAsyncApiService.getDepartmentInfo();
+ System.out.println("departmentInfoList => " + departmentInfo);
+ // 过滤出父节点并根据id进行升序排序
+ List rootDepList = departmentInfo
+ .stream()
+ .filter(item -> 1 == item.getHasChild() && -1 != item.getParentid())
+ .sorted(Comparator.comparing(OtherSysDepartment::getId))
+ .collect(Collectors.toList());
+ System.out.println("rootDepList => "+ JSONObject.toJSONString(rootDepList));
+ for (OtherSysDepartment sysDepartment : rootDepList) {
+ setChildList(sysDepartment, departmentInfo);
+ }
+ // 过滤出父节点并根据id进行升序排序
+
+ System.out.println("departmentInfo => " + JSONObject.toJSONString(departmentInfo, SerializerFeature.DisableCircularReferenceDetect));
+ }
+
+ public void setChildList(OtherSysDepartment department, List departmentList){
+ if(department.getHasChild() == 0){
+ return;
+ }
+ List childList = departmentList
+ .stream()
+ .filter(item -> department.getId() == item.getParentid())
+ .collect(Collectors.toList());
+ System.out.println("childList => " + JSONObject.toJSONString(childList));
+ department.setChildList(childList);
+ for (OtherSysDepartment sysDepartment : childList) {
+ setChildList(sysDepartment, departmentList);
+ }
+ }
+ private final SendTodoTaskMapper mapper = Util.getMapper(SendTodoTaskMapper.class);
+ @Test
+ public void testD(){
+ ArrayList details = new ArrayList<>();
+ for (int i = 0; i < 10; i++) {
+ CusTodoTaskToOADetail detail = new CusTodoTaskToOADetail();
+ detail.setTaskNum("14672332" + (System.currentTimeMillis() / 1000));
+ detail.setRequestUrl("11111");
+ detail.setTaskName("taskName" + i);
+ detail.setTaskType(0);
+ detail.setStatus(0);
+ detail.setSuccess(0);
+ detail.setResponse("{\n" +
+ " \"code\": 200,\n" +
+ " \"msg\": \"操作成功\", //返回文字描述\n" +
+ " \"data\": null,\n" +
+ " \"total\": null,\n" +
+ " \"totalPage\": null,\n" +
+ " \"takeTime\": null\n" +
+ "}");
+ detail.setRequestJson(JSONObject.toJSONString(detail));
+ String sourceTaskId = detail.getTaskNum().substring(0, detail.getTaskNum().length() - 10);
+ detail.setSourceTaskId(sourceTaskId);
+ details.add(detail);
+ }
+// CusInfoToOAUtil.executeBatchByEntity(111, details,"");
+ ArrayList list = new ArrayList<>();
+ ArrayList successTaskIds = new ArrayList<>();
+ List lists = mapper.queryUnSendTodoTaskList("14672332");
+ for (String num : lists) {
+ int success = 0;
+ CusDoneTaskOA taskOA = new CusDoneTaskOA();
+ taskOA.setTaskNum(num);
+ taskOA.setTaskType(1);
+ String sourceTaskId =num.substring(0, num.length() - 10);
+ taskOA.setSourceTaskId(sourceTaskId);
+ taskOA.setResponse("{\n" +
+ " \"code\": 200,\n" +
+ " \"msg\": \"操作成功\", //返回文字描述\n" +
+ " \"data\": null,\n" +
+ " \"total\": null,\n" +
+ " \"totalPage\": null,\n" +
+ " \"takeTime\": null\n" +
+ "}");
+ taskOA.setRequestUrl("22222222");
+ taskOA.setRequestJson(JSONObject.toJSONString(num));
+ taskOA.setSuccess(success);
+ list.add(taskOA);
+ successTaskIds.add(num);
+ }
+ CusInfoToOAUtil.executeBatchByEntity(111, list,"");
+ mapper.updateStatusByTaskNum(successTaskIds);
+ }
+
+ public void sqlTest(int modelId, List> list, String whereSql){
+ List> params = new ArrayList<>();
+ List> whereParams = new ArrayList<>();
+ StringBuilder whereSqlSb = new StringBuilder();
+ LinkedHashSet whereFields = new LinkedHashSet<>();
+ for (Object o : list) {
+ if(Objects.isNull(o)){
+ continue;
+ }
+ Class> clazz = o.getClass();
+ Field[] fields = clazz.getDeclaredFields();
+ LinkedHashMap linkedHashMap = new LinkedHashMap<>();
+ ArrayList whereParam = new ArrayList<>();
+ List fieldArr = Arrays.stream(fields).collect(Collectors.toList());
+ Class> superclass = clazz.getSuperclass();
+ // 找出父类所有的字段
+ while (superclass != null){
+ fieldArr.addAll(Arrays.stream(superclass.getDeclaredFields()).collect(Collectors.toList()));
+ superclass = superclass.getSuperclass();
+ }
+ for (Field field : fieldArr) {
+ field.setAccessible(true);
+ String fieldName = field.getName();
+ Object fieldValue;
+ try {
+ fieldValue = field.get(o);
+ } catch (IllegalAccessException e) {
+ throw new CustomerException(Util.logStr("field get error! the error is :[{}]," +
+ "current field is: [{}], current obj is: [{}]", e.getMessage(), fieldName, JSONObject.toJSONString(o)));
+ }
+ if(Objects.isNull(fieldValue)){
+ continue;
+ }
+ // 数据库字段映射 如果注解中没有值那么写入数据库就是实体类字段名
+ SqlFieldMapping sqlFieldMapping = field.getAnnotation(SqlFieldMapping.class);
+ if(null == sqlFieldMapping){
+ continue;
+ }
+ String sqlFieldMappingValue = sqlFieldMapping.value();
+ if(StringUtils.isNotBlank(sqlFieldMappingValue)){
+ fieldName = sqlFieldMappingValue;
+ }
+ linkedHashMap.put(fieldName, fieldValue);
+
+ // 更新条件字段注解
+ SqlUpdateWhereField sqlUpdateWhereField = field.getAnnotation(SqlUpdateWhereField.class);
+ if(null == sqlUpdateWhereField || !sqlUpdateWhereField.value()){
+ continue;
+ }
+ if(StringUtils.isBlank(whereSql)){
+ whereFields.add(fieldName + " = ? ");
+ }
+ whereParam.add(fieldValue.toString());
+ }
+ params.add(linkedHashMap);
+ whereParams.add(whereParam);
+ }
+ if(!whereFields.isEmpty()){
+ whereSqlSb = new StringBuilder("select id from #{tableName} where ");
+ for (String field : whereFields) {
+ whereSqlSb.append(field).append(" and ");
+ }
+ whereSql = whereSqlSb.substring(0, whereSqlSb.length() - 4);
+ }
+ System.out.println("params => " +JSONObject.toJSONString(params));
+ System.out.println("whereParams => " +JSONObject.toJSONString(whereParams));
+ System.out.println("whereSql => " +JSONObject.toJSONString(whereSql));
+
+ }
+
+
+ SendTodoTaskUtil sendTodoTaskUtil = new SendTodoTaskUtil();
+ @Test
+ public void testToken(){
+ String hrmConvertRuleSql = ShBigDataUtil.getPropertiesValByKey("hrmSenderConvertRuleSql");
+ System.out.println("hrm =>" + hrmConvertRuleSql);
+ RequestStatusObj obj = new RequestStatusObj();
+ obj.setRequestid(121323);
+ obj.setNodeid(12);
+ System.out.println("convert => " + sendTodoTaskUtil.getConvertHrm(0, obj, 22 + "," + 23));
+// String requestid = "8288283";
+// String detail = requestid + "" + (System.currentTimeMillis() / 1000);
+// System.out.println(detail.substring(0, detail.length() - 10));
+// for (int i = 0; i < 10; i++) {
+// int finalI = i;
+// new Thread(()->{
+// try {
+// if(finalI > 5){
+// Thread.sleep(1000 * 5 * finalI);
+// }
+// System.out.println("多线程校验token => " + ShBigDataUtil.getToken());
+// }catch (Exception e){
+//
+// }
+//
+// }).start();
+// }
+//
+// try {
+// Thread.sleep(1000 * 60 * 3);
+// String token1 = ShBigDataUtil.getToken();
+// System.out.println("模拟过期 => " + token1);
+// }catch (Exception e){
+//
+// }
+ }
+}
diff --git a/src/test/java/xuanran/wang/mq/CusMQType.java b/src/test/java/xuanran/wang/mq/CusMQType.java
new file mode 100644
index 0000000..37aebdb
--- /dev/null
+++ b/src/test/java/xuanran/wang/mq/CusMQType.java
@@ -0,0 +1,17 @@
+package xuanran.wang.mq;
+
+/**
+ *
+ *
+ * @author xuanran.wang
+ * @date 2023/4/3 15:13
+ */
+public enum CusMQType {
+ ROCKET_MQ("RocketMQ",0),
+ KAFKA("Kafka",1),
+ RABBIT_MQ("RabbitMQ",2),
+ ACTIVE_MQ("ActiveMQ",3);
+
+ CusMQType(String type, int code) {
+ }
+}
diff --git a/src/test/java/xuanran/wang/mq/consumer/DefaultConsumer.java b/src/test/java/xuanran/wang/mq/consumer/DefaultConsumer.java
new file mode 100644
index 0000000..2c4e646
--- /dev/null
+++ b/src/test/java/xuanran/wang/mq/consumer/DefaultConsumer.java
@@ -0,0 +1,21 @@
+package xuanran.wang.mq.consumer;
+
+import com.weaverboot.frame.ioc.anno.classAnno.WeaSysInitComponent;
+import xuanran.wang.mq.infaces.CusMQClient;
+import xuanran.wang.mq.infaces.callback.CusMQCallBack;
+import xuanran.wang.mq.mq.CusMQFactory;
+
+/**
+ *
+ *
+ * @author xuanran.wang
+ * @date 2023/4/3 15:04
+ */
+@WeaSysInitComponent("MQ-消费者")
+public class DefaultConsumer {
+
+ public static void registerConsumer(String configName, String type, CusMQCallBack callBack){
+ CusMQClient cusMQ = CusMQFactory.createCusMQ(configName, type);
+ cusMQ.consumer(callBack);
+ }
+}
diff --git a/src/test/java/xuanran/wang/mq/infaces/CusBaseMQ.java b/src/test/java/xuanran/wang/mq/infaces/CusBaseMQ.java
new file mode 100644
index 0000000..734b7f7
--- /dev/null
+++ b/src/test/java/xuanran/wang/mq/infaces/CusBaseMQ.java
@@ -0,0 +1,27 @@
+package xuanran.wang.mq.infaces;
+
+import aiyh.utils.Util;
+import org.apache.log4j.Logger;
+import xuanran.wang.mq.infaces.aop.CusMQAop;
+
+/**
+ * mq基础类
+ *
+ * @author xuanran.wang
+ * @date 2023/3/31 11:47
+ */
+public interface CusBaseMQ {
+ Logger log = Util.getLogger();
+ /**
+ * 初始化生产者
+ **/
+ void initProducer(String configName);
+ /**
+ * 初始化消费者
+ **/
+ void initConsumer(String configName);
+ /**
+ * 销毁
+ **/
+ void destroy();
+}
diff --git a/src/test/java/xuanran/wang/mq/infaces/CusConsumer.java b/src/test/java/xuanran/wang/mq/infaces/CusConsumer.java
new file mode 100644
index 0000000..fbdcc67
--- /dev/null
+++ b/src/test/java/xuanran/wang/mq/infaces/CusConsumer.java
@@ -0,0 +1,16 @@
+package xuanran.wang.mq.infaces;
+
+import xuanran.wang.mq.infaces.callback.CusMQCallBack;
+
+/**
+ * 消费者
+ *
+ * @author xuanran.wang
+ * @date 2023/3/31 11:56
+ */
+public interface CusConsumer extends CusBaseMQ{
+ /**
+ * 消费
+ **/
+ void consumer(CusMQCallBack callBack);
+}
diff --git a/src/test/java/xuanran/wang/mq/infaces/CusMQClient.java b/src/test/java/xuanran/wang/mq/infaces/CusMQClient.java
new file mode 100644
index 0000000..6c0d88f
--- /dev/null
+++ b/src/test/java/xuanran/wang/mq/infaces/CusMQClient.java
@@ -0,0 +1,11 @@
+package xuanran.wang.mq.infaces;
+
+/**
+ * 客户端
+ *
+ * @author xuanran.wang
+ * @date 2023/3/31 13:09
+ */
+public interface CusMQClient extends CusProducer, CusConsumer {
+}
+
diff --git a/src/test/java/xuanran/wang/mq/infaces/CusProducer.java b/src/test/java/xuanran/wang/mq/infaces/CusProducer.java
new file mode 100644
index 0000000..84cc44a
--- /dev/null
+++ b/src/test/java/xuanran/wang/mq/infaces/CusProducer.java
@@ -0,0 +1,16 @@
+package xuanran.wang.mq.infaces;
+
+import java.util.Map;
+
+/**
+ * 生产者方法
+ *
+ * @author xuanran.wang
+ * @date 2023/3/30 11:37
+ */
+public interface CusProducer extends CusBaseMQ{
+ /**
+ * 生产者
+ **/
+ void send(Object message);
+}
diff --git a/src/test/java/xuanran/wang/mq/infaces/aop/CusMQAop.java b/src/test/java/xuanran/wang/mq/infaces/aop/CusMQAop.java
new file mode 100644
index 0000000..a5184af
--- /dev/null
+++ b/src/test/java/xuanran/wang/mq/infaces/aop/CusMQAop.java
@@ -0,0 +1,18 @@
+package xuanran.wang.mq.infaces.aop;
+
+import aiyh.utils.tool.cn.hutool.core.collection.CollUtil;
+
+/**
+ * 切面
+ *
+ * @author xuanran.wang
+ * @date 2023/3/31 12:52
+ */
+public interface CusMQAop {
+ void sendBefore();
+ void sendAfter();
+ void consumerBefore();
+ void consumerAfter();
+ void destroyBefore();
+ void destroyAfter();
+}
diff --git a/src/test/java/xuanran/wang/mq/infaces/callback/CusMQCallBack.java b/src/test/java/xuanran/wang/mq/infaces/callback/CusMQCallBack.java
new file mode 100644
index 0000000..81a19a6
--- /dev/null
+++ b/src/test/java/xuanran/wang/mq/infaces/callback/CusMQCallBack.java
@@ -0,0 +1,35 @@
+package xuanran.wang.mq.infaces.callback;
+
+import org.apache.kafka.clients.consumer.ConsumerRecords;
+import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
+import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
+import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
+import org.apache.rocketmq.common.message.MessageExt;
+
+import java.util.List;
+
+
+/**
+ * 回调
+ *
+ * @author xuanran.wang
+ * @date 2023/3/31 13:13
+ */
+public interface CusMQCallBack {
+ /**
+ * kafka 回调
+ * @author xuanran.wang
+ * @dateTime 2023/4/3 14:55
+ * @param records 消息对象
+ **/
+ void kafkaCallBack(ConsumerRecords records);
+ /**
+ * rocket-MQ 回调
+ * @author xuanran.wang
+ * @dateTime 2023/4/3 14:55
+ * @param msgList 消息列表
+ * @param context 上下文
+ * @return 状态
+ **/
+ ConsumeConcurrentlyStatus rocketCallBack(List msgList, ConsumeConcurrentlyContext context);
+}
diff --git a/src/test/java/xuanran/wang/mq/mq/CusKafkaMQ.java b/src/test/java/xuanran/wang/mq/mq/CusKafkaMQ.java
new file mode 100644
index 0000000..b17dc4d
--- /dev/null
+++ b/src/test/java/xuanran/wang/mq/mq/CusKafkaMQ.java
@@ -0,0 +1,86 @@
+package xuanran.wang.mq.mq;
+
+import aiyh.utils.Util;
+import aiyh.utils.excention.CustomerException;
+import com.alibaba.fastjson.JSONObject;
+import lombok.NoArgsConstructor;
+import org.apache.kafka.clients.consumer.ConsumerRecords;
+import org.apache.kafka.clients.consumer.KafkaConsumer;
+import org.apache.kafka.clients.producer.KafkaProducer;
+import org.apache.kafka.clients.producer.ProducerRecord;
+import xuanran.wang.mq.infaces.*;
+import xuanran.wang.mq.infaces.aop.CusMQAop;
+import xuanran.wang.mq.infaces.callback.CusMQCallBack;
+import xuanran.wang.mq.util.CusMQUtil;
+
+import java.time.Duration;
+import java.time.temporal.ChronoUnit;
+import java.util.Map;
+
+/**
+ * kafka
+ *
+ * @author xuanran.wang
+ * @date 2023/3/30 11:44
+ */
+@NoArgsConstructor
+public class CusKafkaMQ implements CusMQClient {
+ private KafkaProducer producer = null;
+ private KafkaConsumer consumer = null;
+ private Map config = null;
+ private CusMQAop cusMQAop = new DefaultCusMQAop();
+ public CusKafkaMQ(CusMQAop cusMQAop){
+ this.cusMQAop = cusMQAop;
+ }
+
+ @Override
+ public void initProducer(String configName) {
+ config = CusMQUtil.getConfigMapByName(configName);
+ producer = new KafkaProducer<>(config);
+ }
+
+ @Override
+ public void initConsumer(String configName) {
+ config = CusMQUtil.getConfigMapByName(configName);
+ consumer = new KafkaConsumer<>(config);
+ }
+
+ @Override
+ public void send(Object message) {
+ String topic = Util.null2DefaultStr(config.get("topic"),"");
+ try {
+ producer.send(new ProducerRecord<>(topic, JSONObject.toJSONString(message))).get();
+ }catch (Exception e){
+ log.error(Util.logStr("kafka producer topic: {}, message: {}, error: {}", topic, JSONObject.toJSONString(message), e.getMessage()));
+ throw new CustomerException("kafka producer send message error!");
+ }finally {
+ this.destroy();
+ }
+ }
+
+ @Override
+ public void consumer(CusMQCallBack callBack) {
+ new Thread(() -> {
+ try {
+ while (true) {
+ /*轮询获取数据*/
+ ConsumerRecords records = consumer.poll(Duration.of(100, ChronoUnit.MILLIS));
+ callBack.kafkaCallBack(records);
+ }
+ } finally {
+ consumer.close();
+ }
+ }).start();
+ }
+
+ @Override
+ public void destroy() {
+ if(producer != null){
+ producer.close();
+ }
+ if(consumer != null){
+ consumer.close();
+ }
+ }
+
+}
diff --git a/src/test/java/xuanran/wang/mq/mq/CusMQFactory.java b/src/test/java/xuanran/wang/mq/mq/CusMQFactory.java
new file mode 100644
index 0000000..e2b9352
--- /dev/null
+++ b/src/test/java/xuanran/wang/mq/mq/CusMQFactory.java
@@ -0,0 +1,45 @@
+package xuanran.wang.mq.mq;
+
+import aiyh.utils.Util;
+import aiyh.utils.excention.CustomerException;
+import xuanran.wang.mq.infaces.CusMQClient;
+import xuanran.wang.mq.infaces.aop.CusMQAop;
+
+/**
+ * 工厂
+ *
+ * @author xuanran.wang
+ * @date 2023/3/30 11:38
+ */
+public class CusMQFactory {
+
+ public static final String ROCKET_MQ = "0";
+
+ public static final String KAFKA = "1";
+
+ public static final String RABBIT_MQ = "2";
+
+ public static final String ACTIVE_MQ = "3";
+
+ public static CusMQClient createCusMQ(String configName, String type) {
+ return createCusMQ(configName, type, null);
+ }
+
+ public static CusMQClient createCusMQ(String configName, String type, CusMQAop cusMQAop){
+ CusMQClient cusAbstractMQ;
+ switch (type){
+ case ROCKET_MQ: {
+ cusAbstractMQ = new CusRocketMQ();
+ break;
+ }
+ case KAFKA: {
+ cusAbstractMQ = new CusKafkaMQ();
+ break;
+ }
+ default: throw new CustomerException(Util.logStr("create CusMQClient error! type: {}, not support!", type));
+ }
+ cusAbstractMQ.initConsumer(configName);
+ cusAbstractMQ.initProducer(configName);
+ return cusAbstractMQ;
+ }
+}
diff --git a/src/test/java/xuanran/wang/mq/mq/CusRocketMQ.java b/src/test/java/xuanran/wang/mq/mq/CusRocketMQ.java
new file mode 100644
index 0000000..83f8497
--- /dev/null
+++ b/src/test/java/xuanran/wang/mq/mq/CusRocketMQ.java
@@ -0,0 +1,146 @@
+package xuanran.wang.mq.mq;
+
+import aiyh.utils.Util;
+import aiyh.utils.excention.CustomerException;
+import com.alibaba.fastjson.JSONObject;
+import lombok.NoArgsConstructor;
+import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
+import org.apache.rocketmq.client.exception.MQBrokerException;
+import org.apache.rocketmq.client.exception.MQClientException;
+import org.apache.rocketmq.client.producer.DefaultMQProducer;
+import org.apache.rocketmq.client.producer.SendResult;
+import org.apache.rocketmq.client.producer.SendStatus;
+import org.apache.rocketmq.common.consumer.ConsumeFromWhere;
+import org.apache.rocketmq.common.message.Message;
+import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
+import org.apache.rocketmq.remoting.common.RemotingHelper;
+import org.apache.rocketmq.remoting.exception.RemotingException;
+import weaver.xuanran.wang.shyl_mq.constant.RocketMQConstant;
+import xuanran.wang.mq.infaces.CusMQClient;
+import xuanran.wang.mq.infaces.aop.CusMQAop;
+import xuanran.wang.mq.infaces.callback.CusMQCallBack;
+import xuanran.wang.mq.util.CusMQUtil;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 自定义rocket-mq
+ *
+ * @author xuanran.wang
+ * @date 2023/3/31 13:02
+ */
+@NoArgsConstructor
+public class CusRocketMQ implements CusMQClient {
+ private DefaultMQProducer producer = null;
+
+ private DefaultMQPushConsumer consumer = null;
+
+ private Map config = null;
+ private CusMQAop cusMQAop = new DefaultCusMQAop();
+
+ public CusRocketMQ(CusMQAop cusMQAop){
+ this.cusMQAop = cusMQAop;
+ }
+
+ @Override
+ public void initProducer(String configName) {
+ Map configMap = CusMQUtil.getConfigMapByName(configName);
+ this.config = configMap;
+ producer = new DefaultMQProducer(Util.null2DefaultStr(configMap.get("producerGroup"),""));
+ // 发送消息最大超时时间 默认60000
+ int sendMsgTimeOut = Util.getIntValue(Util.null2String(configMap.get("sendMsgTimeOut")), RocketMQConstant.PRODUCER_SEND_MSG_TIME_OUT);
+ producer.setSendMsgTimeout(sendMsgTimeOut);
+ producer.setVipChannelEnabled(false);
+ producer.setNamesrvAddr(Util.null2String(configMap.get("serverAddr")));
+ try {
+ producer.start();
+ }catch (MQClientException e){
+ throw new CustomerException(Util.logStr("producer start error!:{}",e.getMessage()));
+ }
+ }
+
+ @Override
+ public void initConsumer(String configName) {
+ Map configMap = CusMQUtil.getConfigMapByName(configName);
+ this.config = configMap;
+ try {
+ int maxReconsumeTimes = Util.getIntValue(Util.null2String(configMap.get("maxReconsumeTimes")), RocketMQConstant.DEFAULT_MAX_RECONSUME_TIMES);
+ // 声明一个消费者consumer,需要传入一个组 weaver-consumer
+ consumer = new DefaultMQPushConsumer(Util.null2String(configMap.get("consumerGroup")));
+ // 设置集群的NameServer地址,多个地址之间以分号分隔 183.192.65.118:9876
+ consumer.setNamesrvAddr(Util.null2String(configMap.get("serverAddr")));
+ // 设置consumer的消费策略
+ consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET);
+ // 集群模式消费,广播消费不会重试
+ consumer.setMessageModel(MessageModel.CLUSTERING);
+ // 设置最大重试次数,默认是16次
+ consumer.setMaxReconsumeTimes(maxReconsumeTimes);
+ // 设置consumer所订阅的Topic和Tag,*代表全部的Tag AUTH_CONSOLE_USERINFO_TOPIC
+ consumer.subscribe(Util.null2String(configMap.get("topic")),"*");
+ // 是否开启vip
+ consumer.setVipChannelEnabled(false);
+ }catch (Exception e){
+ throw new CustomerException(Util.logStr("init rocket MQ consumer error: {}!",e.getMessage()));
+ }
+ }
+
+ @Override
+ public void destroy() {
+ if(producer != null){
+ producer.shutdown();
+ }
+ if(consumer != null){
+ consumer.shutdown();
+ }
+ }
+
+ @Override
+ public void send(Object message) {
+ cusMQAop.sendBefore();
+ // 队列名
+ String topic = Util.null2DefaultStr(config.get("topic"), "");
+ Message msg;
+ try {
+ msg = new Message(topic, JSONObject.toJSONString(message).getBytes(RemotingHelper.DEFAULT_CHARSET));
+ } catch (Exception e) {
+ throw new CustomerException(Util.logStr("init message error : {} !", e.getMessage()));
+ }
+ // 发送成功标识
+ boolean sendOk = false;
+ // 发送次数
+ int count = 0;
+ do {
+ SendResult result;
+ count++;
+ try {
+ result = producer.send(msg);
+ } catch (MQClientException | RemotingException | MQBrokerException | InterruptedException e) {
+ throw new CustomerException(Util.logStr("producer send message error!: {}", e.getMessage()));
+ }
+ SendStatus sendStatus = result.getSendStatus();
+ // 如果失败
+ if (!SendStatus.SEND_OK.equals(sendStatus)) {
+ String error = Util.logStr("producer send message call back status is not ok! the message is {}, the status is {}.", msg, sendStatus);
+ // 如果重试超过最大次数
+ if(count >= RocketMQConstant.SEND_MAX_COUNT){
+ throw new CustomerException(error + " and retry > max");
+ }
+ }else {
+ sendOk = true;
+ }
+ } while (!sendOk);
+ cusMQAop.sendAfter();
+ }
+
+
+ @Override
+ public void consumer(CusMQCallBack callBack) {
+ consumer.registerMessageListener(callBack::rocketCallBack);
+ try {
+ consumer.start();
+ }catch (Exception e){
+ throw new CustomerException("consumer start error : " + e.getMessage());
+ }
+ }
+}
diff --git a/src/test/java/xuanran/wang/mq/mq/DefaultCusMQAop.java b/src/test/java/xuanran/wang/mq/mq/DefaultCusMQAop.java
new file mode 100644
index 0000000..483264a
--- /dev/null
+++ b/src/test/java/xuanran/wang/mq/mq/DefaultCusMQAop.java
@@ -0,0 +1,41 @@
+package xuanran.wang.mq.mq;
+
+import xuanran.wang.mq.infaces.aop.CusMQAop;
+
+/**
+ * 默认的aop
+ *
+ * @author xuanran.wang
+ * @date 2023/3/31 12:56
+ */
+public class DefaultCusMQAop implements CusMQAop {
+ @Override
+ public void sendBefore() {
+
+ }
+
+ @Override
+ public void sendAfter() {
+
+ }
+
+ @Override
+ public void consumerBefore() {
+
+ }
+
+ @Override
+ public void consumerAfter() {
+
+ }
+
+ @Override
+ public void destroyBefore() {
+
+ }
+
+ @Override
+ public void destroyAfter() {
+
+ }
+}
diff --git a/src/test/java/xuanran/wang/mq/test/MQTest.java b/src/test/java/xuanran/wang/mq/test/MQTest.java
new file mode 100644
index 0000000..a9a99df
--- /dev/null
+++ b/src/test/java/xuanran/wang/mq/test/MQTest.java
@@ -0,0 +1,58 @@
+package xuanran.wang.mq.test;
+
+import basetest.BaseTest;
+import org.junit.Test;
+import weaver.general.Util;
+import xuanran.wang.mq.infaces.CusMQClient;
+import xuanran.wang.mq.infaces.aop.CusMQAop;
+import xuanran.wang.mq.mq.CusMQFactory;
+
+/**
+ *
+ *
+ * @author xuanran.wang
+ * @date 2023/3/31 12:34
+ */
+public class MQTest extends BaseTest {
+
+ @Test
+ public void testKafka(){
+ CusMQAop cusMQAop = new CusMQAop() {
+ @Override
+ public void sendBefore() {
+ System.out.println("发送前!");
+ }
+
+ @Override
+ public void sendAfter() {
+ System.out.println("发送后!");
+ }
+
+ @Override
+ public void consumerBefore() {
+ System.out.println("消费前!");
+ }
+
+ @Override
+ public void consumerAfter() {
+ System.out.println("消费后!");
+ }
+
+ @Override
+ public void destroyBefore() {
+ System.out.println("销毁前!");
+ }
+
+ @Override
+ public void destroyAfter() {
+ System.out.println("销毁前!");
+ }
+ };
+
+ CusMQClient cusMQ = CusMQFactory.createCusMQ("OACarTest", CusMQFactory.ROCKET_MQ);
+
+ cusMQ.send("11212121212");
+
+ }
+
+}
diff --git a/src/test/java/xuanran/wang/mq/util/CusMQUtil.java b/src/test/java/xuanran/wang/mq/util/CusMQUtil.java
new file mode 100644
index 0000000..29d318b
--- /dev/null
+++ b/src/test/java/xuanran/wang/mq/util/CusMQUtil.java
@@ -0,0 +1,53 @@
+package xuanran.wang.mq.util;
+
+import aiyh.utils.Util;
+import aiyh.utils.excention.CustomerException;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.log4j.Logger;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * mq工具类
+ *
+ * @author xuanran.wang
+ * @date 2023/3/31 11:52
+ */
+public class CusMQUtil {
+ private static final Logger log = Util.getLogger();
+ private static final String[] checkField = new String[]{"serverAddr", "topic"};
+ /**
+ * 配置文件本地存储对象
+ **/
+ public static Map> CONFIG_MAPS = new HashMap<>(16);
+
+ /**
+ * 通过配置文件名称获取配置map
+ * @author xuanran.wang
+ * @dateTime 2023/1/4 13:18
+ * @param configName 配置文件名称
+ * @return 配置文件map
+ **/
+ public synchronized static Map getConfigMapByName(String configName){
+ Map configMap = new HashMap<>();
+ if(!CONFIG_MAPS.containsKey(configName)){
+ configMap = Util.getProperties2Map(configName);
+ checkConfig(configMap);
+ CONFIG_MAPS.put(configName, configMap);
+ }else {
+ configMap = CONFIG_MAPS.get(configName);
+ }
+ return configMap;
+ }
+
+ public static void checkConfig(Map configMap){
+ for (String field : checkField) {
+ if(!configMap.containsKey(field) && StringUtils.isBlank(Util.null2DefaultStr(configMap.get(field),""))){
+ log.error("MQ config : " + JSONObject.toJSONString(configMap));
+ throw new CustomerException("MQ config map not contains " + field + " or " + field + " is empty!");
+ }
+ }
+ }
+}
diff --git a/src/test/java/xuanran/wang/shyl/dataasync/AsyncTest.java b/src/test/java/xuanran/wang/shyl/dataasync/AsyncTest.java
index 563e1dc..057a32b 100644
--- a/src/test/java/xuanran/wang/shyl/dataasync/AsyncTest.java
+++ b/src/test/java/xuanran/wang/shyl/dataasync/AsyncTest.java
@@ -174,25 +174,9 @@ public class AsyncTest extends BaseTest {
consumer.registerMessageListener(new MessageListenerConcurrently() {
@Override
public ConsumeConcurrentlyStatus consumeMessage(List list, ConsumeConcurrentlyContext consumeConcurrentlyContext) {
- MessageExt messageExt = list.get(0);
- String msgBody;
- MQMessage mqMessage;
- try {
- msgBody = new String(messageExt.getBody(), StandardCharsets.UTF_8);
- if (StringUtils.isBlank(msgBody)) {
- throw new CustomerException("MQ msgBody is empty!");
- }
- mqMessage = JSONObject.parseObject(msgBody, MQMessage.class);
- // 业务主体
- String content = Util.null2DefaultStr(mqMessage.getContent(), "");
- if (StringUtils.isBlank(content)) {
- throw new CustomerException(Util.logStr("the messageId : {}, content is empty!", Util.null2DefaultStr(mqMessage.getId(), "")));
- }
- log.info(Util.logStr("MQMessage : {} ", mqMessage));
- return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
- } catch (Exception e) {
- throw new CustomerException("consumeMessage => " + e.getMessage());
- }
+ System.out.println("msgs : " + JSONObject.toJSONString(list));
+ System.out.println("context : " + JSONObject.toJSONString(consumeConcurrentlyContext));
+ return ConsumeConcurrentlyStatus.RECONSUME_LATER;
}
});
consumer.start();
diff --git a/src/test/java/xuanran/wang/shyl/dataasync/MapperTest.java b/src/test/java/xuanran/wang/shyl/dataasync/MapperTest.java
index 98a6fa5..1c548b6 100644
--- a/src/test/java/xuanran/wang/shyl/dataasync/MapperTest.java
+++ b/src/test/java/xuanran/wang/shyl/dataasync/MapperTest.java
@@ -6,14 +6,16 @@ import com.api.meeting.util.FieldUtil;
import com.api.xuanran.wang.shyl.entity.meeting.MeetingCusFieldConfigMain;
import com.api.xuanran.wang.shyl.service.MeetingService;
import org.junit.Test;
+import weaver.file.ImageFileManager;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.systeminfo.SystemEnv;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.*;
/**
*
@@ -42,8 +44,32 @@ public class MapperTest extends BaseTest {
}
@Test
- public void testC(){
- String s = TimeUtil.dateAdd("2023-03-02", -3);
- log.info("time => " + s);
+ public void testC() throws IOException {
+ InputStream inputStream = new FileInputStream("/Users/wangxuanran/Downloads/chrome/1589665325711042c4c7c0e4ff4c6868.png");
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[1024];
+ int bytesRead;
+ while ((bytesRead = inputStream.read(buffer)) != -1) {
+ outputStream.write(buffer, 0, bytesRead);
+ }
+ byte[] bytes = outputStream.toByteArray();
+ String str = Base64.getEncoder().encodeToString(bytes);
+ System.out.println("str => " + str);
+
+ }
+
+ @Test
+ public void testD(){
+ String cusSql = "select a.docsubject fileName, concat('http://10.184.45.196/zjdownload?filed=', a.id)\n" +
+ " fullPath, RIGHT(c.imagefilename, INSTR(REVERSE(c.imagefilename),'.')) downloadType\n" +
+ "from docdetail a\n" +
+ "left join docimagefile b\n" +
+ "on a.id = b.docid\n" +
+ "left join docimagefile c\n" +
+ "on b.imagefileid = c.imagefileid\n" +
+ "where a.id in ${docIds}";
+ String docIds = "1,2,3";
+ cusSql = cusSql.replace("${docIds}", "( " + docIds + " )");
+ System.out.println("cus => " + cusSql);
}
}
From aeb04f41d40fb0b50672082f74b80a3accecbc05 Mon Sep 17 00:00:00 2001
From: "youHong.ai" <774495953@qq.com>
Date: Fri, 14 Apr 2023 10:16:48 +0800
Subject: [PATCH 7/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
javascript/youhong.ai/yihong/index.js | 75 ++++++
src/main/java/aiyh/utils/Util.java | 16 ++
.../RequestLogAuthorityController.java | 6 +-
.../mapper/RequestLogAuthorityMapper.java | 7 +
.../service/RequestLogAuthorityService.java | 24 +-
.../mapper/FunctionListMapper.java | 6 +-
.../pojo/FunctionListConfigItem.java | 4 +
.../impl/InterceptRequestLogImpl.java | 69 +++---
.../impl/RequestLogShowOrHiddenImpl.java | 59 +----
.../mapper/InterceptRequestLogMapper.java | 92 ++++++--
.../pojo/RequestLogPrivacyEntity.java | 40 ++++
.../util/PrivacyRequestLogUtil.java | 216 ++++++++++++++++++
.../config/service/SapConfigService.java | 9 +-
.../prop/prop2map/JituMultilingual.properties | 16 ++
.../java/youhong/ai/utiltest/GenericTest.java | 29 ++-
15 files changed, 544 insertions(+), 124 deletions(-)
create mode 100644 javascript/youhong.ai/yihong/index.js
create mode 100644 src/main/java/com/customization/youhong/deerge/requestlog/pojo/RequestLogPrivacyEntity.java
create mode 100644 src/main/java/com/customization/youhong/deerge/requestlog/util/PrivacyRequestLogUtil.java
create mode 100644 src/main/resources/WEB-INF/prop/prop2map/JituMultilingual.properties
diff --git a/javascript/youhong.ai/yihong/index.js b/javascript/youhong.ai/yihong/index.js
new file mode 100644
index 0000000..bceba14
--- /dev/null
+++ b/javascript/youhong.ai/yihong/index.js
@@ -0,0 +1,75 @@
+/* ******************* 按钮变灰 ******************* */
+$(() => {
+ const disabledRightButton = function (...indexIds) {
+ indexIds.forEach(index => {
+ let buttons = $(".ant-menu-item.text-elli[ecid='_Route@9uoqid_Com@knmejd_WeaRightMenu@spqptt_Item@eu37n0_li@zyccqn']")
+ let nodeArr = []
+ for (let i = 0; i < buttons.length; i++) {
+ let item = buttons[i]
+ nodeArr.push(findReact(item))
+ }
+ let disableArr = []
+ for (let i = 0; i < nodeArr.length; i++) {
+ let node = nodeArr[i]
+ if (index === i) {
+ node.props.disabled = true
+ node.setState({})
+ disableArr.push(node)
+ }
+
+ }
+ for (let i = 0; i < nodeArr.length; i++) {
+ let node = nodeArr[i]
+ let onMouseOver = node.onMouseOver
+ let onMouseLeave = node.onMouseLeave
+ node.onMouseOver = (...args) => {
+ disableArr.forEach(item => {
+ item.props.disabled = true
+ item.setState({})
+ })
+ onMouseOver(...args)
+ }
+ node.onMouseLeave = (...args) => {
+ disableArr.forEach(item => {
+ item.props.disabled = true
+ item.setState({})
+ })
+ onMouseLeave(...args)
+ }
+ }
+ })
+ }
+ const findReact = function (dom, traverseUp = 0) {
+ const key = Object.keys(dom).find(key => {
+ return key.startsWith("__reactFiber$") // react 17+
+ || key.startsWith("__reactInternalInstance$")
+ || key.startsWith("__reactEventHandlers$"); // react <17
+ });
+ const domFiber = dom[key];
+ if (domFiber == null) return null;
+ // react <16
+ if (domFiber._currentElement) {
+ let compFiber = domFiber._currentElement._owner;
+ for (let i = 0; i < traverseUp; i++) {
+ compFiber = compFiber._currentElement._owner;
+ }
+ return compFiber._instance;
+ }
+ // react 16+
+ const GetCompFiber = fiber => {
+ let parentFiber = fiber.return;
+ while (typeof parentFiber.type == "string") {
+ parentFiber = parentFiber.return;
+ }
+ return parentFiber;
+ };
+ let compFiber = GetCompFiber(domFiber);
+ for (let i = 0; i < traverseUp; i++) {
+ compFiber = GetCompFiber(compFiber);
+ }
+ return compFiber.stateNode;
+ }
+ window.disabledRightButton = disabledRightButton
+})
+
+/* ******************* 按钮变灰 ******************* */
\ No newline at end of file
diff --git a/src/main/java/aiyh/utils/Util.java b/src/main/java/aiyh/utils/Util.java
index cc5f158..0c7bf0d 100644
--- a/src/main/java/aiyh/utils/Util.java
+++ b/src/main/java/aiyh/utils/Util.java
@@ -3870,4 +3870,20 @@ public class Util extends weaver.general.Util {
}
return ip;
}
+
+ public static String parseLanguageString(String multiLanguageString, String languageId) {
+ // 将多语言字符串按 `~`~` 分隔成语言id和对应的文本
+ String[] languageTextPairs = multiLanguageString.split("`~`");
+ for (String pair : languageTextPairs) {
+ // 按 ` 分隔语言id和文本
+ String[] parts = pair.split(" ");
+ if (parts[0].equals(languageId)) {
+ // 如果语言id匹配,返回对应文本
+ return Util.joinEach(parts, " ").substring(languageId.length() + 1);
+ }
+ }
+ // 如果没有匹配的语言id,返回空字符串
+ return "";
+ }
+
}
diff --git a/src/main/java/com/api/youhong/ai/geerde/requestlog/controller/RequestLogAuthorityController.java b/src/main/java/com/api/youhong/ai/geerde/requestlog/controller/RequestLogAuthorityController.java
index b8cf5d8..b98f420 100644
--- a/src/main/java/com/api/youhong/ai/geerde/requestlog/controller/RequestLogAuthorityController.java
+++ b/src/main/java/com/api/youhong/ai/geerde/requestlog/controller/RequestLogAuthorityController.java
@@ -37,10 +37,12 @@ public class RequestLogAuthorityController {
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public String getPrivacyAuthority(@Context HttpServletRequest request, @Context HttpServletResponse response,
- @QueryParam("workflowId") String workflowId) {
+ @QueryParam("workflowId") String workflowId,
+ @QueryParam("requestId") String requestId,
+ @QueryParam("nodeId") String nodeId) {
try {
User user = HrmUserVarify.getUser(request, response);
- return ApiResult.success(service.getPrivacyAuthority(user, workflowId));
+ return ApiResult.success(service.getPrivacyAuthority(user, workflowId, requestId, nodeId));
} catch (Exception e) {
log.info("get privacy authority error!" + Util.getErrString(e));
return ApiResult.error(e.getMessage());
diff --git a/src/main/java/com/api/youhong/ai/geerde/requestlog/mapper/RequestLogAuthorityMapper.java b/src/main/java/com/api/youhong/ai/geerde/requestlog/mapper/RequestLogAuthorityMapper.java
index 0201d68..e76d9b3 100644
--- a/src/main/java/com/api/youhong/ai/geerde/requestlog/mapper/RequestLogAuthorityMapper.java
+++ b/src/main/java/com/api/youhong/ai/geerde/requestlog/mapper/RequestLogAuthorityMapper.java
@@ -30,4 +30,11 @@ public interface RequestLogAuthorityMapper {
"and (',' || authority_members || ',') like #{userLike} and enable_status = 1")
RequestLogAuthority selectLogPrivacyConfig(@ParamMapper("userLike") String userLike,
@ParamMapper("workflowId") String workflowId);
+
+
+ @Select("select id from uf_privacy_log_info where request_id = #{requestId} and " +
+ "node_id = #{nodeId} and user_id = #{userId} and enable_privacy = '1'")
+ Integer selectRequestLogId(@ParamMapper("requestId") String requestId,
+ @ParamMapper("nodeId") String nodeId,
+ @ParamMapper("userId") String userId);
}
diff --git a/src/main/java/com/api/youhong/ai/geerde/requestlog/service/RequestLogAuthorityService.java b/src/main/java/com/api/youhong/ai/geerde/requestlog/service/RequestLogAuthorityService.java
index 05f3519..fe6f835 100644
--- a/src/main/java/com/api/youhong/ai/geerde/requestlog/service/RequestLogAuthorityService.java
+++ b/src/main/java/com/api/youhong/ai/geerde/requestlog/service/RequestLogAuthorityService.java
@@ -1,10 +1,13 @@
package com.api.youhong.ai.geerde.requestlog.service;
import aiyh.utils.Util;
+import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
import com.api.youhong.ai.geerde.requestlog.mapper.RequestLogAuthorityMapper;
import com.api.youhong.ai.geerde.requestlog.pojo.RequestLogAuthority;
import weaver.hrm.User;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Objects;
/**
@@ -18,8 +21,25 @@ public class RequestLogAuthorityService {
private final RequestLogAuthorityMapper mapper = Util.getMapper(RequestLogAuthorityMapper.class);
- public boolean getPrivacyAuthority(User user, String workflowId) {
+ public Map getPrivacyAuthority(User user, String workflowId, String requestId, String nodeId) {
+ Map result = new HashMap<>();
+ result.put("show", true);
RequestLogAuthority requestLogAuthority = mapper.selectLogPrivacyConfig("%," + user.getUID() + ",%", workflowId);
- return !Objects.isNull(requestLogAuthority);
+ if (Objects.isNull(requestLogAuthority)) {
+ // 不存在签字意见组中
+ result.put("show", false);
+ return result;
+ }
+ if (StrUtil.isBlank(requestId) || "-1".equals(requestId)) {
+ result.put("enable", false);
+ return result;
+ }
+ Integer id = mapper.selectRequestLogId(requestId, nodeId, String.valueOf(user.getUID()));
+ if (id <= 0) {
+ result.put("enable", false);
+ } else {
+ result.put("enable", true);
+ }
+ return result;
}
}
diff --git a/src/main/java/com/api/youhong/ai/taibao/fcuntionlist/mapper/FunctionListMapper.java b/src/main/java/com/api/youhong/ai/taibao/fcuntionlist/mapper/FunctionListMapper.java
index 205abcd..6d7fdeb 100644
--- a/src/main/java/com/api/youhong/ai/taibao/fcuntionlist/mapper/FunctionListMapper.java
+++ b/src/main/java/com/api/youhong/ai/taibao/fcuntionlist/mapper/FunctionListMapper.java
@@ -27,8 +27,8 @@ public interface FunctionListMapper {
column = "button_icon",
id = @Id(value = String.class, methodId = 1))
)
- @Select("select * from uf_fun_list_config where CONCAT(',' , subcompany_id , ',') like #{userSubCompanyLike}")
- @SelectOracle("select * from uf_fun_list_config where (',' || subcompany_id || ',') like #{userSubCompanyLike}")
+ @Select("select * from uf_fun_list_config where CONCAT(',' , subcompany_id , ',') like #{userSubCompanyLike} order by sort_num")
+ @SelectOracle("select * from uf_fun_list_config where (',' || subcompany_id || ',') like #{userSubCompanyLike} order by sort_num")
List selectFunctionList(@ParamMapper("userSubCompanyLike") String userSubCompanyLike);
@@ -42,7 +42,7 @@ public interface FunctionListMapper {
column = "button_icon",
id = @Id(value = String.class, methodId = 1))
)
- @Select("select * from uf_fun_list_config")
+ @Select("select * from uf_fun_list_config order by sort_num")
List selectFunctionListAll();
/**
diff --git a/src/main/java/com/api/youhong/ai/taibao/fcuntionlist/pojo/FunctionListConfigItem.java b/src/main/java/com/api/youhong/ai/taibao/fcuntionlist/pojo/FunctionListConfigItem.java
index 0c72146..84d5006 100644
--- a/src/main/java/com/api/youhong/ai/taibao/fcuntionlist/pojo/FunctionListConfigItem.java
+++ b/src/main/java/com/api/youhong/ai/taibao/fcuntionlist/pojo/FunctionListConfigItem.java
@@ -35,4 +35,8 @@ public class FunctionListConfigItem {
/** 图标数量接口地址 */
@SqlOracleDbFieldAnn("NUMBER_URL")
private String numberUrl;
+
+ /** 排序字段 */
+ @SqlOracleDbFieldAnn("SORT_NUM")
+ private String sortNum;
}
diff --git a/src/main/java/com/customization/youhong/deerge/requestlog/impl/InterceptRequestLogImpl.java b/src/main/java/com/customization/youhong/deerge/requestlog/impl/InterceptRequestLogImpl.java
index 5670e1c..45f36a5 100644
--- a/src/main/java/com/customization/youhong/deerge/requestlog/impl/InterceptRequestLogImpl.java
+++ b/src/main/java/com/customization/youhong/deerge/requestlog/impl/InterceptRequestLogImpl.java
@@ -1,8 +1,7 @@
package com.customization.youhong.deerge.requestlog.impl;
import aiyh.utils.Util;
-import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
-import com.customization.youhong.deerge.requestlog.mapper.InterceptRequestLogMapper;
+import com.customization.youhong.deerge.requestlog.util.PrivacyRequestLogUtil;
import com.engine.core.cfg.annotation.ServiceDynamicProxy;
import com.engine.core.cfg.annotation.ServiceMethodDynamicProxy;
import com.engine.core.impl.aop.AbstractServiceProxy;
@@ -11,11 +10,13 @@ import com.engine.workflow.entity.requestForm.RequestOperationResultBean;
import com.engine.workflow.service.RequestFormService;
import com.engine.workflow.service.impl.RequestFormServiceImpl;
import org.apache.log4j.Logger;
+import org.jetbrains.annotations.Nullable;
import weaver.workflow.request.RequestManager;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
+import java.util.Objects;
/**
@@ -33,7 +34,7 @@ public class InterceptRequestLogImpl extends AbstractServiceProxy implements Req
public static final String SUCCESS = "SUCCESS";
private final Logger log = Util.getLogger();
- private final InterceptRequestLogMapper mapper = Util.getMapper(InterceptRequestLogMapper.class);
+ private final PrivacyRequestLogUtil privacyRequestLogUtil = new PrivacyRequestLogUtil();
@Override
public Map judgeCreateRight(HttpServletRequest request) {
@@ -118,37 +119,40 @@ public class InterceptRequestLogImpl extends AbstractServiceProxy implements Req
@Override
@ServiceMethodDynamicProxy(desc = "保存和提交流程时,判断是否开启隐私")
public Map requestSubmit(HttpServletRequest request) {
-
+ log.info("requestSubmit:=>");
+ return handlerRequestLogPrivacy(request);
+ }
+
+ @Override
+ @ServiceMethodDynamicProxy(desc = "转发流程、意见征询时,判断是否开启隐私")
+ public Map forwardSubmit(HttpServletRequest request) {
+ log.info("forwardSubmit:=>");
+ return handlerRequestLogPrivacy(request);
+ }
+
+ @Override
+ @ServiceMethodDynamicProxy(desc = "转发流程、意见征询时,判断是否开启隐私")
+ public Map remarkSubmit(HttpServletRequest request) {
+ log.info("remarkSubmit:=>");
+ return handlerRequestLogPrivacy(request);
+ }
+
+ @Nullable
+ private Map handlerRequestLogPrivacy(HttpServletRequest request) {
Map result = (Map) executeMethod(request);
try {
- log.info("调用提交流程和保存流程后的返回参数: " + result);
RequestOperationResultBean data = (RequestOperationResultBean) result.get("data");
+ if (Objects.isNull(data)) {
+ String success = Util.null2DefaultStr(result.get("success"), "false");
+ if (Boolean.parseBoolean(success)) {
+ privacyRequestLogUtil.privacyRequestLogHandle(request);
+ }
+ return result;
+ }
String type = Util.null2String(data.getType());
if (SUCCESS.equals(type)) {
// 保存成功,这里对隐私的签字意见做处理
- String userId = request.getParameter("userId");
- String enablePrivacy = request.getParameter("enablePrivacy");
- String nodeId = request.getParameter("nodeid");
- String requestId = request.getParameter("requestid");
- String remark = request.getParameter("remark");
- if (StrUtil.isBlank(enablePrivacy)) {
- return result;
- }
- if (!Boolean.parseBoolean(enablePrivacy)) {
- return result;
- }
- if ("-1".equals(requestId)) {
- Map submitParams = data.getSubmitParams();
- requestId = Util.null2String(submitParams.get("requestid"));
- }
- // 查询logId
- Integer logId = mapper.selectRequestLogId(requestId, remark, nodeId, userId);
- // 插入logId隐私信息
- int dataId = Util.getModeDataId("uf_privacy_log_info", 1);
- Boolean flag = mapper.insertPrivacyLog(dataId, logId, userId, nodeId, requestId);
- if (!flag) {
- Util.deleteModeId("uf_privacy_log_info", dataId);
- }
+ privacyRequestLogUtil.privacyRequestLogHandle(request);
}
} catch (Exception e) {
log.error("add privacy request log error! " + Util.getErrString(e));
@@ -156,20 +160,11 @@ public class InterceptRequestLogImpl extends AbstractServiceProxy implements Req
return result;
}
- @Override
- public Map forwardSubmit(HttpServletRequest request) {
- return null;
- }
-
@Override
public Map requestWithdraw(HttpServletRequest httpServletRequest) {
return null;
}
- @Override
- public Map remarkSubmit(HttpServletRequest request) {
- return null;
- }
@Override
public Map functionManage(HttpServletRequest request, HttpServletResponse response) {
diff --git a/src/main/java/com/customization/youhong/deerge/requestlog/impl/RequestLogShowOrHiddenImpl.java b/src/main/java/com/customization/youhong/deerge/requestlog/impl/RequestLogShowOrHiddenImpl.java
index 719d594..b0f6be4 100644
--- a/src/main/java/com/customization/youhong/deerge/requestlog/impl/RequestLogShowOrHiddenImpl.java
+++ b/src/main/java/com/customization/youhong/deerge/requestlog/impl/RequestLogShowOrHiddenImpl.java
@@ -1,23 +1,17 @@
package com.customization.youhong.deerge.requestlog.impl;
import aiyh.utils.Util;
-import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil;
-import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
-import com.customization.youhong.deerge.requestlog.mapper.InterceptRequestLogMapper;
+import com.alibaba.fastjson.JSON;
+import com.customization.youhong.deerge.requestlog.util.PrivacyRequestLogUtil;
import com.engine.core.cfg.annotation.ServiceDynamicProxy;
import com.engine.core.cfg.annotation.ServiceMethodDynamicProxy;
import com.engine.core.impl.aop.AbstractServiceProxy;
import com.engine.workflow.service.RequestLogService;
import com.engine.workflow.service.impl.RequestLogServiceImpl;
import org.apache.log4j.Logger;
-import weaver.hrm.HrmUserVarify;
-import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.List;
import java.util.Map;
-import java.util.stream.Collectors;
/**
* 是否显示隐私签字意见
@@ -29,9 +23,8 @@ import java.util.stream.Collectors;
@ServiceDynamicProxy(target = RequestLogServiceImpl.class, desc = "拦截签字意见信息,是否需要隐私控制")
public class RequestLogShowOrHiddenImpl extends AbstractServiceProxy implements RequestLogService {
- private final Logger log = Util.getLogger();
+ private final PrivacyRequestLogUtil privacyRequestLogUtil = new PrivacyRequestLogUtil();
- private final InterceptRequestLogMapper mapper = Util.getMapper(InterceptRequestLogMapper.class);
@Override
public Map getRequestLogBaseInfo(Map params) {
@@ -42,52 +35,14 @@ public class RequestLogShowOrHiddenImpl extends AbstractServiceProxy implements
@ServiceMethodDynamicProxy(desc = "控制是否显示隐私签字意见")
public Map getRequestLogList(HttpServletRequest request, Map params) {
Map result = (Map) executeMethod(request, params);
-
+ Logger log = Util.getLogger();
try {
- String isMonitor = request.getParameter("ismonitor");
- boolean isPrint = "1".equals(Util.null2String(request.getParameter("isprint")));
- // 如果是流程监控,全部返回
- if (!StrUtil.isBlank(isMonitor) && !isPrint) {
- return result;
- }
- User user = HrmUserVarify.getUser(request, null);
- List