xiangpei
2025-05-14 47cd9ecc0eff38ffe6b3b794b2bf197e958f4403
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)