| | |
| | | package cc.mrbird.febs.server.hr.service.impl; |
| | | |
| | | import cc.mrbird.febs.common.core.constant.DicCode; |
| | | import cc.mrbird.febs.common.core.constant.ModuleCode; |
| | | import cc.mrbird.febs.server.hr.entity.EmpLaborTrouble; |
| | | import cc.mrbird.febs.server.hr.entity.EmpOccupational; |
| | | import cc.mrbird.febs.common.core.entity.system.DicItem; |
| | | import cc.mrbird.febs.common.core.exception.FebsException; |
| | | import cc.mrbird.febs.server.hr.entity.*; |
| | | import cc.mrbird.febs.server.hr.entity.EmpLaborTrouble; |
| | | import cc.mrbird.febs.server.hr.mapper.EmpLaborTroubleMapper; |
| | | import cc.mrbird.febs.server.hr.service.IEmpLaborTroubleService; |
| | |
| | | queryWrapper.like(EmpLaborTrouble::getArbitrationReason, empLabortrouble.getArbitrationReason()); |
| | | } |
| | | Page<EmpLaborTrouble> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | return this.page(page, queryWrapper); |
| | | IPage<EmpLaborTrouble> iPage = this.page(page, queryWrapper); |
| | | iPage.setRecords(this.convertDicItemName(iPage.getRecords())); |
| | | return iPage; |
| | | } |
| | | |
| | | @Override |
| | | public List<EmpLaborTrouble> findEmpLabortroubles(EmpLaborTrouble empLabortrouble) { |
| | | LambdaQueryWrapper<EmpLaborTrouble> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(EmpLaborTrouble::getDelFlag, empLabortrouble.getDelFlag()); |
| | | return this.baseMapper.selectList(queryWrapper); |
| | | return this.convertDicItemName(this.baseMapper.selectList(queryWrapper)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void createEmpLabortrouble(EmpLaborTrouble empLabortrouble) { |
| | | public void createEmpLabortrouble(EmpLaborTrouble empLabortrouble) throws FebsException { |
| | | LambdaQueryWrapper<EmpLaborTrouble> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | lambdaQueryWrapper.eq(EmpLaborTrouble::getEmpId, empLabortrouble.getEmpId()); |
| | | lambdaQueryWrapper.eq(EmpLaborTrouble::getArbitrationDate, empLabortrouble.getArbitrationDate()); |
| | | lambdaQueryWrapper.eq(EmpLaborTrouble::getDelFlag,0); |
| | | if (this.count(lambdaQueryWrapper) > 0) { |
| | | throw new FebsException("当日记录已存在"); |
| | | } |
| | | empLabortrouble.setArbitrationId(SequenceUtil.generateId(0L, ModuleCode.HR_EMPLOYEE)); |
| | | empLabortrouble.setCreator(operatorId); |
| | | empLabortrouble.setModifier(operatorId); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateEmpLabortrouble(EmpLaborTrouble empLabortrouble) { |
| | | public void updateEmpLabortrouble(EmpLaborTrouble empLabortrouble) throws FebsException { |
| | | LambdaQueryWrapper<EmpLaborTrouble> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | lambdaQueryWrapper.eq(EmpLaborTrouble::getEmpId, empLabortrouble.getEmpId()); |
| | | lambdaQueryWrapper.eq(EmpLaborTrouble::getArbitrationDate, empLabortrouble.getArbitrationDate()); |
| | | lambdaQueryWrapper.eq(EmpLaborTrouble::getDelFlag,0); |
| | | lambdaQueryWrapper.ne(EmpLaborTrouble::getArbitrationId,empLabortrouble.getArbitrationId()); |
| | | if (this.count(lambdaQueryWrapper) > 0) { |
| | | throw new FebsException("当日记录已存在"); |
| | | } |
| | | EmpLaborTrouble dbData = this.getById(empLabortrouble.getArbitrationId()); |
| | | empLabortrouble.setCreateTime(dbData.getCreateTime()); |
| | | empLabortrouble.setCreator(dbData.getCreator()); |
| | |
| | | this.save(empLabortrouble); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private List<EmpLaborTrouble> convertDicItemName(List<EmpLaborTrouble> list){ |
| | | List<DicItem> dicItems = CastUtil.castList(redisService.get("dicItems"), DicItem.class); |
| | | list.forEach(p -> { |
| | | //仲裁类型 |
| | | p.setArbitrationTypeName(dicItems.stream() |
| | | .filter(k -> DicCode.ARBITRATIONTYPE.equals(k.getDicCode()) && k.getDicItemCode().equals(p.getArbitrationType())) |
| | | .findFirst() |
| | | .map(DicItem::getDicItemName) |
| | | .orElse("劳资纠纷")); |
| | | }); |
| | | |
| | | return list; |
| | | } |
| | | } |