| | |
| | | // 判断是否提交企微审批
|
| | | List<DictDetail> siteTypes = dictDetailRepository.findByDictName(Constant.APPROVAL_SITE_TYPE).stream().filter(siteType -> siteType.getValue().toLowerCase().equals("wecom")).collect(Collectors.toList());
|
| | | if (siteTypes.size() > 0) {
|
| | | // 企微申请时审批人需要默认值
|
| | | resources.setApprovalUserId(0L);
|
| | | // 添加企微申请参数
|
| | | resources.setWecomDateType(ElAdminConstant.Constant.TEMPLATE_DATE_TYPE_HOUR);
|
| | | resources.setWecomDateType(ElAdminConstant.Constant.TEMPLATE_DATE_RANGE_TYPE_HOUR);
|
| | | Map<String, String> cardTypeMap = dictDetailRepository.findByDictName(Constant.CARD_REPLACEMENT_DIFFERENTIATION).stream().collect(Collectors.toMap(DictDetail::getValue, DictDetail::getLabel));
|
| | | resources.setWecomTypeOptionVal(cardTypeMap.get(resources.getCardReplacementDistinguish()));
|
| | | // 提交申请
|
| | |
| | | User user = userRepository.getOne(SecurityUtils.getCurrentUserId());
|
| | | Role role = user.getRoles().iterator().next();
|
| | | //除超管、总经理只能修改自己信息
|
| | | if(role.getId() != Constant.ROLE_LEVEL_SUPER && role.getId() != Constant.ROLE_LEVEL_GENERAL){
|
| | | if(!Constant.SUPER_LEVEL_LIST.contains(Long.valueOf(role.getLevel()))){
|
| | | if (!Long.valueOf(resources.getUserId()).equals(SecurityUtils.getCurrentUserId())){
|
| | | throw new BadRequestException("只能修改自己的记录");
|
| | | }
|
| | |
| | | Role role = user.getRoles().iterator().next();
|
| | | //根据id查询记录
|
| | | Optional<AttendanceCardreplacement> attendanceCardreplacement = attendanceCardreplacementRepository.findById(id);
|
| | | //除超管、总经理只能删除自己信息
|
| | | if(role.getId() != Constant.ROLE_LEVEL_SUPER && role.getId() != Constant.ROLE_LEVEL_GENERAL){
|
| | | // 除超管、总经理只能删除自己信息
|
| | | if (!Constant.SUPER_LEVEL_LIST.contains(Long.valueOf(role.getLevel()))){
|
| | | if (!Long.valueOf(attendanceCardreplacement.get().getUserId()).equals(SecurityUtils.getCurrentUserId())){
|
| | | throw new BadRequestException("只能删除自己的记录");
|
| | | }
|