1 files added
29 files modified
| | |
| | | */ |
| | | @Override |
| | | public Double getYearTimeLength(Long userId) throws ParseException { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | // // 获取当前日期 |
| | | // Date date = new Date(); |
| | | // String nowTime = sdf.format(date); |
| | | // Date dateTime = sdf.parse(nowTime); |
| | | // Double surplusYearTime = new Double(0.00); |
| | | // // 查询用户剩余年假时长 |
| | | // List<SysUserLevelOther> sysUserLevelOtherList = sysUserLevelOtherRepository.findByUserId(userId); |
| | | // for(SysUserLevelOther sysUserLevelOther : sysUserLevelOtherList) { |
| | | // Date dateStart = new Date(sysUserLevelOther.getStartDate().getTime()); |
| | | // Date dateEnd = new Date(); |
| | | // if (ObjectUtils.isNotEmpty(sysUserLevelOther.getStartDate()) && ObjectUtils.isNotEmpty(sysUserLevelOther.getEndDate())) { |
| | | // dateEnd = new Date(sysUserLevelOther.getEndDate().getTime()); |
| | | // } |
| | | // //取当前日期在数据中开始日期与结束日期之间的数据 |
| | | // if (dateTime.compareTo(dateStart) >= 0 && dateTime.compareTo(dateEnd) <= 0 || dateTime.compareTo(dateStart) >= 0 && sysUserLevelOther.getEndDate() == null) { |
| | | // //年假总时长 |
| | | // Double yearTime = Double.valueOf(sysUserLevelOther.getAnnualLeaveDays() == null ? 0 : sysUserLevelOther.getAnnualLeaveDays() * 8); |
| | | // //已使用年假时长 |
| | | // Calendar calendar = Calendar.getInstance(); |
| | | // int year = calendar.get(Calendar.YEAR); |
| | | // String startTime = year + "-01-01 00:00:00"; |
| | | // String endTime = year + "-12-31 23:59:59"; |
| | | // Double usedYearTime = attendanceLeaveRepository.getSurplusYearTime(sysUserLevelOther.getUserId(), startTime, endTime); |
| | | // //剩余年假 |
| | | // surplusYearTime = yearTime - (usedYearTime == null ? 0.0 : usedYearTime); |
| | | // } |
| | | // } |
| | | //获取年假剩余(新) |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); |
| | | // 获取当前日期 |
| | | Date date = new Date(); |
| | | String nowTime = sdf.format(date); |
| | | Date dateTime = sdf.parse(nowTime); |
| | | //剩余年假 |
| | | Double surplusYearTime = new Double(0.00); |
| | | // 查询用户剩余年假时长 |
| | | List<SysUserLevelOther> sysUserLevelOtherList = sysUserLevelOtherRepository.findByUserId(userId); |
| | | for(SysUserLevelOther sysUserLevelOther : sysUserLevelOtherList) { |
| | | Date dateStart = new Date(sysUserLevelOther.getStartDate().getTime()); |
| | | Date dateEnd = new Date(); |
| | | if (ObjectUtils.isNotEmpty(sysUserLevelOther.getStartDate()) && ObjectUtils.isNotEmpty(sysUserLevelOther.getEndDate())) { |
| | | dateEnd = new Date(sysUserLevelOther.getEndDate().getTime()); |
| | | } |
| | | //取当前日期在数据中开始日期与结束日期之间的数据 |
| | | if (dateTime.compareTo(dateStart) >= 0 && dateTime.compareTo(dateEnd) <= 0 || dateTime.compareTo(dateStart) >= 0 && sysUserLevelOther.getEndDate() == null) { |
| | | //年假总时长 |
| | | Double yearTime = Double.valueOf(sysUserLevelOther.getAnnualLeaveDays() == null ? 0 : sysUserLevelOther.getAnnualLeaveDays() * 8); |
| | | //已使用年假时长 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | int year = calendar.get(Calendar.YEAR); |
| | | String startTime = year + "-01-01 00:00:00"; |
| | | String endTime = year + "-12-31 23:59:59"; |
| | | Double usedYearTime = attendanceLeaveRepository.getSurplusYearTime(sysUserLevelOther.getUserId(), startTime, endTime); |
| | | //剩余年假 |
| | | surplusYearTime = yearTime - (usedYearTime == null ? 0.0 : usedYearTime); |
| | | } |
| | | // 根据用户和时间 |
| | | SysUserLevelOther sysUserLevelOther = sysUserLevelOtherRepository.findYearMonth(userId, nowTime); |
| | | if (sysUserLevelOther != null) { |
| | | //年假总时长 |
| | | Double yearTime = Double.valueOf(sysUserLevelOther.getAnnualLeaveDays() == null ? 0 : sysUserLevelOther.getAnnualLeaveDays() * 8); |
| | | //已使用年假时长 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | int year = calendar.get(Calendar.YEAR); |
| | | String startTime = year + "-01-01 00:00:00"; |
| | | String endTime = year + "-12-31 23:59:59"; |
| | | Double usedYearTime = attendanceLeaveRepository.getSurplusYearTime(sysUserLevelOther.getUserId(), startTime, endTime); |
| | | |
| | | surplusYearTime = yearTime - (usedYearTime == null ? 0.0 : usedYearTime); |
| | | } |
| | | return surplusYearTime; |
| | | } |
| | |
| | | @ApiModelProperty(value = "级别ID") |
| | | private Long levelId; |
| | | |
| | | @Column(name = "`start_date`",nullable = false) |
| | | @NotNull |
| | | @Column(name = "`year_month`",nullable = false) |
| | | @NotBlank |
| | | @ApiModelProperty(value = "年月") |
| | | private String yearMonth; |
| | | |
| | | @Column(name = "`start_date`") |
| | | @ApiModelProperty(value = "开始日期") |
| | | private Timestamp startDate; |
| | | |
| | |
| | | @ApiModelProperty(value = "生日") |
| | | private Timestamp birthday; |
| | | |
| | | // 魏传栋 - 始 |
| | | @JoinColumn(name = "company_id") |
| | | @ManyToOne |
| | | @ApiModelProperty(value = "所属公司Id") |
| | | private SysCompany company; |
| | | // 魏传栋 - 终 |
| | | |
| | | @Email |
| | | @NotBlank |
| | |
| | | @ApiModelProperty(value = "最后修改密码的时间", hidden = true) |
| | | private Date pwdResetTime; |
| | | |
| | | @Column(name = "`internship_time`") |
| | | @ApiModelProperty(value = "实习时间(数字)") |
| | | private Integer internshipTime; |
| | | |
| | | @Override |
| | | public boolean equals(Object o) { |
| | | if (this == o) { |
| | |
| | | package me.zhengjie.modules.system.repository; |
| | | |
| | | import me.zhengjie.modules.system.domain.SysUserLevelOther; |
| | | import me.zhengjie.modules.treatment.domain.UserLevelWage; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | |
| | | SysUserLevelOther findTargetYearMonth(Long userId, String targetDate); |
| | | |
| | | /** |
| | | * 根据年月日期, 用户id查询(新) |
| | | * @param userId |
| | | * @param yearsDate |
| | | */ |
| | | @Query(value = "SELECT * FROM sys_user_level_other WHERE user_id = ?1 AND `year_month` = ?2 ORDER BY `year_month` DESC, create_time DESC LIMIT 1", nativeQuery = true) |
| | | SysUserLevelOther findYearMonth(Long userId, String yearsDate); |
| | | |
| | | /** |
| | | * 根据用户查询最新(新) |
| | | * @param userId |
| | | */ |
| | | @Query(value = "SELECT * FROM sys_user_level_other WHERE user_id = ? ORDER BY `year_month` DESC, create_time DESC LIMIT 1", nativeQuery = true) |
| | | SysUserLevelOther findByNewUserId(Long userId); |
| | | |
| | | /** |
| | | * 根据用户ID查询最早记录 |
| | | * @param userId / |
| | | * @return / |
| | |
| | | /** 级别ID */ |
| | | private Long levelId; |
| | | |
| | | /** 年月*/ |
| | | private String yearMonth; |
| | | |
| | | /** 开始日期 */ |
| | | private Timestamp startDate; |
| | | |
| | |
| | | // 魏传栋 - 始 |
| | | private SysCompanyDto company; |
| | | // 魏传栋 - 终 |
| | | |
| | | private Integer internshipTime; |
| | | } |
| | |
| | | String targetYearMonth = DateUtil.internationalTimeToChinaTime(criteria.getTargetYearMonth()); |
| | | // 获取某年某月最后一天 |
| | | String lastDayOfTargetYearMonth = DateUtil.getLastDayOfMonth(targetYearMonth); |
| | | // 根据用户ID、指定年月查询 |
| | | SysUserLevelOther sysUserLevelOther = sysUserLevelOtherRepository.findTargetYearMonth(criteria.getUserId(), lastDayOfTargetYearMonth); |
| | | // // 根据用户ID、指定年月查询 |
| | | // SysUserLevelOther sysUserLevelOther = sysUserLevelOtherRepository.findTargetYearMonth(criteria.getUserId(), lastDayOfTargetYearMonth); |
| | | |
| | | // 根据用户ID、指定年月查询(新) |
| | | SysUserLevelOther sysUserLevelOther = sysUserLevelOtherRepository.findYearMonth(criteria.getUserId(), lastDayOfTargetYearMonth); |
| | | |
| | | // 判断查询结果 |
| | | if (sysUserLevelOther == null) { |
| | | throw new BadRequestException("没有获取到当前员工的级别信息!"); |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public SysUserLevelOtherDto create(SysUserLevelOther resources) throws Exception { |
| | | // 查询旧用户级别其他 |
| | | // // 查询旧用户级别其他 |
| | | // SysUserLevelOther oldSysUserLevelOther = selectOldUserLevelOther(resources.getUserId()); |
| | | // // 判断旧用户级别其他是否为空 |
| | | // if (oldSysUserLevelOther != null) { |
| | | // // 旧日期字符串 |
| | | // String oldDateString = oldSysUserLevelOther.getStartDate().toString().substring(0,10); |
| | | // // 新日期字符串 |
| | | // String newDateString = resources.getStartDate().toString().substring(0,10); |
| | | // // 判断新、旧日期字符串 |
| | | // if (oldDateString.equals(newDateString)) { |
| | | // throw new BadRequestException("每天只能调整一次用户级别其他,请更换日期再试!"); |
| | | // } |
| | | // if (new SimpleDateFormat("yyyy-MM-dd").parse(oldDateString).getTime() >= new SimpleDateFormat("yyyy-MM-dd").parse(newDateString).getTime()) { |
| | | // throw new BadRequestException("日期必须大于最新用户级别其他日期,请更换日期再试!"); |
| | | // } |
| | | // // 创建Calendar实例 |
| | | // Calendar previousCalendar = Calendar.getInstance(); |
| | | // // 设置新日期时间 |
| | | // previousCalendar.setTime(resources.getStartDate()); |
| | | // // 设置前一天时间 |
| | | // previousCalendar.add(Calendar.DATE, -1); |
| | | // // 旧用户级别其他 |
| | | // oldSysUserLevelOther.setEndDate(new Timestamp(previousCalendar.getTime().getTime())); |
| | | // // 保存 |
| | | // sysUserLevelOtherRepository.save(oldSysUserLevelOther); |
| | | // } |
| | | |
| | | // 查询旧用户级别其他(新) |
| | | SysUserLevelOther oldSysUserLevelOther = selectOldUserLevelOther(resources.getUserId()); |
| | | // 判断旧用户级别其他是否为空 |
| | | if (oldSysUserLevelOther != null) { |
| | | // 旧日期字符串 |
| | | String oldDateString = oldSysUserLevelOther.getStartDate().toString().substring(0,10); |
| | | String oldDateString = oldSysUserLevelOther.getYearMonth(); |
| | | // 新日期字符串 |
| | | String newDateString = resources.getStartDate().toString().substring(0,10); |
| | | // 判断新、旧日期字符串 |
| | | if (oldDateString.equals(newDateString)) { |
| | | throw new BadRequestException("每天只能调整一次用户级别其他,请更换日期再试!"); |
| | | } |
| | | if (new SimpleDateFormat("yyyy-MM-dd").parse(oldDateString).getTime() >= new SimpleDateFormat("yyyy-MM-dd").parse(newDateString).getTime()) { |
| | | String newDateString = resources.getYearMonth(); |
| | | if (new SimpleDateFormat("yyyy-MM").parse(oldDateString).getTime() >= new SimpleDateFormat("yyyy-MM").parse(newDateString).getTime()) { |
| | | throw new BadRequestException("日期必须大于最新用户级别其他日期,请更换日期再试!"); |
| | | } |
| | | // 创建Calendar实例 |
| | | Calendar previousCalendar = Calendar.getInstance(); |
| | | // 设置新日期时间 |
| | | previousCalendar.setTime(resources.getStartDate()); |
| | | // 设置前一天时间 |
| | | previousCalendar.add(Calendar.DATE, -1); |
| | | // 旧用户级别其他 |
| | | oldSysUserLevelOther.setEndDate(new Timestamp(previousCalendar.getTime().getTime())); |
| | | // 保存 |
| | | sysUserLevelOtherRepository.save(oldSysUserLevelOther); |
| | | // sysUserLevelOtherRepository.save(oldSysUserLevelOther); |
| | | } |
| | | // 保存 |
| | | return sysUserLevelOtherMapper.toDto(sysUserLevelOtherRepository.save(resources)); |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(SysUserLevelOther resources) throws Exception { |
| | | // 查询旧用户级别其他 |
| | | // // 查询旧用户级别其他 |
| | | // SysUserLevelOther oldSysUserLevelOther = selectOldUserLevelOther(resources.getUserId()); |
| | | // // 判断旧用户级别其他是否为空 |
| | | // if (oldSysUserLevelOther != null) { |
| | | // // 判断修改的是否是最新履历 |
| | | // if (oldSysUserLevelOther.getId() != resources.getId()) { |
| | | // throw new BadRequestException("旧用户级别其他无法进行修改,请选择最新用户级别其他再试!"); |
| | | // } |
| | | // // 旧日期字符串 |
| | | // String oldDateString = oldSysUserLevelOther.getStartDate().toString().substring(0,10); |
| | | // // 获取当前日期 |
| | | // Date nowDate = new Date(); |
| | | // // 创建Calendar实例 |
| | | // Calendar nowCalendar = Calendar.getInstance(); |
| | | // // 设置当前时间 |
| | | // nowCalendar.setTime(nowDate); |
| | | // // 新日期字符串 |
| | | // String nowDateString = new Timestamp(nowCalendar.getTime().getTime()).toString().substring(0,10); |
| | | // // 判断新、旧日期字符串 |
| | | // if (new SimpleDateFormat("yyyy-MM-dd").parse(oldDateString).getTime() >= new SimpleDateFormat("yyyy-MM-dd").parse(nowDateString).getTime()) { |
| | | // // 复制 |
| | | // oldSysUserLevelOther.copy(resources); |
| | | // // 保存 |
| | | // sysUserLevelOtherRepository.save(oldSysUserLevelOther); |
| | | // } else { |
| | | // // 新用户级别其他 |
| | | // resources.setId(null); |
| | | // resources.setStartDate(new Timestamp(nowCalendar.getTime().getTime())); |
| | | // // 保存 |
| | | // sysUserLevelOtherRepository.save(resources); |
| | | // // 设置前一天时间 |
| | | // nowCalendar.add(Calendar.DATE, -1); |
| | | // // 旧用户级别其他 |
| | | // oldSysUserLevelOther.setEndDate(new Timestamp(nowCalendar.getTime().getTime())); |
| | | // // 保存 |
| | | // sysUserLevelOtherRepository.save(oldSysUserLevelOther); |
| | | // } |
| | | // } else { |
| | | // throw new BadRequestException("未找到最新用户级别其他,请稍后再试!"); |
| | | // } |
| | | |
| | | // 查询旧用户级别其他(新) |
| | | SysUserLevelOther oldSysUserLevelOther = selectOldUserLevelOther(resources.getUserId()); |
| | | // 判断旧用户级别其他是否为空 |
| | | if (oldSysUserLevelOther != null) { |
| | |
| | | throw new BadRequestException("旧用户级别其他无法进行修改,请选择最新用户级别其他再试!"); |
| | | } |
| | | // 旧日期字符串 |
| | | String oldDateString = oldSysUserLevelOther.getStartDate().toString().substring(0,10); |
| | | String oldDateString = oldSysUserLevelOther.getYearMonth(); |
| | | // 获取当前日期 |
| | | Date nowDate = new Date(); |
| | | // 创建Calendar实例 |
| | |
| | | // 设置当前时间 |
| | | nowCalendar.setTime(nowDate); |
| | | // 新日期字符串 |
| | | String nowDateString = new Timestamp(nowCalendar.getTime().getTime()).toString().substring(0,10); |
| | | String nowDateString = new Timestamp(nowCalendar.getTime().getTime()).toString().substring(0,7); |
| | | // 判断新、旧日期字符串 |
| | | if (new SimpleDateFormat("yyyy-MM-dd").parse(oldDateString).getTime() >= new SimpleDateFormat("yyyy-MM-dd").parse(nowDateString).getTime()) { |
| | | if (new SimpleDateFormat("yyyy-MM").parse(oldDateString).getTime() >= new SimpleDateFormat("yyyy-MM").parse(nowDateString).getTime()) { |
| | | // 复制 |
| | | oldSysUserLevelOther.copy(resources); |
| | | // 保存 |
| | | sysUserLevelOtherRepository.save(oldSysUserLevelOther); |
| | | } else { |
| | | // 新用户级别其他 |
| | | resources.setId(null); |
| | | resources.setStartDate(new Timestamp(nowCalendar.getTime().getTime())); |
| | | // 保存 |
| | | sysUserLevelOtherRepository.save(resources); |
| | | // 设置前一天时间 |
| | | nowCalendar.add(Calendar.DATE, -1); |
| | | // 旧用户级别其他 |
| | | oldSysUserLevelOther.setEndDate(new Timestamp(nowCalendar.getTime().getTime())); |
| | | // 保存 |
| | | sysUserLevelOtherRepository.save(oldSysUserLevelOther); |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | private SysUserLevelOther selectOldUserLevelOther(Long userId) { |
| | | // 旧用户级别其他 |
| | | SysUserLevelOther oldSysUserLevelOther = sysUserLevelOtherRepository.findLastByUserId(userId); |
| | | // // 旧用户级别其他 |
| | | // SysUserLevelOther oldSysUserLevelOther = sysUserLevelOtherRepository.findLastByUserId(userId); |
| | | |
| | | // 旧用户级别其他(新) |
| | | SysUserLevelOther oldSysUserLevelOther = sysUserLevelOtherRepository.findByNewUserId(userId); |
| | | |
| | | // 判断旧用户级别其他是否为空 |
| | | if (oldSysUserLevelOther != null && oldSysUserLevelOther.getId() != null) { |
| | | return oldSysUserLevelOther; |
| | |
| | | import me.zhengjie.modules.task.service.dto.TaskDaliyQueryCriteria; |
| | | import me.zhengjie.modules.treatment.domain.*; |
| | | import me.zhengjie.modules.treatment.repository.*; |
| | | import me.zhengjie.modules.treatment.rest.CmnInsuranceController; |
| | | import me.zhengjie.utils.*; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.cache.annotation.CacheConfig; |
| | |
| | | private final CmnLevelRepository cmnLevelRepository; |
| | | private final MeritWageRepository meritWageRepository; |
| | | private final CmnLevelRankRepository cmnLevelRankRepository; |
| | | private final CmnInsuranceRepository cmnInsuranceRepository; |
| | | |
| | | private final MongoTemplate mongoTemplate; |
| | | private final UserLevelWageRepository userLevelWageRepository; |
| | |
| | | |
| | | /** |
| | | * 任务下的所有子级 |
| | | * |
| | | * @param taskMongo |
| | | * @param containUserList |
| | | */ |
| | |
| | | if (resultList.isEmpty()) { |
| | | Map map = new HashMap(); |
| | | map.put("name", taskName); |
| | | if (taskDaliyMongo.getTaskUserMongo().getPerformanceType().equals("1")){ |
| | | if (taskDaliyMongo.getTaskUserMongo().getPerformanceType().equals("1")) { |
| | | map.put("value", taskDaliyMongo.getConsumedHours() > taskDaliyMongo.getTaskUserMongo().getPerformanceHours() ? taskDaliyMongo.getTaskUserMongo().getPerformanceHours() : taskDaliyMongo.getConsumedHours()); |
| | | }else { |
| | | } else { |
| | | map.put("value", taskDaliyMongo.getConsumedHours()); |
| | | } |
| | | map.put(taskDaliyMongo.getTaskUserMongo().getName(),taskDaliyMongo.getConsumedHours() > taskDaliyMongo.getTaskUserMongo().getPerformanceHours() ? taskDaliyMongo.getTaskUserMongo().getPerformanceHours() : taskDaliyMongo.getConsumedHours()); |
| | | map.put(taskDaliyMongo.getTaskUserMongo().getName(), taskDaliyMongo.getConsumedHours() > taskDaliyMongo.getTaskUserMongo().getPerformanceHours() ? taskDaliyMongo.getTaskUserMongo().getPerformanceHours() : taskDaliyMongo.getConsumedHours()); |
| | | resultList.add(map); |
| | | continue; |
| | | } |
| | |
| | | for (Map map : resultList) { |
| | | ArrayList<Map> list = new ArrayList<>(); |
| | | for (Object key : map.keySet()) { |
| | | if (!key.equals("name") && !key.equals("value")){ |
| | | if (!key.equals("name") && !key.equals("value")) { |
| | | Map innerMap = new HashMap(); |
| | | innerMap.put(key,map.get(key)); |
| | | innerMap.put(key, map.get(key)); |
| | | list.add(innerMap); |
| | | } |
| | | } |
| | | map.put("list",list); |
| | | map.put("list", list); |
| | | } |
| | | return resultList; |
| | | } |
| | |
| | | User user1 = userRepository.getOne(SecurityUtils.getCurrentUserId()); |
| | | Role role = user1.getRoles().iterator().next(); |
| | | //超管、总经理,痛苦哦经理查看全部 |
| | | if(Long.valueOf(role.getLevel()) == Constant.ROLE_LEVEL_SUPER || Long.valueOf(role.getLevel()) == Constant.ROLE_LEVEL_GENERAL){ |
| | | if (Long.valueOf(role.getLevel()) == Constant.ROLE_LEVEL_SUPER || Long.valueOf(role.getLevel()) == Constant.ROLE_LEVEL_GENERAL) { |
| | | userList = userRepository.findAllByEnabled(true); |
| | | } else { |
| | | userList = userRepository.findByUserId(user1.getId()); |
| | |
| | | Double value = (Double) map.get("value"); |
| | | value += taskDaliyMongo.getConsumedHours() > taskDaliyMongo.getTaskUserMongo().getPerformanceHours() ? taskDaliyMongo.getTaskUserMongo().getPerformanceHours() : taskDaliyMongo.getConsumedHours(); |
| | | map.put("value", value); |
| | | map.put(taskDaliyMongo.getTaskUserMongo().getName(),taskDaliyMongo.getConsumedHours() > taskDaliyMongo.getTaskUserMongo().getPerformanceHours() ? taskDaliyMongo.getTaskUserMongo().getPerformanceHours() : taskDaliyMongo.getConsumedHours()); |
| | | map.put(taskDaliyMongo.getTaskUserMongo().getName(), taskDaliyMongo.getConsumedHours() > taskDaliyMongo.getTaskUserMongo().getPerformanceHours() ? taskDaliyMongo.getTaskUserMongo().getPerformanceHours() : taskDaliyMongo.getConsumedHours()); |
| | | flag = true; |
| | | } |
| | | } |
| | | // 无 |
| | | if (!flag) { |
| | | Map newMap = new HashMap(); |
| | | if (taskDaliyMongo.getTaskUserMongo().getPerformanceType().equals("1")){ |
| | | if (taskDaliyMongo.getTaskUserMongo().getPerformanceType().equals("1")) { |
| | | newMap.put("name", taskDaliyMongo.getTaskUserMongo().getTask().getName()); |
| | | newMap.put("value", taskDaliyMongo.getConsumedHours() > taskDaliyMongo.getTaskUserMongo().getPerformanceHours() ? taskDaliyMongo.getTaskUserMongo().getPerformanceHours() : taskDaliyMongo.getConsumedHours()); |
| | | newMap.put(taskDaliyMongo.getTaskUserMongo().getName(),taskDaliyMongo.getConsumedHours() > taskDaliyMongo.getTaskUserMongo().getPerformanceHours() ? taskDaliyMongo.getTaskUserMongo().getPerformanceHours() : taskDaliyMongo.getConsumedHours()); |
| | | }else { |
| | | newMap.put(taskDaliyMongo.getTaskUserMongo().getName(), taskDaliyMongo.getConsumedHours() > taskDaliyMongo.getTaskUserMongo().getPerformanceHours() ? taskDaliyMongo.getTaskUserMongo().getPerformanceHours() : taskDaliyMongo.getConsumedHours()); |
| | | } else { |
| | | newMap.put("name", taskDaliyMongo.getTaskUserMongo().getTask().getName()); |
| | | newMap.put("value", taskDaliyMongo.getConsumedHours()); |
| | | newMap.put(taskDaliyMongo.getTaskUserMongo().getName(),taskDaliyMongo.getConsumedHours() > taskDaliyMongo.getTaskUserMongo().getPerformanceHours() ? taskDaliyMongo.getTaskUserMongo().getPerformanceHours() : taskDaliyMongo.getConsumedHours()); |
| | | newMap.put(taskDaliyMongo.getTaskUserMongo().getName(), taskDaliyMongo.getConsumedHours() > taskDaliyMongo.getTaskUserMongo().getPerformanceHours() ? taskDaliyMongo.getTaskUserMongo().getPerformanceHours() : taskDaliyMongo.getConsumedHours()); |
| | | } |
| | | resultList.add(newMap); |
| | | } |
| | |
| | | // 判断用户级别变更 |
| | | checkUserLevel(resources.getId(), null, resources.getLevelId()); |
| | | // 判断用户级别变更(新) |
| | | checkUserLevelNew(resources.getId(), resources.getLevelId()); |
| | | checkUserLevelNew(resources); |
| | | } |
| | | |
| | | @Override |
| | |
| | | userRepository.save(user); |
| | | // 判断用户级别变更 |
| | | checkUserLevel(user.getId(), tempOldLevelId, tempNewLevelId); |
| | | // 判断用户级别变更(新) |
| | | checkUserLevelNew(user.getId(), tempNewLevelId); |
| | | // // 判断用户级别变更(新) |
| | | // checkUserLevelNew(resources, tempOldLevelId, tempNewLevelId); |
| | | // 清除缓存 |
| | | delCaches(user.getId(), user.getUsername()); |
| | | } |
| | |
| | | // 查询日报表是否存在小于当前月填写的当前任务的日报 |
| | | List<TaskDaliyMongo> taskDaliyMongoSm = mongoTemplate.find(Query.query(new Criteria("userId").is(SecurityUtils.getCurrentUserId()).and("old_task_id").is(taskDaliyMongo.getOld_task_id()).and("fillDate").lte(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(startTime))).with(Sort.by(Sort.Direction.DESC, "fillDate")), TaskDaliyMongo.class); |
| | | //跨月 |
| | | if(taskDaliyMongoSm.size() > 0) { |
| | | if (taskDaliyMongoSm.size() > 0) { |
| | | Double horseValue1 = Double.valueOf(decimalFormat.format((taskDaliyMongoSm.get(0).getTaskProgress() / 100) * taskDaliyMongo.getTaskUserMongo().getPerformanceHours())); |
| | | horseValue1 = taskDaliyMongo.getTaskUserMongo().getPerformanceHours() - horseValue1; |
| | | completedWork += horseValue1; |
| | | }else { |
| | | } else { |
| | | completedWork += taskDaliyMongo.getTaskUserMongo().getPerformanceHours(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 非绩效 |
| | | for(TaskDaliyMongo taskDaliyMongo : daliyMongoList) { |
| | | for (TaskDaliyMongo taskDaliyMongo : daliyMongoList) { |
| | | //非绩效 |
| | | if (!taskDaliyMongo.getTaskUserMongo().getPerformanceType().equals("1")) { |
| | | completedWork += taskDaliyMongo.getConsumedHours(); |
| | |
| | | createSysUserLevelWage(userId, newLevelId); |
| | | // 创建用户级别保险(旧) |
| | | createSysUserLevelInsurance(userId, newLevelId); |
| | | // // 创建用户级别其他(新) |
| | | // createSysUserLevelOther(userId, sysLevel); |
| | | |
| | | } else if (oldLevelId != newLevelId) { |
| | | // 旧用户级别工资 |
| | |
| | | // 保存 |
| | | sysUserLevelOtherRepository.save(oldSysUserLevelOther); |
| | | } |
| | | // // 创建用户级别其他(新) |
| | | // createSysUserLevelOther(userId, sysLevel); |
| | | } else { |
| | | |
| | | } |
| | |
| | | |
| | | /** |
| | | * 判断用户级别变更 |
| | | * @param userId |
| | | * @param newLevelId |
| | | * |
| | | * @param resources |
| | | */ |
| | | private void checkUserLevelNew(Long userId, Long newLevelId) { |
| | | // 查询级别表 |
| | | SysLevel sysLevel = sysLevelRepository.findById(newLevelId).orElseGet(SysLevel::new); |
| | | private void checkUserLevelNew(User resources) { |
| | | // 查询级别管理表 |
| | | CmnLevel cmnLevel = cmnLevelRepository.findById(resources.getLevelId()).orElseGet(CmnLevel::new); |
| | | for (int i = 0; i < 2; i++) { |
| | | if (i == 1) { |
| | | // 创建第二条用户级别工资(新) |
| | | createNewSysUserLevelWage(userId, sysLevel, 1); |
| | | createNewSysUserLevelWage(resources, cmnLevel, EnumerationType.SECOND_ENUM); |
| | | // 创建第二条用户级别保险 (新) |
| | | createNewSysUserLevelInsurance(userId, sysLevel, 1); |
| | | createNewSysUserLevelInsurance(resources, EnumerationType.SECOND_ENUM); |
| | | } else { |
| | | // 创建第一条用户级别工资(新) |
| | | createNewSysUserLevelWage(userId, sysLevel, 0); |
| | | createNewSysUserLevelWage(resources, cmnLevel, EnumerationType.FIRST_ENUM); |
| | | // 创建第一条用户级别保险 (新) |
| | | createNewSysUserLevelInsurance(userId, sysLevel, 0); |
| | | createNewSysUserLevelInsurance(resources, EnumerationType.FIRST_ENUM); |
| | | } |
| | | } |
| | | // 创建用户级别其他(新) |
| | | createSysUserLevelOther(userId, sysLevel); |
| | | createSysUserLevelOther(resources, cmnLevel); |
| | | } |
| | | |
| | | /** |
| | | * 创建用户界别工资(新) |
| | | * @param userId |
| | | * @param sysLevel |
| | | * 创建用户级别工资(新) |
| | | * |
| | | * @param resources |
| | | * @param cmnLevel |
| | | */ |
| | | private void createNewSysUserLevelWage(Long userId, SysLevel sysLevel, int num) { |
| | | private void createNewSysUserLevelWage(User resources, CmnLevel cmnLevel, EnumerationType enumType) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // 用户级别工资 |
| | | UserLevelWage userLevelWage = new UserLevelWage(); |
| | | userLevelWage.setUserId(userId); |
| | | userLevelWage.setLevel(sysLevel.getId()); |
| | | userLevelWage.setUserId(resources.getId()); |
| | | userLevelWage.setLevel(cmnLevel.getId()); |
| | | // 获取试用期结束的月初时间 |
| | | Timestamp result1 = getThreeTime(); |
| | | Timestamp result1 = getConfirmationTime(resources); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); |
| | | String resultValue = sdf.format(result1); |
| | | if (num == 0) { |
| | | if (enumType.equals(EnumerationType.FIRST_ENUM)) { |
| | | userLevelWage.setYearMonth(sdf.format(new Timestamp(calendar.getTimeInMillis()))); |
| | | } else { |
| | | userLevelWage.setYearMonth(resultValue); |
| | | } |
| | | // 查询最小的等级 |
| | | MeritLevel meritLevel = meritLevelRepository.findMinMeritStandardByLevelId(sysLevel.getId()).get(0); |
| | | MeritLevel meritLevel = meritLevelRepository.findMinMeritStandardByLevelId(cmnLevel.getId()); |
| | | userLevelWage.setRank(meritLevel.getId()); |
| | | // 查询级别基本工资 |
| | | CmnLevel cmnLevel = cmnLevelRepository.findByJobId(sysLevel.getJobId()).get(0); |
| | | userLevelWage.setBasicWage(num == 0 ? cmnLevel.getBasicWage() : new BigDecimal(cmnLevel.getBasicWage().doubleValue() * 0.8)); |
| | | userLevelWage.setRankWage(num == 0 ? cmnLevel.getRankWage() : new BigDecimal(cmnLevel.getRankWage().doubleValue() * 0.8)); |
| | | userLevelWage.setPerformanceWage(num == 0 ? cmnLevel.getPerformanceWage() : new BigDecimal(cmnLevel.getPerformanceWage().doubleValue() * 0.8)); |
| | | userLevelWage.setBasicWage(enumType.equals(EnumerationType.FIRST_ENUM) ? new BigDecimal(cmnLevel.getBasicWage().doubleValue() * 0.8) :cmnLevel.getBasicWage()); |
| | | userLevelWage.setRankWage(enumType.equals(EnumerationType.FIRST_ENUM) ? new BigDecimal(cmnLevel.getRankWage().doubleValue() * 0.8) : cmnLevel.getRankWage()); |
| | | userLevelWage.setPerformanceWage(enumType.equals(EnumerationType.FIRST_ENUM) ? new BigDecimal(cmnLevel.getPerformanceWage().doubleValue() * 0.8) : cmnLevel.getPerformanceWage()); |
| | | // 查询绩效系数 |
| | | CmnLevelRank cmnLevelRank = cmnLevelRankRepository.findbylevelSm(sysLevel.getId()).get(0); |
| | | CmnLevelRank cmnLevelRank = cmnLevelRankRepository.findbylevelSm(cmnLevel.getId()); |
| | | userLevelWage.setPerformanceCoefficient(new BigDecimal(cmnLevelRank.getPerformanceCoefficient())); |
| | | // 保存 |
| | | userLevelWageRepository.save(userLevelWage); |
| | |
| | | |
| | | /** |
| | | * 创建用户级别保险 (新) |
| | | * @param userId |
| | | * @param sysLevel |
| | | * |
| | | * @param resources |
| | | */ |
| | | public void createNewSysUserLevelInsurance(Long userId, SysLevel sysLevel,int num) { |
| | | public void createNewSysUserLevelInsurance(User resources, EnumerationType enumType) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // 用户级别工资 |
| | | UserInsurance userInsurance = new UserInsurance(); |
| | | userInsurance.setUserId(userId); |
| | | userInsurance.setUserId(resources.getId()); |
| | | // 获取试用期结束的月初时间 |
| | | Timestamp result = getThreeTime(); |
| | | Timestamp result = getConfirmationTime(resources); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); |
| | | String resultValue = sdf.format(result); |
| | | if (num == 0) { |
| | | if (enumType.equals(EnumerationType.FIRST_ENUM)) { |
| | | userInsurance.setYearMonth(sdf.format(new Timestamp(calendar.getTimeInMillis()))); |
| | | } else { |
| | | userInsurance.setYearMonth(resultValue); |
| | | } |
| | | userInsurance.setAccumulationFund(num == 0 ? new BigDecimal(num) : sysLevel.getAccumulationRadix()); |
| | | userInsurance.setAccumulationFundPersonal(num == 0 ? new Double(num) : sysLevel.getAccumulationPersonalProportion()); |
| | | userInsurance.setAccumulationFundCompany(num == 0 ? new Double(num) : sysLevel.getAccumulationCompanyProportion()); |
| | | userInsurance.setRetirementInsurance(num == 0 ? new BigDecimal(num) : sysLevel.getPensionRadix()); |
| | | userInsurance.setRetirementInsurancePersonal(num == 0 ? new Double(num) : sysLevel.getPensionPersonalProportion()); |
| | | userInsurance.setRetirementInsuranceCompany(num == 0 ? new Double(num) : sysLevel.getPensionCompanyProportion()); |
| | | userInsurance.setMedicalInsurance(num == 0 ? new BigDecimal(num) : sysLevel.getMedicalRadix()); |
| | | userInsurance.setMedicalInsurancePersonal(num == 0 ? new Double(num) : sysLevel.getMedicalPersonalProportion()); |
| | | userInsurance.setMedicalInsuranceCompany(num == 0 ? new Double(num) : sysLevel.getMedicalCompanyProportion()); |
| | | userInsurance.setUnemploymentInsurance(num == 0 ? new BigDecimal(num) : sysLevel.getUnemploymentRadix()); |
| | | userInsurance.setUnemploymentInsurancePersonal(num == 0 ? new Double(num) : sysLevel.getUnemploymentPersonalProportion()); |
| | | userInsurance.setUnemploymentInsuranceCompany(num == 0 ? new Double(num) : sysLevel.getUnemploymentCompanyProportion()); |
| | | userInsurance.setBirthInsurance(num == 0 ? new BigDecimal(num) : sysLevel.getMaternityRadix()); |
| | | userInsurance.setBirthInsurancePersonal(num == 0 ? new Double(num) : sysLevel.getMaternityPersonalProportion()); |
| | | userInsurance.setBirthInsuranceCompany(num == 0 ? new Double(num) : sysLevel.getMaternityCompanyProportion()); |
| | | userInsurance.setEmploymentInsurance(num == 0 ? new BigDecimal(num) : sysLevel.getIndustrialInjuryRadix()); |
| | | userInsurance.setEmploymentInsurancePersonal(num == 0 ? new Double(num) : sysLevel.getIndustrialInjuryPersonalProportion()); |
| | | userInsurance.setEmploymentInsuranceCompany(num == 0 ? new Double(num) : sysLevel.getIndustrialInjuryCompanyProportion()); |
| | | // 根据选择的公司查询五险一金 |
| | | CmnInsurance cmnInsurance = cmnInsuranceRepository.findByCompany(resources.getCompany()).orElseGet(CmnInsurance::new); |
| | | userInsurance.setAccumulationFund(enumType.equals(EnumerationType.FIRST_ENUM) ? new BigDecimal(0) : cmnInsurance.getAccumulationFund()); |
| | | userInsurance.setAccumulationFundPersonal(enumType.equals(EnumerationType.FIRST_ENUM) ? new Double(0) : cmnInsurance.getAccumulationFundPersonal()); |
| | | userInsurance.setAccumulationFundCompany(enumType.equals(EnumerationType.FIRST_ENUM) ? new Double(0) : cmnInsurance.getAccumulationFundCompany()); |
| | | userInsurance.setRetirementInsurance(enumType.equals(EnumerationType.FIRST_ENUM) ? new BigDecimal(0) : cmnInsurance.getRetirementInsurance()); |
| | | userInsurance.setRetirementInsurancePersonal(enumType.equals(EnumerationType.FIRST_ENUM) ? new Double(0) : cmnInsurance.getRetirementInsurancePersonal()); |
| | | userInsurance.setRetirementInsuranceCompany(enumType.equals(EnumerationType.FIRST_ENUM) ? new Double(0) : cmnInsurance.getRetirementInsuranceCompany()); |
| | | userInsurance.setMedicalInsurance(enumType.equals(EnumerationType.FIRST_ENUM) ? new BigDecimal(0) : cmnInsurance.getMedicalInsurance()); |
| | | userInsurance.setMedicalInsurancePersonal(enumType.equals(EnumerationType.FIRST_ENUM) ? new Double(0) : cmnInsurance.getMedicalInsurancePersonal()); |
| | | userInsurance.setMedicalInsuranceCompany(enumType.equals(EnumerationType.FIRST_ENUM) ? new Double(0) : cmnInsurance.getMedicalInsuranceCompany()); |
| | | userInsurance.setUnemploymentInsurance(enumType.equals(EnumerationType.FIRST_ENUM) ? new BigDecimal(0) : cmnInsurance.getUnemploymentInsurance()); |
| | | userInsurance.setUnemploymentInsurancePersonal(enumType.equals(EnumerationType.FIRST_ENUM) ? new Double(0) : cmnInsurance.getUnemploymentInsurancePersonal()); |
| | | userInsurance.setUnemploymentInsuranceCompany(enumType.equals(EnumerationType.FIRST_ENUM) ? new Double(0) : cmnInsurance.getUnemploymentInsuranceCompany()); |
| | | userInsurance.setBirthInsurance(enumType.equals(EnumerationType.FIRST_ENUM) ? new BigDecimal(0) : cmnInsurance.getBirthInsurance()); |
| | | userInsurance.setBirthInsurancePersonal(enumType.equals(EnumerationType.FIRST_ENUM) ? new Double(0) : cmnInsurance.getBirthInsurancePersonal()); |
| | | userInsurance.setBirthInsuranceCompany(enumType.equals(EnumerationType.FIRST_ENUM) ? new Double(0) : cmnInsurance.getBirthInsuranceCompany()); |
| | | userInsurance.setEmploymentInsurance(enumType.equals(EnumerationType.FIRST_ENUM) ? new BigDecimal(0) : cmnInsurance.getEmploymentInsurance()); |
| | | userInsurance.setEmploymentInsurancePersonal(enumType.equals(EnumerationType.FIRST_ENUM) ? new Double(0) : cmnInsurance.getEmploymentInsurancePersonal()); |
| | | userInsurance.setEmploymentInsuranceCompany(enumType.equals(EnumerationType.FIRST_ENUM) ? new Double(0) : cmnInsurance.getEmploymentInsuranceCompany()); |
| | | // 保存 |
| | | userInsuranceRepository.save(userInsurance); |
| | | } |
| | | |
| | | /** |
| | | * 创建用户级别其他(新) |
| | | * @param userId |
| | | * @param sysLevel |
| | | * @param resources |
| | | * @param cmnLevel |
| | | */ |
| | | private void createSysUserLevelOther(Long userId, SysLevel sysLevel) { |
| | | // 获取今年年份 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | int Year = calendar.get(Calendar.YEAR); |
| | | private void createSysUserLevelOther(User resources, CmnLevel cmnLevel) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM"); |
| | | // 获取试用期结束的月初时间 |
| | | Timestamp result = getThreeTime(); |
| | | Timestamp result = getConfirmationTime(resources); |
| | | // 获取实习期结束的年份 |
| | | Calendar calendar1 = Calendar.getInstance(); |
| | | calendar1.setTime(result); |
| | | int formalYear = calendar1.get(Calendar.YEAR); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(result); |
| | | int formalYear = calendar.get(Calendar.YEAR); |
| | | // 获取当前年份 |
| | | int currentYear = Calendar.getInstance().get(Calendar.YEAR); |
| | | |
| | | // 判断实习期结束是否为今年 |
| | | if (formalYear == Year) { |
| | | createUserLevelOther(0, userId, sysLevel); |
| | | } else { |
| | | createUserLevelOther(1, userId, sysLevel); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 创建用户级别其他数据 |
| | | * @param num |
| | | */ |
| | | private void createUserLevelOther(int num, Long userId, SysLevel sysLevel){ |
| | | // 添加两条数据 |
| | | for (int i = 0; i < 2; i++) { |
| | | if (i == 0) { |
| | | // 用户级别其他 |
| | | // 第一条记录 |
| | | SysUserLevelOther sysUserLevelOther = new SysUserLevelOther(); |
| | | sysUserLevelOther.setUserId(userId); |
| | | sysUserLevelOther.setLevelId(sysLevel.getId()); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | sysUserLevelOther.setStartDate(new Timestamp(calendar.getTimeInMillis())); |
| | | // 设置为当前年的12月 |
| | | calendar.set(Calendar.MONTH, Calendar.DECEMBER); |
| | | // 将日期设置为12月的最后一天 |
| | | calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); |
| | | sysUserLevelOther.setEndDate(new Timestamp(calendar.getTimeInMillis())); |
| | | sysUserLevelOther.setPersonalPerformanceProportion(sysLevel.getPersonalPerformanceProportion()); |
| | | sysUserLevelOther.setAnnualLeaveDays(0.0); |
| | | // 保存 |
| | | sysUserLevelOther.setUserId(resources.getId()); |
| | | sysUserLevelOther.setLevelId(cmnLevel.getId()); |
| | | sysUserLevelOther.setPersonalPerformanceProportion(Double.valueOf(0)); |
| | | // 计算剩余年假 |
| | | Double annualLeave = getAnnualLeave(calendar); |
| | | sysUserLevelOther.setAnnualLeaveDays(annualLeave); |
| | | // 判断为今年设置为当前日期 |
| | | if (formalYear == currentYear) { |
| | | sysUserLevelOther.setYearMonth(sdf.format(new Date())); |
| | | } else { |
| | | // 设置为明年转正日期 |
| | | sysUserLevelOther.setYearMonth(sdf.format(calendar.getTime())); |
| | | } |
| | | sysUserLevelOtherRepository.save(sysUserLevelOther); |
| | | } else { |
| | | // 第二条记录 |
| | | SysUserLevelOther sysUserLevelOther1 = new SysUserLevelOther(); |
| | | sysUserLevelOther1.setUserId(userId); |
| | | sysUserLevelOther1.setLevelId(sysLevel.getId()); |
| | | // 转正的日期 |
| | | Timestamp result = getThreeTime(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(result); |
| | | // 转正的月份 |
| | | int joinMonth = calendar.get(Calendar.MONTH); |
| | | Double annualLeave = 0.0; |
| | | // 判断为今年计算年假 |
| | | if (num == 0) { |
| | | int remainingMonths = 12 - joinMonth; |
| | | // 计算年假天数 |
| | | annualLeave = (5.0 / 12) * remainingMonths; |
| | | BigDecimal big = new BigDecimal(annualLeave); |
| | | big = big.setScale(1, BigDecimal.ROUND_HALF_UP); |
| | | annualLeave = big.doubleValue(); |
| | | sysUserLevelOther1.setUserId(resources.getId()); |
| | | sysUserLevelOther1.setLevelId(cmnLevel.getId()); |
| | | Calendar calendar1 = Calendar.getInstance(); |
| | | calendar1.add(Calendar.YEAR, 1); |
| | | // 设置月份为一月 |
| | | calendar1.set(Calendar.MONTH, Calendar.JANUARY); |
| | | calendar1.set(Calendar.DAY_OF_MONTH, 1); |
| | | sysUserLevelOther1.setPersonalPerformanceProportion(Double.valueOf(0)); |
| | | sysUserLevelOther1.setAnnualLeaveDays(5.0); |
| | | // 判断实习期结束日期的年份不是今年,年份加1 |
| | | if (formalYear != currentYear) { |
| | | // 在增加一年 |
| | | calendar1.add(Calendar.YEAR, 1); |
| | | } |
| | | sysUserLevelOther1.setStartDate(getThreeTime()); |
| | | sysUserLevelOther1.setPersonalPerformanceProportion(sysLevel.getPersonalPerformanceProportion()); |
| | | sysUserLevelOther1.setAnnualLeaveDays(annualLeave); |
| | | // 保存 |
| | | // 日期设置为 明年/后年 年初 |
| | | sysUserLevelOther1.setYearMonth(sdf.format(calendar1.getTime())); |
| | | sysUserLevelOtherRepository.save(sysUserLevelOther1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取三个月后转正的月初时间 |
| | | * 获取转正的月初时间 |
| | | * |
| | | * @return |
| | | */ |
| | | private Timestamp getThreeTime(){ |
| | | private Timestamp getConfirmationTime(User resources) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // 获取 Calendar 对象所代表的时间 |
| | | calendar.setTime(new Timestamp(calendar.getTimeInMillis())); |
| | |
| | | int daysInMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); |
| | | Timestamp result; |
| | | if (dayOfMonth <= daysInMonth / 2) { |
| | | // 用户是在前半个月加入的,算上本月获取两个月之后的日期 |
| | | calendar.add(Calendar.MONTH, 3); |
| | | result = new Timestamp(calendar.getTimeInMillis()); |
| | | // 实习时间为空默认三个月,用户是在前半个月加入的,算上本月获取两个月之后的日期 |
| | | calendar.add(Calendar.MONTH, resources.getInternshipTime() == null ? 3 : resources.getInternshipTime()); |
| | | } else { |
| | | // 用户是在后半个月加入的,不算本月获取三个月之后的日期 |
| | | calendar.add(Calendar.MONTH, 4); |
| | | calendar.set(Calendar.DAY_OF_MONTH, 1); |
| | | result = new Timestamp(calendar.getTimeInMillis()); |
| | | calendar.add(Calendar.MONTH, resources.getInternshipTime() == null ? 4 : resources.getInternshipTime() + 1); |
| | | } |
| | | calendar.set(Calendar.DAY_OF_MONTH, 1); |
| | | result = new Timestamp(calendar.getTimeInMillis()); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 获取年假 |
| | | * @param calendar |
| | | * @return |
| | | */ |
| | | private Double getAnnualLeave(Calendar calendar) { |
| | | // 转正的月份 |
| | | int joinMonth = calendar.get(Calendar.MONTH); |
| | | Double annualLeave = 0.0; |
| | | int remainingMonths = 12 - joinMonth; |
| | | // 计算年假天数 |
| | | annualLeave = (5.0 / 12) * remainingMonths; |
| | | BigDecimal big = new BigDecimal(annualLeave); |
| | | big = big.setScale(1, BigDecimal.ROUND_HALF_UP); |
| | | annualLeave = big.doubleValue(); |
| | | return annualLeave; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建用户级别工资(旧) |
| | |
| | | // 保存 |
| | | sysUserLevelInsuranceRepository.save(sysUserLevelInsurance); |
| | | } |
| | | |
| | | // /** |
| | | // * 创建用户级别其他 |
| | | // * |
| | | // * @param userId |
| | | // * @param levelId |
| | | // */ |
| | | // private void createSysUserLevelOther(Long userId, Long levelId) { |
| | | // // 级别 |
| | | // SysLevel sysLevel = sysLevelRepository.findById(levelId).orElseGet(SysLevel::new); |
| | | // // 添加两条数据 |
| | | // for (int i = 0; i < 2; i++) { |
| | | // if (i == 1) { |
| | | // // 用户级别其他 |
| | | // SysUserLevelOther sysUserLevelOther = new SysUserLevelOther(); |
| | | // sysUserLevelOther.setUserId(userId); |
| | | // sysUserLevelOther.setLevelId(levelId); |
| | | // Calendar calendar = Calendar.getInstance(); |
| | | // calendar.set(Calendar.DAY_OF_MONTH, 1); |
| | | // calendar.add(Calendar.MONTH, 1); |
| | | // sysUserLevelOther.setStartDate(new Timestamp(calendar.getTimeInMillis())); |
| | | // sysUserLevelOther.setPersonalPerformanceProportion(sysLevel.getPersonalPerformanceProportion()); |
| | | // sysUserLevelOther.setAnnualLeaveDays(0.0); |
| | | // // 保存 |
| | | // sysUserLevelOtherRepository.save(sysUserLevelOther); |
| | | // } else { |
| | | // // 用户级别其他 |
| | | // SysUserLevelOther sysUserLevelOther = new SysUserLevelOther(); |
| | | // sysUserLevelOther.setUserId(userId); |
| | | // sysUserLevelOther.setLevelId(levelId); |
| | | // Calendar calendar = Calendar.getInstance(); |
| | | // calendar.set(Calendar.DAY_OF_MONTH, 1); |
| | | // calendar.add(Calendar.MONTH, 1); |
| | | // calendar.add(Calendar.DATE, -1); |
| | | // sysUserLevelOther.setStartDate(new Timestamp(new Date().getTime())); |
| | | // // 添加月末日期 |
| | | // sysUserLevelOther.setEndDate(new Timestamp(calendar.getTimeInMillis())); |
| | | // sysUserLevelOther.setPersonalPerformanceProportion(sysLevel.getPersonalPerformanceProportion()); |
| | | // sysUserLevelOther.setAnnualLeaveDays(0.0); |
| | | // // 保存 |
| | | // sysUserLevelOtherRepository.save(sysUserLevelOther); |
| | | // } |
| | | // } |
| | | // |
| | | // // 查询最早用户级别其他表 |
| | | // SysUserLevelOther sysUserLevelOther = sysUserLevelOtherRepository.findOldByUserId(userId); |
| | | // |
| | | // Calendar calendar = Calendar.getInstance(); |
| | | // calendar.setTime(sysUserLevelOther.getStartDate()); |
| | | // int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH); |
| | | // |
| | | // int daysInMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); |
| | | // if (dayOfMonth <= daysInMonth / 2) { |
| | | // // 用户是在前半个月加入的,算上本月获取两个月之后的日期 |
| | | // getYearDays(3, userId); |
| | | // } else { |
| | | // // 用户是在后半个月加入的,不算本月获取三个月之后的日期 |
| | | // getYearDays(4, userId); |
| | | // } |
| | | // } |
| | | |
| | | // // 获取用户的年假天数 |
| | | // public void getYearDays(int num, Long userId){ |
| | | // Calendar calendar1 = Calendar.getInstance(); |
| | | // calendar1.add(Calendar.MONTH, num); |
| | | // int currentYear = calendar1.get(calendar1.YEAR); |
| | | // calendar1.set(Calendar.DAY_OF_MONTH, 1); // 设置为月初 |
| | | // calendar1.set(Calendar.HOUR_OF_DAY, 0); |
| | | // calendar1.set(Calendar.MINUTE, 0); |
| | | // calendar1.set(Calendar.SECOND, 0); |
| | | // calendar1.set(Calendar.MILLISECOND, 0); |
| | | // Timestamp timestamp = new Timestamp(calendar1.getTimeInMillis()); |
| | | // |
| | | // Calendar joinDate = Calendar.getInstance(); |
| | | // joinDate.setTime(timestamp); |
| | | // |
| | | // // 三个月后转正的日期 |
| | | // int joinMonth = joinDate.get(Calendar.MONTH); |
| | | // |
| | | // // 获取明年的年份 |
| | | // Calendar calendar2 = Calendar.getInstance(); |
| | | // calendar2.add(Calendar.YEAR, 1); |
| | | // int nextYear = calendar2.get(Calendar.YEAR); |
| | | // |
| | | // // 计算剩余的月份 |
| | | // int remainingMonths = 0; |
| | | // if (currentYear != nextYear) { |
| | | // if (joinMonth == Calendar.DECEMBER) { |
| | | // // 如果用户在12月转正 |
| | | // remainingMonths = 1; |
| | | // } else { |
| | | // // 否则,剩余的月份是 12 减去加入的月份加上本月 |
| | | // remainingMonths = 12 - joinMonth; |
| | | // } |
| | | // } |
| | | // |
| | | // // 计算年假天数 |
| | | // double annualLeave = (5.0 / 12) * remainingMonths; |
| | | // BigDecimal big = new BigDecimal(annualLeave); |
| | | // big = big.setScale(1, BigDecimal.ROUND_HALF_UP); |
| | | // annualLeave = big.doubleValue(); |
| | | // |
| | | // // 查询用户级别其他表(修改年假) |
| | | // List<SysUserLevelOther> sysUserLevelOtherList = sysUserLevelOtherRepository.findByUserId(userId); |
| | | // for (SysUserLevelOther sysUserLevelOther : sysUserLevelOtherList) { |
| | | // sysUserLevelOther.setAnnualLeaveDays(annualLeave); |
| | | // sysUserLevelOtherRepository.save(sysUserLevelOther); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @Column(name = "`performance_coefficient`",nullable = false) |
| | | @NotNull |
| | | @ApiModelProperty(value = "团队工资比例") |
| | | @ApiModelProperty(value = "绩效系数") |
| | | private BigDecimal performanceCoefficient = BigDecimal.ZERO; |
| | | |
| | | @Column(name = "`locked`") |
| | |
| | | import me.zhengjie.modules.system.domain.SysCompany; |
| | | import me.zhengjie.modules.treatment.domain.CmnInsurance; |
| | | |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | import me.zhengjie.modules.treatment.domain.UserInsurance; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | import org.springframework.data.jpa.repository.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | |
| | | public interface CmnInsuranceRepository extends JpaRepository<CmnInsurance, Long>, JpaSpecificationExecutor<CmnInsurance> { |
| | | |
| | | Optional<CmnInsurance> findByCompany(SysCompany company); |
| | | |
| | | @Query(value = "SELECT * FROM `new_cmn_insurance` WHERE id in (?1)",nativeQuery = true) |
| | | List<CmnInsurance> findByIds(Long[] ids); |
| | | } |
| | |
| | | @Query(value = "select * from new_cmn_level_rank where level_id = ?1",nativeQuery = true) |
| | | List<CmnLevelRank> findByLevelId(Long levelId); |
| | | |
| | | @Query(value = "select * from new_cmn_level_rank where level_id = ?1 ORDER BY min_rank_wage ASC",nativeQuery = true) |
| | | List<CmnLevelRank> findbylevelSm(Long levelId); |
| | | @Query(value = "select * from new_cmn_level_rank where level_id = ?1 ORDER BY min_rank_wage ASC LIMIT 1",nativeQuery = true) |
| | | CmnLevelRank findbylevelSm(Long levelId); |
| | | |
| | | } |
| | |
| | | |
| | | @Query(value = "SELECT * FROM `new_cmn_level` WHERE job_id = ? ORDER BY basic_wage ASC", nativeQuery = true) |
| | | List<CmnLevel> findByJobId(Long jobId); |
| | | |
| | | @Query(value = "SELECT * FROM `new_cmn_level` WHERE id in (?1)", nativeQuery = true) |
| | | List<CmnLevel> findByIds(Long[] ids); |
| | | |
| | | } |
| | |
| | | * @param levelId |
| | | * @return |
| | | */ |
| | | @Query(value = "SELECT * FROM merit_level WHERE merit_wage_id = (SELECT id FROM merit_wage WHERE level_id = ?1) ORDER BY merit_standard ASC", nativeQuery = true) |
| | | List<MeritLevel> findMinMeritStandardByLevelId(Long levelId); |
| | | @Query(value = "SELECT * FROM merit_level WHERE merit_wage_id = (SELECT id FROM merit_wage WHERE level_id = ?1) ORDER BY merit_standard ASC LIMIT 1", nativeQuery = true) |
| | | MeritLevel findMinMeritStandardByLevelId(Long levelId); |
| | | } |
| | |
| | | |
| | | @Query(value = "SELECT * from new_user_insurance WHERE user_id = ?1 AND `year_month` = ?2 ORDER BY create_time DESC LIMIT 1",nativeQuery = true) |
| | | UserInsurance findbyUserIdAndDate(Long userId, String yearMonth); |
| | | |
| | | @Query(value = "SELECT * FROM `new_user_insurance` WHERE user_id in (SELECT user_id FROM sys_user WHERE company_id = ?1 AND enabled is true)",nativeQuery = true) |
| | | List<UserInsurance> findbyCompanyId(Long companyId); |
| | | |
| | | // /** |
| | | // * 查询第二条 |
| | | // * @param companyId |
| | | // * @return |
| | | // */ |
| | | // @Query(value = "SELECT * FROM (\n" + |
| | | // " SELECT *,\n" + |
| | | // " ROW_NUMBER() OVER(PARTITION BY user_id ORDER BY id) as row_num\n" + |
| | | // " FROM new_user_insurance\n" + |
| | | // " WHERE user_id IN (\n" + |
| | | // " SELECT user_id \n" + |
| | | // " FROM sys_user \n" + |
| | | // " WHERE company_id = ?1 AND enabled is true\n" + |
| | | // " )\n" + |
| | | // ") t\n" + |
| | | // "WHERE t.row_num = 2",nativeQuery = true) |
| | | // List<UserInsurance> findbyCompanyId(Long companyId); |
| | | |
| | | // @Query(value = "SELECT * from new_user_insurance WHERE user_id = ?1 ORDER BY 'year_month' DESC LIMIT 1",nativeQuery = true) |
| | | // UserInsurance findByUserId(Long userId); |
| | | } |
| | |
| | | |
| | | @Query(value = "SELECT * from new_user_level_wage WHERE user_id = ?1 AND `year_month` = ?2 ORDER BY create_time DESC LIMIT 1",nativeQuery = true) |
| | | UserLevelWage findbyUserIdAndDate(Long userId, String yearMonth); |
| | | |
| | | @Query(value = "select * from new_user_level_wage where level = ?1",nativeQuery = true) |
| | | List<UserLevelWage> findByLevel(Long level); |
| | | } |
| | |
| | | cmnInsuranceService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | @PutMapping("/synchronous") |
| | | @Log("同步五险一金") |
| | | @ApiOperation("同步五险一金") |
| | | @PreAuthorize("@el.check('cmnInsurance:synchronous')") |
| | | public ResponseEntity<Object> updateCmnInsurance(@RequestBody Long[] ids){ |
| | | cmnInsuranceService.synchronous(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | cmnLevelService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | @PutMapping("/synchronous") |
| | | @Log("同步五险一金") |
| | | @ApiOperation("同步五险一金") |
| | | @PreAuthorize("@el.check('cmnLevel:synchronous')") |
| | | public ResponseEntity<Object> updateCmnInsurance(@RequestBody Long[] ids){ |
| | | cmnLevelService.synchronous(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | } |
| | |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<CmnInsuranceDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 同步按钮 |
| | | */ |
| | | void synchronous(Long[] ids); |
| | | } |
| | |
| | | import me.zhengjie.modules.treatment.service.dto.CmnLevelDto; |
| | | import me.zhengjie.modules.treatment.service.dto.CmnLevelQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<CmnLevelDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 同步按钮 |
| | | */ |
| | | void synchronous(Long[] ids); |
| | | } |
| | |
| | | |
| | | /** 描述 */ |
| | | private String description; |
| | | |
| | | /** 公司id */ |
| | | private Long companyId; |
| | | } |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.treatment.service.impl; |
| | | |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.treatment.domain.CmnInsurance; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.modules.treatment.domain.UserInsurance; |
| | | import me.zhengjie.modules.treatment.repository.UserInsuranceRepository; |
| | | import me.zhengjie.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.treatment.repository.CmnInsuranceRepository; |
| | | import me.zhengjie.modules.treatment.service.CmnInsuranceService; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author 姚增春 |
| | | * @date 2023-05-09 |
| | | **/ |
| | | * @author 姚增春 |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @date 2023-05-09 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class CmnInsuranceServiceImpl implements CmnInsuranceService { |
| | | |
| | | private final CmnInsuranceRepository cmnInsuranceRepository; |
| | | private final CmnInsuranceMapper cmnInsuranceMapper; |
| | | private final UserInsuranceRepository userInsuranceRepository; |
| | | private final UserRepository userRepository; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(CmnInsuranceQueryCriteria criteria, Pageable pageable){ |
| | | Page<CmnInsurance> page = cmnInsuranceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | public Map<String, Object> queryAll(CmnInsuranceQueryCriteria criteria, Pageable pageable) { |
| | | Page<CmnInsurance> page = cmnInsuranceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); |
| | | return PageUtil.toPage(page.map(cmnInsuranceMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<CmnInsuranceDto> queryAll(CmnInsuranceQueryCriteria criteria){ |
| | | return cmnInsuranceMapper.toDto(cmnInsuranceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | public List<CmnInsuranceDto> queryAll(CmnInsuranceQueryCriteria criteria) { |
| | | return cmnInsuranceMapper.toDto(cmnInsuranceRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public CmnInsuranceDto findById(Long id) { |
| | | CmnInsurance cmnInsurance = cmnInsuranceRepository.findById(id).orElseGet(CmnInsurance::new); |
| | | ValidationUtil.isNull(cmnInsurance.getId(),"CmnInsurance","id",id); |
| | | ValidationUtil.isNull(cmnInsurance.getId(), "CmnInsurance", "id", id); |
| | | return cmnInsuranceMapper.toDto(cmnInsurance); |
| | | } |
| | | |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(CmnInsurance resources) { |
| | | CmnInsurance cmnInsurance = cmnInsuranceRepository.findById(resources.getId()).orElseGet(CmnInsurance::new); |
| | | ValidationUtil.isNull( cmnInsurance.getId(),"CmnInsurance","id",resources.getId()); |
| | | ValidationUtil.isNull(cmnInsurance.getId(), "CmnInsurance", "id", resources.getId()); |
| | | cmnInsurance.copy(resources); |
| | | cmnInsuranceRepository.save(cmnInsurance); |
| | | } |
| | |
| | | public void download(List<CmnInsuranceDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (CmnInsuranceDto cmnInsurance : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("公司", cmnInsurance.getCompany().getLabel()); |
| | | map.put("公积金基数", cmnInsurance.getAccumulationFund()); |
| | | map.put("公积金个人比例", cmnInsurance.getAccumulationFundPersonal()); |
| | |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | @Override |
| | | public void synchronous(Long[] ids) { |
| | | // 查询五险一金表 |
| | | List<CmnInsurance> cmnInsuranceList = cmnInsuranceRepository.findByIds(ids); |
| | | for (CmnInsurance cmnInsurance : cmnInsuranceList) { |
| | | // 根据五险一金表中的公司,去查询对应的个人五险一金表中的员工 |
| | | List<UserInsurance> userInsurances = userInsuranceRepository.findbyCompanyId(cmnInsurance.getCompany().getId()); |
| | | for (UserInsurance userInsurance : userInsurances) { |
| | | // 查询用户 |
| | | User user = userRepository.findById(userInsurance.getUserId()).orElseGet(User::new); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // 获取员工的添加时间 |
| | | calendar.setTime(user.getCreateTime()); |
| | | int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH); |
| | | int daysInMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); |
| | | if (dayOfMonth <= daysInMonth / 2) { |
| | | calendar.add(Calendar.MONTH, user.getInternshipTime() == null ? 3 : user.getInternshipTime()); |
| | | } else { |
| | | calendar.add(Calendar.MONTH, user.getInternshipTime() == null ? 4 : user.getInternshipTime() + 1); |
| | | } |
| | | calendar.set(Calendar.DAY_OF_MONTH, 1); |
| | | // 获取转正时间 |
| | | String result = new Timestamp(calendar.getTimeInMillis()).toString().substring(0, 7); |
| | | if (userInsurance.getYearMonth().equals(result)) { |
| | | userInsurance.setAccumulationFund(cmnInsurance.getAccumulationFund()); |
| | | userInsurance.setAccumulationFundPersonal(cmnInsurance.getAccumulationFundPersonal()); |
| | | userInsurance.setAccumulationFundCompany(cmnInsurance.getAccumulationFundCompany()); |
| | | userInsurance.setRetirementInsurance(cmnInsurance.getRetirementInsurance()); |
| | | userInsurance.setRetirementInsurancePersonal(cmnInsurance.getRetirementInsurancePersonal()); |
| | | userInsurance.setRetirementInsuranceCompany(cmnInsurance.getRetirementInsuranceCompany()); |
| | | userInsurance.setMedicalInsurance(cmnInsurance.getMedicalInsurance()); |
| | | userInsurance.setMedicalInsurancePersonal(cmnInsurance.getMedicalInsurancePersonal()); |
| | | userInsurance.setMedicalInsuranceCompany(cmnInsurance.getMedicalInsuranceCompany()); |
| | | userInsurance.setUnemploymentInsurance(cmnInsurance.getUnemploymentInsurance()); |
| | | userInsurance.setUnemploymentInsurancePersonal(cmnInsurance.getUnemploymentInsurancePersonal()); |
| | | userInsurance.setUnemploymentInsuranceCompany(cmnInsurance.getUnemploymentInsuranceCompany()); |
| | | userInsurance.setBirthInsurance(cmnInsurance.getBirthInsurance()); |
| | | userInsurance.setBirthInsurancePersonal(cmnInsurance.getBirthInsurancePersonal()); |
| | | userInsurance.setBirthInsuranceCompany(cmnInsurance.getBirthInsuranceCompany()); |
| | | userInsurance.setEmploymentInsurance(cmnInsurance.getEmploymentInsurance()); |
| | | userInsurance.setEmploymentInsurancePersonal(cmnInsurance.getEmploymentInsurancePersonal()); |
| | | userInsurance.setEmploymentInsuranceCompany(cmnInsurance.getEmploymentInsuranceCompany()); |
| | | // 保存 |
| | | userInsuranceRepository.save(userInsurance); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.treatment.service.impl; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.util.*; |
| | | |
| | | import javax.persistence.EntityManager; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import me.zhengjie.modules.system.domain.User; |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.treatment.domain.UserInsurance; |
| | | import me.zhengjie.modules.treatment.domain.UserLevelWage; |
| | | import me.zhengjie.modules.treatment.repository.UserInsuranceRepository; |
| | | import me.zhengjie.modules.treatment.repository.UserLevelWageRepository; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author 姚增春 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | * @author 姚增春 |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @date 2023-05-07 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class CmnLevelServiceImpl implements CmnLevelService { |
| | |
| | | private final CmnLevelRepository cmnLevelRepository; |
| | | private final CmnLevelRankRepository cmnLevelRankRepository; |
| | | private final CmnLevelMapper cmnLevelMapper; |
| | | private final UserLevelWageRepository userLevelWageRepository; |
| | | private final UserRepository userRepository; |
| | | private final UserInsuranceRepository userInsuranceRepository; |
| | | @Autowired |
| | | private EntityManager entityManager; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(CmnLevelQueryCriteria criteria, Pageable pageable){ |
| | | Page<CmnLevel> page = cmnLevelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | public Map<String, Object> queryAll(CmnLevelQueryCriteria criteria, Pageable pageable) { |
| | | Page<CmnLevel> page = cmnLevelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); |
| | | return PageUtil.toPage(page.map(cmnLevelMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<CmnLevelDto> queryAll(CmnLevelQueryCriteria criteria){ |
| | | return cmnLevelMapper.toDto(cmnLevelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | public List<CmnLevelDto> queryAll(CmnLevelQueryCriteria criteria) { |
| | | return cmnLevelMapper.toDto(cmnLevelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public CmnLevelDto findById(Long id) { |
| | | CmnLevel cmnLevel = cmnLevelRepository.findById(id).orElseGet(CmnLevel::new); |
| | | ValidationUtil.isNull(cmnLevel.getId(),"CmnLevel","id",id); |
| | | ValidationUtil.isNull(cmnLevel.getId(), "CmnLevel", "id", id); |
| | | return cmnLevelMapper.toDto(cmnLevel); |
| | | } |
| | | |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(CmnLevel resources) { |
| | | CmnLevel cmnLevel = cmnLevelRepository.findById(resources.getId()).orElseGet(CmnLevel::new); |
| | | ValidationUtil.isNull( cmnLevel.getId(),"CmnLevel","id",resources.getId()); |
| | | ValidationUtil.isNull(cmnLevel.getId(), "CmnLevel", "id", resources.getId()); |
| | | cmnLevel.copy(resources); |
| | | for (CmnLevelRank cmnLevelRank : cmnLevel.getCmnLevelRankList()) { |
| | | cmnLevelRank.setLevel(cmnLevel); |
| | | // cmnLevelRank = mergeCmnLevelRank(cmnLevelRank); |
| | | // cmnLevelRank.setLevel(cmnLevel); |
| | | cmnLevelRank.setId(null); |
| | | cmnLevelRank.setLevel(cmnLevel); |
| | | cmnLevelRankRepository.save(cmnLevelRank); |
| | | } |
| | | cmnLevelRankRepository.deleteByLevelId(cmnLevel.getId()); |
| | | cmnLevelRepository.save(cmnLevel); |
| | |
| | | public void download(List<CmnLevelDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (CmnLevelDto cmnLevel : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | Map<String, Object> map = new LinkedHashMap<>(); |
| | | map.put("岗位", cmnLevel.getJob().getName()); |
| | | map.put("名称", cmnLevel.getName()); |
| | | map.put("描述", cmnLevel.getDescription()); |
| | |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | public CmnLevelRank mergeCmnLevelRank(CmnLevelRank cmnLevelRank) { |
| | | return entityManager.merge(cmnLevelRank); |
| | | } |
| | | |
| | | @Override |
| | | public void synchronous(Long[] ids) { |
| | | // 查询级别表 |
| | | List<CmnLevel> cmnLevelList = cmnLevelRepository.findByIds(ids); |
| | | for (CmnLevel cmnLevel : cmnLevelList) { |
| | | // 个人级别表 |
| | | List<UserLevelWage> userLevelWages = userLevelWageRepository.findByLevel(cmnLevel.getId()); |
| | | for (UserLevelWage userLevelWage : userLevelWages) { |
| | | userLevelWage.setBasicWage(cmnLevel.getBasicWage()); |
| | | userLevelWage.setPerformanceWage(cmnLevel.getPerformanceWage()); |
| | | // 个人级别等级工资大于级别表的级别等级工资 |
| | | if (userLevelWage.getRankWage().doubleValue() > cmnLevel.getRankWage().doubleValue()) { |
| | | // 查询用户 |
| | | User user = userRepository.findById(userLevelWage.getUserId()).orElseGet(User::new); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | // 获取员工的添加时间 |
| | | calendar.setTime(user.getCreateTime()); |
| | | int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH); |
| | | int daysInMonth = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); |
| | | if (dayOfMonth <= daysInMonth / 2) { |
| | | calendar.add(Calendar.MONTH, user.getInternshipTime() == null ? 3 : user.getInternshipTime()); |
| | | } else { |
| | | calendar.add(Calendar.MONTH, user.getInternshipTime() == null ? 4 : user.getInternshipTime() + 1); |
| | | } |
| | | calendar.set(Calendar.DAY_OF_MONTH, 1); |
| | | // 获取转正时间 |
| | | String result = new Timestamp(calendar.getTimeInMillis()).toString().substring(0,7); |
| | | // UserInsurance userInsurance = userInsuranceRepository.findByUserId(userLevelWage.getUserId()); |
| | | // 时间一样修改转正后的 |
| | | if (userLevelWage.getYearMonth().equals(result)) { |
| | | userLevelWage.setRankWage(cmnLevel.getRankWage()); |
| | | } else { |
| | | userLevelWage.setRankWage(new BigDecimal(cmnLevel.getRankWage().doubleValue() * 0.8)); |
| | | } |
| | | |
| | | } |
| | | // 保存 |
| | | userLevelWageRepository.save(userLevelWage); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package me.zhengjie.utils; |
| | | |
| | | public enum EnumerationType { |
| | | FIRST_ENUM, |
| | | SECOND_ENUM |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll } |
| | | export function synchronous(ids) { |
| | | return request({ |
| | | url: 'api/cmnInsurance/synchronous/', |
| | | method: 'put', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll, synchronous } |
| | |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll } |
| | | export function synchronous(ids) { |
| | | return request({ |
| | | url: 'api/cmnLevel/synchronous/', |
| | | method: 'put', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, getAll, synchronous } |
| | |
| | | </el-button> |
| | | </crudOperation> |
| | | </div> |
| | | <!--表单渲染--> |
| | | <!--表单组件--> |
| | | <el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="570px"> |
| | | <el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="66px"> |
| | | <el-form-item label="用户名" prop="username"> |
| | |
| | | >{{ item.label }}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="公司" prop="companyId"> |
| | | <el-select v-model="form.companyId" style="width: 437px" clearable> |
| | | <el-form-item v-if="!isEditing" label="实习时间" prop="internshipTime" label-width="68px"> |
| | | <el-select v-model="form.internshipTime" clearable style="width: 437px"> |
| | | <el-option v-for="item in internshipTimeList" :key="item.id" :label="item.label" :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="公司" prop="company.id"> |
| | | <el-select v-model="form.company.id" clearable style="width: 437px"> |
| | | <el-option v-for="item in companyList" :key="item.id" :label="item.label" :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | <div>{{ scope.row.dept.name }}</div> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- 魏传栋 - 始 --> |
| | | <el-table-column :show-overflow-tooltip="true" prop="companyId" label="公司" width="150"> |
| | | <template slot-scope="scope"> |
| | | <!-- <template slot-scope="scope"> |
| | | <span>{{ scope.row.company.label }}</span> |
| | | <template v-for="item in companyList"> |
| | | <span v-if="scope.row.companyId == item.id" :key="item.id">{{ item.label }}</span> |
| | | <span v-if="scope.row.company.id == item.id" :key="item.id">{{ item.label }}</span> |
| | | </template> |
| | | </template> |
| | | </template> --> |
| | | </el-table-column> |
| | | <!-- 魏传栋 - 终 --> |
| | | <el-table-column label="状态" align="center" prop="enabled"> |
| | | <template slot-scope="scope"> |
| | | <el-switch |
| | |
| | | import crudSysCompany from '@/api/system/sysCompany' |
| | | let userRoles = [] |
| | | let userJobs = [] |
| | | const defaultForm = { id: null, username: null, nickName: null, gender: '男', email: null, enabled: 'false', roles: [], jobs: [], dept: { id: null }, phone: null, birthday: null, address: null, dingding: null, sysRostering: { id: null }, levelId: null } |
| | | const defaultForm = { id: null, username: null, company: { id: null }, internshipTime:null, nickName: null, gender: '男', email: null, enabled: 'false', roles: [], jobs: [], dept: { id: null }, phone: null, birthday: null, address: null, dingding: null, sysRostering: { id: null }, levelId: null } |
| | | export default { |
| | | name: 'User', |
| | | components: { Treeselect, crudOperation, rrOperation, udOperation, pagination, DateRangePicker }, |
| | |
| | | address: [ |
| | | { min: 2, max: 100, message: '长度在 2 到 100 个字符', trigger: 'blur' } |
| | | ], |
| | | // 魏传栋 - 始 |
| | | companyId: [ |
| | | { required: true, message: '请选择公司', trigger: 'blur' } |
| | | ] |
| | | // 魏传栋 - 终 |
| | | ], |
| | | 'company.id': [ |
| | | { required: true, message: '公司不能为空', trigger: 'blur' } |
| | | ], |
| | | }, |
| | | // CRUD状态 |
| | | crudStatusPrepared: CRUD.STATUS.PREPARED, |
| | |
| | | rosterings: [], |
| | | // 级别 |
| | | levels: [], |
| | | // 魏传栋-始 |
| | | // 公司 |
| | | companyList: [] |
| | | // 魏传栋-终 |
| | | companyList: [], |
| | | internshipTimeList: Array.from({length: 12}, (v, i) => ({id: i+2, label: `${i+1}个月`})), |
| | | isEditing: false |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | // 魏传栋 - 始 |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 查询配置参数 |
| | | crudSysCompany.getAll().then(res => { |
| | | // 公司列表 |
| | | this.companyList = res |
| | | this.companyList.forEach(image => { |
| | | console.log('id:' + image.id) |
| | | }) |
| | | }) |
| | | return true |
| | | }, |
| | | // 魏传栋 - 终 |
| | | // 禁止输入空格 |
| | | keydown(e) { |
| | | if (e.keyCode === 32) { |
| | |
| | | [CRUD.HOOK.beforeToAdd]() { |
| | | this.jobDatas = [] |
| | | this.roleDatas = [] |
| | | this.isEditing = false |
| | | }, |
| | | // 初始化编辑时候的角色与岗位 |
| | | [CRUD.HOOK.beforeToEdit](crud, form) { |
| | |
| | | userRoles = [] |
| | | userJobs = [] |
| | | const _this = this |
| | | this.isEditing = true |
| | | form.roles.forEach(function(role, index) { |
| | | _this.roleDatas.push(role.id) |
| | | const rol = { id: role.id } |
| | |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="开始日期" prop="startDate"> |
| | | <el-form-item label="年月" prop="yearMonth"> |
| | | <el-date-picker v-model="form.yearMonth" value-format="yyyy-MM" format="yyyy 年 MM 月" :disabled="crud.status.add == 0" clearable type="month" placeholder="请选择年月" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <!-- <el-form-item label="开始日期" prop="startDate"> |
| | | <el-date-picker v-model="form.startDate" type="date" :picker-options="startDatePickerOptions" :disabled="crud.status.edit == crudStatusPrepared" style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="结束日期"> |
| | | <el-date-picker v-model="form.endDate" type="date" :picker-options="endDatePickerOptions" style="width: 340px;" /> |
| | | </el-form-item> |
| | | </el-form-item> --> |
| | | <el-form-item label="个人业绩比例" prop="personalPerformanceProportion"> |
| | | <el-input v-model="form.personalPerformanceProportion" style="width: 340px;"> |
| | | <template slot="append">%</template> |
| | |
| | | <el-tag>{{ scope.row.levelName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column :show-overflow-tooltip="true" prop="startDate" label="开始日期"> |
| | | <!-- <el-table-column :show-overflow-tooltip="true" prop="startDate" label="开始日期"> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.startDate) }} |
| | | </template> |
| | |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.endDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> --> |
| | | <el-table-column prop="yearMonth" label="年月" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="personalPerformanceProportion" label="个人业绩比例"> |
| | | <template slot-scope="scope"> |
| | | {{ scope.row.personalPerformanceProportion }}% |
| | |
| | | import crudUser from '@/api/system/user' |
| | | import crudLevel from '@/api/system/level' |
| | | |
| | | const defaultForm = { id: null, userId: null, levelId: null, startDate: null, endDate: null, personalPerformanceProportion: null, annualLeaveDays: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | const defaultForm = { id: null, userId: null, levelId: null, yearMonth: null, startDate: null, endDate: null, personalPerformanceProportion: null, annualLeaveDays: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'SysUserLevelOther', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | |
| | | levelId: [ |
| | | { required: true, message: '所属级别不能为空', trigger: 'change' } |
| | | ], |
| | | startDate: [ |
| | | { required: true, message: '开始日期不能为空', trigger: 'change' } |
| | | yearMonth: [ |
| | | { required: true, message: '日期不能为空', trigger: 'change' } |
| | | ], |
| | | // startDate: [ |
| | | // { required: true, message: '开始日期不能为空', trigger: 'change' } |
| | | // ], |
| | | personalPerformanceProportion: [ |
| | | { required: true, message: '个人业绩比例不能为空', trigger: 'blur' }, |
| | | { validator: proportionValidate, trigger: 'blur' } |
| | |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission" /> |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.synchronous" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-refresh" |
| | | style="margin-right: 6px;" |
| | | :loading="loading" |
| | | :disabled="crud.selections.length === 0" |
| | | @click="synchronous(crud.selections)" |
| | | >同步</el-button> |
| | | </crudOperation> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
| | |
| | | add: ['admin', 'cmnInsurance:add'], |
| | | edit: ['admin', 'cmnInsurance:edit'], |
| | | del: ['admin', 'cmnInsurance:del'], |
| | | download: ['admin', 'cmnInsurance:list'] |
| | | download: ['admin', 'cmnInsurance:list'], |
| | | synchronous: ["admin", "cmnInsurance:synchronous"] |
| | | }, |
| | | rules: { |
| | | 'company.id': [ |
| | |
| | | { key: 'companyId', display_name: '公司' } |
| | | ], |
| | | // 公司 |
| | | companys: [] |
| | | companys: [], |
| | | loading:false |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | crudSysCompany.getAll().then(res => { |
| | | this.companys = res |
| | | }) |
| | | }, |
| | | // 修改同步按钮 |
| | | synchronous(data) { |
| | | this.$confirm( |
| | | "此操作将同步 " + data.length + " 条五险一金相关的数据, 是否继续?", |
| | | "提示", |
| | | { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "success" |
| | | } |
| | | ).then(() => { |
| | | this.loading = true; |
| | | // ID列表 |
| | | const ids = []; |
| | | for (let i = 0; i < data.length; i++) { |
| | | // ID列表 |
| | | ids.push(data[i].id); |
| | | } |
| | | crudCmnInsurance.synchronous(ids).then(res => { |
| | | // 消息提示 |
| | | this.crud.notify("同步成功", CRUD.NOTIFICATION_TYPE.SUCCESS); |
| | | this.loading = false; |
| | | }); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | |
| | | <div class="head-container"> |
| | | <div v-if="crud.props.searchToggle"> |
| | | <!-- 搜索 --> |
| | | <el-select v-model="query.jobId" filterable clearable placeholder="岗位" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-select |
| | | v-model="query.jobId" |
| | | filterable |
| | | clearable |
| | | placeholder="岗位" |
| | | style="width: 185px;" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | | > |
| | | <el-option |
| | | v-for="item in jobs" |
| | | :key="item.id" |
| | |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-input v-model="query.name" clearable placeholder="名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" /> |
| | | <el-input |
| | | v-model="query.name" |
| | | clearable |
| | | placeholder="名称" |
| | | style="width: 185px;" |
| | | class="filter-item" |
| | | @keyup.enter.native="crud.toQuery" |
| | | /> |
| | | <rrOperation :crud="crud" /> |
| | | </div> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <crudOperation :permission="permission" /> |
| | | <crudOperation :permission="permission"> |
| | | <el-button |
| | | slot="right" |
| | | v-permission="permission.synchronous" |
| | | class="filter-item" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-refresh" |
| | | :loading="loading" |
| | | style="margin-right: 6px;" |
| | | :disabled="crud.selections.length === 0" |
| | | @click="synchronous(crud.selections)" |
| | | >同步</el-button |
| | | > |
| | | </crudOperation> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
| | | <el-dialog |
| | | :close-on-click-modal="false" |
| | | :before-close="crud.cancelCU" |
| | | :visible.sync="crud.status.cu > 0" |
| | | :title="crud.status.title" |
| | | width="500px" |
| | | > |
| | | <el-form |
| | | ref="form" |
| | | :model="form" |
| | | :rules="rules" |
| | | size="small" |
| | | label-width="80px" |
| | | > |
| | | <el-form-item label="岗位" prop="job.id"> |
| | | <el-select v-model="form.job.id" filterable clearable placeholder="岗位" :disabled="crud.status.edit === 1" style="width: 370px;" @change="changeJob"> |
| | | <el-select |
| | | v-model="form.job.id" |
| | | filterable |
| | | clearable |
| | | placeholder="岗位" |
| | | :disabled="crud.status.edit === 1" |
| | | style="width: 370px;" |
| | | @change="changeJob" |
| | | > |
| | | <el-option |
| | | v-for="item in jobs" |
| | | :key="item.id" |
| | |
| | | <el-input v-model="form.performanceWage" style="width: 370px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="描述"> |
| | | <el-input v-model="form.description" :autosize="{ minRows: 2, maxRows: 5}" type="textarea" style="width: 370px;" /> |
| | | <el-input |
| | | v-model="form.description" |
| | | :autosize="{ minRows: 2, maxRows: 5 }" |
| | | type="textarea" |
| | | style="width: 370px;" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="子级别"> |
| | | <el-switch |
| | |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item v-if="form.hasChild" label="级别阶梯"> |
| | | <el-input-number v-model="form.step" :min="100" :step="100" step-strictly /> |
| | | <el-button style="margin-left:5px" type="success" round size="mini" @click="calcByStep">计算</el-button> |
| | | <el-input-number |
| | | v-model="form.step" |
| | | :min="100" |
| | | :step="100" |
| | | step-strictly |
| | | /> |
| | | <el-button |
| | | style="margin-left:5px" |
| | | type="success" |
| | | round |
| | | size="mini" |
| | | @click="calcByStep" |
| | | >计算</el-button |
| | | > |
| | | </el-form-item> |
| | | <el-divider v-if="form.hasChild" style="margin-top:10px"><b>级别阶梯详细</b></el-divider> |
| | | <el-divider v-if="form.hasChild" style="margin-top:10px" |
| | | ><b>级别阶梯详细</b></el-divider |
| | | >-- |
| | | <el-form-item v-if="form.hasChild" label-width="0px"> |
| | | <el-table ref="miniTable" :data="form.cmnLevelRankList" size="small" style="width: 100%;"> |
| | | <el-table-column prop="basicWage" label="级别基本工资" width="100" fixed="left"> |
| | | <el-table |
| | | ref="miniTable" |
| | | :data="form.cmnLevelRankList" |
| | | size="small" |
| | | style="width: 100%;" |
| | | > |
| | | <el-table-column |
| | | prop="basicWage" |
| | | label="级别基本工资" |
| | | width="100" |
| | | fixed="left" |
| | | > |
| | | <template> |
| | | <el-tag>{{ form.basicWage }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="rankWage" label="级别浮动工资" width="160" fixed="left"> |
| | | <el-table-column |
| | | prop="rankWage" |
| | | label="级别浮动工资" |
| | | width="160" |
| | | fixed="left" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.minRankWage }} ~ {{ scope.row.maxRankWage }}</el-tag> |
| | | <el-tag |
| | | >{{ scope.row.minRankWage }} ~ |
| | | {{ scope.row.maxRankWage }}</el-tag |
| | | > |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="performanceWage" label="绩效工资" width="100" fixed="left"> |
| | | <el-table-column |
| | | prop="performanceWage" |
| | | label="绩效工资" |
| | | width="100" |
| | | fixed="left" |
| | | > |
| | | <template> |
| | | <el-tag>{{ form.performanceWage }}</el-tag> |
| | | </template> |
| | |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="crud.cancelCU">取消</el-button> |
| | | <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button> |
| | | <el-button |
| | | :loading="crud.status.cu === 2" |
| | | type="primary" |
| | | @click="crud.submitCU" |
| | | >确认</el-button |
| | | > |
| | | </div> |
| | | </el-dialog> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table |
| | | ref="table" |
| | | v-loading="crud.loading" |
| | | :data="crud.data" |
| | | size="small" |
| | | style="width: 100%;" |
| | | @selection-change="crud.selectionChangeHandler" |
| | | > |
| | | <el-table-column type="selection" width="55" fixed="left" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="jobName" label="岗位名称" width="100" fixed="left"> |
| | | <el-table-column |
| | | :show-overflow-tooltip="true" |
| | | prop="jobName" |
| | | label="岗位名称" |
| | | width="100" |
| | | fixed="left" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.job.name }}</el-tag> |
| | | </template> |
| | |
| | | <el-table-column prop="basicWage" label="级别基本工资" /> |
| | | <el-table-column prop="rankWage" label="级别浮动工资" /> |
| | | <el-table-column prop="performanceWage" label="绩效工资" /> |
| | | <el-table-column :show-overflow-tooltip="true" prop="description" label="描述" /> |
| | | <el-table-column v-if="checkPer(['admin','cmnLevel:edit','cmnLevel:del'])" label="操作" width="150px" align="center"> |
| | | <el-table-column |
| | | :show-overflow-tooltip="true" |
| | | prop="description" |
| | | label="描述" |
| | | /> |
| | | <el-table-column |
| | | v-if="checkPer(['admin', 'cmnLevel:edit', 'cmnLevel:del'])" |
| | | label="操作" |
| | | width="150px" |
| | | align="center" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | | <udOperation :data="scope.row" :permission="permission" /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import crudCmnLevel from '@/api/treatment/cmnLevel' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import crudJob from '@/api/system/job' |
| | | import crudCmnLevel from "@/api/treatment/cmnLevel"; |
| | | import CRUD, { presenter, header, form, crud } from "@crud/crud"; |
| | | import rrOperation from "@crud/RR.operation"; |
| | | import crudOperation from "@crud/CRUD.operation"; |
| | | import udOperation from "@crud/UD.operation"; |
| | | import pagination from "@crud/Pagination"; |
| | | import crudJob from "@/api/system/job"; |
| | | |
| | | const defaultForm = { id: null, job: { id: null }, name: null, basicWage: null, rankWage: null, performanceWage: null, description: null, hasChild: false, step: null, cmnLevelRankList: [] } |
| | | const defaultForm = { |
| | | id: null, |
| | | job: { id: null }, |
| | | name: null, |
| | | basicWage: null, |
| | | rankWage: null, |
| | | performanceWage: null, |
| | | description: null, |
| | | hasChild: false, |
| | | step: null, |
| | | cmnLevelRankList: [] |
| | | }; |
| | | export default { |
| | | name: 'CmnLevel', |
| | | name: "CmnLevel", |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '级别定义', url: 'api/cmnLevel', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCmnLevel }}) |
| | | return CRUD({ |
| | | title: "级别定义", |
| | | url: "api/cmnLevel", |
| | | idField: "id", |
| | | sort: "id,desc", |
| | | crudMethod: { ...crudCmnLevel } |
| | | }); |
| | | }, |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'cmnLevel:add'], |
| | | edit: ['admin', 'cmnLevel:edit'], |
| | | del: ['admin', 'cmnLevel:del'], |
| | | download: ['admin', 'cmnLevel:download'] |
| | | add: ["admin", "cmnLevel:add"], |
| | | edit: ["admin", "cmnLevel:edit"], |
| | | del: ["admin", "cmnLevel:del"], |
| | | download: ["admin", "cmnLevel:download"], |
| | | synchronous: ["admin", "cmnLevel:synchronous"] |
| | | }, |
| | | rules: { |
| | | 'job.id': [ |
| | | { required: true, message: '岗位不能为空', trigger: 'blur' } |
| | | "job.id": [ |
| | | { required: true, message: "岗位不能为空", trigger: "blur" } |
| | | ], |
| | | name: [ |
| | | { required: true, message: '名称不能为空', trigger: 'blur' } |
| | | ], |
| | | name: [{ required: true, message: "名称不能为空", trigger: "blur" }], |
| | | basicWage: [ |
| | | { required: true, message: '级别基本工资不能为空', trigger: 'blur' } |
| | | { required: true, message: "级别基本工资不能为空", trigger: "blur" } |
| | | ], |
| | | rankWage: [ |
| | | { required: true, message: '级别浮动工资不能为空', trigger: 'blur' } |
| | | { required: true, message: "级别浮动工资不能为空", trigger: "blur" } |
| | | ], |
| | | performanceWage: [ |
| | | { required: true, message: '绩效工资不能为空', trigger: 'blur' } |
| | | { required: true, message: "绩效工资不能为空", trigger: "blur" } |
| | | ] |
| | | }, |
| | | queryTypeOptions: [ |
| | | { key: 'jobId', display_name: '岗位' }, |
| | | { key: 'name', display_name: '名称' } |
| | | { key: "jobId", display_name: "岗位" }, |
| | | { key: "name", display_name: "名称" } |
| | | ], |
| | | // 岗位列表 |
| | | jobs: [] |
| | | } |
| | | jobs: [], |
| | | loading: false |
| | | }; |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | // 获取所有岗位 |
| | | this.getAllJob() |
| | | return true |
| | | this.getAllJob(); |
| | | return true; |
| | | }, |
| | | // 钩子: 在新增前执行 |
| | | [CRUD.HOOK.beforeToCU]() { |
| | | this.form.hasChild = this.form.cmnLevelRankList.length !== 0 |
| | | this.form.hasChild = this.form.cmnLevelRankList.length !== 0; |
| | | }, |
| | | // 获取所有岗位 |
| | | getAllJob() { |
| | | // 获取所有岗位 |
| | | crudJob.getAll().then(res => { |
| | | // 岗位列表 |
| | | this.jobs = res |
| | | }).catch(() => { |
| | | |
| | | }) |
| | | crudJob |
| | | .getAll() |
| | | .then(res => { |
| | | // 岗位列表 |
| | | this.jobs = res; |
| | | }) |
| | | .catch(() => {}); |
| | | }, |
| | | // 岗位变更 |
| | | changeJob() { |
| | | this.form.name = null |
| | | this.form.name = null; |
| | | }, |
| | | // 计算级别阶梯详细 |
| | | calcByStep() { |
| | | this.$refs['form'].validate((valid) => { |
| | | this.$refs["form"].validate(valid => { |
| | | if (valid) { |
| | | this.form.cmnLevelRankList = [] |
| | | let totalCnt = this.form.rankWage |
| | | this.form.cmnLevelRankList = []; |
| | | let totalCnt = this.form.rankWage; |
| | | while (totalCnt > 0) { |
| | | const performanceCoefficient = (parseInt(this.form.basicWage) + (parseInt(totalCnt)) + (parseInt(this.form.performanceWage))) / (this.form.job.performanceUnitWage) |
| | | console.log(this.form.job.performanceUnitWage) |
| | | this.form.cmnLevelRankList.push({ minRankWage: totalCnt - this.form.step, maxRankWage: totalCnt, performanceCoefficient: performanceCoefficient.toFixed(2) }) |
| | | const performanceCoefficient = |
| | | (parseInt(this.form.basicWage) + |
| | | parseInt(totalCnt) + |
| | | parseInt(this.form.performanceWage)) / |
| | | this.form.job.performanceUnitWage; |
| | | console.log(this.form.job.performanceUnitWage); |
| | | this.form.cmnLevelRankList.push({ |
| | | minRankWage: totalCnt - this.form.step, |
| | | maxRankWage: totalCnt, |
| | | performanceCoefficient: performanceCoefficient.toFixed(2) |
| | | }); |
| | | // TODO performanceCoefficient 不需要在这里算出 |
| | | totalCnt = totalCnt - this.form.step |
| | | totalCnt = totalCnt - this.form.step; |
| | | } |
| | | } else { |
| | | return false |
| | | return false; |
| | | } |
| | | }) |
| | | }); |
| | | }, |
| | | // 同步 |
| | | synchronous(data) { |
| | | this.$confirm( |
| | | "此操作将同步 " + data.length + " 条级别定义相关的数据, 是否继续?", |
| | | "提示", |
| | | { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "success" |
| | | } |
| | | ).then(() => { |
| | | this.loading = true; |
| | | // ID列表 |
| | | const ids = []; |
| | | for (let i = 0; i < data.length; i++) { |
| | | // ID列表 |
| | | ids.push(data[i].id); |
| | | } |
| | | crudCmnLevel.synchronous(ids).then(res => { |
| | | // 消息提示 |
| | | this.crud.notify("同步成功", CRUD.NOTIFICATION_TYPE.SUCCESS); |
| | | this.loading = false |
| | | }); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
| | | <style scoped></style> |
| | |
| | | </div> |
| | | <div> |
| | | 名称: |
| | | <el-input v-model="form.cmnLevelRankList[index].levelName" placeholder="请输入业绩标准">、 |
| | | <el-input v-model="form.cmnLevelRankList[index].levelName" placeholder="请输入业绩标准" :disabled="true" >、 |
| | | </el-input> |
| | | 最小等级工资: |
| | | <el-input v-model="form.cmnLevelRankList[index].minRankWage" placeholder="请输入业绩标准">、 |
| | | <el-input v-model="form.cmnLevelRankList[index].minRankWage" placeholder="请输入业绩标准" :disabled="true" >、 |
| | | <template slot="append">元</template> |
| | | </el-input> |
| | | 最大等级工资: |
| | | <el-input v-model="form.cmnLevelRankList[index].maxRankWage" placeholder="请输入业绩奖金"> |
| | | <el-input v-model="form.cmnLevelRankList[index].maxRankWage" placeholder="请输入业绩奖金" :disabled="true" > |
| | | <template slot="append">元</template> |
| | | </el-input> |
| | | 绩效系数: |
| | | <el-input v-model="form.cmnLevelRankList[index].performanceCoefficient" placeholder="请输入业绩奖金" /> |
| | | <el-input v-model="form.cmnLevelRankList[index].performanceCoefficient" placeholder="请输入业绩奖金" :disabled="true" /> |
| | | </div> |
| | | </el-card> |
| | | </el-form-item> |