From 57301fd3982ec9ab430b71a430a1fe1c4b9c3488 Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Mon, 21 Oct 2024 11:52:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DcWeChatController.java | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 zc-business/src/main/java/com/zc/business/controller/DcWeChatController.java diff --git a/zc-business/src/main/java/com/zc/business/controller/DcWeChatController.java b/zc-business/src/main/java/com/zc/business/controller/DcWeChatController.java new file mode 100644 index 00000000..a17a9f4a --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/controller/DcWeChatController.java @@ -0,0 +1,48 @@ +package com.zc.business.controller; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.zc.business.domain.DcBoardPublish; +import com.zc.business.service.IDcBoardService; +import com.zc.business.utils.QYWXUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * @Description 企业微信推送Controller + * + * @author liuwenge + * @date 2024/10/21 11:38 + */ +@Api(tags = "企业微信推送") +@RestController +@RequestMapping("/business/weChat") +public class DcWeChatController { + + @Autowired + private QYWXUtil qywxUtil; + + + @ApiOperation("发送消息") + @PostMapping("/qywxSendMessage") + public AjaxResult qywxSendMessage(@RequestBody Map params){ + + List userIdList = Arrays.asList(params.get("userId").split(",")); + String content = params.get("content"); + return AjaxResult.success(qywxUtil.sendMessageByWxUserId(userIdList,content)); + } + + @ApiOperation("根据手机号获取userId") + @PostMapping("/getQywxUserId") + public AjaxResult getQywxUserId(@RequestBody Map params){ + String mobile = params.get("mobile"); + return AjaxResult.success(qywxUtil.getUserIdByMobile(mobile)); + } + +}