|
|
|
@ -1,6 +1,8 @@
|
|
|
|
package com.ruoyi.kaohe.controller;
|
|
|
|
package com.ruoyi.kaohe.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
|
|
import java.net.URLEncoder;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
@ -10,6 +12,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|
|
|
import com.ruoyi.kaohe.domain.*;
|
|
|
|
import com.ruoyi.kaohe.domain.*;
|
|
|
|
import com.ruoyi.kaohe.service.IKhVoteEmpService;
|
|
|
|
import com.ruoyi.kaohe.service.IKhVoteEmpService;
|
|
|
|
import com.ruoyi.kaohe.service.IKhVoteService;
|
|
|
|
import com.ruoyi.kaohe.service.IKhVoteService;
|
|
|
|
|
|
|
|
import com.ruoyi.kaohe.util.EnhancedJsonExporter;
|
|
|
|
import com.ruoyi.kaohe.util.PinYinUtil;
|
|
|
|
import com.ruoyi.kaohe.util.PinYinUtil;
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
@ -51,14 +54,16 @@ public class KhKhrwResultController extends BaseController {
|
|
|
|
@PreAuthorize("@ss.hasPermi('kaohe:kh_result:generate')")
|
|
|
|
@PreAuthorize("@ss.hasPermi('kaohe:kh_result:generate')")
|
|
|
|
@PostMapping("/generateResult")
|
|
|
|
@PostMapping("/generateResult")
|
|
|
|
public AjaxResult generateResult(KhPingce pc) { //传递参数 id、pcTitle、bkhdxtype
|
|
|
|
public AjaxResult generateResult(KhPingce pc) { //传递参数 id、pcTitle、bkhdxtype
|
|
|
|
|
|
|
|
boolean isUpdate=false;
|
|
|
|
//查询是否已经生成结果
|
|
|
|
//查询是否已经生成结果
|
|
|
|
KhKhrwResult resultQuery = new KhKhrwResult();
|
|
|
|
KhKhrwResult resultQuery = new KhKhrwResult();
|
|
|
|
resultQuery.setPcId(pc.getId());
|
|
|
|
resultQuery.setPcId(pc.getId());
|
|
|
|
List<KhKhrwResult> khKhrwResults = khKhrwResultService.selectKhKhrwResultList(resultQuery);
|
|
|
|
List<KhKhrwResult> khKhrwResults = khKhrwResultService.selectKhKhrwResultList(resultQuery);
|
|
|
|
if(khKhrwResults!=null&&khKhrwResults.size()>0){
|
|
|
|
if(khKhrwResults!=null&&khKhrwResults.size()>0){
|
|
|
|
return AjaxResult.error("该考核任务已有生成结果!");
|
|
|
|
isUpdate=true;
|
|
|
|
|
|
|
|
pc.setPcResultId(khKhrwResults.get(0).getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return khKhrwResultService.generateResult(pc);
|
|
|
|
return khKhrwResultService.generateResult(pc,isUpdate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
@ -83,6 +88,20 @@ public class KhKhrwResultController extends BaseController {
|
|
|
|
ExcelUtil<KhKhrwResult> util = new ExcelUtil<KhKhrwResult>(KhKhrwResult.class);
|
|
|
|
ExcelUtil<KhKhrwResult> util = new ExcelUtil<KhKhrwResult>(KhKhrwResult.class);
|
|
|
|
util.exportExcel(response, list, "考核结果数据");
|
|
|
|
util.exportExcel(response, list, "考核结果数据");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 根据考核结果id导出具体考核结果
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('kaohe:kh_result:export')")
|
|
|
|
|
|
|
|
@Log(title = "考核结果", businessType = BusinessType.EXPORT)
|
|
|
|
|
|
|
|
@PostMapping("/exportById")
|
|
|
|
|
|
|
|
public void exportById(HttpServletResponse response, Long id) throws Exception {
|
|
|
|
|
|
|
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
|
|
|
|
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("汇总数据.xlsx", "UTF-8"));
|
|
|
|
|
|
|
|
KhKhrwResult khrwResult = khKhrwResultService.selectKhKhrwResultById(id);
|
|
|
|
|
|
|
|
String tableHeader = khrwResult.getTableHeader();
|
|
|
|
|
|
|
|
String tableData = khrwResult.getTableData();
|
|
|
|
|
|
|
|
EnhancedJsonExporter.exportWithMergedHeader(tableHeader,tableData,response);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 获取考核结果详细信息
|
|
|
|
* 获取考核结果详细信息
|
|
|
|
|