|
|
@@ -1,97 +0,0 @@
|
|
|
-package cn.reghao.devops.manager.home.controller.page;
|
|
|
-
|
|
|
-import cn.reghao.devops.manager.app.model.vo.KeyValue;
|
|
|
-import cn.reghao.devops.manager.notification.db.repository.DingAccountRepository;
|
|
|
-import cn.reghao.devops.manager.notification.db.repository.NotifyGroupRepository;
|
|
|
-import cn.reghao.devops.manager.notification.model.po.DingAccount;
|
|
|
-import cn.reghao.devops.manager.notification.model.po.NotifyGroup;
|
|
|
-import cn.reghao.devops.manager.notification.model.po.NotifyType;
|
|
|
-import cn.reghao.devops.manager.util.db.PageList;
|
|
|
-import cn.reghao.devops.manager.util.db.PageSort;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import org.springframework.data.domain.Page;
|
|
|
-import org.springframework.data.domain.PageRequest;
|
|
|
-import org.springframework.stereotype.Controller;
|
|
|
-import org.springframework.ui.Model;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-/**
|
|
|
- * @author reghao
|
|
|
- * @date 2022-09-22 18:24:18
|
|
|
- */
|
|
|
-@Api(tags = "系统通知配置页面")
|
|
|
-@RequestMapping("/sys/notify")
|
|
|
-@Controller
|
|
|
-public class SysNotifyPageController {
|
|
|
- private final DingAccountRepository dingRepository;
|
|
|
- private final NotifyGroupRepository receiverRepository;
|
|
|
-
|
|
|
- public SysNotifyPageController(DingAccountRepository dingRepository, NotifyGroupRepository receiverRepository) {
|
|
|
- this.dingRepository = dingRepository;
|
|
|
- this.receiverRepository = receiverRepository;
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "钉钉通知配置页面")
|
|
|
- @GetMapping("/ding")
|
|
|
- public String dingNotifyConfigPage(Model model) {
|
|
|
- PageRequest pageRequest = PageSort.pageRequest();
|
|
|
- Page<DingAccount> page = dingRepository.findAll(pageRequest);
|
|
|
- PageList<DingAccount> pageList = PageList.pageList(page);
|
|
|
-
|
|
|
- model.addAttribute("page", page);
|
|
|
- model.addAttribute("list", pageList.getList());
|
|
|
- return "/sys/notify/ding";
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/ding/add")
|
|
|
- public String dingNotifyConfigAddPage(Model model) {
|
|
|
- return "/sys/notify/dingadd";
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/ding/edit/{id}")
|
|
|
- public String dingNotifyConfigEditPage(@PathVariable("id") DingAccount dingAccount, Model model) {
|
|
|
- model.addAttribute("dingAccount", dingAccount);
|
|
|
- return "/sys/notify/dingadd";
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "全局通知接收配置页面")
|
|
|
- @GetMapping("/receiver")
|
|
|
- public String receiverConfigPage(Model model) {
|
|
|
- PageRequest pageRequest = PageSort.pageRequest();
|
|
|
- Page<NotifyGroup> page = receiverRepository.findAll(pageRequest);
|
|
|
- PageList<NotifyGroup> pageList = PageList.pageList(page);
|
|
|
-
|
|
|
- model.addAttribute("page", page);
|
|
|
- model.addAttribute("list", pageList.getList());
|
|
|
- return "/sys/notify/receiver";
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/receiver/add")
|
|
|
- public String receiverConfigAddPage(Model model) {
|
|
|
- List<KeyValue> notifyTypes = new ArrayList<>();
|
|
|
- for (NotifyType notifyType : NotifyType.values()) {
|
|
|
- notifyTypes.add(new KeyValue(notifyType.name(), notifyType.name()));
|
|
|
- }
|
|
|
-
|
|
|
- model.addAttribute("notifyTypes", notifyTypes);
|
|
|
- return "/sys/notify/receiveradd";
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/receiver/edit/{id}")
|
|
|
- public String receiverConfigEditPage(@PathVariable("id") NotifyGroup notifyGroup, Model model) {
|
|
|
- model.addAttribute("notifyGroup", notifyGroup);
|
|
|
- return "/sys/notify/receiveradd";
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/receiver/{id}/receivers")
|
|
|
- public String receiversPage(@PathVariable("id") NotifyGroup notifyGroup, Model model) {
|
|
|
- //model.addAttribute("list", notifyGroup.getReceivers());
|
|
|
- return "/sys/notify/notifyreceivers";
|
|
|
- }
|
|
|
-}
|