基于javaweb+mysql的springboot企业员工绩效工资管理系统(java+springboot+freemarker+mysql)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot企业员工绩效工资管理系统(java+springboot+freemarker+mysql)
超级管理员等角色,除基础脚手架外,实现的功能有:
超级管理员:系统管理、用户管理(冻结等)、职称管理、部门管理(工资项)、岗位管理(考核指标管理,可指定部门)、工龄管理等。
普通员工:考勤管理(查看自己的考勤记录)、工资管理(查看自己的工资详情)。
HR人事:员工管理、考勤管理、工资管理。
部门经理:部门绩效考核管理、年度考核管理、考核指标管理。
运行环境:windows/Linux均可、jdk1.8、mysql5.7、idea/eclipse均可。
return Result.error(CodeMsg.ADMIN_PASSWORD_ERROR);
}
//表示密码正确,接下来判断用户状态是否可用
if(findByUsername.getStatus() == User.ADMIN_USER_STATUS_UNABLE){
return Result.error(CodeMsg.ADMIN_USER_UNABLE);
}
//检查用户所属角色状态是否可用
if(findByUsername.getRole() == null || findByUsername.getRole().getStatus() == Role.ADMIN_ROLE_STATUS_UNABLE){
return Result.error(CodeMsg.ADMIN_USER_ROLE_UNABLE);
}
//检查用户所属角色的权限是否存在
if(findByUsername.getRole().getAuthorities() == null || findByUsername.getRole().getAuthorities().size() == 0){
return Result.error(CodeMsg.ADMIN_USER_ROLE_AUTHORITES_EMPTY);
}
//检查一切符合,可以登录,将用户信息存放至session
request.getSession().setAttribute(SessionConstant.SESSION_USER_LOGIN_KEY, findByUsername);
request.getSession().setAttribute("loginType",type);
//销毁session中的验证码
request.getSession().setAttribute("admin_login", null);
//将登陆记录写入日志库
operaterLogService.add("用户【"+username+"】于【" + StringUtil.getFormatterDate(new Date(), "yyyy-MM-dd HH:mm:ss") + "】登录系统!");
log.info("用户成功登录,user = " + findByUsername);
}else{
Staff byJobNumber = staffService.findByNameAndIsStatus(username);
//判断是否为空
if(byJobNumber == null){
return Result.error(CodeMsg.ADMIN_USERNAME_NO_EXIST);
}
//表示用户存在,进一步对比密码是否正确
if(!byJobNumber.getPassword().equals(password)){
return Result.error(CodeMsg.ADMIN_PASSWORD_ERROR);
}
//检查用户所属角色状态是否可用
if(byJobNumber.getRole() == null || byJobNumber.getRole().getStatus() == Role.ADMIN_ROLE_STATUS_UNABLE){
return Result.error(CodeMsg.ADMIN_USER_ROLE_UNABLE);
}
//检查用户所属角色的权限是否存在
if(byJobNumber.getRole().getAuthorities() == null || byJobNumber.getRole().getAuthorities().size() == 0){
return Result.error(CodeMsg.ADMIN_USER_ROLE_AUTHORITES_EMPTY);
}
* 工资Controller
*/
@Controller
@RequestMapping("/admin/salary")
public class SalaryController {
@Autowired
private SalaryService salaryService;
@Autowired
private StaffService staffService;
@Autowired
private WageItemService wageItemService;
@Autowired
private AttendanceService attendanceService;
@Autowired
private WorkingYearsService workingYearsService;
@Autowired
private PeranceAssmentService peranceAssmentService;
@Autowired
private AnnualAssessmentService annualAssessmentService;
/**
* 分页查询列表
* @param model
* @param salary
* @param pageBean
* @return
*/
@RequestMapping("/list")
public String list(Model model, Salary salary, PageBean<Salary> pageBean,
String month,String jobNumber){
model.addAttribute("title","工资列表");
model.addAttribute("jobNumber",jobNumber);
model.addAttribute("month",month);
model.addAttribute("pageBean",salaryService.findList(salary,pageBean,jobNumber));
return "admin/salary/list";
}
/**
@ResponseBody
public Result<Boolean> delete(@RequestParam(name="id",required=true)Long id){
try{
workingYearsService.delete(id);
}catch (Exception e){
return Result.error(CodeMsg.ADMIN_WORKING_YEARS_DELETE_ERROR);
}
operaterLogService.add("删除工龄补贴,工龄ID:" + id);
return Result.success(true);
}
}
/**
* 后台用户管理控制器
*
*/
@RequestMapping("/admin/user")
@Controller
public class UserController {
@Autowired
private UserService userService;
@Autowired
private RoleService roleService;
@Autowired
private OperaterLogService operaterLogService;
/**
* 用户列表页面
* @param model
* @param user
* @param pageBean
* @return
/**
* 工龄添加提交处理
* @param workingYears
* @return
*/
@RequestMapping(value = "/add",method = RequestMethod.POST)
@ResponseBody
public Result<Boolean> add(WorkingYears workingYears){
//用统一验证实体方法验证是否合法
CodeMsg validate = ValidateEntityUtil.validate(workingYears);
if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
return Result.error(validate);
}
if(workingYearsService.findByYears(workingYears.getYears())!=null){
return Result.error(CodeMsg.ADMIN_WORKING_YEARS_EXIST_ERROR);
}
if(workingYearsService.save(workingYears) == null){
return Result.error(CodeMsg.ADMIN_WORKING_YEARS_ADD_ERROR);
}
operaterLogService.add("添加工龄,工龄补贴为:" + workingYears.getSubsidy());
return Result.success(true);
}
/**
* 编辑页面
* @param model
* @param id
* @return
*/
@RequestMapping("/edit")
public String edit(Model model,@RequestParam(name="id",required=true)Long id){
model.addAttribute("workYears",workingYearsService.find(id));
return "/admin/working_years/edit";
}
/**
* 编辑表单提交处理
* @param workingYears
* @return
*/
@RequestMapping(value = "/edit",method = RequestMethod.POST)
@ResponseBody
public Result<Boolean> edit(WorkingYears workingYears){
//用统一验证实体方法验证是否合法
CodeMsg validate = ValidateEntityUtil.validate(workingYears);
if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
return Result.error(validate);
}
salary.setDepartment(staff.getDepartment());
setSalary(salary);
if(salaryService.save(salary) == null){
return Result.error(CodeMsg.ADMIN_SALARY_SAVE_ERROR);
}
return Result.success(true);
}
public Salary setSalary(Salary salary){
BigDecimal basicWage = salary.getStaff().getSalary();
int daysByYearMonth = DateUtil.getDaysByYearMonth(salary.getYear(), salary.getMonthOfDay());
//该月平均每日工资
BigDecimal dayBasicWage = basicWage.divide(BigDecimal.valueOf(daysByYearMonth),4,BigDecimal.ROUND_HALF_UP);
//查询工资项
WageItem wageItem = wageItemService.findFirstByOrderByCreateTimeDesc();
//餐饮补贴
BigDecimal foodSubsidy = BigDecimal.ZERO;
//交通补贴
BigDecimal travelAllowance = BigDecimal.ZERO;
//出差补贴
BigDecimal missionAllowance = BigDecimal.ZERO;
//加班奖金
BigDecimal overTimeBonus = BigDecimal.ZERO;
//全勤奖金
BigDecimal attendanceBonus = BigDecimal.ZERO;
//迟到罚金
BigDecimal latePenalty = BigDecimal.ZERO;
//早退罚金
BigDecimal leaveEarlyFine = BigDecimal.ZERO;
//病假罚金
BigDecimal sick = BigDecimal.ZERO;
//事假罚金
BigDecimal personalLeave = BigDecimal.ZERO;
//缺勤罚金
BigDecimal absence = BigDecimal.ZERO;
//绩效奖金
BigDecimal performance = BigDecimal.ZERO;
//年度考核奖金
BigDecimal annualAssessmentBonus = BigDecimal.ZERO;
if(wageItem != null){
CodeMsg validate = ValidateEntityUtil.validate(menu);
if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
return Result.error(validate);
}
if(menu.getParent() != null){
if(menu.getParent().getId() == null){
menu.setParent(null);
}
}
Menu existMenu = menuService.find(menu.getId());
if(existMenu == null){
Result.error(CodeMsg.ADMIN_MENU_ID_ERROR);
}
//表示验证都通过,开始添加数据库
existMenu.setIcon(menu.getIcon());
existMenu.setName(menu.getName());
existMenu.setParent(menu.getParent());
existMenu.setSort(menu.getSort());
existMenu.setUrl(menu.getUrl());
existMenu.setButton(menu.isButton());
existMenu.setShow(menu.isShow());
if(menuService.save(existMenu) == null){
Result.error(CodeMsg.ADMIN_MENU_ADD_ERROR);
}
//数据库添加操作成功,记录日志
operaterLogService.add("编辑菜单信息【" + existMenu + "】");
return Result.success(true);
}
/**
* 删除菜单信息
* @param request
* @param id
* @return
*/
@RequestMapping(value="/delete",method=RequestMethod.POST)
@ResponseBody
public Result<Boolean> delete(@RequestParam(name="id",required=true)Long id){
try {
menuService.delete(id);
} catch (Exception e) {
return Result.error(CodeMsg.ADMIN_MENU_DELETE_ERROR);
}
//数据库添加操作成功,记录日志
operaterLogService.add("删除菜单信息,菜单ID【" + id + "】");
return Result.success(true);
}
}
/**
* 后台角色管理控制器
*
*/
@RequestMapping("/admin/role")
@Controller
public class RoleController {
private Logger log = LoggerFactory.getLogger(RoleController.class);
@Autowired
private MenuService menuService;
@Autowired
private OperaterLogService operaterLogService;
@Autowired
private RoleService roleService;
/**
* 分页搜索角色列表
* @param model
* @param role
* @param pageBean
* @return
*/
@RequestMapping(value="/list")
public String list(Model model,Role role,PageBean<Role> pageBean){
model.addAttribute("title", "角色列表");
if(type == LoginType.ADMINISTRATOR.getCode()){
//表示验证码正确,开始查询数据库,检验密码是否正确
User findByUsername = userService.findByUsername(username);
//判断是否为空
if(findByUsername == null){
return Result.error(CodeMsg.ADMIN_USERNAME_NO_EXIST);
}
//表示用户存在,进一步对比密码是否正确
if(!findByUsername.getPassword().equals(password)){
return Result.error(CodeMsg.ADMIN_PASSWORD_ERROR);
}
//表示密码正确,接下来判断用户状态是否可用
if(findByUsername.getStatus() == User.ADMIN_USER_STATUS_UNABLE){
return Result.error(CodeMsg.ADMIN_USER_UNABLE);
}
//检查用户所属角色状态是否可用
if(findByUsername.getRole() == null || findByUsername.getRole().getStatus() == Role.ADMIN_ROLE_STATUS_UNABLE){
return Result.error(CodeMsg.ADMIN_USER_ROLE_UNABLE);
}
//检查用户所属角色的权限是否存在
if(findByUsername.getRole().getAuthorities() == null || findByUsername.getRole().getAuthorities().size() == 0){
return Result.error(CodeMsg.ADMIN_USER_ROLE_AUTHORITES_EMPTY);
}
//检查一切符合,可以登录,将用户信息存放至session
request.getSession().setAttribute(SessionConstant.SESSION_USER_LOGIN_KEY, findByUsername);
request.getSession().setAttribute("loginType",type);
//销毁session中的验证码
request.getSession().setAttribute("admin_login", null);
//将登陆记录写入日志库
operaterLogService.add("用户【"+username+"】于【" + StringUtil.getFormatterDate(new Date(), "yyyy-MM-dd HH:mm:ss") + "】登录系统!");
log.info("用户成功登录,user = " + findByUsername);
}else{
Staff byJobNumber = staffService.findByNameAndIsStatus(username);
//判断是否为空
if(byJobNumber == null){
return Result.error(CodeMsg.ADMIN_USERNAME_NO_EXIST);
}
//表示用户存在,进一步对比密码是否正确
if(!byJobNumber.getPassword().equals(password)){
return Result.error(CodeMsg.ADMIN_PASSWORD_ERROR);
}
//检查用户所属角色状态是否可用
* 工龄添加提交处理
* @param workingYears
* @return
*/
@RequestMapping(value = "/add",method = RequestMethod.POST)
@ResponseBody
public Result<Boolean> add(WorkingYears workingYears){
//用统一验证实体方法验证是否合法
CodeMsg validate = ValidateEntityUtil.validate(workingYears);
if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
return Result.error(validate);
}
if(workingYearsService.findByYears(workingYears.getYears())!=null){
return Result.error(CodeMsg.ADMIN_WORKING_YEARS_EXIST_ERROR);
}
if(workingYearsService.save(workingYears) == null){
return Result.error(CodeMsg.ADMIN_WORKING_YEARS_ADD_ERROR);
}
operaterLogService.add("添加工龄,工龄补贴为:" + workingYears.getSubsidy());
return Result.success(true);
}
/**
* 编辑页面
* @param model
* @param id
* @return
*/
@RequestMapping("/edit")
public String edit(Model model,@RequestParam(name="id",required=true)Long id){
model.addAttribute("workYears",workingYearsService.find(id));
return "/admin/working_years/edit";
}
/**
* 编辑表单提交处理
* @param workingYears
* @return
*/
@RequestMapping(value = "/edit",method = RequestMethod.POST)
@ResponseBody
public Result<Boolean> edit(WorkingYears workingYears){
//用统一验证实体方法验证是否合法
CodeMsg validate = ValidateEntityUtil.validate(workingYears);
if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
return Result.error(validate);
}
//工伤
BigDecimal occupationalInjury = BigDecimalUtil.multiply(shouldSalary,PercentageEnum.OCCUPATIONAL_INJURY.getRate()).setScale(2,BigDecimal.ROUND_HALF_UP);
salary.setOccupationalInjury(occupationalInjury.negate());
//生育
BigDecimal childbirth = BigDecimalUtil.multiply(shouldSalary,PercentageEnum.CHILDBIRTH.getRate()).setScale(2,BigDecimal.ROUND_HALF_UP);
salary.setChildbirth(childbirth.negate());
//住房公积金
BigDecimal housingFund = BigDecimalUtil.multiply(shouldSalary,PercentageEnum.HOUSING_FUND.getRate()).setScale(2,BigDecimal.ROUND_HALF_UP);
salary.setHousingFund(housingFund.negate());
//实发工资
BigDecimal netPayroll = shouldSalary.add(salary.getAnnuity()).add(salary.getMedical()).
add(salary.getUnemployment()).add(salary.getOccupationalInjury()).add(salary.getChildbirth()).add(salary.getHousingFund());
//个人所得税
BigDecimal individualIncomeTax = TaxRateEnum.countTaxRate(netPayroll).setScale(2,BigDecimal.ROUND_HALF_UP);
salary.setIndividualIncomeTax(individualIncomeTax);
//实发工资
salary.setNetPayroll(netPayroll.add(individualIncomeTax));
return salary;
}
/**
* 发放工资
* @param id
* @return
*/
@RequestMapping(value = "/send",method = RequestMethod.POST)
@ResponseBody
public Result<Boolean> send(@RequestParam(name="id",required=true)Long id){
Salary salary = salaryService.find(id);
if(salary == null){
return Result.error(CodeMsg.ADMIN_SALARY_EMPRY);
}
if(salary.getIsStatus() == IsStatus.IS_ATTENDANCE){
return Result.error(CodeMsg.ADMIN_SALRY_STATUS_SEND);
}
if(salaryService.updateStatus(IsStatus.IS_ATTENDANCE,id) <= 0){
return Result.error(CodeMsg.ADMIN_SALARY_SEND_ERROR);
}
return Result.success(true);
}
/**
* 删除
* @param id
* @return
if(type == LoginType.ADMINISTRATOR.getCode()){
//表示验证码正确,开始查询数据库,检验密码是否正确
User findByUsername = userService.findByUsername(username);
//判断是否为空
if(findByUsername == null){
return Result.error(CodeMsg.ADMIN_USERNAME_NO_EXIST);
}
//表示用户存在,进一步对比密码是否正确
if(!findByUsername.getPassword().equals(password)){
return Result.error(CodeMsg.ADMIN_PASSWORD_ERROR);
}
//表示密码正确,接下来判断用户状态是否可用
if(findByUsername.getStatus() == User.ADMIN_USER_STATUS_UNABLE){
return Result.error(CodeMsg.ADMIN_USER_UNABLE);
}
//检查用户所属角色状态是否可用
if(findByUsername.getRole() == null || findByUsername.getRole().getStatus() == Role.ADMIN_ROLE_STATUS_UNABLE){
return Result.error(CodeMsg.ADMIN_USER_ROLE_UNABLE);
}
//检查用户所属角色的权限是否存在
if(findByUsername.getRole().getAuthorities() == null || findByUsername.getRole().getAuthorities().size() == 0){
return Result.error(CodeMsg.ADMIN_USER_ROLE_AUTHORITES_EMPTY);
}
//检查一切符合,可以登录,将用户信息存放至session
request.getSession().setAttribute(SessionConstant.SESSION_USER_LOGIN_KEY, findByUsername);
request.getSession().setAttribute("loginType",type);
//销毁session中的验证码
request.getSession().setAttribute("admin_login", null);
//将登陆记录写入日志库
operaterLogService.add("用户【"+username+"】于【" + StringUtil.getFormatterDate(new Date(), "yyyy-MM-dd HH:mm:ss") + "】登录系统!");
log.info("用户成功登录,user = " + findByUsername);
}else{
Staff byJobNumber = staffService.findByNameAndIsStatus(username);
//判断是否为空
if(byJobNumber == null){
return Result.error(CodeMsg.ADMIN_USERNAME_NO_EXIST);
}
//表示用户存在,进一步对比密码是否正确
if(!byJobNumber.getPassword().equals(password)){
return Result.error(CodeMsg.ADMIN_PASSWORD_ERROR);
}
//检查用户所属角色状态是否可用
if(byJobNumber.getRole() == null || byJobNumber.getRole().getStatus() == Role.ADMIN_ROLE_STATUS_UNABLE){
return Result.error(CodeMsg.ADMIN_USER_ROLE_UNABLE);
}
//检查用户所属角色的权限是否存在
if(byJobNumber.getRole().getAuthorities() == null || byJobNumber.getRole().getAuthorities().size() == 0){
return Result.error(CodeMsg.ADMIN_USER_ROLE_AUTHORITES_EMPTY);
}
PerformanceAssessment assessment = peranceAssmentService.findByYearAndMonthAndStaffId(year, month,staff.getId());
if(assessment!=null){
return Result.error(CodeMsg.ADMIN_PERFORMANCE_EXIST_ERROR);
}
JSONArray array = JSONObject.parseArray(assTarget);
double totalScore=0;
double weight=0;
for(int i=0;i<array.size();i++){
Object assessmentTarget = array.getJSONObject(i);
Object targetId = ((com.alibaba.fastjson.JSONObject) assessmentTarget).get("targetId");
Object currentScore = ((com.alibaba.fastjson.JSONObject) assessmentTarget).get("score");
String idl = targetId.toString();
AssessTarget assessTarget = assessTargetService.find(Long.valueOf(idl));
Integer targetScore = assessTarget.getScore();
String score = currentScore.toString();
totalScore += Double.parseDouble(score) *targetScore.doubleValue();
weight+=targetScore.doubleValue();
}
double finalScore = totalScore / weight;
BigDecimal bigDecimal = new BigDecimal(0.0d);
try {
bigDecimal = new BigDecimal(finalScore);
} catch (Exception e) {
e.printStackTrace();
}
performanceAssessment.setPercentage(bigDecimal);
GradeEnum gradeEnum = GradeEnum.countGrade(finalScore);
performanceAssessment.setGrade(gradeEnum);
if(peranceAssmentService.save(performanceAssessment)==null){
return Result.error(CodeMsg.ADMIN_PERFORMANCE_ADD_ERROR);
}
return Result.success(true);
}
/**
* 添加年度考核
* @param id
* @return
*/
@RequestMapping("/annual_add")
public String annualAdd(Model model,@RequestParam(name="id",required=true)Long id){
Staff staff = staffService.findByIdAndIsStatus(id, StaffStatus.ON_THE_JOB.getCode());
if(staff == null){
return "redirect:list";
}
Date date = new Date();
Calendar cal = Calendar.getInstance();
cal.setTime(date);
//获取去年的年份
int year = cal.get(Calendar.YEAR) - 1;
//请假天数
if(staffService.updateStatus(StaffStatus.QUIT.getCode(), id)<=0){
return Result.error(CodeMsg.ADMIN_STAFF_STATUS_ERROR);
}
operaterLogService.add("员工离职,员工ID:" + id);
return Result.success(true);
}
/**
* 修改个人信息
* @param model
* @return
*/
@RequestMapping("/self")
public String self(Model model){
Staff loginedStaff = SessionUtil.getLoginedStaff();
Staff staff = staffService.find(loginedStaff.getId());
model.addAttribute("roles", roleService.findAll());
model.addAttribute("educationEnum",EducationEnum.values());
model.addAttribute("jobTitleList",jobTitleService.findAll());
model.addAttribute("positionList",positionService.findAll());
model.addAttribute("departmentList",departmentService.findAll());
model.addAttribute("staff",staff);
return "admin/staff/self";
}
}
@Autowired
private OperaterLogService operaterLogService;
@Autowired
private AssessTargetService assessTargetService;
@Autowired
private DepartmentService departmentService;
/**
* 指标列表
* @param model
* @return
*/
@RequestMapping("/list")
public String list(Model model, PageBean<AssessTarget> pageBean, AssessTarget assessTarget){
model.addAttribute("title","指标列表");
model.addAttribute("name",assessTarget.getName());
model.addAttribute("pageBean",assessTargetService.findList(assessTarget,pageBean));
return "admin/assess_target/list";
}
/**
* 新增指标页面
* @param model
* @return
*/
@RequestMapping(value="/add",method=RequestMethod.GET)
public String add(Model model){
model.addAttribute("departmentList",departmentService.findAll());
model.addAttribute("targetClassifyList",TargetClassify.values());
return "admin/assess_target/add";
}
/**
* 指标添加提交处理
* @param assessTarget
* @return
*/
@RequestMapping(value = "/add",method = RequestMethod.POST)
@ResponseBody
public Result<Boolean> add(AssessTarget assessTarget){
//用统一验证实体方法验证是否合法
CodeMsg validate = ValidateEntityUtil.validate(assessTarget);
if(validate.getCode() != CodeMsg.SUCCESS.getCode()){
return Result.error(validate);
}
if(assessTarget.getTargetClassify().getCode()==-1){
return Result.error(CodeMsg.ADMIN_ASSESS_TARGET_CATEGORY_ERROR);
}
if(assessTargetService.isExistName(assessTarget.getName(),0l)){
return Result.error(CodeMsg.ADMIN_ASSESS_TARGET_NAME_EXIST_ERROR);
}
if(assessTargetService.save(assessTarget) == null){
return Result.error(CodeMsg.ADMIN_ASSESS_TARGET_ADD_ERROR);
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} catch (Exception e) {
// TODO: handle exception
}
return string;
}
/**
* 验证输入的邮箱格式是否符合
* @param email
* @return
*/
public static boolean emailFormat(String email){
boolean tag = true;
final String pattern1 = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
final Pattern pattern = Pattern.compile(pattern1);
final Matcher mat = pattern.matcher(email);
if (!mat.find()) {
tag = false;
}
return tag;
}
/**
* 验证是否是手机号
* @param
* @return
*/
public static boolean isMobile(String str) {
Pattern p = null;
Matcher m = null;
boolean b = false;
String s2="^1[0-9]{10}$";// 验证手机号
if(StringUtils.isNotBlank(str)){
p = Pattern.compile(s2);
m = p.matcher(str);
b = m.matches();
}
return b;
}
/**
* @return
*/
@RequestMapping(value="/delete",method=RequestMethod.POST)
@ResponseBody
public Result<Boolean> delete(@RequestParam(name="id",required=true)Long id){
if(staffService.updateStatus(StaffStatus.QUIT.getCode(), id)<=0){
return Result.error(CodeMsg.ADMIN_STAFF_STATUS_ERROR);
}
operaterLogService.add("员工离职,员工ID:" + id);
return Result.success(true);
}
/**
* 修改个人信息
* @param model
* @return
*/
@RequestMapping("/self")
public String self(Model model){
Staff loginedStaff = SessionUtil.getLoginedStaff();
Staff staff = staffService.find(loginedStaff.getId());
model.addAttribute("roles", roleService.findAll());
model.addAttribute("educationEnum",EducationEnum.values());
model.addAttribute("jobTitleList",jobTitleService.findAll());
model.addAttribute("positionList",positionService.findAll());
model.addAttribute("departmentList",departmentService.findAll());
model.addAttribute("staff",staff);
return "admin/staff/self";
}
}
CodeMsg codeMsg = CodeMsg.ADMIN_DAYS_ERROR;
codeMsg.setMsg("Excel第" + line + "行"+codeMsg.getMsg());
return Result.error(codeMsg);
}
if(attendance.getDaysSick() == 0 && attendance.getPersonalLeaveDays() == 0 && attendance.getLateNumber() == 0
&& attendance.getLeaveEarlyTimes() == 0 && attendance.getAbsenceDays() == 0){
attendance.setIsStatus(IsStatus.IS_ATTENDANCE);
}
attendanceList.add(attendance);
}
attendanceList = attendanceList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(
() -> new TreeSet<>(Comparator.comparing(f -> f.getJobNumber() + f.getYear() + f.getMonthOfDay()))), ArrayList::new));
try
{
attendanceService.saveAll(attendanceList);
}catch (Exception e)
{
return Result.error(CodeMsg.ADMIN_ATTENDANCE_LIST_ADD_ERROR);
}
return Result.success(true);
}
}