|
@@ -0,0 +1,52 @@
|
|
|
+package com.ym.mec.web.controller.education;
|
|
|
+
|
|
|
+
|
|
|
+import com.ym.mec.biz.dal.dto.PushInfoDto;
|
|
|
+import com.ym.mec.biz.dal.entity.FinancialExpenditure;
|
|
|
+import com.ym.mec.biz.dal.enums.MessageTypeEnum;
|
|
|
+import com.ym.mec.biz.service.SysMessageService;
|
|
|
+import com.ym.mec.common.controller.BaseController;
|
|
|
+import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
+import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+@Api(tags = "发送PUSH、IM(教务端)")
|
|
|
+@RequestMapping("eduSendNotice")
|
|
|
+@RestController
|
|
|
+public class EduSendNoticeController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysMessageService sysMessageService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "发送PUSH")
|
|
|
+ @PostMapping(value = "/push")
|
|
|
+ public HttpResponseResult push(@RequestBody PushInfoDto pushInfo) {
|
|
|
+ Map<Integer, String> userMap = new HashMap<>();
|
|
|
+ for (Integer userId : pushInfo.getUserIds()) {
|
|
|
+ userMap.put(userId, userId.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, pushInfo.getMessageType(), userMap, null, 0, null, "SYSTEM");
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "发送IM")
|
|
|
+ @PostMapping(value = "/im")
|
|
|
+ public HttpResponseResult im(@RequestBody PushInfoDto pushInfo) {
|
|
|
+
|
|
|
+ for (Integer userId : pushInfo.getUserIds()) {
|
|
|
+ sysMessageService.sendNoAuthPrivateMessage("1", userId.toString(), pushInfo.getImContent());
|
|
|
+ }
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
+}
|