diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index 712ab9d985c20018a0c97b93d2148ac1ffe588a5..d46a6c72eb9846ca04c9ed9f1e678945df1a2ba1 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -1,6 +1,11 @@
+
+
+
+
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 91581d5bb3d0e2e03e28b06da76ebff7c8132cca..74dc93664b8894d19b38d53bef85bd15927bd6cd 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,4 +1,3 @@
-
diff --git a/README.md b/README.md
index d3b162b8726d528c30d2cd165e9c2d23d5aaed7d..2e197d0e2ea2e252cd7e3dd02bdd248689bf06e6 100644
--- a/README.md
+++ b/README.md
@@ -192,7 +192,8 @@

## 应用实例

-
+## 职责链模式总结
+
# 特技
diff --git a/byv-adapter-pattern-08/pom.xml b/byv-adapter-pattern-08/pom.xml
index 0cac1fff490092d2158a0a34974243f4efd1eceb..fcd2b0f5dde49e06318268d44be3dd2d6b749700 100644
--- a/byv-adapter-pattern-08/pom.xml
+++ b/byv-adapter-pattern-08/pom.xml
@@ -13,5 +13,12 @@
8
UTF-8
+
+
+ com.progsbase.libraries
+ JSON
+ 0.4.0
+
+
\ No newline at end of file
diff --git a/byv-bridge-pattern-06/pom.xml b/byv-bridge-pattern-06/pom.xml
index ae04a5fd41f16b8f0480ac085d0b527cc66bf6b1..c4380fbfd2ac1eb48678389a504998eb639ac899 100644
--- a/byv-bridge-pattern-06/pom.xml
+++ b/byv-bridge-pattern-06/pom.xml
@@ -34,6 +34,11 @@
cglib
3.3.0
+
+ com.progsbase.libraries
+ JSON
+ 0.4.0
+
diff --git a/byv-chainduty-patttern-15/pom.xml b/byv-chainduty-patttern-15/pom.xml
index c40845200a26153e9e4c91200d54249b4b35ddb5..76d97f12c3e07cc8136060f6cc2202d09a1d2bf7 100644
--- a/byv-chainduty-patttern-15/pom.xml
+++ b/byv-chainduty-patttern-15/pom.xml
@@ -31,6 +31,28 @@
jaxen
1.1.6
+
+ log4j
+ log4j
+ 1.2.12
+
+
+ org.slf4j
+ slf4j-api
+ 1.7.36
+
+
+ com.alibaba
+ fastjson
+ 1.2.62
+
+
+ junit
+ junit
+ 4.12
+ compile
+
+
\ No newline at end of file
diff --git a/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example02/AuthController.java b/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example02/AuthController.java
new file mode 100644
index 0000000000000000000000000000000000000000..9c629429b5dace1e14cd219795242fc9b45b8922
--- /dev/null
+++ b/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example02/AuthController.java
@@ -0,0 +1,55 @@
+package com.boyunv.chainduty.example02;
+/*
+ *@description
+ * 审核申请接口
+ *@author boyunv
+ *@create 2023/8/22 22:20
+ *@version 1.0
+ */
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class AuthController {
+ /**
+ * 审核方法
+ * @param name 申请人姓名
+ * @param orderId 申请单ID
+ * @param authDate 申请时间
+ * @return
+ */
+ public AuthInfo doAuth(String name, String orderId, Date authDate) throws ParseException {
+ //三级审批
+ Date date=null;
+
+ //查询是否存在审核信息,虚拟三级审核人信息100013
+ date=AuthService.queryAuthInfo("100013",orderId);
+ if(date==null){
+ return new AuthInfo("0001","单号:"+orderId,"状态:等待三级负责人审批");
+ }
+ //二级审批
+ //查询是否存在审核信息,虚拟二级审核人信息100012 审核时间范围: 11.1~11.10
+ SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ if (authDate.after(sdf.parse("2022-10-31 00:00:00"))
+ &&authDate.before(sdf.parse("2022-11-11 00:00:00"))){
+ //条件成立,查询二级信息
+ date=AuthService.queryAuthInfo("100012","orderId");
+ if(date==null){
+ return new AuthInfo("0001","单号:"+orderId,"状态:等待二级负责人审批");
+ }
+ }
+ //1级审批
+ //查询是否存在审核信息,虚拟1级审核人信息100012 审核时间范围: 11.1~11.10
+ if (authDate.after(sdf.parse("2022-11-11 00:00:00"))
+ &&authDate.before(sdf.parse("2022-11-31 00:00:00"))){
+ //条件成立,查询二级信息
+ date=AuthService.queryAuthInfo("100011","orderId");
+ if(date==null){
+ return new AuthInfo("0001","单号:"+orderId,"状态:等待1级负责人审批");
+ }
+ }
+
+ return new AuthInfo("0001"+"单号:"+orderId,"申请人:"+name,"状态:审批完成");
+ }
+}
diff --git a/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example02/AuthInfo.java b/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example02/AuthInfo.java
index 5a7e7c78e7dc5b0a6500b7ee69506ab0d717ced2..f995f54959cc7fa85b11c0bb606f8414823bea35 100644
--- a/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example02/AuthInfo.java
+++ b/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example02/AuthInfo.java
@@ -18,7 +18,7 @@ public class AuthInfo {
//状态码
private String code;
//审核相关信息
- private String info;
+ private String info="";
public AuthInfo(String code,String... infos){
this.code=code;
diff --git a/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example02/Client.java b/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example02/Client.java
new file mode 100644
index 0000000000000000000000000000000000000000..f8968b89cd0b749996647457afaa7cec45889840
--- /dev/null
+++ b/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example02/Client.java
@@ -0,0 +1,40 @@
+package com.boyunv.chainduty.example02;
+/*
+ *@description
+ *
+ *@author boyunv
+ *@create 2023/8/22 22:37
+ *@version 1.0
+ */
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.logging.SimpleFormatter;
+
+public class Client {
+ public static void main(String[] args) throws ParseException {
+ AuthController controller = new AuthController();
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ Date parse = format.parse("2022-11-12 00:00:20");
+ //模拟审核请求和操作
+ AuthInfo info = controller.doAuth("研发小赵", "1000000022320", parse);
+ System.out.println("当前的审核状态:"+info.getInfo());
+
+ AuthService.auth("100013","1000000022320");
+ System.out.println("三级审批负责人审批完成,审批人:小赵 ");
+ System.out.println("=====================================");
+ AuthInfo info2 = controller.doAuth("研发小赵", "1000000022320", parse);
+ System.out.println("当前的审核状态:"+info2.getInfo());
+
+ AuthService.auth("100012","1000000022320");
+ System.out.println("2级审批负责人审批完成,审批人:赵 ");
+
+ System.out.println("=====================================");
+ AuthInfo info3 = controller.doAuth("研发小赵", "1000000022320", parse);
+ System.out.println("当前的审核状态:"+info2.getInfo());
+
+ AuthService.auth("100011","1000000022320");
+ System.out.println("1级审批负责人审批完成,审批人:赵硕 ");
+ }
+}
diff --git a/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example03/AuthLink.java b/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example03/AuthLink.java
new file mode 100644
index 0000000000000000000000000000000000000000..ba4572d461e39992976cebe2f5fabf2ff1c9be6e
--- /dev/null
+++ b/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example03/AuthLink.java
@@ -0,0 +1,45 @@
+package com.boyunv.chainduty.example03;
+/*
+ *@description
+ * 抽象审核链类
+ *@author boyunv
+ *@create 2023/8/26 13:25
+ *@version 1.0
+ */
+
+import com.boyunv.chainduty.example02.AuthInfo;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public abstract class AuthLink {
+
+ protected Logger logger=LoggerFactory .getLogger(AuthLink.class);
+
+ protected SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+ protected String levelUserId; //审核人ID
+
+ protected String levelUserName;//审核人姓名
+
+ @Getter
+ protected AuthLink next;//表示持有下一个处理对象的的引用
+
+ //向责任链中添加处理器
+ public AuthLink appendNext(AuthLink next){
+ this.next=next;
+ return this;
+ }
+
+ public AuthLink(String levelUserId, String levelUserName) {
+ this.levelUserId = levelUserId;
+ this.levelUserName = levelUserName;
+ }
+
+ //抽象的审核方法
+ public abstract AuthInfo doAuth(String uId, String orderId, Date authDate);
+}
diff --git a/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example03/Client.java b/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example03/Client.java
new file mode 100644
index 0000000000000000000000000000000000000000..f80c843b2e41906146e44ba05978a89e0db90023
--- /dev/null
+++ b/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example03/Client.java
@@ -0,0 +1,39 @@
+package com.boyunv.chainduty.example03;
+/*
+ *@description
+ *
+ *@author boyunv
+ *@create 2023/8/26 14:38
+ *@version 1.0
+ */
+
+import com.alibaba.fastjson.JSON;
+import com.boyunv.chainduty.example02.AuthService;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class Client {
+ private Logger logger=LoggerFactory.getLogger(Client.class);
+
+ @Test
+ public void tst_auth() throws ParseException {
+ //定义责任链
+ AuthLink authLink = new Level3AuthLink("100013", "笑凡")
+ .appendNext(new Level2AuthLink("100012", "jdii")
+ .appendNext(new Level1AuthLink("100011", "ddd"))
+ );
+ SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ Date parse = s.parse("2023-8-26 14:47:35");
+ logger.info("测试结果:{}", JSON.toJSONString(authLink.doAuth("硕士","51655",parse)));
+
+ //模拟三级负责人审批
+ AuthService.auth("100013","10252125415");
+ logger.info("测试结果:{}","模拟三级负责人审批,几句话");
+ logger.info("测试结果:{}",JSON.toJSONString(authLink.doAuth("dddd","8615651",parse)));
+ }
+}
diff --git a/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example03/Level1AuthLink.java b/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example03/Level1AuthLink.java
new file mode 100644
index 0000000000000000000000000000000000000000..af1ddf52f8ae446148bc335e6f17c495754f91c9
--- /dev/null
+++ b/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example03/Level1AuthLink.java
@@ -0,0 +1,47 @@
+package com.boyunv.chainduty.example03;
+/*
+ *@description
+ *
+ *@author boyunv
+ *@create 2023/8/26 14:28
+ *@version 1.0
+ */
+
+import com.boyunv.chainduty.example02.AuthInfo;
+import com.boyunv.chainduty.example02.AuthService;
+import org.slf4j.Logger;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class Level1AuthLink extends AuthLink{
+
+
+ private Date beginDate=sdf.parse("2023-08-26 00:00:00");
+ private Date endDate=sdf.parse("2023-08-31 00:00:00");
+
+ public Level1AuthLink(String levelUserId, String levelUserName) throws ParseException {
+ super(levelUserId, levelUserName);
+ }
+
+
+ @Override
+ public AuthInfo doAuth(String uId, String orderId, Date authDate) {
+ Date date = AuthService.queryAuthInfo(levelUserId, orderId);
+ if(null==date){
+ return new AuthInfo("0001","单号:"+orderId,"状态:待一级审核人审批",levelUserName);
+ }
+ AuthLink next = super.getNext();
+ if(next==null){
+ return new AuthInfo("0001","单号:"+orderId,"状态:一级审核人审批完成","审批人:"+levelUserName);
+ }
+
+ if(authDate.before(beginDate)||authDate.after(endDate )){
+ return new AuthInfo("0001","单号:"+orderId,"状态:一级审核人审批完成","审批人:"+levelUserName);
+ }
+
+
+ return next.doAuth(uId,orderId,authDate);
+ }
+}
diff --git a/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example03/Level2AuthLink.java b/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example03/Level2AuthLink.java
new file mode 100644
index 0000000000000000000000000000000000000000..a49b28dd8e40cb717d2b074ec29dd0c75124acf2
--- /dev/null
+++ b/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example03/Level2AuthLink.java
@@ -0,0 +1,48 @@
+package com.boyunv.chainduty.example03;
+/*
+ *@description
+ *
+ *@author boyunv
+ *@create 2023/8/26 14:28
+ *@version 1.0
+ */
+
+import com.boyunv.chainduty.example02.AuthInfo;
+import com.boyunv.chainduty.example02.AuthService;
+import org.slf4j.Logger;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class Level2AuthLink extends AuthLink{
+
+
+
+ private Date beginDate=sdf.parse("2023-08-26 00:00:00");
+ private Date endDate=sdf.parse("2023-08-31 00:00:00");
+
+ public Level2AuthLink(String levelUserId, String levelUserName) throws ParseException {
+ super(levelUserId, levelUserName);
+ }
+
+
+ @Override
+ public AuthInfo doAuth(String uId, String orderId, Date authDate) {
+ Date date = AuthService.queryAuthInfo(levelUserId, orderId);
+ if(null==date){
+ return new AuthInfo("0001","单号:"+orderId,"状态:待2级审核人审批",levelUserName);
+ }
+ AuthLink next = super.getNext();
+ if(next==null){
+ return new AuthInfo("0001","单号:"+orderId,"状态:2级审核人审批完成","审批人:"+levelUserName);
+ }
+
+ if(authDate.before(beginDate)||authDate.after(endDate )){
+ return new AuthInfo("0001","单号:"+orderId,"状态:2级审核人审批完成","审批人:"+levelUserName);
+ }
+
+
+ return next.doAuth(uId,orderId,authDate);
+ }
+}
diff --git a/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example03/Level3AuthLink.java b/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example03/Level3AuthLink.java
new file mode 100644
index 0000000000000000000000000000000000000000..2aec0e7f2c8969ee049f609c422f2fb1b4cb9733
--- /dev/null
+++ b/byv-chainduty-patttern-15/src/main/java/com/boyunv/chainduty/example03/Level3AuthLink.java
@@ -0,0 +1,45 @@
+package com.boyunv.chainduty.example03;
+/*
+ *@description
+ *
+ *@author boyunv
+ *@create 2023/8/26 14:28
+ *@version 1.0
+ */
+
+import com.boyunv.chainduty.example02.AuthInfo;
+import com.boyunv.chainduty.example02.AuthService;
+import org.slf4j.Logger;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class Level3AuthLink extends AuthLink{
+
+
+
+ private Date beginDate=sdf.parse("2023-08-26 00:00:00");
+ private Date endDate=sdf.parse("2023-08-31 00:00:00");
+
+ public Level3AuthLink(String levelUserId, String levelUserName) throws ParseException {
+ super(levelUserId, levelUserName);
+ }
+
+
+ @Override
+ public AuthInfo doAuth(String uId, String orderId, Date authDate) {
+ Date date = AuthService.queryAuthInfo(levelUserId, orderId);
+ if(null==date){
+ return new AuthInfo("0001","单号:"+orderId,"状态:待3级审核人审批",levelUserName);
+ }
+ AuthLink next = super.getNext();
+ if(next==null){
+ return new AuthInfo("0001","单号:"+orderId,"状态:3级审核人审批完成","审批人:"+levelUserName);
+ }
+
+
+
+ return next.doAuth(uId,orderId,authDate);
+ }
+}
diff --git a/byv-composite-patttern-10/pom.xml b/byv-composite-patttern-10/pom.xml
index e56f80b0f1fbf696b59e097f17443e64443a2955..865b85106184de853d9545dce08998d33115224d 100644
--- a/byv-composite-patttern-10/pom.xml
+++ b/byv-composite-patttern-10/pom.xml
@@ -20,6 +20,11 @@
1.18.28
compile
+
+ com.progsbase.libraries
+ JSON
+ 0.4.0
+
\ No newline at end of file
diff --git a/byv-decorator-pattern07/pom.xml b/byv-decorator-pattern07/pom.xml
index 5978cdab2db566dbf8cec66b01bc3afa3da04736..558b4d21a280a1407a9f80ea97ac25bc1098a23a 100644
--- a/byv-decorator-pattern07/pom.xml
+++ b/byv-decorator-pattern07/pom.xml
@@ -20,6 +20,11 @@
commons-io
2.6
+
+ com.progsbase.libraries
+ JSON
+ 0.4.0
+
\ No newline at end of file
diff --git a/byv-facade-patttern-09/pom.xml b/byv-facade-patttern-09/pom.xml
index 0ad57e68780b47762b8c20ec32e5058ae9c717c4..02f4a333b9660b874739e80f04a9ed853fc93c39 100644
--- a/byv-facade-patttern-09/pom.xml
+++ b/byv-facade-patttern-09/pom.xml
@@ -13,5 +13,12 @@
8
UTF-8
+
+
+ com.progsbase.libraries
+ JSON
+ 0.4.0
+
+
\ No newline at end of file
diff --git a/byv-flyweight-patttern-11/pom.xml b/byv-flyweight-patttern-11/pom.xml
index 48484dd4ba90156f569dc4ef2aceba95309a80fc..bb1acfa28cdeb9e09b97c0711b5d81370c91d914 100644
--- a/byv-flyweight-patttern-11/pom.xml
+++ b/byv-flyweight-patttern-11/pom.xml
@@ -20,6 +20,11 @@
1.18.28
compile
+
+ com.progsbase.libraries
+ JSON
+ 0.4.0
+
\ No newline at end of file
diff --git a/byv-observer-patttern-12/pom.xml b/byv-observer-patttern-12/pom.xml
index 60da3c71fc9465c74ea6d2cd4b0461219914195d..e8d4e8975c74f7a523102c34820479404297624d 100644
--- a/byv-observer-patttern-12/pom.xml
+++ b/byv-observer-patttern-12/pom.xml
@@ -20,6 +20,11 @@
1.18.28
compile
+
+ com.progsbase.libraries
+ JSON
+ 0.4.0
+
\ No newline at end of file
diff --git a/byv-proxy-pattern-05/pom.xml b/byv-proxy-pattern-05/pom.xml
index 90798a7e377330e867ed7bd53bf9ffd9a067b2aa..218ca94bbe8abb935d6d361e562af63619f0c378 100644
--- a/byv-proxy-pattern-05/pom.xml
+++ b/byv-proxy-pattern-05/pom.xml
@@ -34,6 +34,11 @@
cglib
3.3.0
+
+ com.progsbase.libraries
+ JSON
+ 0.4.0
+
diff --git a/byv-strategy-patttern-14/pom.xml b/byv-strategy-patttern-14/pom.xml
index 8852549b82a7a736a329becfcfaeca32d1b9a7ad..0fa133927be71b6127c8e943e866169eb33d43ff 100644
--- a/byv-strategy-patttern-14/pom.xml
+++ b/byv-strategy-patttern-14/pom.xml
@@ -31,6 +31,11 @@
jaxen
1.1.6
+
+ com.progsbase.libraries
+ JSON
+ 0.4.0
+
\ No newline at end of file
diff --git a/byv-templatemethod-patttern-13/pom.xml b/byv-templatemethod-patttern-13/pom.xml
index fa93da0559f3aa7c9227d4e90111c23c5cccc781..0c300ef49bf820fe0cb179f6a37bdcfb5806ddf4 100644
--- a/byv-templatemethod-patttern-13/pom.xml
+++ b/byv-templatemethod-patttern-13/pom.xml
@@ -20,6 +20,11 @@
1.18.28
compile
+
+ com.progsbase.libraries
+ JSON
+ 0.4.0
+
\ No newline at end of file
diff --git a/img/img_chainDuty_summary.png b/img/img_chainDuty_summary.png
new file mode 100644
index 0000000000000000000000000000000000000000..9cfdc8b516c5507b0fe6156e62441e79092e61e9
Binary files /dev/null and b/img/img_chainDuty_summary.png differ