|
|
@@ -1,6 +1,7 @@
|
|
|
package vip.xiaonuo.exam.controller.admin;
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
@@ -8,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import vip.xiaonuo.auth.core.pojo.SaBaseLoginUser;
|
|
|
+import vip.xiaonuo.common.pojo.CommonResult;
|
|
|
+import vip.xiaonuo.dev.api.DevMessageApi;
|
|
|
import vip.xiaonuo.exam.base.BaseApiController;
|
|
|
import vip.xiaonuo.exam.base.RestResponse;
|
|
|
import vip.xiaonuo.exam.domain.Message;
|
|
|
@@ -19,6 +22,7 @@ import vip.xiaonuo.exam.viewmodel.admin.message.MessagePageRequestVM;
|
|
|
import vip.xiaonuo.exam.viewmodel.admin.message.MessageResponseVM;
|
|
|
import vip.xiaonuo.exam.viewmodel.admin.message.MessageSendVM;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
@@ -30,6 +34,8 @@ public class MessageController extends BaseApiController {
|
|
|
|
|
|
private final MessageService messageService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private DevMessageApi devMessageApi;
|
|
|
|
|
|
@Autowired
|
|
|
public MessageController(MessageService messageService) {
|
|
|
@@ -81,4 +87,24 @@ public class MessageController extends BaseApiController {
|
|
|
return RestResponse.ok();
|
|
|
}
|
|
|
|
|
|
+ @RequestMapping(value = "/sendCommitRemind", method = RequestMethod.POST)
|
|
|
+ public CommonResult sendCommitRemind(@RequestBody JSONObject model) {
|
|
|
+ try {
|
|
|
+ SaBaseLoginUser user = getCurrentUser();
|
|
|
+ if(user == null || user.getId() == null){
|
|
|
+ throw new RuntimeException("未登录!!!");
|
|
|
+ }
|
|
|
+ String content = "教师-"+user.getNickname()+"-提醒您提交试卷!!!";
|
|
|
+ List<String> receiverIdList = model.getJSONArray("receiverIdList").toJavaList(String.class);
|
|
|
+ if(receiverIdList.isEmpty()){
|
|
|
+ throw new RuntimeException("入参 receiverIdList 不能为空!!!");
|
|
|
+ }
|
|
|
+ devMessageApi.sendMessage(receiverIdList,content);
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.err.println("sendCommitRemind 提交提醒失败!!!");
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new RuntimeException("sendCommitRemind 提交提醒失败!!!");
|
|
|
+ }
|
|
|
+ return CommonResult.ok();
|
|
|
+ }
|
|
|
}
|