OfficialDocumentReceivedHandleServiceImpl.java 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. package com.xjrsoft.module.oa.service.impl;
  2. import cn.dev33.satoken.stp.StpUtil;
  3. import cn.hutool.core.bean.BeanUtil;
  4. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  5. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  6. import com.github.yulichang.base.MPJBaseServiceImpl;
  7. import com.xjrsoft.module.oa.dto.AddOfficialDocumentReceivedHandleAlertSetDto;
  8. import com.xjrsoft.module.oa.dto.AddOfficialDocumentReceivedHandleDto;
  9. import com.xjrsoft.module.oa.dto.OfficialDocumentReceivedHandlePageDto;
  10. import com.xjrsoft.module.oa.entity.OfficialDocumentReceived;
  11. import com.xjrsoft.module.oa.entity.OfficialDocumentReceivedHandle;
  12. import com.xjrsoft.module.oa.mapper.OfficialDocumentReceivedHandleMapper;
  13. import com.xjrsoft.module.oa.mapper.OfficialDocumentReceivedMapper;
  14. import com.xjrsoft.module.oa.service.IOfficialDocumentReceivedHandleService;
  15. import com.xjrsoft.module.oa.vo.OfficialDocumentReceivedHandlePageVo;
  16. import lombok.AllArgsConstructor;
  17. import org.springframework.stereotype.Service;
  18. import org.springframework.transaction.annotation.Transactional;
  19. import java.time.LocalDateTime;
  20. /**
  21. * @title: 公文收文-承办表
  22. * @Author dzx
  23. * @Date: 2025-04-14
  24. * @Version 1.0
  25. */
  26. @Service
  27. @AllArgsConstructor
  28. public class OfficialDocumentReceivedHandleServiceImpl extends MPJBaseServiceImpl<OfficialDocumentReceivedHandleMapper, OfficialDocumentReceivedHandle> implements IOfficialDocumentReceivedHandleService {
  29. private final OfficialDocumentReceivedMapper documentReceivedMapper;
  30. @Override
  31. public Page<OfficialDocumentReceivedHandlePageVo> getPage(Page<OfficialDocumentReceivedHandlePageVo> page, OfficialDocumentReceivedHandlePageDto dto) {
  32. dto.setLongUserId(StpUtil.getLoginIdAsLong());
  33. return this.baseMapper.getPage(page, dto);
  34. }
  35. @Override
  36. @Transactional
  37. public Boolean addAlertTime(AddOfficialDocumentReceivedHandleAlertSetDto dto) {
  38. this.remove(
  39. new QueryWrapper<OfficialDocumentReceivedHandle>().lambda()
  40. .eq(OfficialDocumentReceivedHandle::getOfficialDocumentReceivedId, dto.getId())
  41. .eq(OfficialDocumentReceivedHandle::getReceiveUserId, StpUtil.getLoginIdAsLong())
  42. );
  43. OfficialDocumentReceivedHandle receivedHandle = new OfficialDocumentReceivedHandle();
  44. receivedHandle.setAlertTime(dto.getAlertTime());
  45. receivedHandle.setOfficialDocumentReceivedId(dto.getId());
  46. receivedHandle.setIsTransfer(0);
  47. receivedHandle.setReceiveUserId(StpUtil.getLoginIdAsLong());
  48. boolean isSuccess = this.save(receivedHandle);
  49. return isSuccess;
  50. }
  51. @Override
  52. @Transactional
  53. public Boolean handle(AddOfficialDocumentReceivedHandleDto dto) {
  54. LocalDateTime now = LocalDateTime.now();
  55. OfficialDocumentReceivedHandle handle = BeanUtil.toBean(dto, OfficialDocumentReceivedHandle.class);
  56. handle.setIsHandle(1);
  57. handle.setReceiveUserId(StpUtil.getLoginIdAsLong());
  58. handle.setHandleTime(now);
  59. this.save(handle);
  60. OfficialDocumentReceived received = documentReceivedMapper.selectById(handle.getOfficialDocumentReceivedId());
  61. received.setIsHandle(1);
  62. received.setHandleTime(now);
  63. received.setHandleUserId(StpUtil.getLoginIdAsLong());
  64. documentReceivedMapper.updateById(received);
  65. return true;
  66. }
  67. @Override
  68. @Transactional
  69. public Boolean transfer(AddOfficialDocumentReceivedHandleDto dto) {
  70. OfficialDocumentReceivedHandle handle = BeanUtil.toBean(dto, OfficialDocumentReceivedHandle.class);
  71. handle.setIsHandle(0);
  72. handle.setIsTransfer(1);
  73. this.save(handle);
  74. return true;
  75. }
  76. }