package com.xjrsoft.module.oa.service.impl; import cn.dev33.satoken.stp.StpUtil; import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.yulichang.base.MPJBaseServiceImpl; import com.xjrsoft.module.oa.dto.AddOfficialDocumentReceivedHandleAlertSetDto; import com.xjrsoft.module.oa.dto.AddOfficialDocumentReceivedHandleDto; import com.xjrsoft.module.oa.dto.OfficialDocumentReceivedHandlePageDto; import com.xjrsoft.module.oa.entity.OfficialDocumentReceived; import com.xjrsoft.module.oa.entity.OfficialDocumentReceivedHandle; import com.xjrsoft.module.oa.mapper.OfficialDocumentReceivedHandleMapper; import com.xjrsoft.module.oa.mapper.OfficialDocumentReceivedMapper; import com.xjrsoft.module.oa.service.IOfficialDocumentReceivedHandleService; import com.xjrsoft.module.oa.vo.OfficialDocumentReceivedHandlePageVo; import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; import java.util.List; /** * @title: 公文收文-承办表 * @Author dzx * @Date: 2025-04-14 * @Version 1.0 */ @Service @AllArgsConstructor public class OfficialDocumentReceivedHandleServiceImpl extends MPJBaseServiceImpl implements IOfficialDocumentReceivedHandleService { private final OfficialDocumentReceivedMapper documentReceivedMapper; @Override public Page getPage(Page page, OfficialDocumentReceivedHandlePageDto dto) { dto.setLoginUserId(StpUtil.getLoginIdAsLong()); List roleList = StpUtil.getRoleList(); if(roleList.contains("undertaker")){ dto.setLoginUserId(null); } return this.baseMapper.getPage(page, dto); } @Override @Transactional public Boolean addAlertTime(AddOfficialDocumentReceivedHandleAlertSetDto dto) { this.remove( new QueryWrapper().lambda() .eq(OfficialDocumentReceivedHandle::getOfficialDocumentReceivedId, dto.getId()) .eq(OfficialDocumentReceivedHandle::getReceiveUserId, StpUtil.getLoginIdAsLong()) ); OfficialDocumentReceivedHandle receivedHandle = new OfficialDocumentReceivedHandle(); receivedHandle.setAlertTime(dto.getAlertTime()); receivedHandle.setOfficialDocumentReceivedId(dto.getId()); receivedHandle.setIsTransfer(0); receivedHandle.setReceiveUserId(StpUtil.getLoginIdAsLong()); boolean isSuccess = this.save(receivedHandle); return isSuccess; } @Override @Transactional public Boolean handle(AddOfficialDocumentReceivedHandleDto dto) { LocalDateTime now = LocalDateTime.now(); OfficialDocumentReceivedHandle handle = BeanUtil.toBean(dto, OfficialDocumentReceivedHandle.class); handle.setIsHandle(1); handle.setReceiveUserId(StpUtil.getLoginIdAsLong()); handle.setHandleTime(now); this.save(handle); OfficialDocumentReceived received = documentReceivedMapper.selectById(handle.getOfficialDocumentReceivedId()); received.setIsHandle(1); received.setHandleTime(now); received.setHandleUserId(StpUtil.getLoginIdAsLong()); documentReceivedMapper.updateById(received); return true; } @Override @Transactional public Boolean transfer(AddOfficialDocumentReceivedHandleDto dto) { OfficialDocumentReceivedHandle handle = BeanUtil.toBean(dto, OfficialDocumentReceivedHandle.class); handle.setIsHandle(0); handle.setIsTransfer(1); this.save(handle); return true; } }