BAOLH
2025-08-29 076271d17a9bd616a26d5bd2363a29ca774c944f
Merge branch 'dengjh-2507-update' into wcd-2411-update
4 files modified
92 ■■■■■ changed files
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/rest/ProjectController.java 8 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/ProjectService.java 2 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectServiceImpl.java 48 ●●●●● patch | view | raw | blame | history
eladmin-web-master/src/views/project/project/index.vue 34 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/rest/ProjectController.java
@@ -204,4 +204,12 @@
        projectService.generateReport(criteria);
        return new ResponseEntity<>(HttpStatus.OK);
    }
    @Log("导出项目进度")
    @ApiOperation("导出项目进度")
    @GetMapping(value = "/downloadProgress")
    @PreAuthorize("@el.check('project:download')")
    public void exportProjectProgress(HttpServletResponse response, ProjectQueryCriteria criteria) throws IOException {
        projectService.downloadProgress(criteria, response);
    }
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/ProjectService.java
@@ -163,4 +163,6 @@
     * @param criteria
     */
    void generateReport(ProjectQueryCriteria criteria);
    void downloadProgress(ProjectQueryCriteria criteria, HttpServletResponse response) throws IOException;
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/project/service/impl/ProjectServiceImpl.java
@@ -825,4 +825,52 @@
        }
        weComService.toWeComSheetPushProjectReport(projectIds);
    }
    @Override
    public void downloadProgress(ProjectQueryCriteria criteria, HttpServletResponse response) throws IOException {
        List<Map<String, Object>> list = new ArrayList<>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        List<TaskMongo> taskMongoList = mongoTemplate.find(Query.query(Criteria.where("projectId").in(criteria.getIdInList())), TaskMongo.class);
        List<TaskUserMongo> taskUserList = mongoTemplate.find(Query.query(Criteria.where("task").in(taskMongoList)), TaskUserMongo.class);
        Integer sortId = 1;
        for (TaskUserMongo taskUserMongo : taskUserList) {
            Project project = projectRepository.findById(taskUserMongo.getTask().getProjectId()).get();
            // 任务负责人
            List<Long> userIdList = taskUserMongo.getTask().getUserIdList();
            String taskLiableUser = userIdList.stream().map(userId -> userRepository.findById(userId).get().getNickName()).collect(Collectors.joining(","));
            // 作成者
            String creator = userRepository.findById(taskUserMongo.getUserId()).get().getNickName();
            // 项目负责人
            String projectUserId = "";
            if (project.getLiableUserId() != null) {
                projectUserId = project.getLiableUserId().replace("-", "");
            }
            List<String> idList = Arrays.asList(projectUserId.split(","));
            String projectLiableUser = idList.stream().filter(userId ->!userId.equals("")).distinct().map(userId -> userRepository.findById(Long.parseLong(userId)).get().getNickName()).collect(Collectors.joining(","));
            Map<String, Object> map = new LinkedHashMap<>();
            map.put("序号", sortId++);
            map.put("任务详情-项目", project.getName());
            map.put("项目负责人", projectLiableUser);
            map.put("任务分类", String.join(",", taskUserMongo.getTask().getTagList()));
            map.put("任务详情-名称", taskUserMongo.getTask().getName());
            map.put("项目单位", "/");
            map.put("任务负责人", taskLiableUser);
            map.put("任务详情-描述", taskUserMongo.getTask().getDescription());
            map.put("任务分配-名称", taskUserMongo.getName());
            map.put("作成者", creator);
            map.put("计划开始时间", sdf.format(taskUserMongo.getTask().getPlanStartTime()));
            map.put("预计完成时间", sdf.format(taskUserMongo.getTask().getPlanEndTime()));
            map.put("预计工时", taskUserMongo.getTask().getPlanHours());
            map.put("实际开始时间", sdf.format(taskUserMongo.getTaskStartDate()));
            map.put("实际完成时间", sdf.format(taskUserMongo.getTaskEndDate()));
            map.put("实际工时", taskUserMongo.getTaskHours());
            map.put("进度", taskUserMongo.getNewTaskProgress());
            map.put("预警", "");
            map.put("备注", taskUserMongo.getRemarks());
            list.add(map);
        }
        FileUtil.downloadExcel(list, response);
    }
}
eladmin-web-master/src/views/project/project/index.vue
@@ -122,6 +122,20 @@
        >
          报告生成
        </el-button>
        <el-button
          slot="right"
          v-permission="permission.download"
          class="filter-item"
          size="mini"
          type="primary"
          icon="el-icon-download"
          style="margin-left: 4px !important;"
          v-loading="downloadProgressLoading"
          :disabled="crud.selections.length === 0"
          @click="doExportProjectProgress()"
        >
          项目进度导出
        </el-button>
      </crudOperation>
      <!--表单组件-->
      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="690px">
@@ -433,6 +447,7 @@
import pagination from '@crud/Pagination'
import { mapGetters } from 'vuex'
import constant from '@/utils/constant'
import { downloadFile } from '@/utils/index'
const defaultForm = { id: null, name: null, projectTypeId: null, projectDistinguish: null, companyId: null, requirement: null, unitCurrency: null, performanceObjectives: null, quotationPrice: null, performancePrice: null, contractPrice: null, contractPrePrice: null, projectPrice: null, liableUserId: null, liableUserIdList: [], planStartDate: null, planEndDate: null, projectStatus: null, approveStatus: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null }
export default {
@@ -551,7 +566,9 @@
      // 报告生成参数
      generateReportParam: {
        loading: false
      }
      },
      // 加载
      downloadProgressLoading: false
    }
  },
  computed: {
@@ -816,6 +833,21 @@
      }).catch(() => {
        that.$message({ type: 'info', message: '已取消操作' })
      })
    },
    // 执行项目进度导出
    doExportProjectProgress() {
      const that = this
      const projects = that.crud.selections.map(p => p.id)
      if (projects.length > 0) {
        that.downloadProgressLoading = true
        that.crud.crudMethod.downloadProjectProgress({ idInList: projects }).then(result => {
          downloadFile(result, '项目进度导出数据', 'xlsx')
        }).catch(e => {
          that.$message.error(e.message)
        }).finally(() => {
          that.downloadProgressLoading = false;
        })
      }
    }
  }
}