Commit 992a5e30 authored by 廖旭伟's avatar 廖旭伟

人员信息增加考核授权功能;人员离职时更新离职时间

parent 124c3eb4
......@@ -140,6 +140,32 @@ public class StaffEntity extends StaffVo {
* 最后登录时间
*/
private Date lastLoginTime;
/**
* 考勤授权(0.不启用,1.启用)
*/
private Integer attendCheck;
/**
* 评价授权(0.不启用,1.启用)
*/
private Integer complainCheck;
/**
* 投诉授权(0.不启用,1.启用)
*/
private Integer reviewCheck;
/**
* 办件授权(0.不启用,1.启用)
*/
private Integer goworkCheck;
/**
* 效能授权(0.不启用,1.启用)
*/
private Integer effectCheck;
/**
* 其他授权(0.不启用,1.启用)
*/
private Integer otherCheck;
@Override
public int hashCode() {
return this.getId().hashCode();
......@@ -211,5 +237,17 @@ public class StaffEntity extends StaffVo {
this.loginPwd = "";
this.lastLoginTime = null;
this.attendCheck = 0;
this.complainCheck = 0;
this.reviewCheck = 0;
this.goworkCheck = 0;
this.effectCheck = 0;
this.otherCheck = 0;
}
}
\ No newline at end of file
package com.mortals.xhx.module.staff.model.vo;
import lombok.Data;
@Data
public class StaffCheckAuthorizePdu {
private Long staffId;
/** 核查类型枚举CheckTypeEnum(1.考勤绩效,2.评价绩效,3.办件绩效,4.效能绩效,5.其它绩效,6.投诉绩效) */
private Integer type;
}
package com.mortals.xhx.module.staff.service;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.vo.StaffCheckAuthorizePdu;
import com.mortals.xhx.module.staff.model.vo.StaffInfoVo;
import java.util.List;
......@@ -30,4 +32,11 @@ public interface StaffService extends ICRUDCacheService<StaffEntity,Long> {
*/
Rest<Void> syncPersons(Context context);
/**
* 绩效考核授权
* @param pdu
* @return
*/
int checkAuthorize(StaffCheckAuthorizePdu pdu,Context context) throws AppException;
}
\ No newline at end of file
......@@ -34,6 +34,7 @@ import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.StaffLeaveEntity;
import com.mortals.xhx.module.staff.model.StaffLeaveQuery;
import com.mortals.xhx.module.staff.model.StaffQuery;
import com.mortals.xhx.module.staff.model.vo.StaffCheckAuthorizePdu;
import com.mortals.xhx.module.staff.model.vo.StaffInfoVo;
import com.mortals.xhx.module.staff.service.StaffLeaveService;
import com.mortals.xhx.module.staff.service.StaffService;
......@@ -207,6 +208,7 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
if (!ObjectUtils.isEmpty(key)) {
StaffEntity staff = item.getValue();
staff.setStatus(StaffSatusEnum.离职.getValue());
staff.setLeaveDate(new Date());
staff.setUpdateTime(new Date());
staff.setUpdateUserId(1L);
this.update(staff);
......@@ -365,6 +367,76 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
return params;
}
@Override
public int checkAuthorize(StaffCheckAuthorizePdu pdu,Context context) throws AppException {
StaffEntity temp = this.get(pdu.getStaffId());
if(temp == null){
throw new AppException("人员信息ID不正确");
}
CheckTypeEnum checkTypeEnum = CheckTypeEnum.getByValue(pdu.getType());
if(checkTypeEnum==null){
throw new AppException("考核类型不正确");
}
StaffEntity update = new StaffEntity();
update.setId(pdu.getStaffId());
//1.考勤绩效,2.评价绩效,3.办件绩效,4.效能绩效,5.其它绩效,6.投诉绩效
switch(checkTypeEnum){
case 考勤绩效:
if(temp.getAttendCheck()==1){
update.setAttendCheck(0);
}else {
update.setAttendCheck(1);
}
break;
case 评价绩效:
if(temp.getComplainCheck()==1){
update.setComplainCheck(0);
}else {
update.setComplainCheck(1);
}
break;
case 办件绩效:
if(temp.getGoworkCheck()==1){
update.setGoworkCheck(0);
}else {
update.setGoworkCheck(1);
}
break;
case 效能绩效:
if(temp.getEffectCheck()==1){
update.setEffectCheck(0);
}else {
update.setEffectCheck(1);
}
break;
case 其它绩效:
if(temp.getOtherCheck()==1){
update.setOtherCheck(0);
}else {
update.setOtherCheck(1);
}
break;
case 投诉绩效:
if(temp.getReviewCheck()==1){
update.setReviewCheck(0);
}else {
update.setReviewCheck(1);
}
break;
default:
if(temp.getOtherCheck()==1){
update.setOtherCheck(0);
}else {
update.setOtherCheck(1);
}
}
update.setUpdateTime(new Date());
if(context.getUser()!=null) {
update.setUpdateUserId(context.getUser().getId());
}
return dao.update(update);
}
public static void main(String[] args) {
System.out.println("1" + StrUtil.padPre("125", 7, "0"));
......
......@@ -28,12 +28,14 @@ import com.mortals.xhx.module.job.model.JobQuery;
import com.mortals.xhx.module.job.service.JobService;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.vo.HolidayListVo;
import com.mortals.xhx.module.staff.model.vo.StaffCheckAuthorizePdu;
import com.mortals.xhx.module.staff.model.vo.StaffInfoVo;
import com.mortals.xhx.module.staff.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
......@@ -221,5 +223,34 @@ public class StaffController extends BaseCRUDJsonBodyMappingController<StaffServ
public String delete(Long[] id) {
return super.delete(id);
}
@PostMapping(value = "check/authorize")
public String checkAuthorize(StaffCheckAuthorizePdu pdu) {
Map<String, Object> model = new HashMap();
if (pdu.getStaffId() == null) {
return this.createFailJsonResp("请选择待授权" + this.getModuleDesc() + "信息");
} else {
JSONObject ret = new JSONObject();
String busiDesc = "授权" + this.getModuleDesc();
Context context = this.getContext();
try {
this.service.checkAuthorize(pdu,context);
if (!ObjectUtils.isEmpty(context) && !ObjectUtils.isEmpty(context.getUser())) {
this.recordSysLog(this.request, busiDesc + " 【成功】");
}
} catch (Exception var8) {
this.doException(this.request, busiDesc, model, var8);
Object msg = model.get("message_info");
return this.createFailJsonResp(msg == null ? "系统异常" : msg.toString());
}
this.init(model, context);
ret.put("data", model);
ret.put("code", 1);
ret.put("msg", model.remove("message_info"));
return ret.toJSONString();
}
}
}
......@@ -884,3 +884,16 @@ CREATE TABLE `mortals_sys_holiday`
-- 2023-12-05 员工绩效分数初始化任务
-- --------------
INSERT INTO `mortals_xhx_task` (`name`, `taskKey`, `status`, `excuteService`, `excuteParam`, `excuteHost`, `excuteStrategy`, `excuteDate`, `excuteTime`, `remark`, `lastExcuteHost`, `lastExcuteTime`, `interimExcuteStatus`, `createTime`, `createUserId`, `createUserName`) VALUES ('员工绩效分数初始化任务', 'StaffPerformInitDataTask', '0', 'StaffPerformInitDataTask', NULL, NULL, '1', '0', '00:10', NULL, NULL, NULL, '0', NOW(), '1', '系统管理员');
-- ----------
-- 2024-01-08 更新人员信息离职时间,人员信息表增加考核授权
-- ----------
update mortals_xhx_staff s INNER JOIN mortals_xhx_staff_leave l ON s.id = l.staffId SET s.leaveDate = l.leaveDate;
ALTER TABLE `mortals_xhx_staff` ADD COLUMN `attendCheck` TINYINT (2) DEFAULT '0' COMMENT '考勤授权(0.不启用,1.启用)',
ADD COLUMN `complainCheck` TINYINT (2) DEFAULT '0' COMMENT '评价授权(0.不启用,1.启用)',
ADD COLUMN `reviewCheck` TINYINT (2) DEFAULT '0' COMMENT '投诉授权(0.不启用,1.启用)',
ADD COLUMN `goworkCheck` TINYINT (2) DEFAULT '0' COMMENT '办件授权(0.不启用,1.启用)',
ADD COLUMN `effectCheck` TINYINT (2) DEFAULT '0' COMMENT '效能授权(0.不启用,1.启用)',
ADD COLUMN `otherCheck` TINYINT (2) DEFAULT '0' COMMENT '其他授权(0.不启用,1.启用)';
\ No newline at end of file
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