From a728ac78275966964509bc1574bdeed61a2e8952 Mon Sep 17 00:00:00 2001 From: hshansha Date: Thu, 10 Jul 2025 09:41:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=A0=E6=AF=94=E3=80=81=E5=8D=95=E7=8B=AC?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=8E=B7=E5=8F=96=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/KhKhrwResultController.java | 155 ++++++++---------- .../java/com/ruoyi/kaohe/domain/KhDdpf.java | 29 ---- .../java/com/ruoyi/kaohe/domain/KhPfzb.java | 45 ----- .../java/com/ruoyi/kaohe/domain/KhXxpf.java | 20 +-- 4 files changed, 78 insertions(+), 171 deletions(-) delete mode 100644 ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/domain/KhDdpf.java delete mode 100644 ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/domain/KhPfzb.java diff --git a/ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/controller/KhKhrwResultController.java b/ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/controller/KhKhrwResultController.java index 01c3762..c6abf7e 100644 --- a/ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/controller/KhKhrwResultController.java +++ b/ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/controller/KhKhrwResultController.java @@ -31,14 +31,13 @@ import com.ruoyi.common.core.page.TableDataInfo; /** * 考核结果Controller - * + * * @author hs * @date 2025-07-05 */ @RestController @RequestMapping("/kaohe/kh_result") -public class KhKhrwResultController extends BaseController -{ +public class KhKhrwResultController extends BaseController { @Autowired private IKhKhrwResultService khKhrwResultService; @Autowired @@ -58,7 +57,7 @@ public class KhKhrwResultController extends BaseController headerData.put("label", pc.getPcTitle()); List children = new ArrayList<>(); JSONObject tableColumn = new JSONObject(); - tableColumn.put("name", "khdxName"); + tableColumn.put("name", "khdx"); if (pc.getBkhdxType().equals("0")) { tableColumn.put("label", "单位"); } else { @@ -73,7 +72,7 @@ public class KhKhrwResultController extends BaseController //----------------------------------------------------------------------------------------- - JSONArray endData = new JSONArray (); //存放表格数据 + JSONArray endData = new JSONArray(); //存放表格数据 List lists = new ArrayList<>(); KhVote khVote = new KhVote(); @@ -96,31 +95,27 @@ public class KhKhrwResultController extends BaseController Collectors.toList())); // 根据getBkhdxName分组*/lists.stream(). //循环map得到对应数据 Set>> entries = khdxMap.entrySet(); + Integer index1=0; for (Map.Entry> entry : entries) { - BigDecimal sumScore=BigDecimal.ZERO; + index1++; + BigDecimal sumScore = BigDecimal.ZERO; String key = entry.getKey(); //获取表头数据 List children2 = new ArrayList<>(); - List children3 = new ArrayList<>(); - JSONObject child1 = new JSONObject(); - JSONObject child2 = new JSONObject(); - JSONObject child3 = new JSONObject(); - JSONObject child4 = new JSONObject(); - JSONObject child5 = new JSONObject(); - JSONObject child6 = new JSONObject(); //------------------------------------------------------------------------------------------------------ //获取表数据 JSONObject pcdata = new JSONObject(); List value = entry.getValue(); JSONObject votesDatas = new JSONObject(); - Integer index=0; + Integer index2 = 0; for (KhVoteEmp voteEmp : value) { - index++; - String pyVoteTitle = PinYinUtil.getPinyinInitials(voteEmp.getVoteTitle()); + index2++; + // String pyVoteTitle = PinYinUtil.getPinyinInitials(voteEmp.getVoteTitle()); JSONObject tabledata = new JSONObject(); - tabledata.put("name", pyVoteTitle); - tabledata.put("label", voteEmp.getVoteTitle()); + // tabledata.put("name", pyVoteTitle); + tabledata.put("name", "khx"+index2); + tabledata.put("label", voteEmp.getVoteTitle()); Object objectData; //根据考核类型存储不同数据 @@ -132,73 +127,69 @@ public class KhKhrwResultController extends BaseController xxpf.setOptionD(voteEmp.getOptionD()); xxpf.setAvgScore(voteEmp.getAvgScore()); xxpf.setPercentage(voteEmp.getPercentage()); - objectData = xxpf; - sumScore=sumScore.add(voteEmp.getEndScore()); - if(index==1){ - child1.put("name","optionA"); - child1.put("label","优秀"); - child2.put("name","optionB"); - child2.put("label","合格"); - child3.put("name","optionC"); - child3.put("label","基本合格"); - child4.put("name","optionD"); - child4.put("label","不合格"); - child5.put("name","avgScore"); - child5.put("label","得分"); - child6.put("name","percentage"); - child6.put("label","占比"); + // votesDatas.put(pyVoteTitle, xxpf); + votesDatas.put("khx"+index2, xxpf); + sumScore = sumScore.add(voteEmp.getEndScore()); + if (index1 == 1) { + List children3 = new ArrayList<>(); + JSONObject child1 = new JSONObject(); + JSONObject child2 = new JSONObject(); + JSONObject child3 = new JSONObject(); + JSONObject child4 = new JSONObject(); + JSONObject child5 = new JSONObject(); + JSONObject child6 = new JSONObject(); + child1.put("name", "optionA"); + child1.put("label", "优秀"); + child2.put("name", "optionB"); + child2.put("label", "合格"); + child3.put("name", "optionC"); + child3.put("label", "基本合格"); + child4.put("name", "optionD"); + child4.put("label", "不合格"); + child5.put("name", "avgScore"); + child5.put("label", "得分"); + child6.put("name", "percentage"); + child6.put("label", "占比"); children3.add(child1); children3.add(child2); children3.add(child3); children3.add(child4); children3.add(child5); children3.add(child6); + tabledata.put("children", children3); + children2.add(tabledata); } - - - } else if (voteEmp.getKhitemTypeid().equals(2L)) {//评分占比 - KhPfzb pfzb = new KhPfzb(); - pfzb.setAvgScore(voteEmp.getAvgScore()); - pfzb.setPercentage(voteEmp.getPercentage()); - objectData = pfzb; - sumScore=sumScore.add(voteEmp.getEndScore()); - + //votesDatas.put(pyVoteTitle, voteEmp.getAvgScore()); + votesDatas.put("khx"+index2, voteEmp.getAvgScore()); + // votesDatas.put(pyVoteTitle+"_zb", voteEmp.getPercentage()); + votesDatas.put("khx"+index2+"_zb", voteEmp.getPercentage()); + sumScore = sumScore.add(voteEmp.getEndScore()); - if(index==1){ - child1.put("name","avgScore"); - child1.put("label","得分"); - child2.put("name","percentage"); - child2.put("label","占比"); - children3.add(child2); - children3.add(child1); + if (index1 == 1) { + JSONObject tabledata2 = new JSONObject(); + // tabledata2.put("name", pyVoteTitle + "_zb"); + tabledata2.put("name", "khx"+index2 + "_zb"); + tabledata2.put("label", "占比"); + children2.add(tabledata); + children2.add(tabledata2); } - - } else {//单独评分 - KhDdpf ddpf = new KhDdpf(); - ddpf.setAvgScore(voteEmp.getAvgScore()); - objectData = ddpf; - sumScore=sumScore.add(voteEmp.getAvgScore()); - - - if(index==1){{ - child1.put("name","avgScore"); - child1.put("label","得分"); - children3.add(child1); - }} + if (index1 == 1) { + // votesDatas.put(pyVoteTitle, voteEmp.getAvgScore()); + votesDatas.put("khx"+index2, voteEmp.getAvgScore()); + children2.add(tabledata); + } + sumScore = sumScore.add(voteEmp.getAvgScore()); } - votesDatas.put(pyVoteTitle, objectData); - - tabledata.put("children",children3); - children2.add(tabledata); } - pcdata.put("khdxName", key); + pcdata.put("khdx", key); pcdata.put(pyPCtitle, votesDatas); - pcdata.put("df",sumScore); + pcdata.put("df", sumScore); endData.add(pcdata); - - tableColumn2.put("children",children2); + if (index1 == 1) { + tableColumn2.put("children", children2); + } } children.add(tableColumn2); @@ -206,7 +197,7 @@ public class KhKhrwResultController extends BaseController tableColumn3.put("name", "df"); tableColumn3.put("label", "得分"); children.add(tableColumn3); - headerData.put("children",children); + headerData.put("children", children); header.add(headerData); @@ -216,7 +207,7 @@ public class KhKhrwResultController extends BaseController pcResult.setTableHeader(header.toJSONString()); pcResult.setTableData(endData.toJSONString()); khKhrwResultService.insertKhKhrwResult(pcResult); - return AjaxResult.success(); + return AjaxResult.success(header); } /** @@ -224,8 +215,7 @@ public class KhKhrwResultController extends BaseController */ @PreAuthorize("@ss.hasPermi('kaohe:kh_result:list')") @GetMapping("/list") - public TableDataInfo list(KhKhrwResult khKhrwResult) - { + public TableDataInfo list(KhKhrwResult khKhrwResult) { startPage(); List list = khKhrwResultService.selectKhKhrwResultList(khKhrwResult); return getDataTable(list); @@ -237,8 +227,7 @@ public class KhKhrwResultController extends BaseController @PreAuthorize("@ss.hasPermi('kaohe:kh_result:export')") @Log(title = "考核结果", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export(HttpServletResponse response, KhKhrwResult khKhrwResult) - { + public void export(HttpServletResponse response, KhKhrwResult khKhrwResult) { List list = khKhrwResultService.selectKhKhrwResultList(khKhrwResult); ExcelUtil util = new ExcelUtil(KhKhrwResult.class); util.exportExcel(response, list, "考核结果数据"); @@ -249,8 +238,7 @@ public class KhKhrwResultController extends BaseController */ @PreAuthorize("@ss.hasPermi('kaohe:kh_result:query')") @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) - { + public AjaxResult getInfo(@PathVariable("id") Long id) { return success(khKhrwResultService.selectKhKhrwResultById(id)); } @@ -260,8 +248,7 @@ public class KhKhrwResultController extends BaseController @PreAuthorize("@ss.hasPermi('kaohe:kh_result:add')") @Log(title = "考核结果", businessType = BusinessType.INSERT) @PostMapping - public AjaxResult add(@RequestBody KhKhrwResult khKhrwResult) - { + public AjaxResult add(@RequestBody KhKhrwResult khKhrwResult) { return toAjax(khKhrwResultService.insertKhKhrwResult(khKhrwResult)); } @@ -271,8 +258,7 @@ public class KhKhrwResultController extends BaseController @PreAuthorize("@ss.hasPermi('kaohe:kh_result:edit')") @Log(title = "考核结果", businessType = BusinessType.UPDATE) @PutMapping - public AjaxResult edit(@RequestBody KhKhrwResult khKhrwResult) - { + public AjaxResult edit(@RequestBody KhKhrwResult khKhrwResult) { return toAjax(khKhrwResultService.updateKhKhrwResult(khKhrwResult)); } @@ -281,9 +267,8 @@ public class KhKhrwResultController extends BaseController */ @PreAuthorize("@ss.hasPermi('kaohe:kh_result:remove')") @Log(title = "考核结果", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) - { + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(khKhrwResultService.deleteKhKhrwResultByIds(ids)); } } diff --git a/ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/domain/KhDdpf.java b/ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/domain/KhDdpf.java deleted file mode 100644 index 4920fb6..0000000 --- a/ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/domain/KhDdpf.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ruoyi.kaohe.domain; - -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; - -import java.math.BigDecimal; - -/** - * 单独评分 - * - * @author hs - * @date 2025-06-23 - */ -public class KhDdpf extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** 最终分数 */ - @Excel(name = "得分") - private BigDecimal avgScore; - - public BigDecimal getAvgScore() { - return avgScore; - } - - public void setAvgScore(BigDecimal avgScore) { - this.avgScore = avgScore; - } -} diff --git a/ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/domain/KhPfzb.java b/ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/domain/KhPfzb.java deleted file mode 100644 index cecddba..0000000 --- a/ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/domain/KhPfzb.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.ruoyi.kaohe.domain; - -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.core.domain.BaseEntity; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -import java.math.BigDecimal; - -/** - * 评分占比 - * - * @author hs - * @date 2025-06-23 - */ -public class KhPfzb extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - - /** 最终分数 */ - @Excel(name = "得分") - private BigDecimal avgScore; - - /** 评分占比(0-1之间) */ - @Excel(name = "评分占比(0-1之间)") - private BigDecimal percentage; - - - public BigDecimal getPercentage() { - return percentage; - } - - public void setPercentage(BigDecimal percentage) { - this.percentage = percentage; - } - - public BigDecimal getAvgScore() { - return avgScore; - } - - public void setAvgScore(BigDecimal avgScore) { - this.avgScore = avgScore; - } -} diff --git a/ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/domain/KhXxpf.java b/ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/domain/KhXxpf.java index fe85310..7656796 100644 --- a/ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/domain/KhXxpf.java +++ b/ruoyi-kaohe/src/main/java/com/ruoyi/kaohe/domain/KhXxpf.java @@ -26,10 +26,6 @@ public class KhXxpf { @Excel(name = "不合格") private BigDecimal optionD; -/* *//** 平均分数 *//* - @Excel(name = "平均分数") - private BigDecimal avgScore;*/ - /** 最终分数 */ @Excel(name = "得分") private BigDecimal avgScore; @@ -70,14 +66,6 @@ public class KhXxpf { this.optionD = optionD; } - public BigDecimal getPercentage() { - return percentage; - } - - public void setPercentage(BigDecimal percentage) { - this.percentage = percentage; - } - public BigDecimal getAvgScore() { return avgScore; } @@ -85,4 +73,12 @@ public class KhXxpf { public void setAvgScore(BigDecimal avgScore) { this.avgScore = avgScore; } + + public BigDecimal getPercentage() { + return percentage; + } + + public void setPercentage(BigDecimal percentage) { + this.percentage = percentage; + } }