|
@@ -0,0 +1,113 @@
|
|
|
+package com.dayou.service.impl;
|
|
|
+
|
|
|
+import cn.dev33.satoken.stp.StpUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.dayou.dto.report.ReportBaseInfoDTO;
|
|
|
+import com.dayou.entity.AssetsReport;
|
|
|
+import com.dayou.mapper.AssetsReportMapper;
|
|
|
+import com.dayou.service.AssetsReportService;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.dayou.vo.AssetsReportVO;
|
|
|
+import com.dayou.vo.report.AssetsReportProgressVO;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.ArrayList;
|
|
|
+
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+/**
|
|
|
+ * <p>
|
|
|
+ * 资产项目报告信息表 服务实现类
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @author mybatis-plus-generator
|
|
|
+ * @since 2024-12-06
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class AssetsReportServiceImpl extends ServiceImpl<AssetsReportMapper, AssetsReport> implements AssetsReportService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private AssetsReportMapper assetsReportMapper;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据项目id查询所有报告信息
|
|
|
+ *
|
|
|
+ * @param projectId 项目id
|
|
|
+ * @return List<AssetsReport>
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<AssetsReportVO> listAllByProjectId(Long projectId) {
|
|
|
+ return assetsReportMapper.listAllByProjectId(projectId);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AssetsReport detail(Long id) {
|
|
|
+ return this.getById(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean add(AssetsReport assetsReport) {
|
|
|
+ assetsReport.setCreateUserId(StpUtil.getLoginIdAsLong());
|
|
|
+ if (ObjectUtil.isNull(assetsReport.getId())) {
|
|
|
+ return this.save(assetsReport);
|
|
|
+ }else {
|
|
|
+ return this.updateById(assetsReport);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean update(AssetsReport assetsReport) {
|
|
|
+ return this.updateById(assetsReport);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean delete(Long id) {
|
|
|
+ //逻辑删除
|
|
|
+ return this.removeById(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据项目id获取未完成报告的进度信息
|
|
|
+ * @param projectId 项目id
|
|
|
+ * @return AssetsReportProgressVO
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public AssetsReportProgressVO getUnFinishedReportProgress(Long projectId) {
|
|
|
+ return assetsReportMapper.getUnFinishedReportProgress(projectId);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新报告基础信息
|
|
|
+ * @param reportBaseInfoDTO dto
|
|
|
+ * @return Boolean
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean updateReportBaseInfo(ReportBaseInfoDTO reportBaseInfoDTO) {
|
|
|
+ // 如果baseInfo为null说明是第一次进行填写测算基本信息的操作,则更新报告进度
|
|
|
+ if (ObjectUtil.isNull(getReportBaseInfo(reportBaseInfoDTO.getReportId()))) {
|
|
|
+ assetsReportMapper.updateReportProgress(reportBaseInfoDTO.getReportId(), "GENERATE");
|
|
|
+ }
|
|
|
+ return assetsReportMapper.updateReportBaseInfo(reportBaseInfoDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据报告id获取报告基础信息
|
|
|
+ * @param reportId 报告id
|
|
|
+ * @return String
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public String getReportBaseInfo(Long reportId) {
|
|
|
+ return assetsReportMapper.getReportBaseInfo(reportId);
|
|
|
+ }
|
|
|
+}
|