Merge branch 'dengjh-2507-update' into wcd-2411-update
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | * @param criteria |
| | | */ |
| | | void generateReport(ProjectQueryCriteria criteria); |
| | | |
| | | void downloadProgress(ProjectQueryCriteria criteria, HttpServletResponse response) throws IOException; |
| | | } |
| | |
| | | }
|
| | | 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);
|
| | | }
|
| | | } |
| | |
| | | > |
| | | 报告生成 |
| | | </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"> |
| | |
| | | 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 { |
| | |
| | | // 报告生成参数 |
| | | generateReportParam: { |
| | | loading: false |
| | | } |
| | | }, |
| | | // 加载 |
| | | downloadProgressLoading: false |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | }).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; |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |