From 32ec64370ad5af7df86d59acdc134e697d936db2 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期一, 23 九月 2024 20:41:11 +0800
Subject: [PATCH] 课目管理

---
 src/main/java/com/mindskip/xzs/controller/admin/DepartmentExamineController.java |   26 +++++++++++++++++++++++---
 1 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/mindskip/xzs/controller/admin/DepartmentExamineController.java b/src/main/java/com/mindskip/xzs/controller/admin/DepartmentExamineController.java
index 075741a..eb299b6 100644
--- a/src/main/java/com/mindskip/xzs/controller/admin/DepartmentExamineController.java
+++ b/src/main/java/com/mindskip/xzs/controller/admin/DepartmentExamineController.java
@@ -5,12 +5,18 @@
 import com.mindskip.xzs.base.BaseApiController;
 import com.mindskip.xzs.base.RestResponse;
 import com.mindskip.xzs.domain.DepartmentExamine;
+import com.mindskip.xzs.domain.Notify;
+import com.mindskip.xzs.domain.enums.NotifyRefType;
 import com.mindskip.xzs.domain.vo.DepartmentExamineVO;
-import com.mindskip.xzs.service.IDepartmentExamineService;
+import com.mindskip.xzs.service.DepartmentExamineService;
+import com.mindskip.xzs.service.NotifyService;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import java.time.LocalDateTime;
+import java.util.Date;
 
 /**
  * <p>
@@ -25,18 +31,32 @@
 @RequiredArgsConstructor
 public class DepartmentExamineController extends BaseApiController {
 
-    private final IDepartmentExamineService departmentExamineService;
+    private final DepartmentExamineService departmentExamineService;
+    private final NotifyService notifyService;
 
     @RequestMapping(value = "list", method = RequestMethod.POST)
     public RestResponse<PageInfo<DepartmentExamineVO>> list(@RequestBody DepartmentExamineVO departmentExamineVO) {
+        departmentExamineVO.setDeptIds(ObjectUtils.isNotEmpty(departmentExamineVO.getDeptIds()) ? departmentExamineVO.getDeptIds() : getAdminDeptIds());
         return RestResponse.ok(departmentExamineService.pageInfo(departmentExamineVO));
     }
 
+    @Transactional(rollbackFor = Exception.class)
     @RequestMapping(value = "save", method = RequestMethod.POST)
     public RestResponse<Boolean> save(@RequestBody DepartmentExamine departmentExamine) {
         departmentExamine.setCreateTime(LocalDateTime.now());
         departmentExamine.setCreateUser(getCurrentUser().getId());
-        return RestResponse.ok(departmentExamineService.save(departmentExamine));
+
+        departmentExamineService.save(departmentExamine);
+
+        // 娣诲姞閫氱煡
+        Notify notify = new Notify();
+        notify.setCreateTime(new Date());
+        notify.setReadStatus(2);
+        notify.setRefId(departmentExamine.getId());
+        notify.setRefType(NotifyRefType.MOBILIZE.getValue());
+        notify.setCreateUserId(webContext.getCurrentUser().getId());
+        notifyService.add(notify);
+        return RestResponse.ok();
     }
 
     @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)

--
Gitblit v1.8.0