CaseTabulationServiceImpl.java 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. package com.fdkankan.fusion.service.impl;
  2. import cn.dev33.satoken.stp.StpUtil;
  3. import cn.hutool.core.date.DateUtil;
  4. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  5. import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  6. import com.fdkankan.fusion.common.util.UploadToOssUtil;
  7. import com.fdkankan.fusion.entity.CaseFiles;
  8. import com.fdkankan.fusion.entity.CaseOverview;
  9. import com.fdkankan.fusion.entity.CaseTabulation;
  10. import com.fdkankan.fusion.httpClient.client.FdKKClient;
  11. import com.fdkankan.fusion.httpClient.request.AddMediaLibraryParam;
  12. import com.fdkankan.fusion.mapper.ICaseTabulationMapper;
  13. import com.fdkankan.fusion.request.ExportOverviewParam;
  14. import com.fdkankan.fusion.service.ICaseFilesService;
  15. import com.fdkankan.fusion.service.ICaseOverviewService;
  16. import com.fdkankan.fusion.service.ICaseTabulationService;
  17. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  18. import org.apache.commons.lang3.StringUtils;
  19. import org.springframework.beans.factory.annotation.Autowired;
  20. import org.springframework.stereotype.Service;
  21. import java.util.Date;
  22. import java.util.List;
  23. /**
  24. * <p>
  25. * 服务实现类
  26. * </p>
  27. *
  28. * @author
  29. * @since 2025-05-13
  30. */
  31. @Service
  32. public class CaseTabulationServiceImpl extends ServiceImpl<ICaseTabulationMapper, CaseTabulation> implements ICaseTabulationService {
  33. @Autowired
  34. ICaseFilesService caseFilesService;
  35. @Autowired
  36. ICaseOverviewService caseOverviewService;
  37. @Autowired
  38. FdKKClient fdKKClient;
  39. @Autowired
  40. UploadToOssUtil uploadToOssUtil;
  41. @Override
  42. public List<CaseTabulation> getByCaseId(String caseId) {
  43. LambdaQueryWrapper<CaseTabulation> wrapper = new LambdaQueryWrapper<>();
  44. wrapper.eq(CaseTabulation::getCaseId,caseId);
  45. wrapper.orderByDesc(CaseTabulation::getId);
  46. return this.list(wrapper);
  47. }
  48. @Override
  49. public List<CaseTabulation> getByOverviewId(String overviewId) {
  50. LambdaQueryWrapper<CaseTabulation> wrapper = new LambdaQueryWrapper<>();
  51. wrapper.eq(CaseTabulation::getOverviewId,overviewId);
  52. wrapper.orderByDesc(CaseTabulation::getId);
  53. return this.list(wrapper);
  54. }
  55. @Override
  56. public void addOrUpdate(CaseTabulation caseTabulation) {
  57. this.saveOrUpdate(caseTabulation);
  58. caseTabulation = this.getById(caseTabulation.getId());
  59. if(StringUtils.isNotBlank(caseTabulation.getTitle()) && caseTabulation.getOverviewId() != null){
  60. caseOverviewService.updateTitleById(caseTabulation.getOverviewId(),caseTabulation.getTitle());
  61. }
  62. if(StringUtils.isNotBlank(caseTabulation.getListCover()) && caseTabulation.getOverviewId() != null){
  63. caseOverviewService.updateListCoverById(caseTabulation.getOverviewId(),caseTabulation.getListCover());
  64. }
  65. caseFilesService.addOrUpdateOver(caseTabulation);
  66. }
  67. @Override
  68. public void updateTitleById(Integer tabulationId, String filesTitle) {
  69. LambdaUpdateWrapper<CaseTabulation> wrapper = new LambdaUpdateWrapper<>();
  70. wrapper.eq(CaseTabulation::getId,tabulationId);
  71. wrapper.set(CaseTabulation::getTitle,filesTitle);
  72. this.update(wrapper);
  73. }
  74. @Override
  75. public void updateCaseByOverIds(List<Integer> overviewIds, Integer caseId) {
  76. LambdaUpdateWrapper<CaseTabulation> wrapper = new LambdaUpdateWrapper<>();
  77. wrapper.in(CaseTabulation::getOverviewId,overviewIds);
  78. wrapper.set(CaseTabulation::getCaseId,caseId);
  79. this.update(wrapper);
  80. }
  81. @Override
  82. public void updateCaseByIds(List<Integer> tabulationIds, Integer caseId) {
  83. LambdaUpdateWrapper<CaseTabulation> wrapper = new LambdaUpdateWrapper<>();
  84. wrapper.in(CaseTabulation::getId,tabulationIds);
  85. wrapper.set(CaseTabulation::getCaseId,caseId);
  86. this.update(wrapper);
  87. }
  88. @Override
  89. public Long getNo(Long sysUserId) {
  90. LambdaUpdateWrapper<CaseTabulation> wrapper = new LambdaUpdateWrapper<>();
  91. wrapper.eq(CaseTabulation::getSysUserId,sysUserId);
  92. return this.count(wrapper);
  93. }
  94. }