企业微信推送
This commit is contained in:
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import cn.van.business.enums.WXReqType;
|
import cn.van.business.enums.WXReqType;
|
||||||
import cn.van.business.mq.MessageProducerService;
|
import cn.van.business.mq.MessageProducerService;
|
||||||
|
import cn.van.business.repository.OrderRowRepository;
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -14,8 +15,10 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,7 +28,6 @@ import java.util.*;
|
|||||||
* @description:
|
* @description:
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@Lazy
|
|
||||||
public class WXUtil {
|
public class WXUtil {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(WXUtil.class);
|
private static final Logger logger = LoggerFactory.getLogger(WXUtil.class);
|
||||||
@@ -33,8 +35,8 @@ public class WXUtil {
|
|||||||
public static Map<String, SuperAdmin> super_admins = new HashMap<>();
|
public static Map<String, SuperAdmin> super_admins = new HashMap<>();
|
||||||
public static Map<String, String> jdidToWxidMap = new HashMap<>();
|
public static Map<String, String> jdidToWxidMap = new HashMap<>();
|
||||||
|
|
||||||
@Autowired
|
private final WxtsUtil wxTsUtil;
|
||||||
private WxtsUtil wxTsUtil;
|
private final MessageProducerService messageProducerService;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -48,15 +50,21 @@ public class WXUtil {
|
|||||||
private String secretKey;
|
private String secretKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 通过构造函数注入所有依赖项,Spring将自动注入这些依赖
|
||||||
|
@Autowired // @Autowired 在构造函数上可以省略,如果类只有一个构造函数
|
||||||
|
public WXUtil(WxtsUtil wxTsUtil, MessageProducerService messageProducerService) {
|
||||||
|
this.messageProducerService = messageProducerService;
|
||||||
|
this.wxTsUtil = wxTsUtil;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 初始化超级管理员
|
// 初始化超级管理员
|
||||||
public void initSuperAdmins() {
|
public void initSuperAdmins() {
|
||||||
SuperAdmin admin1 = new SuperAdmin("wxid_ytpc72mdoskt22", "凡", "2014264913",
|
SuperAdmin admin1 = new SuperAdmin("wxid_ytpc72mdoskt22", "凡", "2014264913", "98e21c89ae5610240ec3f5f575f86a59", "3dcb6b23a1104639ac433fd07adb6dfb");
|
||||||
"98e21c89ae5610240ec3f5f575f86a59", "3dcb6b23a1104639ac433fd07adb6dfb");
|
|
||||||
super_admins.put(admin1.getWxid(), admin1);
|
super_admins.put(admin1.getWxid(), admin1);
|
||||||
jdidToWxidMap.put(admin1.getUnionId(), admin1.getWxid());
|
jdidToWxidMap.put(admin1.getUnionId(), admin1.getWxid());
|
||||||
|
|
||||||
SuperAdmin admin2 = new SuperAdmin("wxid_yneqf1implxu12", "源", "2025353364"
|
SuperAdmin admin2 = new SuperAdmin("wxid_yneqf1implxu12", "源", "2025353364", "e3c161242c8a1416fada5b5564d7ee70", "41ae9aabf03b41e6ba309682e36b323e");
|
||||||
, "e3c161242c8a1416fada5b5564d7ee70", "41ae9aabf03b41e6ba309682e36b323e");
|
|
||||||
super_admins.put(admin2.getWxid(), admin2);
|
super_admins.put(admin2.getWxid(), admin2);
|
||||||
jdidToWxidMap.put(admin2.getUnionId(), admin2.getWxid());
|
jdidToWxidMap.put(admin2.getUnionId(), admin2.getWxid());
|
||||||
wxTsUtil.sendNotify("initSuperAdmins 初始化完成");
|
wxTsUtil.sendNotify("initSuperAdmins 初始化完成");
|
||||||
@@ -101,8 +109,7 @@ public class WXUtil {
|
|||||||
*/
|
*/
|
||||||
public static String WX_BASE_URL;
|
public static String WX_BASE_URL;
|
||||||
private Environment env;
|
private Environment env;
|
||||||
@Autowired
|
|
||||||
private MessageProducerService messageProducerService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public WXUtil(Environment env) {
|
public WXUtil(Environment env) {
|
||||||
|
|||||||
Reference in New Issue
Block a user