xieb
2024-01-11 567775c8ef9761b5fe5d04073ca329b7ef30e22d
第一轮结果导出
2 files modified
1 files added
101 ■■■■■ changed files
src/main/java/org/springblade/modules/evaluate/controller/EvaluateCandidateResultController.java 9 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/evaluate/controller/EvaluateTaskReferrerController.java 21 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/evaluate/excel/ReferrerResultGroupExcel.java 71 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/evaluate/controller/EvaluateCandidateResultController.java
@@ -95,15 +95,20 @@
    @ApiOperation(value = "分页", notes = "传入evaluateCandidateResult")
    public R listByCategoryId(EvaluateCandidateResultEntity evaluateCandidateResult,Query query) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("evaluate_task_category_id", evaluateCandidateResult.getEvaluateTaskCategoryId());
        queryWrapper.select("*,count(*) voteNum");
        EvaluateTaskEntity taskEntity = evaluateTaskService.getById(evaluateCandidateResult.getEvaluateTaskId());
        if (taskEntity.getType() == 0) {
            queryWrapper.eq("evaluate_task_category_id", evaluateCandidateResult.getEvaluateTaskCategoryId());
            queryWrapper.groupBy("user_id");
        } else {
            queryWrapper.groupBy("dept_id");
        }
        if (null != evaluateCandidateResult.getEvaluateTaskId())
            queryWrapper.eq("evaluate_task_id", evaluateCandidateResult.getEvaluateTaskId());
        queryWrapper.select("*,count(*) voteNum");
        queryWrapper.orderByDesc("count(*)");
        return R.data(evaluateCandidateResultService.pageMaps(Condition.getPage(query), queryWrapper));
src/main/java/org/springblade/modules/evaluate/controller/EvaluateTaskReferrerController.java
@@ -18,6 +18,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -34,6 +35,7 @@
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.evaluate.entity.EvaluateTaskReferrerEntity;
import org.springblade.modules.evaluate.excel.EvaluateTaskReferrerExcel;
import org.springblade.modules.evaluate.excel.ReferrerResultGroupExcel;
import org.springblade.modules.evaluate.service.IEvaluateTaskReferrerService;
import org.springblade.modules.evaluate.vo.EvaluateTaskReferrerVO;
import org.springblade.modules.evaluate.wrapper.EvaluateTaskReferrerWrapper;
@@ -96,6 +98,25 @@
        return R.data(evaluateTaskReferrerService.pageMaps(Condition.getPage(query), queryWrapper));
    }
    /**
     * 第一轮投票结果导出数据
     */
    @GetMapping("/export/{taskId}")
    @ApiOperationSupport(order = 9)
    @ApiOperation(value = "导出数据", notes = "传入evaluateTaskReferrer")
    public void exportListByTaskId(@PathVariable("taskId") Long taskId, HttpServletResponse response) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.select("*, count(*) as voteNum");
        queryWrapper.eq("evaluate_task_id", taskId);
        queryWrapper.orderByDesc("dept_name,count(*)");
        queryWrapper.groupBy("user_id");
        Page page = new Page();
        page.setSize(1);
        page.setCurrent(9999);
        IPage pages = evaluateTaskReferrerService.pageMaps(page, queryWrapper);
        ExcelUtil.export(response, "第一轮投票结果数据数据" + DateUtil.time(), "投票结果数据", page.getRecords(), ReferrerResultGroupExcel.class);
    }
    @GetMapping("/listInfo/{taskId}/{userId}")
    public R listInfo(@PathVariable("taskId") Long taskId,@PathVariable("userId") Long userId, Query query) {
        QueryWrapper queryWrapper = new QueryWrapper();
src/main/java/org/springblade/modules/evaluate/excel/ReferrerResultGroupExcel.java
New file
@@ -0,0 +1,71 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.evaluate.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serializable;
/**
 * 评优任务推荐人员表 Excel实体类
 *
 * @author aix
 * @since 2024-01-05
 */
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class ReferrerResultGroupExcel implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 姓名
     */
    @ColumnWidth(20)
    @ExcelProperty("姓名")
    private String userName;
    /**
     * 部门
     */
    @ColumnWidth(20)
    @ExcelProperty("部门")
    private String deptName;
    /**
     * 职位
     */
    @ColumnWidth(20)
    @ExcelProperty("职位")
    private String postName;
    /**
     * 票数
     */
    @ColumnWidth(20)
    @ExcelProperty("票数")
    private String viteNum;
}