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.service.IKhPcEmpService;
import com.ruoyi.kaohe.service.IKhVoteEmpService;
import com.ruoyi.kaohe.service.IKhVoteService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
@ -33,20 +35,51 @@ import com.ruoyi.common.core.page.TableDataInfo;
*/
@RestController
@RequestMapping("/kaohe/pingce")
public class KhPingceController extends BaseController
{
public class KhPingceController extends BaseController {
@Autowired
private IKhPingceService khPingceService;
@Autowired
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')")
@GetMapping("/list")
public TableDataInfo list(KhPingce khPingce)
{
public TableDataInfo list(KhPingce khPingce) {
startPage();
List<KhPingce> list = khPingceService.selectKhPingceList(khPingce);
return getDataTable(list);
@ -58,8 +91,7 @@ public class KhPingceController extends BaseController
@PreAuthorize("@ss.hasPermi('kaohe:pingce:export')")
@Log(title = "考核评测", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, KhPingce khPingce)
{
public void export(HttpServletResponse response, KhPingce khPingce) {
List<KhPingce> list = khPingceService.selectKhPingceList(khPingce);
ExcelUtil<KhPingce> util = new ExcelUtil<KhPingce>(KhPingce.class);
util.exportExcel(response, list, "考核评测数据");
@ -70,8 +102,7 @@ public class KhPingceController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('kaohe:pingce:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(khPingceService.selectKhPingceById(id));
}
@ -82,19 +113,18 @@ public class KhPingceController extends BaseController
@Log(title = "考核评测", businessType = BusinessType.INSERT)
@Transactional
@PostMapping
public AjaxResult add(@RequestBody KhPingce khPingce)
{
public AjaxResult add(@RequestBody KhPingce khPingce) {
khPingceService.insertKhPingce(khPingce);
//增加关联表
List<Bkhdx> pcEmps = khPingce.getPcBkhdxs();
if(pcEmps !=null&& pcEmps.size()>0){
for(Bkhdx item:pcEmps){
if (pcEmps != null && pcEmps.size() > 0) {
for (Bkhdx item : pcEmps) {
KhPcEmp pcEmp = new KhPcEmp();
pcEmp.setPcId(khPingce.getId());
pcEmp.setBkhdxId(item.getBkhdxId());
pcEmp.setBkhdxName(item.getBkhdxName());
pcEmp.setDeptId(item.getDeptId());
pcEmp.setDeptName(item.getDeptName());
pcEmp.setPcId(khPingce.getId());
pcEmp.setBkhdxId(item.getBkhdxId());
pcEmp.setBkhdxName(item.getBkhdxName());
pcEmp.setDeptId(item.getDeptId());
pcEmp.setDeptName(item.getDeptName());
pcEmpService.insertKhPcEmp(pcEmp);
}
}
@ -108,22 +138,21 @@ public class KhPingceController extends BaseController
@Log(title = "考核评测", businessType = BusinessType.UPDATE)
@PutMapping
@Transactional
public AjaxResult edit(@RequestBody KhPingce khPingce)
{
public AjaxResult edit(@RequestBody KhPingce khPingce) {
khPingceService.updateKhPingce(khPingce);
List<Bkhdx> pcEmps = khPingce.getPcBkhdxs();
if(pcEmps !=null&& pcEmps.size()>0){
if (pcEmps != null && pcEmps.size() > 0) {
//删除原来关联
KhPcEmp query = new KhPcEmp();
query.setPcId(khPingce.getId());
List<KhPcEmp> temItems = pcEmpService.selectKhPcEmpList(query);
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()]));
}
//增加新的关联
for(Bkhdx item:pcEmps){
for (Bkhdx item : pcEmps) {
KhPcEmp pcEmp = new KhPcEmp();
pcEmp.setPcId(khPingce.getId());
pcEmp.setBkhdxId(item.getBkhdxId());
@ -133,7 +162,7 @@ public class KhPingceController extends BaseController
pcEmpService.insertKhPcEmp(pcEmp);
}
}
return AjaxResult.success();
return AjaxResult.success();
}
/**
@ -141,13 +170,12 @@ public class KhPingceController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('kaohe:pingce:remove')")
@Log(title = "考核评测", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
for(Long id:ids){
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
for (Long id : ids) {
KhPingce khPingce = khPingceService.selectKhPingceById(id);
if(!khPingce.getState().equals("0")){
return AjaxResult.error("评测:"+khPingce.getPcTitle()+" 不是未开始状态,不允许删除");
if (!khPingce.getState().equals("0")) {
return AjaxResult.error("评测:" + khPingce.getPcTitle() + " 不是未开始状态,不允许删除");
}
}
return toAjax(khPingceService.deleteKhPingceByIds(ids));

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

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

@ -53,7 +53,8 @@
select v.*,it.type_id from kh_vote v left join kh_items it on v.khitem_id =it.id
<where>
<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
<foreach item="itemId" collection="itemIds" open="(" separator="," close=")">
#{itemId}
@ -61,6 +62,7 @@
</if>
</where>
</select>
<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
where v.state !='2'

Loading…
Cancel
Save