Merge remote-tracking branch 'origin/main'

main
wanglei 2 months ago
commit 1fee56ba26

@ -44,6 +44,10 @@ public class KhPingceController extends BaseController {
private IKhPingceService khPingceService;
@Autowired
private IKhPcEmpService pcEmpService;
@Autowired
private IKhVoteService khVoteService;
@Autowired
private IKhVoteEmpService khVoteEmpService;
/**
*
@ -152,4 +156,58 @@ public class KhPingceController extends BaseController {
}
return toAjax(khPingceService.deleteKhPingceByIds(ids));
}
/**
* voteemp voteemp
* vote_recard
*/
// @PreAuthorize("@ss.hasPermi('kaohe:pingce:remove')")
@Log(title = "考核评测", businessType = BusinessType.DELETE)
@DeleteMapping("/clean")
@Transactional
public AjaxResult removeTest() {
//已完成
KhPingce khPingce = new KhPingce();
khPingce.setState("2");
List<KhPingce> wPingces = khPingceService.selectKhPingceList(khPingce);
List<Long> wIds = wPingces.stream().map(KhPingce::getId).collect(Collectors.toList());
khPingceService.deleteKhPingceByIds2(wIds.toArray(new Long[wIds.size()]));
//进行中 的数据 清除关联的vote及voteemp数据为原始状态
KhPingce jxz = new KhPingce();
jxz.setState("1");
List<KhPingce> jxzPingces = khPingceService.selectKhPingceList(jxz);
List<Long> jxzIds = jxzPingces.stream().map(KhPingce::getId).collect(Collectors.toList());
for (Long jxzId : jxzIds) {
KhVote vote = new KhVote();
vote.setPingceId(jxzId);
List<KhVote> votes = khVoteService.selectKhVoteList(vote);
List<Long> vIds = votes.stream().map(KhVote::getId).collect(Collectors.toList());
if (vIds != null && vIds.size() > 0) {
//修改voteemp
for (Long vId : vIds) {
KhVoteEmp vemp = new KhVoteEmp();
vemp.setVoteId(vId);
List<KhVoteEmp> vEmps = khVoteEmpService.selectKhVoteEmpList(vemp);
if(vEmps != null && vEmps.size() > 0){
//修改关联的员工数据到最初创建状态
for (KhVoteEmp uPEmp : vEmps) {
uPEmp.setVoteNum(BigDecimal.ZERO);
uPEmp.setVoteScore(BigDecimal.ZERO);
uPEmp.setAvgScore(BigDecimal.ZERO);
uPEmp.setEndScore(BigDecimal.ZERO);
if(uPEmp.getKhitemTypeid().equals(1L)){
uPEmp.setOptionA(BigDecimal.ZERO);
uPEmp.setOptionB(BigDecimal.ZERO);
uPEmp.setOptionC(BigDecimal.ZERO);
uPEmp.setOptionD(BigDecimal.ZERO);
}
khVoteEmpService.updateKhVoteEmp(uPEmp);
}
}
}
}
}
return toAjax(1);
}
}

@ -97,7 +97,6 @@ public class KhVoteController extends BaseController {
}
}
}
/**

@ -58,4 +58,6 @@ public interface IKhPingceService
* @return
*/
public int deleteKhPingceById(Long id);
int deleteKhPingceByIds2(Long[] toArray);
}

@ -114,7 +114,7 @@ public class KhEmployeeServiceImpl implements IKhEmployeeService {
param.setWordId(khEmployee.getWordId());
List<KhEmployee> e = khEmployeeMapper.selectKhEmployeeList(param);
if (e!=null&& e.size() == 1) {
if(e.get(0).getId()!=khEmployee.getId()){
if(!e.get(0).getId().equals(khEmployee.getId())){
return AjaxResult.error("修改失败,工号已存在!");
}else{//没有修改员工工号 则直接修改
return khEmployeeMapper.updateKhEmployee(khEmployee)>0 ? AjaxResult.success() : AjaxResult.error();

@ -5,7 +5,11 @@ import java.util.stream.Collectors;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.kaohe.domain.KhPcEmp;
import com.ruoyi.kaohe.domain.KhVote;
import com.ruoyi.kaohe.domain.KhVoteEmp;
import com.ruoyi.kaohe.mapper.KhPcEmpMapper;
import com.ruoyi.kaohe.mapper.KhVoteEmpMapper;
import com.ruoyi.kaohe.mapper.KhVoteMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.kaohe.mapper.KhPingceMapper;
@ -26,6 +30,11 @@ public class KhPingceServiceImpl implements IKhPingceService
private KhPingceMapper khPingceMapper;
@Autowired
private KhPcEmpMapper khPcEmpMapper;
@Autowired
private KhVoteMapper khVoteMapper;
@Autowired
private KhVoteEmpMapper khVoteEmpMapper;
/**
*
@ -100,6 +109,42 @@ public class KhPingceServiceImpl implements IKhPingceService
}
return r;
}
@Override
@Transactional
public int deleteKhPingceByIds2(Long[] ids)
{
int r = khPingceMapper.deleteKhPingceByIds(ids);
for (Long id : ids) {
//删除原来关联的pcemp
KhPcEmp query = new KhPcEmp();
query.setPcId(id);
List<KhPcEmp> temItems = khPcEmpMapper.selectKhPcEmpList(query);
List<Long> pcEmpIds = temItems.stream().map(KhPcEmp::getId).collect(Collectors.toList());
if (pcEmpIds != null && pcEmpIds.size() > 0) {
khPcEmpMapper.deleteKhPcEmpByIds(pcEmpIds.toArray(new Long[pcEmpIds.size()]));
}
//删除原来关联的vote及voteemp
KhVote vote = new KhVote();
vote.setPingceId(id);
List<KhVote> votes = khVoteMapper.selectKhVoteList(vote);
List<Long> vIds = votes.stream().map(KhVote::getId).collect(Collectors.toList());
if (vIds != null && vIds.size() > 0) {
//清除vote
khVoteMapper.deleteKhVoteByIds(vIds.toArray(new Long[vIds.size()]));
//清除voteemp
for (Long vId : vIds) {
KhVoteEmp vemp = new KhVoteEmp();
vemp.setVoteId(vId);
List<KhVoteEmp> vEmps = khVoteEmpMapper.selectKhVoteEmpList(vemp);
List<Long> veIds = vEmps.stream().map(KhVoteEmp::getId).collect(Collectors.toList());
if(veIds != null && veIds.size() > 0){
khVoteEmpMapper.deleteKhVoteEmpByIds(veIds.toArray(new Long[veIds.size()]));
}
}
}
}
return r;
}
/**
*

@ -56,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="contact != null and contact != ''"> and contact = #{contact}</if>
<if test="contactPhone != null and contactPhone != ''"> and contact_phone = #{contactPhone}</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
</where>
</select>

@ -66,9 +66,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
select u.user_id, u.dept_id, u.nick_name, u.user_name,u.pc_id,u.pc_ids,u.pc_names,u.vote_ids, u.item_ids, u.item_names,u.uid, u.sex, u.email, u.avatar, u.phonenumber, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader
,ur.role_id from sys_user u
from sys_user u
left join sys_dept d on u.dept_id = d.dept_id
join sys_user_role ur on u.user_id = ur.user_id <!--改行后添加 为使用角色查询用户-->
left join sys_user_role ur on u.user_id = ur.user_id <!--改行后添加 为使用角色查询用户-->
where u.del_flag = '0'
<if test="userId != null and userId != 0">
AND u.user_id = #{userId}

Loading…
Cancel
Save