deps: 移除Spring反应式框架
This commit is contained in:
parent
957245ed99
commit
f67d70fcb6
@ -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>
|
@ -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,52 +63,24 @@ public class WechatMessageTemplate implements Template {
|
|||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BodyInserters.FormInserter<String> createFormInserter(BodyInserters.FormInserter<String> inserter, Map<String, Object> context) {
|
public String createJsonRequest(Map<String, Object> context) {
|
||||||
inserter.with("agentid", this.getAgentId())
|
JSONObject json = new JSONObject();
|
||||||
.with("msgtype","text")
|
json.put("agentid", getAgentId());
|
||||||
.with("text",this.createMessage(context));
|
json.put("msgtype", "text");
|
||||||
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){
|
|
||||||
JSONObject json=new JSONObject();
|
|
||||||
json.put("agentid",getAgentId());
|
|
||||||
json.put("msgtype","text");
|
|
||||||
// TODO
|
// TODO
|
||||||
// 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;
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user