deps: 移除Spring反应式框架

This commit is contained in:
椰子 2021-07-03 01:50:40 +08:00
parent 957245ed99
commit f67d70fcb6
3 changed files with 14 additions and 45 deletions

View File

@ -25,12 +25,6 @@
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
<version>2.3.11.RELEASE</version>
</dependency>
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
@ -50,6 +44,12 @@
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
<version>4.5.13</version> <version>4.5.13</version>
</dependency> </dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -3,9 +3,7 @@ package com.cicdi.notify.wechat;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cicdi.notify.template.Template; import com.cicdi.notify.template.Template;
import org.springframework.util.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.util.UriComponentsBuilder;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
@ -65,20 +63,6 @@ public class WechatMessageTemplate implements Template {
this.message = message; this.message = message;
} }
public BodyInserters.FormInserter<String> createFormInserter(BodyInserters.FormInserter<String> inserter, Map<String, Object> context) {
inserter.with("agentid", this.getAgentId())
.with("msgtype","text")
.with("text",this.createMessage(context));
if (StringUtils.hasText(toUser)) {
inserter.with("touser", this.createUserIdList(context));
}
if (StringUtils.hasText(toParty)) {
inserter.with("toparty", this.createDepartmentIdList(context));
}
return inserter;
}
public String createJsonRequest(Map<String, Object> context) { public String createJsonRequest(Map<String, Object> context) {
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("agentid", getAgentId()); json.put("agentid", getAgentId());
@ -87,30 +71,16 @@ public class WechatMessageTemplate implements Template {
// json.put("text",Collections.singletonMap("content",ExpressionUtils.analytical(message, context.getAllValues(), "spel"))); // json.put("text",Collections.singletonMap("content",ExpressionUtils.analytical(message, context.getAllValues(), "spel")));
json.put("text", Collections.singletonMap("content", message)); json.put("text", Collections.singletonMap("content", message));
if (StringUtils.hasText(toUser)) { if (StringUtils.isNotBlank(toUser)) {
json.put("touser", this.createUserIdList(context)); json.put("touser", this.createUserIdList(context));
} }
if (StringUtils.hasText(toParty)) { if (StringUtils.isNotBlank(toParty)) {
json.put("toparty", this.createDepartmentIdList(context)); json.put("toparty", this.createDepartmentIdList(context));
} }
return json.toJSONString(); return json.toJSONString();
} }
public UriComponentsBuilder createUriParameter(UriComponentsBuilder builder, Map<String, Object> context){
builder.queryParam("agentid", this.getAgentId())
.queryParam("msgtype","text")
.queryParam("text",this.createMessage(context));
if (StringUtils.hasText(toUser)) {
builder.queryParam("touser", this.createUserIdList(context));
}
if (StringUtils.hasText(toParty)) {
builder.queryParam("toparty", this.createDepartmentIdList(context));
}
return builder;
}
public String createUserIdList(Map<String, Object> context) { public String createUserIdList(Map<String, Object> context) {
if (StringUtils.isEmpty(toUser)) { if (StringUtils.isEmpty(toUser)) {
return toUser; return toUser;

View File

@ -7,7 +7,6 @@ import com.cicdi.notify.template.Template;
import com.cicdi.notify.template.TemplateManager; import com.cicdi.notify.template.TemplateManager;
import com.cicdi.notify.template.TemplateProperties; import com.cicdi.notify.template.TemplateProperties;
import org.junit.Test; import org.junit.Test;
import reactor.core.publisher.Hooks;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;