Kaynağa Gözat

Merge branch 'master' of ssh://10.10.100.21/source/uas-office-integration

RaoMeng 6 yıl önce
ebeveyn
işleme
bbe50766a8

+ 33 - 0
uas-office-qywx/src/main/java/com/usoftchina/uas/office/qywx/controller/QywxMessageController.java

@@ -0,0 +1,33 @@
+package com.usoftchina.uas.office.qywx.controller;
+
+import com.usoftchina.qywx.sdk.MessageSdk;
+import com.usoftchina.qywx.sdk.dto.SendMessageReq;
+import com.usoftchina.uas.office.dto.Result;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author yingp
+ * @date 2020/2/19
+ */
+@RestController
+public class QywxMessageController {
+    @Autowired
+    private MessageSdk messageSdk;
+
+    /**
+     * 发送消息
+     *
+     * @param agent
+     * @param message
+     * @param user
+     * @return
+     */
+    @PostMapping(value = "/api/message/send")
+    public Result send(@RequestParam(value = "agent") String agent, String message, String user) {
+        messageSdk.send(agent, new SendMessageReq().text(message).toUser(user));
+        return Result.success();
+    }
+}

+ 0 - 4
uas-office-qywx/src/main/java/com/usoftchina/uas/office/qywx/manage/controller/QywxSettingController.java

@@ -4,7 +4,6 @@ import com.usoftchina.uas.office.dto.Result;
 import com.usoftchina.uas.office.entity.DataCenter;
 import com.usoftchina.uas.office.jdbc.DataSourceHolder;
 import com.usoftchina.uas.office.qywx.manage.service.QywxSettingService;
-import com.usoftchina.uas.office.service.DataCenterService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -19,9 +18,6 @@ public class QywxSettingController {
     @Autowired
     private QywxSettingService settingService;
 
-    @Autowired
-    private DataCenterService dataCenterService;
-
     @GetMapping(path = "/setting")
     public Result getQywxSetting() {
         DataCenter dataCenter = DataCenter.INSTANCE;