Merge remote-tracking branch 'origin/main'

main
wanglei 5 months ago
commit 1f67af98f8

@ -37,8 +37,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
*/
@RestController
@RequestMapping("/kaohe/kh_result")
public class KhKhrwResultController extends BaseController
{
public class KhKhrwResultController extends BaseController {
@Autowired
private IKhKhrwResultService khKhrwResultService;
@Autowired
@ -52,13 +51,21 @@ public class KhKhrwResultController extends BaseController
@PreAuthorize("@ss.hasPermi('kaohe:kh_result:generate')")
@PostMapping("/generateResult")
public AjaxResult generateResult(KhPingce pc) { //传递参数 id、pcTitle、bkhdxtype
//查询是否已经生成结果
KhKhrwResult resultQuery = new KhKhrwResult();
resultQuery.setPcId(pc.getId());
List<KhKhrwResult> khKhrwResults = khKhrwResultService.selectKhKhrwResultList(resultQuery);
if(khKhrwResults!=null&&khKhrwResults.size()>0){
return AjaxResult.error("该考核任务已有生成结果!");
}
JSONArray header = new JSONArray();//存放表头及表格关联数据
JSONObject headerData = new JSONObject();
headerData.put("name", null);
headerData.put("label", pc.getPcTitle());
List<Object> children = new ArrayList<>();
JSONObject tableColumn = new JSONObject();
tableColumn.put("name", "khdxName");
tableColumn.put("name", "khdx");
if (pc.getBkhdxType().equals("0")) {
tableColumn.put("label", "单位");
} else {
@ -96,30 +103,26 @@ public class KhKhrwResultController extends BaseController
Collectors.toList())); // 根据getBkhdxName分组*/lists.stream().
//循环map得到对应数据
Set<Map.Entry<String, List<KhVoteEmp>>> entries = khdxMap.entrySet();
Integer index1=0;
for (Map.Entry<String, List<KhVoteEmp>> entry : entries) {
index1++;
BigDecimal sumScore = BigDecimal.ZERO;
String key = entry.getKey();
//获取表头数据
List<Object> children2 = new ArrayList<>();
List<Object> 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<KhVoteEmp> 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("name", pyVoteTitle);
tabledata.put("name", "khx"+index2);
tabledata.put("label", voteEmp.getVoteTitle());
Object objectData;
@ -132,9 +135,17 @@ public class KhKhrwResultController extends BaseController
xxpf.setOptionD(voteEmp.getOptionD());
xxpf.setAvgScore(voteEmp.getAvgScore());
xxpf.setPercentage(voteEmp.getPercentage());
objectData = xxpf;
// votesDatas.put(pyVoteTitle, xxpf);
votesDatas.put("khx"+index2, xxpf);
sumScore = sumScore.add(voteEmp.getEndScore());
if(index==1){
if (index1 == 1) {
List<Object> 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");
@ -153,53 +164,41 @@ public class KhKhrwResultController extends BaseController
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;
//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;
if (index1 == 1) {
// votesDatas.put(pyVoteTitle, voteEmp.getAvgScore());
votesDatas.put("khx"+index2, voteEmp.getAvgScore());
children2.add(tabledata);
}
sumScore = sumScore.add(voteEmp.getAvgScore());
if(index==1){{
child1.put("name","avgScore");
child1.put("label","得分");
children3.add(child1);
}}
}
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);
endData.add(pcdata);
if (index1 == 1) {
tableColumn2.put("children", children2);
}
}
children.add(tableColumn2);
JSONObject tableColumn3 = new JSONObject();
@ -224,8 +223,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<KhKhrwResult> list = khKhrwResultService.selectKhKhrwResultList(khKhrwResult);
return getDataTable(list);
@ -237,8 +235,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<KhKhrwResult> list = khKhrwResultService.selectKhKhrwResultList(khKhrwResult);
ExcelUtil<KhKhrwResult> util = new ExcelUtil<KhKhrwResult>(KhKhrwResult.class);
util.exportExcel(response, list, "考核结果数据");
@ -249,8 +246,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 +256,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 +266,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));
}
@ -282,8 +276,7 @@ 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)
{
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(khKhrwResultService.deleteKhKhrwResultByIds(ids));
}
}

@ -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;
}
}

@ -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;
}
}

@ -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;
}
}

Loading…
Cancel
Save