OfficialDocumentReceivedHandleServiceImpl.java 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. import java.util.List;
  21. /**
  22. * @title: 公文收文-承办表
  23. * @Author dzx
  24. * @Date: 2025-04-14
  25. * @Version 1.0
  26. */
  27. @Service
  28. @AllArgsConstructor
  29. public class OfficialDocumentReceivedHandleServiceImpl extends MPJBaseServiceImpl<OfficialDocumentReceivedHandleMapper, OfficialDocumentReceivedHandle> implements IOfficialDocumentReceivedHandleService {
  30. private final OfficialDocumentReceivedMapper documentReceivedMapper;
  31. @Override
  32. public Page<OfficialDocumentReceivedHandlePageVo> getPage(Page<OfficialDocumentReceivedHandlePageVo> page, OfficialDocumentReceivedHandlePageDto dto) {
  33. dto.setLoginUserId(StpUtil.getLoginIdAsLong());
  34. List<String> roleList = StpUtil.getRoleList();
  35. if(roleList.contains("undertaker")){
  36. dto.setLoginUserId(null);
  37. }
  38. return this.baseMapper.getPage(page, dto);
  39. }
  40. @Override
  41. @Transactional
  42. public Boolean addAlertTime(AddOfficialDocumentReceivedHandleAlertSetDto dto) {
  43. this.remove(
  44. new QueryWrapper<OfficialDocumentReceivedHandle>().lambda()
  45. .eq(OfficialDocumentReceivedHandle::getOfficialDocumentReceivedId, dto.getId())
  46. .eq(OfficialDocumentReceivedHandle::getReceiveUserId, StpUtil.getLoginIdAsLong())
  47. );
  48. OfficialDocumentReceivedHandle receivedHandle = new OfficialDocumentReceivedHandle();
  49. receivedHandle.setAlertTime(dto.getAlertTime());
  50. receivedHandle.setOfficialDocumentReceivedId(dto.getId());
  51. receivedHandle.setIsTransfer(0);
  52. receivedHandle.setReceiveUserId(StpUtil.getLoginIdAsLong());
  53. boolean isSuccess = this.save(receivedHandle);
  54. return isSuccess;
  55. }
  56. @Override
  57. @Transactional
  58. public Boolean handle(AddOfficialDocumentReceivedHandleDto dto) {
  59. LocalDateTime now = LocalDateTime.now();
  60. OfficialDocumentReceivedHandle handle = BeanUtil.toBean(dto, OfficialDocumentReceivedHandle.class);
  61. handle.setIsHandle(1);
  62. handle.setReceiveUserId(StpUtil.getLoginIdAsLong());
  63. handle.setHandleTime(now);
  64. this.save(handle);
  65. OfficialDocumentReceived received = documentReceivedMapper.selectById(handle.getOfficialDocumentReceivedId());
  66. received.setIsHandle(1);
  67. received.setHandleTime(now);
  68. received.setHandleUserId(StpUtil.getLoginIdAsLong());
  69. documentReceivedMapper.updateById(received);
  70. return true;
  71. }
  72. @Override
  73. @Transactional
  74. public Boolean transfer(AddOfficialDocumentReceivedHandleDto dto) {
  75. OfficialDocumentReceivedHandle handle = BeanUtil.toBean(dto, OfficialDocumentReceivedHandle.class);
  76. handle.setIsHandle(0);
  77. handle.setIsTransfer(1);
  78. this.save(handle);
  79. return true;
  80. }
  81. }