Merge remote-tracking branch 'origin/main'

main
wanglei 6 months ago
commit 878a5dba69

@ -6,6 +6,8 @@ import javax.servlet.http.HttpServletResponse;
import com.ruoyi.kaohe.domain.*; import com.ruoyi.kaohe.domain.*;
import com.ruoyi.kaohe.service.IKhPcEmpService; import com.ruoyi.kaohe.service.IKhPcEmpService;
import com.ruoyi.kaohe.service.IKhVoteEmpService;
import com.ruoyi.kaohe.service.IKhVoteService;
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;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -27,26 +29,57 @@ import com.ruoyi.common.core.page.TableDataInfo;
/** /**
* Controller * Controller
* *
* @author hs * @author hs
* @date 2025-06-17 * @date 2025-06-17
*/ */
@RestController @RestController
@RequestMapping("/kaohe/pingce") @RequestMapping("/kaohe/pingce")
public class KhPingceController extends BaseController public class KhPingceController extends BaseController {
{
@Autowired @Autowired
private IKhPingceService khPingceService; private IKhPingceService khPingceService;
@Autowired @Autowired
private IKhPcEmpService pcEmpService; private IKhPcEmpService pcEmpService;
@Autowired
private IKhVoteEmpService voteEmpService;
@Autowired
private IKhVoteService khVoteService;
/**
*
*/
// @PreAuthorize("@ss.hasPermi('kaohe:pingce:list')")
@GetMapping("/generateResult")
public TableDataInfo generateResult(Long id) {
KhVote khVote = new KhVote();
khVote.setPingceId(id);
//查询该考核任务下的所有评分任务
List<KhVote> votes = khVoteService.selectKhVoteList(khVote);
for (KhVote vote : votes) {
KhVoteEmp khVoteEmp = new KhVoteEmp();
khVoteEmp.setVoteId(vote.getId());
//查询该评分任务对应的所有被考核对象详情
List<KhVoteEmp> khVoteEmps = voteEmpService.selectKhVoteEmpList(khVoteEmp);
for (KhVoteEmp voteEmp : khVoteEmps) {
//根据考核类型存储不同数据
if(vote.getKhitemTypeid().equals(1L)){
}else if(vote.getKhitemTypeid().equals(2L)) {
}else{
}
}
}
return getDataTable(null);
}
/** /**
* *
*/ */
@PreAuthorize("@ss.hasPermi('kaohe:pingce:list')") @PreAuthorize("@ss.hasPermi('kaohe:pingce:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(KhPingce khPingce) public TableDataInfo list(KhPingce khPingce) {
{
startPage(); startPage();
List<KhPingce> list = khPingceService.selectKhPingceList(khPingce); List<KhPingce> list = khPingceService.selectKhPingceList(khPingce);
return getDataTable(list); return getDataTable(list);
@ -58,8 +91,7 @@ public class KhPingceController extends BaseController
@PreAuthorize("@ss.hasPermi('kaohe:pingce:export')") @PreAuthorize("@ss.hasPermi('kaohe:pingce:export')")
@Log(title = "考核评测", businessType = BusinessType.EXPORT) @Log(title = "考核评测", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, KhPingce khPingce) public void export(HttpServletResponse response, KhPingce khPingce) {
{
List<KhPingce> list = khPingceService.selectKhPingceList(khPingce); List<KhPingce> list = khPingceService.selectKhPingceList(khPingce);
ExcelUtil<KhPingce> util = new ExcelUtil<KhPingce>(KhPingce.class); ExcelUtil<KhPingce> util = new ExcelUtil<KhPingce>(KhPingce.class);
util.exportExcel(response, list, "考核评测数据"); util.exportExcel(response, list, "考核评测数据");
@ -70,8 +102,7 @@ public class KhPingceController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('kaohe:pingce:query')") @PreAuthorize("@ss.hasPermi('kaohe:pingce:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("id") Long id) {
{
return success(khPingceService.selectKhPingceById(id)); return success(khPingceService.selectKhPingceById(id));
} }
@ -82,19 +113,18 @@ public class KhPingceController extends BaseController
@Log(title = "考核评测", businessType = BusinessType.INSERT) @Log(title = "考核评测", businessType = BusinessType.INSERT)
@Transactional @Transactional
@PostMapping @PostMapping
public AjaxResult add(@RequestBody KhPingce khPingce) public AjaxResult add(@RequestBody KhPingce khPingce) {
{
khPingceService.insertKhPingce(khPingce); khPingceService.insertKhPingce(khPingce);
//增加关联表 //增加关联表
List<Bkhdx> pcEmps = khPingce.getPcBkhdxs(); List<Bkhdx> pcEmps = khPingce.getPcBkhdxs();
if(pcEmps !=null&& pcEmps.size()>0){ if (pcEmps != null && pcEmps.size() > 0) {
for(Bkhdx item:pcEmps){ for (Bkhdx item : pcEmps) {
KhPcEmp pcEmp = new KhPcEmp(); KhPcEmp pcEmp = new KhPcEmp();
pcEmp.setPcId(khPingce.getId()); pcEmp.setPcId(khPingce.getId());
pcEmp.setBkhdxId(item.getBkhdxId()); pcEmp.setBkhdxId(item.getBkhdxId());
pcEmp.setBkhdxName(item.getBkhdxName()); pcEmp.setBkhdxName(item.getBkhdxName());
pcEmp.setDeptId(item.getDeptId()); pcEmp.setDeptId(item.getDeptId());
pcEmp.setDeptName(item.getDeptName()); pcEmp.setDeptName(item.getDeptName());
pcEmpService.insertKhPcEmp(pcEmp); pcEmpService.insertKhPcEmp(pcEmp);
} }
} }
@ -108,22 +138,21 @@ public class KhPingceController extends BaseController
@Log(title = "考核评测", businessType = BusinessType.UPDATE) @Log(title = "考核评测", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
@Transactional @Transactional
public AjaxResult edit(@RequestBody KhPingce khPingce) public AjaxResult edit(@RequestBody KhPingce khPingce) {
{
khPingceService.updateKhPingce(khPingce); khPingceService.updateKhPingce(khPingce);
List<Bkhdx> pcEmps = khPingce.getPcBkhdxs(); List<Bkhdx> pcEmps = khPingce.getPcBkhdxs();
if(pcEmps !=null&& pcEmps.size()>0){ if (pcEmps != null && pcEmps.size() > 0) {
//删除原来关联 //删除原来关联
KhPcEmp query = new KhPcEmp(); KhPcEmp query = new KhPcEmp();
query.setPcId(khPingce.getId()); query.setPcId(khPingce.getId());
List<KhPcEmp> temItems = pcEmpService.selectKhPcEmpList(query); List<KhPcEmp> temItems = pcEmpService.selectKhPcEmpList(query);
List<Long> ids = temItems.stream().map(KhPcEmp::getId).collect(Collectors.toList()); List<Long> ids = temItems.stream().map(KhPcEmp::getId).collect(Collectors.toList());
if(ids!=null&&ids.size()>0){ if (ids != null && ids.size() > 0) {
pcEmpService.deleteKhPcEmpByIds(ids.toArray(new Long[ids.size()])); pcEmpService.deleteKhPcEmpByIds(ids.toArray(new Long[ids.size()]));
} }
//增加新的关联 //增加新的关联
for(Bkhdx item:pcEmps){ for (Bkhdx item : pcEmps) {
KhPcEmp pcEmp = new KhPcEmp(); KhPcEmp pcEmp = new KhPcEmp();
pcEmp.setPcId(khPingce.getId()); pcEmp.setPcId(khPingce.getId());
pcEmp.setBkhdxId(item.getBkhdxId()); pcEmp.setBkhdxId(item.getBkhdxId());
@ -133,7 +162,7 @@ public class KhPingceController extends BaseController
pcEmpService.insertKhPcEmp(pcEmp); pcEmpService.insertKhPcEmp(pcEmp);
} }
} }
return AjaxResult.success(); return AjaxResult.success();
} }
/** /**
@ -141,13 +170,12 @@ public class KhPingceController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('kaohe:pingce:remove')") @PreAuthorize("@ss.hasPermi('kaohe:pingce:remove')")
@Log(title = "考核评测", businessType = BusinessType.DELETE) @Log(title = "考核评测", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) public AjaxResult remove(@PathVariable Long[] ids) {
{ for (Long id : ids) {
for(Long id:ids){
KhPingce khPingce = khPingceService.selectKhPingceById(id); KhPingce khPingce = khPingceService.selectKhPingceById(id);
if(!khPingce.getState().equals("0")){ if (!khPingce.getState().equals("0")) {
return AjaxResult.error("评测:"+khPingce.getPcTitle()+" 不是未开始状态,不允许删除"); return AjaxResult.error("评测:" + khPingce.getPcTitle() + " 不是未开始状态,不允许删除");
} }
} }
return toAjax(khPingceService.deleteKhPingceByIds(ids)); return toAjax(khPingceService.deleteKhPingceByIds(ids));

@ -1,19 +1,15 @@
package com.ruoyi.kaohe.controller; package com.ruoyi.kaohe.controller;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.kaohe.domain.KhPcEmp; import com.ruoyi.kaohe.domain.KhPcEmp;
import com.ruoyi.kaohe.domain.KhPingce;
import com.ruoyi.kaohe.domain.KhVoteEmp; import com.ruoyi.kaohe.domain.KhVoteEmp;
import com.ruoyi.kaohe.service.IKhPcEmpService; import com.ruoyi.kaohe.service.IKhPcEmpService;
import com.ruoyi.kaohe.service.IKhVoteEmpService; import com.ruoyi.kaohe.service.IKhVoteEmpService;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import java.math.BigDecimal;
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;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -90,6 +86,7 @@ public class KhVoteController extends BaseController {
@PreAuthorize("@ss.hasPermi('kaohe:vote:list')") @PreAuthorize("@ss.hasPermi('kaohe:vote:list')")
@GetMapping("/listByConditons") @GetMapping("/listByConditons")
public TableDataInfo getListByConditons(KhVote khVote) { public TableDataInfo getListByConditons(KhVote khVote) {
khVote.setState("2");
startPage(); startPage();
List<KhVote> list = khVoteService.getListByPcIdAndItemIds(khVote); List<KhVote> list = khVoteService.getListByPcIdAndItemIds(khVote);
return getDataTable(list); return getDataTable(list);
@ -129,7 +126,6 @@ public class KhVoteController extends BaseController {
KhPcEmp query = new KhPcEmp(); KhPcEmp query = new KhPcEmp();
query.setPcId(khVote.getPingceId()); query.setPcId(khVote.getPingceId());
List<KhPcEmp> pcEmps = pcEmpService.selectKhPcEmpList(query); List<KhPcEmp> pcEmps = pcEmpService.selectKhPcEmpList(query);
BigDecimal initv= new BigDecimal("O");
for (KhPcEmp pcEmp : pcEmps) { for (KhPcEmp pcEmp : pcEmps) {
//新增投票选项关联表 //新增投票选项关联表
KhVoteEmp voteEmp = new KhVoteEmp(); KhVoteEmp voteEmp = new KhVoteEmp();
@ -140,10 +136,10 @@ public class KhVoteController extends BaseController {
voteEmp.setPercentage(khVote.getPercentage()); voteEmp.setPercentage(khVote.getPercentage());
voteEmp.setKhitemTypeid(khVote.getKhitemTypeid()); voteEmp.setKhitemTypeid(khVote.getKhitemTypeid());
if(khVote.getKhitemTypeid().equals(1L)){ if(khVote.getKhitemTypeid().equals(1L)){
voteEmp.setOptionA(initv); voteEmp.setOptionA(BigDecimal.ZERO);
voteEmp.setOptionB(initv); voteEmp.setOptionB(BigDecimal.ZERO);
voteEmp.setOptionC(initv); voteEmp.setOptionC(BigDecimal.ZERO);
voteEmp.setOptionD(initv); voteEmp.setOptionD(BigDecimal.ZERO);
} }
voteEmpService.insertKhVoteEmp(voteEmp); voteEmpService.insertKhVoteEmp(voteEmp);
} }

@ -12,6 +12,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.kaohe.domain.KhVoteRecard; import com.ruoyi.kaohe.domain.KhVoteRecard;
import com.ruoyi.kaohe.domain.KhVoteRecardParam; import com.ruoyi.kaohe.domain.KhVoteRecardParam;
import com.ruoyi.kaohe.mapper.KhVoteItemsMapper;
import com.ruoyi.kaohe.mapper.KhVoteRecardMapper; import com.ruoyi.kaohe.mapper.KhVoteRecardMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -33,6 +34,8 @@ public class KhVoteEmpServiceImpl implements IKhVoteEmpService
private KhVoteEmpMapper khVoteEmpMapper; private KhVoteEmpMapper khVoteEmpMapper;
@Autowired @Autowired
private KhVoteRecardMapper khVoteRecardMapper; private KhVoteRecardMapper khVoteRecardMapper;
@Autowired
private KhVoteItemsMapper khVoteItemsMapper;
/** /**
* *
@ -116,6 +119,7 @@ public class KhVoteEmpServiceImpl implements IKhVoteEmpService
List<KhVoteEmp> voteEmpList = param.getVoteEmpList(); List<KhVoteEmp> voteEmpList = param.getVoteEmpList();
Date nowDate = DateUtils.getNowDate(); Date nowDate = DateUtils.getNowDate();
Long typeid = param.getKhitemTypeid(); Long typeid = param.getKhitemTypeid();
// khVoteItemsMapper.s 从数据库获取分值
BigDecimal a = new BigDecimal("100"); BigDecimal a = new BigDecimal("100");
BigDecimal b = new BigDecimal("80"); BigDecimal b = new BigDecimal("80");
BigDecimal c = new BigDecimal("60"); BigDecimal c = new BigDecimal("60");
@ -126,16 +130,16 @@ public class KhVoteEmpServiceImpl implements IKhVoteEmpService
KhVoteEmp oldvoteEmp = khVoteEmpMapper.selectKhVoteEmpById(voteEmp.getId()); KhVoteEmp oldvoteEmp = khVoteEmpMapper.selectKhVoteEmpById(voteEmp.getId());
if (typeid.equals(1L)) {//选项评分 if (typeid.equals(1L)) {//选项评分
//存储投票详情到map //存储投票详情到map
if(voteEmp.getOptionA().compareTo(new BigDecimal("0"))==1){ if(voteEmp.getOptionA().compareTo(BigDecimal.ZERO)==1){
xuanxiangDetails.put(voteEmp.getBkhdxName(),voteEmp.getOptionA()); xuanxiangDetails.put(voteEmp.getBkhdxName(),voteEmp.getOptionA());
} }
if(voteEmp.getOptionB().compareTo(new BigDecimal("0"))==1){ if(voteEmp.getOptionB().compareTo(BigDecimal.ZERO)==1){
xuanxiangDetails.put(voteEmp.getBkhdxName(),voteEmp.getOptionB()); xuanxiangDetails.put(voteEmp.getBkhdxName(),voteEmp.getOptionB());
} }
if(voteEmp.getOptionC().compareTo(new BigDecimal("0"))==1){ if(voteEmp.getOptionC().compareTo(BigDecimal.ZERO)==1){
xuanxiangDetails.put(voteEmp.getBkhdxName(),voteEmp.getOptionC()); xuanxiangDetails.put(voteEmp.getBkhdxName(),voteEmp.getOptionC());
} }
if(voteEmp.getOptionD().compareTo(new BigDecimal("0"))==1){ if(voteEmp.getOptionD().compareTo(BigDecimal.ZERO)==1){
xuanxiangDetails.put(voteEmp.getBkhdxName(),voteEmp.getOptionD()); xuanxiangDetails.put(voteEmp.getBkhdxName(),voteEmp.getOptionD());
} }
//修改投票情况 //修改投票情况

@ -53,7 +53,8 @@
select v.*,it.type_id from kh_vote v left join kh_items it on v.khitem_id =it.id select v.*,it.type_id from kh_vote v left join kh_items it on v.khitem_id =it.id
<where> <where>
<if test="pingceId != null "> and pingce_id = #{pingceId}</if> <if test="pingceId != null "> and pingce_id = #{pingceId}</if>
<if test="state != null and state != ''"> and state = #{state}</if> <!--状态值传1也就是展示所有状态不等于2非完成状态的数据-->
<if test="state != null and state != ''"> and state != #{state}</if>
<if test="itemIds != null"> and khitem_id in <if test="itemIds != null"> and khitem_id in
<foreach item="itemId" collection="itemIds" open="(" separator="," close=")"> <foreach item="itemId" collection="itemIds" open="(" separator="," close=")">
#{itemId} #{itemId}
@ -61,6 +62,7 @@
</if> </if>
</where> </where>
</select> </select>
<select id="selectUnfinishedVote" parameterType="KhVote" resultMap="KhVoteResult"> <select id="selectUnfinishedVote" parameterType="KhVote" resultMap="KhVoteResult">
select v.*,it.type_id from kh_vote v left join kh_items it on v.khitem_id =it.id select v.*,it.type_id from kh_vote v left join kh_items it on v.khitem_id =it.id
where v.state !='2' where v.state !='2'

Loading…
Cancel
Save