Commit e85cff9f by tangzhaoqian Committed by chenzg

登录缓存数据优化、员工绩效、历史归档、转派、终止考核

parent c6dff835
package cn.timer.api.aspect;
import java.lang.reflect.Method;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.lang.Console;
import cn.timer.api.aspect.lang.annotation.BindingResultCtrol;
import cn.timer.api.aspect.lang.annotation.Role;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import cn.timer.api.config.enums.SysRoleType;
import cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper;
import cn.timer.api.utils.ResultUtil;
/**
* 角色权限 处理
*
* @author Tang
*/
@Aspect
@Component
public class RoleAspect {
// private static final Logger log = LoggerFactory.getLogger(RoleAspect.class);
@Autowired
private QyzxEmpEntAssoMapper qyzxEmpEntAssoMapper;
@Resource
private HttpSession session;
// 配置织入点
@Pointcut("@annotation(cn.timer.api.aspect.lang.annotation.Role)")
public void RolePointCut() {
}
@Around("RolePointCut()")
public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
Object retVal;
// 获得注解
Role role = getAnnotationLog(joinPoint);
String httpMethodName = role.httpMethod().name();
List<Integer> sysRoleType = ListUtil.toList();
for (SysRoleType t : role.sysRoleType()) {
sysRoleType.add(t.getType());
}
QyzxEmpLogin eld = BeanUtil.toBean(session.getAttribute("ui"), QyzxEmpLogin.class);
Integer orgCode = eld.getOrgId();
Integer count = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper)
.eq(QyzxEmpEntAsso::getEmpNum, eld.getId())
.eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.in(QyzxEmpEntAsso::getUserType, sysRoleType)
.count();
if (count <= 0) {
switch (httpMethodName) {
case "POST":
retVal = ResultUtil.error("无权限操作");
break;
case "PUT":
retVal = ResultUtil.error("无权限编辑");
break;
case "GET":
retVal = ResultUtil.error("无权限查看");
break;
case "DELETE":
retVal = ResultUtil.error("无权限删除");
break;
default:
retVal = ResultUtil.error("无权限操作");
break;
}
return retVal;
}else {
return retVal = joinPoint.proceed(joinPoint.getArgs());
}
}
/**
* 是否存在注解,如果存在就获取
*/
private Role getAnnotationLog(JoinPoint joinPoint) {
Signature signature = joinPoint.getSignature();
MethodSignature methodSignature = (MethodSignature) signature;
Method method = methodSignature.getMethod();
if (method != null) {
return method.getAnnotation(Role.class);
}
return null;
}
}
package cn.timer.api.aspect.lang.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import cn.timer.api.config.enums.HttpMethod;
import cn.timer.api.config.enums.SysRoleType;
/**
* 自定义 角色 注解
*
* @author Tang
*
*/
@Target({ ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Role {
/**
* 操作 类型
*/
public HttpMethod httpMethod() default HttpMethod.POST;
/**
* 角色类型
*/
public SysRoleType[] sysRoleType() default {SysRoleType.U_TYPE_ADMIN,SysRoleType.U_TYPE_C_ADMIN};
}
......@@ -63,7 +63,25 @@ public class JxglAppraisal extends Model<JxglAppraisal> {
@ApiModelProperty(value = "状态 0目标填写 1目标确认 2自评 3上级评分 4 结果确认 5考核完成 6终止考核 7归档", example = "0")
private Integer sts;
// 已归档绩效
@TableField(exist = false)
private Integer archivedPNum;
// 进行中绩效
@TableField(exist = false)
private Integer underwayPNum;
// 最近绩效方案
@TableField(exist = false)
private String recentlyProject;
// 最近绩效评分
@TableField(exist = false)
private Double recentlyScore;
// 最近绩效等级
@TableField(exist = false)
private String recentlyLevel;
@TableField(exist = false)
private String userName;
......@@ -72,10 +90,16 @@ public class JxglAppraisal extends Model<JxglAppraisal> {
@TableField(exist = false)
private String bmName;
@TableField(exist = false)
private Date rzTime;
@TableField(exist = false)
private String executorName;
@TableField(exist = false)
private Double comprehensiveScore;
@TableField(exist = false)
private String level;
@TableField(exist = false)
private String confirmor;
}
\ No newline at end of file
......@@ -4,6 +4,8 @@ import java.util.Date;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
......@@ -11,6 +13,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import cn.timer.api.config.exception.ValidationMsg;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -37,10 +40,10 @@ public class JxglAppraisalAssessment extends Model<JxglAppraisalAssessment> {
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号 编号", example = "10")
private Integer id;
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "考核id 考核id", example = "10")
private Integer appraisalId;
......@@ -50,6 +53,7 @@ public class JxglAppraisalAssessment extends Model<JxglAppraisalAssessment> {
@ApiModelProperty(value = "评定人名称", example = "评定人名称")
private String assessorName;
@NotBlank(message = ValidationMsg.NOTBLANK)
@ApiModelProperty(value = "综合评分", example = "综合评分")
private String comprehensiveScore;
......@@ -63,6 +67,7 @@ public class JxglAppraisalAssessment extends Model<JxglAppraisalAssessment> {
@ApiModelProperty(value = "创建时间", example = "2020-10-10 10:10:10")
private Date createTime;
@NotBlank(message = ValidationMsg.NOTBLANK)
@ApiModelProperty(value = "等级", example = "等级")
private String level;
......
package cn.timer.api.bean.jxgl;
import java.util.Date;
import java.util.List;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
......@@ -97,4 +98,10 @@ public class JxglPerformanceAppraisal extends Model<JxglPerformanceAppraisal> {
@TableField(exist = false)
private Integer performanceArchive;
@TableField(exist = false)
private JxglAppraisal appraisal;
@TableField(exist = false)
private JxglAppraisalAssessment appraisalAssessment;
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.dto.login.QysDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -62,10 +63,6 @@ public class QyzxEmpLogin extends Model<QyzxEmpLogin> {
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value="注册时间 ",example="注册时间")
private Date regTime;
/*
* @ApiModelProperty(value="到期时间 ",example="到期时间") private Date endTime;
*/
@ApiModelProperty(value="头像地址 ",example="http://asd")
private String headUrl;
......@@ -86,4 +83,6 @@ public class QyzxEmpLogin extends Model<QyzxEmpLogin> {
@Builder.Default
private List<QysDto> qys = new ArrayList<QysDto>();
@TableField(exist = false)
private YgglMainEmp ygglMainEmp;
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import java.io.Serializable;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import cn.timer.api.config.swagger.IgnoreSwaggerParameter;
import cn.timer.api.dto.yggl.UserInfo;
import lombok.*;
@Data
......@@ -28,5 +29,9 @@ public class UserBean implements Serializable {
@IgnoreSwaggerParameter
private String refreshToken;
@IgnoreSwaggerParameter
private UserInfo userInfo;
}
......@@ -11,22 +11,7 @@ import lombok.Getter;
@Getter
public enum CommonEnum {
NULL_STR(0,""),
/**
* 1 超管理员
*/
U_TYPE_ADMIN(0, "超管理员"),
/**
* 2 子管理
*/
U_TYPE_C_ADMIN(1, "子管理"),
/**
* 3 普通员工
*/
U_TYPE_EMP(2, "普通员工"),
/**
* 0 关闭
......@@ -74,10 +59,6 @@ public enum CommonEnum {
*/
DEPT_TYPE_OFF(1,"关闭"),
/**
* 审批组-其他
*/
SPZ_OTHER(999999,"其他")
;
private Integer type;
......
package cn.timer.api.config.enums;
import lombok.Getter;
/**
* 角色类型
* @author Administrator
*
*/
@Getter
public enum SysRoleType {
/**
* 0 超管理员
*/
U_TYPE_ADMIN(0, "超管理员"),
/**
* 1 子管理
*/
U_TYPE_C_ADMIN(1, "子管理"),
/**
* 2 普通员工
*/
U_TYPE_EMP(2, "普通员工");
private Integer type;
private String desc;
SysRoleType(Integer type, String desc) {
this.type = type;
this.desc = desc;
}
public Integer getType() {
return this.type;
}
}
......@@ -10,10 +10,13 @@ import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;
import cn.hutool.core.bean.BeanUtil;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.controller.dzht.cn.tign.hz.constant.CacheKeyConstant;
import cn.timer.api.dto.yggl.UserInfo;
@Component
public class UserMethodArgumentResolver implements HandlerMethodArgumentResolver {
......@@ -38,19 +41,19 @@ public class UserMethodArgumentResolver implements HandlerMethodArgumentResolver
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
// String webRequestid = webRequest.getSessionId();
// String sessionid = session.getId();
QyzxEmpLogin eld = (QyzxEmpLogin) session.getAttribute("ui");
String token = (String) session.getAttribute(CacheKeyConstant.TOKEN);
String refreshToken = (String) session.getAttribute(CacheKeyConstant.REFRESH_TOKEN);
QyzxEmpLogin eld = BeanUtil.toBean(session.getAttribute("ui"), QyzxEmpLogin.class);
String token = BeanUtil.toBean(session.getAttribute(CacheKeyConstant.TOKEN), String.class);
String refreshToken = BeanUtil.toBean(session.getAttribute(CacheKeyConstant.REFRESH_TOKEN), String.class);
// Object phone = webRequest.getAttribute(currentUserAnnotation.id(),
// NativeWebRequest.SCOPE_SESSION);
Integer empNum = eld.getId();
Integer orgCode = eld.getOrgId();
// Integer empNum = (Integer) redisTemplate.get("empNum:"+sessionid);
// Integer orgCode = (Integer) redisTemplate.get("orgCode:"+sessionid);
UserBean userBean = UserBean.builder().token(token).refreshToken(refreshToken).empNum(empNum)
.orgCode(orgCode).qyzxEmpLogin(eld).build();
// log.info("webRequest:"+sessionid);
return userBean;
YgglMainEmp mE = eld.getYgglMainEmp();
UserInfo userInfo = UserInfo.builder().name(mE.getName()).phone(mE.getPhone()).bmgwId(mE.getBmgwId()).build();
return UserBean.builder().token(token).refreshToken(refreshToken).empNum(eld.getId())
.orgCode(eld.getOrgId()).userInfo(userInfo).qyzxEmpLogin(eld).build();
}
}
......@@ -21,10 +21,12 @@ import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.timer.api.aspect.lang.annotation.Log;
......@@ -43,9 +45,11 @@ import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enuminterface.YgEnumInterface;
import cn.timer.api.config.enuminterface.YgEnumInterface.YgJobType;
import cn.timer.api.config.enums.CommonEnum;
import cn.timer.api.config.enums.SysRoleType;
import cn.timer.api.controller.spmk.service.SpmkServiceImpl;
import cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper;
import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper;
import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dao.zzgl.ZzglBmgwMMapper;
import cn.timer.api.dto.login.QysDto;
import cn.timer.api.dto.qyzx.EntRegisterDto;
......@@ -144,6 +148,9 @@ public class LoginController {
private ZzglBmgwMMapper zzglBmgwMMapper;
@Autowired
private YgglMainEmpMapper ygglMainEmpMapper;
@Autowired
private AliyunSMS aliyunSMS;
// @Autowired
......@@ -254,7 +261,8 @@ public class LoginController {
String phone = entRegisterDto.getPhone();
String code = entRegisterDto.getCode().toString();
// String codeRedis = (String) redisTemplate.get(phone);
String codeRedis = session.getAttribute(phone).toString();
String codeRedis = BeanUtil.toBean(session.getAttribute(phone), String.class);
if (code == null || !code.equals(codeRedis)) {
return ResultUtil.error("验证码不符");
}
......@@ -315,8 +323,8 @@ public class LoginController {
return ResultUtil.error("新密码与原密码相同,请修改后重试!");
}
} else {
Object codeRedis = session.getAttribute(phone);
if (!code.equals(codeRedis.toString())) {
String codeRedis = BeanUtil.toBean(session.getAttribute(phone), String.class);
if (!code.equals(codeRedis)) {
return ResultUtil.error("短信验证码错误");
}
if (Md5.md5(pw).equals(dbPwd)) {
......@@ -343,8 +351,7 @@ public class LoginController {
String code = entRegisterDto.getCode();
if (entRegisterDto.getPwUpdateType() != 2) {
// String codeRedis =redisTemplate.get(phone).toString();
String codeRedis = session.getAttribute(phone).toString();
String codeRedis = BeanUtil.toBean(session.getAttribute(phone), String.class);
if (code == null) {
return ResultUtil.error("请填写验证码");
}
......@@ -404,7 +411,7 @@ public class LoginController {
String phone = entRegisterDto.getPhone();
String code = entRegisterDto.getCode();
// String codeRedis = redisTemplate.get(phone).toString();
String codeRedis = (String) session.getAttribute(phone);
String codeRedis = BeanUtil.toBean(session.getAttribute(phone), String.class);
if (code == null || !code.toString().equals(codeRedis)) {
return ResultUtil.error("验证码不符/失效");
......@@ -457,7 +464,7 @@ public class LoginController {
if (login != null) {
Integer count = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper)
.eq(QyzxEmpEntAsso::getEmpNum, login.getId())
.eq(QyzxEmpEntAsso::getUserType, CommonEnum.U_TYPE_ADMIN.getType()).count();
.eq(QyzxEmpEntAsso::getUserType, SysRoleType.U_TYPE_ADMIN.getType()).count();
if (count > max) {
return ResultUtil.error("已注册过企业");
......@@ -487,7 +494,7 @@ public class LoginController {
}
boolean b4 = YgglMainEmp.builder().orgCode(qyzxEntInfoM.getId()).empNum(login.getId()).rzTime(new Date())
.isManager(CommonEnum.U_TYPE_ADMIN.getType()).name(username).phone(phone)
.isManager(SysRoleType.U_TYPE_ADMIN.getType()).name(username).phone(phone)
.jobType(YgJobType.QUANZHI.getType()).jobStatus(YgEnumInterface.jobStatus.ZHENSHI.getType()).build()
.insert();
if (!b4) {
......@@ -497,7 +504,7 @@ public class LoginController {
// 员工企业关联表
QyzxEmpEntAsso qyzxEmpEntAsso = QyzxEmpEntAsso.builder().empNum(login.getId()).orgCode(qyzxEntInfoM.getId())
.status(1).userType(CommonEnum.U_TYPE_ADMIN.getType()).build();
.status(1).userType(SysRoleType.U_TYPE_ADMIN.getType()).build();
boolean b3 = qyzxEmpEntAsso.insert();
if (!b3) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
......@@ -533,10 +540,9 @@ public class LoginController {
String code = entRegisterDto.getCode();
String phone = entRegisterDto.getPhone();
// Object codeRedis = redisTemplate.get(phone);
Integer codeRedis = (Integer) session.getAttribute(phone);
String codeRedis = BeanUtil.toBean(session.getAttribute(phone), String.class);
if (codeRedis == null || !code.equals(codeRedis.toString()))
if (codeRedis == null || !code.equals(codeRedis))
return ResultUtil.error("验证码不符");
QyzxEmpLogin qyzxEmpLogin1 = new LambdaQueryChainWrapper<QyzxEmpLogin>(qyzxEmpLoginMapper)
......@@ -555,10 +561,13 @@ public class LoginController {
} catch (Exception e) {
e.printStackTrace();
}
List<QysDto> qys = qyzxEmpLoginMapper.getQys(qyzxEmpLogin1.getId());
if (qys.size() == 0)
return ResultUtil.error("没有任何公司可以查看!");
qyzxEmpLogin1.setQys(qys);
QysDto ctrl = qys.get(0);
if (qyzxEmpLogin1.getOrgId() != null) {
......@@ -568,22 +577,24 @@ public class LoginController {
}
}
// Stream<QysDto> s = qys.stream()
// .filter(item -> item.getStatus() == 1 && qyzxEmpLogin1.getOrgId().equals(item.getId()));
//
// if (s != null) {
// ctrl = s.findFirst().get();
// }
}
YgglMainEmp userInfo = ygglMainEmpMapper.selectOne(new QueryWrapper<YgglMainEmp>().lambda()
.select(YgglMainEmp::getName,YgglMainEmp::getPhone,YgglMainEmp::getBmgwId)
.eq(YgglMainEmp::getEmpNum, qyzxEmpLogin1.getId())
.eq(YgglMainEmp::getOrgCode, qyzxEmpLogin1.getOrgId()));
if (userInfo == null) {
return ResultUtil.error("账号不存在");
}
qyzxEmpLogin1.setYgglMainEmp(userInfo);
if (ctrl.getStatus() == null || ctrl.getStatus().equals(0)) {
return ResultUtil.error("帐号被禁用");
}
qyzxEmpLogin1.setOrgId(ctrl.getId());
@SuppressWarnings("unused")
String phone = qyzxEmpLogin1.getPhone();
if (CommonEnum.U_TYPE_ADMIN.getType().equals(ctrl.getUserType())
|| CommonEnum.U_TYPE_C_ADMIN.getType().equals(ctrl.getUserType())) {
if (SysRoleType.U_TYPE_ADMIN.getType().equals(ctrl.getUserType())
|| SysRoleType.U_TYPE_C_ADMIN.getType().equals(ctrl.getUserType())) {
} else {
// 获取权限
ArrayList<Integer> list = new ArrayList<Integer>();
......@@ -607,9 +618,7 @@ public class LoginController {
// 需要更新最后一次登陆信息
// 用户信息缓存
session.setAttribute("ui", qyzxEmpLogin1);
// redisTemplate.set("loginUser:" + phone, session.getId());
// redisTemplate.set("empNum:" + session.getId(), qyzxEmpLogin1.getId());
// redisTemplate.set("orgCode:" + session.getId(), qyzxEmpLogin1.getOrgId());
return ResultUtil.data(qyzxEmpLogin1);
}
......
package cn.timer.api.controller.jxgl;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -28,9 +24,9 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.timer.api.aspect.lang.annotation.Role;
import cn.timer.api.bean.jxgl.JxglAppraisal;
import cn.timer.api.bean.jxgl.JxglAppraisalAssessment;
import cn.timer.api.bean.jxgl.JxglAppraisalIndicators;
......@@ -55,7 +51,7 @@ import cn.timer.api.config.enuminterface.JxglEnumInterface.BeingAppraisalType;
import cn.timer.api.config.enuminterface.JxglEnumInterface.ExecuteType;
import cn.timer.api.config.enuminterface.JxglEnumInterface.ProcessNodeSts;
import cn.timer.api.config.enuminterface.JxglEnumInterface.ProcessType;
import cn.timer.api.config.enums.CommonEnum;
import cn.timer.api.config.enums.SysRoleType;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.controller.yggl.service.YgglService;
import cn.timer.api.controller.zzgl.service.ZzglBmgwMService;
......@@ -70,11 +66,14 @@ import cn.timer.api.dao.jxgl.JxglAppraisalTMapper;
import cn.timer.api.dao.jxgl.JxglBasicSettingMapper;
import cn.timer.api.dao.jxgl.JxglPerformanceAppraisalMapper;
import cn.timer.api.dao.jxgl.JxglPerformanceRatingMapper;
import cn.timer.api.dao.jxgl.JxglProcessNodeMapper;
import cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper;
import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dto.jxgl.AppraisalDetail;
import cn.timer.api.dto.jxgl.AppraisalQuery;
import cn.timer.api.dto.jxgl.BeingAppraisalPerson;
import cn.timer.api.dto.jxgl.EmpAppraisalQuery;
import cn.timer.api.dto.jxgl.EmpPerformanceQuery;
import cn.timer.api.dto.jxgl.PerformanceAppraisal;
import cn.timer.api.dto.jxgl.PerformanceAppraisalQuery;
import cn.timer.api.dto.jxgl.ProcessNode;
......@@ -84,7 +83,6 @@ import cn.timer.api.utils.ResultUtil;
import cn.timer.api.utils.StreamUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
@Api(tags = "3.1绩效管理")
@RestController
......@@ -118,12 +116,13 @@ public class JxglController {
@PostMapping(value = "/save_basic_setting")
@ApiOperation(value = "1.新增或编辑-基础设置", httpMethod = "POST", notes = "新增或编辑-审批模板组")
@ApiOperationSupport(order = 1)
@Role
public Result<Object> saveAtg(@CurrentUser UserBean userBean ,@Validated @RequestBody JxglBasicSetting basicSetting) throws Exception{
Integer orgCode = userBean.getOrgCode();
Integer count = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper)
.eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum())
.eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.in(QyzxEmpEntAsso::getUserType, CommonEnum.U_TYPE_ADMIN.getType(),CommonEnum.U_TYPE_C_ADMIN.getType())
.in(QyzxEmpEntAsso::getUserType, SysRoleType.U_TYPE_ADMIN.getType(),SysRoleType.U_TYPE_C_ADMIN.getType())
.count();
if (count <= 0) {
......@@ -169,6 +168,7 @@ public class JxglController {
@GetMapping(value = "/select_basic_setting")
@ApiOperation(value = "2.查询-基础设置", httpMethod = "GET", notes = "查询-基础设置")
@ApiOperationSupport(order = 2)
@Role
public Result<Object> selectAT(@CurrentUser UserBean userBean){
JxglBasicSetting bS = jxglBasicSettingMapper.selectAll(userBean.getOrgCode());
......@@ -186,23 +186,14 @@ public class JxglController {
@PostMapping(value = "/save_appraisal_t")
@ApiOperation(value = "3.新增或编辑-考核模板", httpMethod = "POST", notes = "新增或编辑-考核模板")
@ApiOperationSupport(order = 3)
@Role
public Result<Object> saveAtg(@CurrentUser UserBean userBean ,@Validated @RequestBody JxglAppraisalT jxglAppraisalT) throws Exception{
Integer orgCode = userBean.getOrgCode();
Integer count = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper)
.eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum())
.eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.in(QyzxEmpEntAsso::getUserType, CommonEnum.U_TYPE_ADMIN.getType(),CommonEnum.U_TYPE_C_ADMIN.getType())
.count();
if (count <= 0) {
return ResultUtil.error("无权限编辑");
}
if (jxglAppraisalT.getId() != null && jxglAppraisalT.selectCount(new QueryWrapper<JxglAppraisalT>().lambda()
.eq(JxglAppraisalT::getId, jxglAppraisalT.getId())) > 0) {
jxglAppraisalT.updateById();
}else {
jxglAppraisalT.setOrgCode(orgCode);
jxglAppraisalT.setOrgCode(userBean.getOrgCode());
jxglAppraisalT.insert();
}
LambdaQueryWrapper<JxglAppraisalIndicatorsT> q = new QueryWrapper<JxglAppraisalIndicatorsT>().lambda()
......@@ -247,6 +238,7 @@ public class JxglController {
@GetMapping(value = "/selects_appraisal_t")
@ApiOperation(value = "4.查询-考核模板-列表", httpMethod = "GET", notes = "查询-考核模板-列表")
@ApiOperationSupport(order = 4)
@Role
public Result<Object> selectListAT(@CurrentUser UserBean userBean, cn.timer.api.utils.Page page){
IPage<JxglAppraisalT> p = new Page<JxglAppraisalT>(page.getCurrentPage(),page.getTotalPage());
......@@ -266,6 +258,7 @@ public class JxglController {
@GetMapping(value = "/selects_appraisal_t/{id}")
@ApiOperation(value = "5.查询-考核模板-详情", httpMethod = "GET", notes = "查询-考核模板-详情")
@ApiOperationSupport(order = 5)
@Role
public Result<Object> selectAT(@CurrentUser UserBean userBean,@PathVariable Integer id){
JxglAppraisalT aT = jxglAppraisalTMapper.selectDetailById(id);
......@@ -280,22 +273,12 @@ public class JxglController {
@DeleteMapping(value = "/del_appraisal_t/{id}")
@ApiOperation(value = "6.删除-考核模板", httpMethod = "DELETE", notes = "删除-考核模板")
@ApiOperationSupport(order = 6)
@Role
public Result<Object> delAT(@CurrentUser UserBean userBean,@PathVariable Integer id) throws Exception{
Integer orgCode = userBean.getOrgCode();
Integer count = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper)
.eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum())
.eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.in(QyzxEmpEntAsso::getUserType, CommonEnum.U_TYPE_ADMIN.getType(),CommonEnum.U_TYPE_C_ADMIN.getType())
.count();
if (count <= 0) {
return ResultUtil.error("无权限编辑");
}
jxglAppraisalTMapper.delete(new QueryWrapper<JxglAppraisalT>().lambda()
.eq(JxglAppraisalT::getId, id)
.eq(JxglAppraisalT::getOrgCode, orgCode));
.eq(JxglAppraisalT::getOrgCode, userBean.getOrgCode()));
return ResultUtil.success();
......@@ -337,8 +320,7 @@ public class JxglController {
BeanUtil.copyProperties(performanceAppraisal, pA, "processNode","beingAppraisalPerson","appraisalTId");
pA.setProcessNode(ObjectUtil.serialize(performanceAppraisal.getProcessNode()));
pA.setBeingAppraisalPerson(ObjectUtil.serialize(performanceAppraisal.getBeingAppraisalPerson()));
// 新增 绩效考核
pA.insert();
System.out.println("新增 绩效考核 :" + pA);
List<ProcessNode> listPN = performanceAppraisal.getProcessNode();
......@@ -383,7 +365,9 @@ public class JxglController {
// 过滤掉 无需被考核人id
listEmpId = listEmpId.stream().filter(e -> !listNotEmpId.contains(e)).collect(Collectors.toList());
pA.setAppraisalPersonNum(listEmpId.size());
// 新增 绩效考核
pA.insert();
// 考核模板
JxglAppraisalT aT = jxglAppraisalTMapper.selectById(performanceAppraisal.getAppraisalTId());
if (aT == null) {
......@@ -395,6 +379,7 @@ public class JxglController {
JxglAppraisalIndicators appraisalIndicators = JxglAppraisalIndicators.builder().build();
JxglAppraisalItem appraisalItem = JxglAppraisalItem.builder().build();
JxglAppraisalLog appraisalLog = JxglAppraisalLog.builder().build();
System.out.println("listEmpId----"+listEmpId);
for (Integer bAP : listEmpId) {
// 考核
......@@ -445,12 +430,6 @@ public class JxglController {
listAIT.stream().forEach(aIT -> {
// 考核指标
// appraisalIndicators.setIsEdit(aIT.getIsEdit());
// appraisalIndicators.setIsSetWeight(aIT.getIsSetWeight());
// appraisalIndicators.setTitle(aIT.getTitle());
// appraisalIndicators.setType(aIT.getType());
// appraisalIndicators.setWeight(aIT.getWeight());
BeanUtil.copyProperties(aIT, appraisalIndicators, "appraisalId", "createTime", "updateTime");
appraisalIndicators.setAppraisalId(appraisal.getId());
// 新增 考核指标
......@@ -495,22 +474,34 @@ public class JxglController {
}
/**
* 查询-绩效考核-列表
* 查询-绩效考核-列表-归档
*/
@PostMapping(value = "/selects_performance_appraisal")
@ApiOperation(value = "8.查询-绩效考核-列表", httpMethod = "POST", notes = "查询-绩效考核-列表")
@PostMapping(value = "/selects_performance_appraisal_archive")
@ApiOperation(value = "8.查询-绩效考核-列表-非归档", httpMethod = "POST", notes = "查询-绩效考核-列表-非归档")
@ApiOperationSupport(order = 8)
public Result<Object> selectsPA(@CurrentUser UserBean userBean,@RequestBody PerformanceAppraisalQuery query){
Integer orgCode = userBean.getOrgCode();
Integer count = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper)
.eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum())
.eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.in(QyzxEmpEntAsso::getUserType, CommonEnum.U_TYPE_ADMIN.getType(),CommonEnum.U_TYPE_C_ADMIN.getType())
.count();
@Role
public Result<Object> selectsPAArchive(@CurrentUser UserBean userBean,@RequestBody PerformanceAppraisalQuery query){
if (count <= 0) {
return ResultUtil.error("无权限查看");
}
IPage<SpmkApproveSummary> page = new Page<SpmkApproveSummary>(query.getCurrentPage(),query.getTotalPage());
query.setOrgCode(userBean.getOrgCode());
IPage<JxglPerformanceAppraisal> pagePA = jxglPerformanceAppraisalMapper.selectArchiveListByQuery(page, query);
List<JxglPerformanceAppraisal> listPA = pagePA.getRecords();
return ResultUtil.data(pagePA,listPA);
}
/**
* 查询-绩效考核-列表-非归档
*/
@PostMapping(value = "/selects_performance_appraisal")
@ApiOperation(value = "9.查询-绩效考核-列表-归档", httpMethod = "POST", notes = "查询-绩效考核-列表-归档")
@ApiOperationSupport(order = 9)
@Role
public Result<Object> selectsPA(@CurrentUser UserBean userBean,@RequestBody PerformanceAppraisalQuery query){
IPage<SpmkApproveSummary> page = new Page<SpmkApproveSummary>(query.getCurrentPage(),query.getTotalPage());
......@@ -530,17 +521,8 @@ public class JxglController {
@PostMapping(value = "/selects_appraisal")
@ApiOperation(value = "10.查询-考核-列表", httpMethod = "POST", notes = "查询-考核-列表")
@ApiOperationSupport(order = 10)
@Role
public Result<Object> selectsA(@CurrentUser UserBean userBean,@RequestBody AppraisalQuery query){
Integer orgCode = userBean.getOrgCode();
Integer count = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper)
.eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum())
.eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.in(QyzxEmpEntAsso::getUserType, CommonEnum.U_TYPE_ADMIN.getType(),CommonEnum.U_TYPE_C_ADMIN.getType())
.count();
if (count <= 0) {
return ResultUtil.error("无权限查看");
}
IPage<JxglAppraisal> page = new Page<JxglAppraisal>(query.getCurrentPage(),query.getTotalPage());
query.setOrgCode(userBean.getOrgCode());
......@@ -559,19 +541,9 @@ public class JxglController {
@GetMapping(value = "/select_appraisal/{id}")
@ApiOperation(value = "11.查询-考核-详情", httpMethod = "GET", notes = "查询-考核-详情")
@ApiOperationSupport(order = 11)
@Role
public Result<Object> selectA(@CurrentUser UserBean userBean,@PathVariable Integer id){
Integer orgCode = userBean.getOrgCode();
Integer count = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper)
.eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum())
.eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.in(QyzxEmpEntAsso::getUserType, CommonEnum.U_TYPE_ADMIN.getType(),CommonEnum.U_TYPE_C_ADMIN.getType())
.count();
if (count <= 0) {
return ResultUtil.error("无权限查看");
}
AppraisalDetail aD = jxglAppraisalMapper.selectDetailById(userBean.getOrgCode(), id);
return ResultUtil.data(aD);
......@@ -584,19 +556,9 @@ public class JxglController {
@PutMapping(value = "/update_process_node")
@ApiOperation(value = "12.修改-流程执行人-转派", httpMethod = "PUT", notes = "修改-流程执行人-转派")
@ApiOperationSupport(order = 12)
@Role
public Result<Object> updatePN(@CurrentUser UserBean userBean,@RequestBody ProcessNodeUpdate processNodeUpdate){
Integer orgCode = userBean.getOrgCode();
Integer count = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper)
.eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum())
.eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.in(QyzxEmpEntAsso::getUserType, CommonEnum.U_TYPE_ADMIN.getType(),CommonEnum.U_TYPE_C_ADMIN.getType())
.count();
if (count <= 0) {
return ResultUtil.error("无权限查看");
}
Integer count2 = jxglAppraisalMapper.selectCount(new QueryWrapper<JxglAppraisal>().lambda()
.eq(JxglAppraisal::getId, processNodeUpdate.getAppraisalId())
.in(JxglAppraisal::getSts, AppraisalSts.ASSESSMENT_COMPLETE.getType(),
......@@ -621,26 +583,19 @@ public class JxglController {
@PutMapping(value = "/termination_assessment")
@ApiOperation(value = "13.终止-考核", httpMethod = "PUT", notes = "终止-考核")
@ApiOperationSupport(order = 13)
@Role
public Result<Object> terminationAssessment(@CurrentUser UserBean userBean,@PathVariable Integer id){
Integer orgCode = userBean.getOrgCode();
Integer count = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper)
.eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum())
.eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.in(QyzxEmpEntAsso::getUserType, CommonEnum.U_TYPE_ADMIN.getType(),CommonEnum.U_TYPE_C_ADMIN.getType())
.count();
if (count <= 0) {
return ResultUtil.error("无权限查看");
}
JxglAppraisal.builder().id(id).sts(AppraisalSts.TERMINATION_ASSESSMENT.getType()).build().updateById();
return ResultUtil.success();
}
@Autowired
JxglAppraisalAssessmentMapper appraisalAssessmentMapper;
private JxglAppraisalAssessmentMapper appraisalAssessmentMapper;
@Autowired
private JxglProcessNodeMapper processNodeMapper;
/**
* 新增-考核评定
......@@ -650,17 +605,6 @@ public class JxglController {
@ApiOperationSupport(order = 13)
public Result<Object> saveAA(@CurrentUser UserBean userBean,@RequestBody JxglAppraisalAssessment appraisalAssessment){
Integer orgCode = userBean.getOrgCode();
Integer count = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper)
.eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum())
.eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.in(QyzxEmpEntAsso::getUserType, CommonEnum.U_TYPE_ADMIN.getType(),CommonEnum.U_TYPE_C_ADMIN.getType())
.count();
if (count <= 0) {
return ResultUtil.error("无权限查看");
}
Integer count2 = jxglAppraisalMapper.selectCount(new QueryWrapper<JxglAppraisal>().lambda()
.eq(JxglAppraisal::getId, appraisalAssessment.getAppraisalId())
.in(JxglAppraisal::getSts, AppraisalSts.ASSESSMENT_COMPLETE.getType(),
......@@ -670,11 +614,92 @@ public class JxglController {
if (count2 > 0) {
return ResultUtil.error("考核已结束");
}
Integer empNum = userBean.getEmpNum();
JxglProcessNode pN = processNodeMapper.selectOne(new QueryWrapper<JxglProcessNode>().lambda()
.in(JxglProcessNode::getProcessType, ProcessType.SELF_ASSESSMENT,ProcessType.SUPERIOR_SCORE));
if (pN == null) {
return ResultUtil.error("在该流程状态 无法评价");
}else if (!empNum.equals(pN.getExecutorId())) {
return ResultUtil.error("无权限 评价");
}
appraisalAssessment.setAssessorName(userBean.getUserInfo().getName());
appraisalAssessment.setAssessorId(userBean.getEmpNum());
appraisalAssessment.insert();
return ResultUtil.data(appraisalAssessment);
}
/**
* 查询-所有员工绩效-汇总
*/
@PostMapping(value = "/selects_emp_performance")
@ApiOperation(value = "14.查询-所有员工绩效-汇总", httpMethod = "POST", notes = "查询-所有员工绩效-汇总")
@ApiOperationSupport(order = 14)
@Role
public Result<Object> selectsEP(@CurrentUser UserBean userBean,@RequestBody EmpPerformanceQuery query){
IPage<JxglAppraisal> page = new Page<JxglAppraisal>(query.getCurrentPage(),query.getTotalPage());
query.setOrgCode(userBean.getOrgCode());
IPage<JxglAppraisal> pageA = jxglAppraisalMapper.selectListEmpByQuery(page, query);
List<JxglAppraisal> listA = pageA.getRecords();
return ResultUtil.data(pageA,listA);
}
/**
* 查询-某员工考核-列表
*/
@PostMapping(value = "/selects_emp_appraisal")
@ApiOperation(value = "15.查询-某员工考核-列表", httpMethod = "POST", notes = "查询-某员工考核-列表")
@ApiOperationSupport(order = 15)
@Role
public Result<Object> selectsEA(@CurrentUser UserBean userBean,@RequestBody EmpAppraisalQuery query){
IPage<JxglPerformanceAppraisal> page = new Page<JxglPerformanceAppraisal>(query.getCurrentPage(),query.getTotalPage());
query.setOrgCode(userBean.getOrgCode());
IPage<JxglPerformanceAppraisal> pagePA = jxglPerformanceAppraisalMapper.selectListEmpByQuery(page, query);
List<JxglPerformanceAppraisal> listPA = pagePA.getRecords();
return ResultUtil.data(pagePA,listPA);
}
/**
* 查询-绩效考核-方案
*/
@GetMapping(value = "/selects_performance_appraisal/{id}")
@ApiOperation(value = "16.查询-绩效考核-方案", httpMethod = "GET", notes = "查询-绩效考核-方案")
@ApiOperationSupport(order = 16)
@Role
public Result<Object> selectPA(@CurrentUser UserBean userBean,@PathVariable Integer id){
JxglPerformanceAppraisal pA = jxglPerformanceAppraisalMapper.selectById(id);
if (pA == null) {
return ResultUtil.error("方案不存在");
}
PerformanceAppraisal paDto = PerformanceAppraisal.builder()
.name(pA.getName())
.period(pA.getPeriod())
.appraisalStartTime(pA.getAppraisalStartTime())
.appraisalEndTime(pA.getAppraisalEndTime())
.isVisible(pA.getIsVisible())
.scope(pA.getScope())
.appraisalTName(pA.getAppraisalTName())
.processNode(ObjectUtil.deserialize(pA.getProcessNode()))
.beingAppraisalPerson(ObjectUtil.deserialize(pA.getBeingAppraisalPerson()))
.build();
return ResultUtil.data(paDto);
}
}
......@@ -40,6 +40,7 @@ import cn.timer.api.bean.zzgl.ZzglBmgwM;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enums.CommonEnum;
import cn.timer.api.config.enums.SysRoleType;
import cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper;
import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper;
import cn.timer.api.dao.qyzx.QyzxEntInfoMMapper;
......@@ -277,8 +278,8 @@ public class QyzxController {
return ResultUtil.data(menus, "你不是该企业的用户!");
}
if (CommonEnum.U_TYPE_ADMIN.getType().equals(ctrl.getUserType())
|| CommonEnum.U_TYPE_C_ADMIN.getType().equals(ctrl.getUserType())) {
if (SysRoleType.U_TYPE_ADMIN.getType().equals(ctrl.getUserType())
|| SysRoleType.U_TYPE_C_ADMIN.getType().equals(ctrl.getUserType())) {
} else {
// 获取权限
ArrayList<Integer> list = new ArrayList<Integer>();
......
......@@ -80,9 +80,11 @@ import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enuminterface.YgEnumInterface;
import cn.timer.api.config.enuminterface.YgEnumInterface.jobStatus;
import cn.timer.api.config.enums.CommonEnum;
import cn.timer.api.config.enums.SysRoleType;
import cn.timer.api.config.exception.Regular;
import cn.timer.api.config.validation.ValidList;
import cn.timer.api.dao.clazz.CommonAreaMapper;
import cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper;
import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper;
import cn.timer.api.dao.yggl.YgMzDtoMapper;
import cn.timer.api.dao.yggl.YgglMainEmpMapper;
......@@ -124,6 +126,9 @@ public class YgglController {
@Autowired
private YgglMainEmpMapper ygglMainEmpMapper;
@Autowired
private QyzxEmpEntAssoMapper qyzxEmpEntAssoMapper;
@Autowired
private QyzxEmpLoginMapper qyzxEmpLoginMapper;
......@@ -272,7 +277,7 @@ public class YgglController {
if (ygglMainEmp == null) {
QyzxEmpEntAsso.builder()
.empNum(login.getId()).orgCode(orgCode).userType(CommonEnum.U_TYPE_EMP.getType()).status(CommonEnum.U_STS_ON.getType())
.empNum(login.getId()).orgCode(orgCode).userType(SysRoleType.U_TYPE_EMP.getType()).status(CommonEnum.U_STS_ON.getType())
.build()
.insert();
ygglMainEmp = YgglMainEmp.builder()
......@@ -449,7 +454,7 @@ public class YgglController {
}
QyzxEmpEntAsso.builder().empNum(login.getId()).orgCode(orgCode)
.userType(CommonEnum.U_TYPE_EMP.getType()).status(CommonEnum.U_STS_ON.getType()).build().insert();// usertype2普通员工 status1正常
.userType(SysRoleType.U_TYPE_EMP.getType()).status(CommonEnum.U_STS_ON.getType()).build().insert();// usertype2普通员工 status1正常
yme = YgglMainEmp.builder()
.name(name).phone(phone).zjType(zjType).zjNum(zjNum).jobType(jobType)
.jobStatus(YgEnumInterface.jobStatus.SHIYONG.getType()).rzTime(rzTime)
......@@ -1298,13 +1303,20 @@ public class YgglController {
YgglMainLzb.builder().empNum(empNum).jobStatus(YgEnumInterface.jobStatus.YILIZHI.getType()).sjlzTime(new Date())
.build().update(new UpdateWrapper<YgglMainLzb>().lambda().eq(YgglMainLzb::getEmpNum, empNum));
LambdaQueryWrapper<QyzxEmpEntAsso> queryWrapper = new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getEmpNum, empNum);
// 确认离职 删除员工关联表
QyzxEmpEntAsso.builder().empNum(lzygQueryDto.getEmpNum()).build()
.delete(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getEmpNum, empNum));
qyzxEmpEntAssoMapper.delete(queryWrapper);
// 初始化 部门主管
zzglBmgwMMapper.update(ZzglBmgwM.builder().leader(null).build(),
new UpdateWrapper<ZzglBmgwM>().lambda().eq(ZzglBmgwM::getLeader, empNum));
// 更新当前企业
List<QyzxEmpEntAsso> listEEA = qyzxEmpEntAssoMapper.selectList(queryWrapper);
if (listEEA != null && listEEA.size() > 0) {
QyzxEmpLogin.builder().id(empNum).orgId(CollUtil.getFirst(listEEA).getOrgCode()).build().updateById();
}
return ResultUtil.success("确认离职员工成功");
}
......
......@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.timer.api.bean.jxgl.JxglAppraisal;
import cn.timer.api.dto.jxgl.AppraisalDetail;
import cn.timer.api.dto.jxgl.AppraisalQuery;
import cn.timer.api.dto.jxgl.EmpPerformanceQuery;
/**
* 考核
......@@ -20,4 +21,6 @@ public interface JxglAppraisalMapper extends BaseMapper<JxglAppraisal> {
AppraisalDetail selectDetailById(Integer orgCode, Integer id);
IPage<JxglAppraisal> selectListEmpByQuery(IPage<JxglAppraisal> page,@Param("param") EmpPerformanceQuery query);
}
......@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.timer.api.bean.jxgl.JxglPerformanceAppraisal;
import cn.timer.api.bean.spmk.SpmkApproveSummary;
import cn.timer.api.dto.jxgl.EmpAppraisalQuery;
import cn.timer.api.dto.jxgl.PerformanceAppraisalQuery;
/**
......@@ -20,6 +21,11 @@ public interface JxglPerformanceAppraisalMapper extends BaseMapper<JxglPerforman
IPage<JxglPerformanceAppraisal> selectListByQuery(IPage<SpmkApproveSummary> page, @Param("param") PerformanceAppraisalQuery param);
IPage<JxglPerformanceAppraisal> selectListEmpByQuery(IPage<JxglPerformanceAppraisal> page,@Param("param") EmpAppraisalQuery query);
IPage<JxglPerformanceAppraisal> selectArchiveListByQuery(IPage<SpmkApproveSummary> page,@Param("param")
PerformanceAppraisalQuery query);
}
package cn.timer.api.dto.jxgl;
import javax.validation.constraints.NotNull;
import cn.timer.api.config.exception.ValidationMsg;
import cn.timer.api.utils.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EmpAppraisalQuery extends Page {
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "员工id", example = "")
private Integer id;
@ApiModelProperty(value = "企业id", example = "")
private Integer orgCode;
}
package cn.timer.api.dto.jxgl;
import javax.validation.constraints.NotNull;
import cn.timer.api.config.exception.ValidationMsg;
import cn.timer.api.utils.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EmpPerformanceQuery extends Page {
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "绩效考核id", example = "")
private Integer id;
@ApiModelProperty(value = "企业id", example = "")
private Integer orgCode;
@ApiModelProperty(value = "姓名、手机号", example = "")
private String query;
@ApiModelProperty(value = "部门id", example = "")
private Integer bmId;
}
package cn.timer.api.dto.jxgl;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import cn.timer.api.config.exception.ValidationMsg;
import cn.timer.api.utils.Page;
......
package cn.timer.api.dto.yggl;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class UserInfo {
private String name;
private String phone;
private Integer bmgwId;
}
......@@ -29,6 +29,28 @@
<result column="executor_name" property="executorName" />
<result column="comprehensive_score" property="comprehensiveScore" />
<result column="level" property="level" />
<result column="confirmor" property="confirmor" />
</resultMap>
<resultMap id="BaseResultMap_Emp" type="cn.timer.api.bean.jxgl.JxglAppraisal" >
<id column="id" property="id" />
<result column="performance_appraisal_id" property="performanceAppraisalId" />
<result column="emp_num" property="empNum" />
<result column="name" property="name" />
<result column="appraisal_explain" property="appraisalExplain" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="sts" property="sts" />
<result column="user_name" property="userName" />
<result column="phone" property="phone" />
<result column="bm_name" property="bmName" />
<result column="rz_time" property="rzTime" />
<result column="archivedPNum" property="archivedPNum" />
<result column="underwayPNum" property="underwayPNum" />
<result column="recentlyProject" property="recentlyProject" />
<result column="recentlyScore" property="recentlyScore" />
<result column="recentlyLevel" property="recentlyLevel" />
</resultMap>
<resultMap id="BaseResultMap_e" type="cn.timer.api.bean.jxgl.JxglAppraisalIndicators" >
......@@ -181,6 +203,7 @@
b.name user_name, b.phone,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = b.bmgw_id limit 1) limit 1) as bm_name,
(SELECT name FROM yggl_main_emp WHERE emp_num = c.executor_id AND org_code = #{param.orgCode}) as executor_name,
(SELECT executor_name FROM jxgl_process_node WHERE process_type = 4 AND sts = 2 LIMIT 1) as confirmor,
d.comprehensive_score ,d.level
FROM jxgl_appraisal a
LEFT JOIN yggl_main_emp b ON a.emp_num = b.emp_num AND b.org_code = #{param.orgCode}
......@@ -190,8 +213,8 @@
WHERE a.performance_appraisal_id = #{param.id}
<if test="param.query != null and param.query != ''">
and (
a.name like CONCAT('%',#{param.query},'%') or
a.phone like CONCAT('%',#{param.query},'%')
b.name like CONCAT('%',#{param.query},'%') or
b.phone like CONCAT('%',#{param.query},'%')
)
</if>
<if test="param.sts != null">
......@@ -200,6 +223,34 @@
ORDER BY a.id DESC
</select>
<select id="selectListEmpByQuery" resultMap="BaseResultMap_Emp" >
SELECT
a.emp_num,
b.name user_name, b.phone,b.rz_time,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = b.bmgw_id limit 1) limit 1) as bm_name,
SUM((CASE WHEN c.sts = 3 THEN 1 ELSE 0 END)) AS archivedPNum,
SUM((CASE WHEN c.sts in (0,1,2) THEN 1 ELSE 0 END)) AS underwayPNum,
(SELECT name FROM jxgl_performance_appraisal WHERE id = a.performance_appraisal_id ORDER BY create_time DESC LIMIT 1 ) recentlyProject,
(SELECT comprehensive_score FROM jxgl_appraisal_assessment WHERE type = 1 AND appraisal_id in (SELECT id FROM jxgl_appraisal WHERE emp_num = a.emp_num) ORDER BY create_time DESC LIMIT 1 ) recentlyScore,
(SELECT level FROM jxgl_appraisal_assessment WHERE type = 1 AND appraisal_id in (SELECT id FROM jxgl_appraisal WHERE emp_num = a.emp_num) ORDER BY create_time DESC LIMIT 1 ) recentlyLevel
FROM jxgl_appraisal a
LEFT JOIN yggl_main_emp b ON a.emp_num = b.emp_num AND b.org_code = #{param.orgCode}
LEFT JOIN jxgl_performance_appraisal c ON a.performance_appraisal_id = c.id
<!-- 缺部门 搜索 -->
<where>
<if test="param.query != null and param.query != ''">
and (
b.name like CONCAT('%',#{param.query},'%') or
b.phone like CONCAT('%',#{param.query},'%')
)
</if>
</where>
GROUP BY a.emp_num
ORDER BY a.id DESC
</select>
<select id="selectDetailById" resultMap="BaseResultMap_Detail">
SELECT
......
......@@ -42,6 +42,11 @@
<result column="performance_score" property="performanceScore" />
<result column="result_verification" property="resultVerification" />
<result column="performance_archive" property="performanceArchive" />
<association property="appraisal" column="b_id" javaType="cn.timer.api.bean.jxgl.JxglAppraisal" columnPrefix="b_"
resultMap="cn.timer.api.dao.jxgl.JxglAppraisalMapper.BaseResultMap" />
<association property="appraisalAssessment" column="c_id" javaType="cn.timer.api.bean.jxgl.JxglAppraisalAssessment" columnPrefix="c_"
resultMap="cn.timer.api.dao.jxgl.JxglAppraisalAssessmentMapper.BaseResultMap" />
</resultMap>
<sql id="Base_Column_List">
......@@ -80,6 +85,29 @@
a.update_time
</sql>
<sql id="Base_Column_List_b">
b.id b_id,
b.performance_appraisal_id b_performance_appraisal_id,
b.emp_num b_emp_num,
b.name b_name,
b.appraisal_explain b_appraisal_explain,
b.create_time b_create_time,
b.update_time b_update_time,
b.sts b_sts
</sql>
<sql id="Base_Column_List_c">
c.id c_id,
c.appraisal_id c_appraisal_id,
c.assessor_id c_assessor_id,
c.assessor_name c_assessor_name,
c.comprehensive_score c_comprehensive_score,
c.remarks c_remarks,
c.type c_type,
c.create_time c_create_time,
c.level c_level
</sql>
<sql id="Base_Column_List_Alias">
id JxglPerformanceAppraisal_id,
org_code JxglPerformanceAppraisal_org_code,
......@@ -107,7 +135,7 @@
SUM((CASE WHEN b.sts = 7 THEN 1 ELSE 0 END)) AS performance_archive
FROM jxgl_performance_appraisal a
LEFT JOIN jxgl_appraisal b ON a.id = b.performance_appraisal_id
WHERE a.org_code = #{param.orgCode}
WHERE a.org_code = #{param.orgCode} AND a.sts != 3
<if test="param.query != null and param.query != ''">
and (
a.name like CONCAT('%',#{param.query},'%')
......@@ -126,7 +154,45 @@
ORDER BY a.id DESC
</select>
<select id="selectArchiveListByQuery" resultMap="BaseResultMap_ALl" >
SELECT
<include refid="Base_Column_List_a" />,
SUM((CASE WHEN b.sts in (0,1) THEN 1 ELSE 0 END)) AS target_seting,
SUM((CASE WHEN b.sts in (2,3) THEN 1 ELSE 0 END)) AS performance_score,
SUM((CASE WHEN b.sts in (4,5) THEN 1 ELSE 0 END)) AS result_verification,
SUM((CASE WHEN b.sts = 7 THEN 1 ELSE 0 END)) AS performance_archive
FROM jxgl_performance_appraisal a
LEFT JOIN jxgl_appraisal b ON a.id = b.performance_appraisal_id
WHERE a.org_code = #{param.orgCode} AND a.sts = 3
<if test="param.query != null and param.query != ''">
and (
a.name like CONCAT('%',#{param.query},'%')
)
</if>
<if test="param.startTime != null and param.startTime != ''">
and a.create_time <![CDATA[ >= ]]> #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
and a.create_time <![CDATA[ <= ]]> #{param.endTime}
</if>
GROUP BY a.id
ORDER BY a.id DESC
</select>
<select id="selectListEmpByQuery" resultMap="BaseResultMap_ALl" >
SELECT
a.name,a.appraisal_start_time,a.appraisal_end_time,
b.sts b_sts,
c.comprehensive_score c_comprehensive_score,
c.level c_level
FROM jxgl_performance_appraisal a
LEFT JOIN jxgl_appraisal b ON b.performance_appraisal_id = a.id
LEFT JOIN jxgl_appraisal_assessment c ON b.id = c.appraisal_id
WHERE a.org_code = #{param.orgCode} AND b.emp_num = #{param.id} AND c.type = 1
</select>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.jxgl.JxglPerformanceAppraisal">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment