| | |
| | | package cc.mrbird.febs.server.hr.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | import cc.mrbird.febs.common.core.constant.DicCode; |
| | | import cc.mrbird.febs.common.core.constant.ModuleCode; |
| | | import cc.mrbird.febs.common.core.entity.QueryRequest; |
| | |
| | | import cc.mrbird.febs.server.hr.feign.IRemoteDeptService; |
| | | import cc.mrbird.febs.server.hr.mapper.EmpBaseInfoMapper; |
| | | import cc.mrbird.febs.server.hr.service.IEmpBaseInfoService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * name:EmpBaseinfo |
| | |
| | | public IPage<EmpBaseInfo> findEmpBaseInfos(QueryRequest request, EmpBaseInfo empBaseInfo) { |
| | | LambdaQueryWrapper<EmpBaseInfo> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(EmpBaseInfo::getDelFlag, empBaseInfo.getDelFlag()); |
| | | if (StringUtils.isNotBlank(empBaseInfo.getEmpNumb())) { |
| | | queryWrapper.like(EmpBaseInfo::getEmpNumb, empBaseInfo.getEmpNumb()); |
| | | } |
| | | if (StringUtils.isNotBlank(empBaseInfo.getEmpName())) { |
| | | queryWrapper.like(EmpBaseInfo::getEmpName, empBaseInfo.getEmpName()); |
| | | } |
| | | if (StringUtils.isNotBlank(empBaseInfo.getCertificateNumb())) { |
| | | queryWrapper.like(EmpBaseInfo::getCertificateNumb, empBaseInfo.getCertificateNumb()); |
| | | } |
| | | if (StringUtils.isNotBlank(empBaseInfo.getDeptName())) { |
| | | queryWrapper.like(EmpBaseInfo::getDeptName, empBaseInfo.getDeptName()); |
| | | } |
| | | if (StringUtils.isNotBlank(empBaseInfo.getEntryDateStr())) { |
| | | queryWrapper.between(EmpBaseInfo::getEntryDate, empBaseInfo.getEntryDateStr().split(",")[0], empBaseInfo.getEntryDateStr().split(",")[1]); |
| | | } |
| | | if (StringUtils.isNotBlank(empBaseInfo.getDimissionDateStr())) { |
| | | queryWrapper.between(EmpBaseInfo::getDimissionDate, empBaseInfo.getDimissionDateStr().split(",")[0], empBaseInfo.getDimissionDateStr().split(",")[1]); |
| | | } |
| | | if (StringUtils.isNotBlank(empBaseInfo.getSex())) { |
| | | queryWrapper.eq(EmpBaseInfo::getSex, empBaseInfo.getSex()); |
| | | } |
| | | if (StringUtils.isNotBlank(empBaseInfo.getEducation())) { |
| | | queryWrapper.like(EmpBaseInfo::getEducation, empBaseInfo.getEducation()); |
| | | } |
| | | if (StringUtils.isNotBlank(empBaseInfo.getPolitics())) { |
| | | queryWrapper.like(EmpBaseInfo::getPolitics, empBaseInfo.getPolitics()); |
| | | } |
| | | if (StringUtils.isNotBlank(empBaseInfo.getAgeStr())) { |
| | | queryWrapper.between(EmpBaseInfo::getAge, empBaseInfo.getAgeStr().split(",")[0], empBaseInfo.getAgeStr().split(",")[1]); |
| | | } |
| | | if (StringUtils.isNotBlank(empBaseInfo.getArchivesStatus())) { |
| | | queryWrapper.eq(EmpBaseInfo::getArchivesStatus, empBaseInfo.getArchivesStatus()); |
| | | } |
| | | if (StringUtils.isNotBlank(empBaseInfo.getInsuranceType())) { |
| | | queryWrapper.eq(EmpBaseInfo::getInsuranceType, empBaseInfo.getInsuranceType()); |
| | | } |
| | | if (StringUtils.isNotBlank(empBaseInfo.getEmpStatus())) { |
| | | queryWrapper.eq(EmpBaseInfo::getEmpStatus, empBaseInfo.getEmpStatus()); |
| | | } |
| | | if (StringUtils.isNotBlank(empBaseInfo.getHandbookStatus())) { |
| | | queryWrapper.eq(EmpBaseInfo::getHandbookStatus, empBaseInfo.getHandbookStatus()); |
| | | } |
| | | if (StringUtils.isNotBlank(empBaseInfo.getEmpCardStatus())) { |
| | | queryWrapper.eq(EmpBaseInfo::getEmpCardStatus, empBaseInfo.getEmpCardStatus()); |
| | | } |
| | | Page<EmpBaseInfo> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<EmpBaseInfo> iPage = this.page(page, queryWrapper); |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void createEmpBaseInfo(EmpBaseInfo empBaseInfo) { |
| | | empBaseInfo.setEmpId(SequenceUtil.generateId(0L, ModuleCode.HR_EMPLOYEE)); |
| | | EmpBaseInfo dbInfo = this.getEmpBaseInfo(empBaseInfo); |
| | | if(dbInfo==null) { |
| | | empBaseInfo.setEmpId(SequenceUtil.generateId(0L, ModuleCode.HR_EMPLOYEE)); |
| | | } else{ |
| | | empBaseInfo.setEmpId(dbInfo.getEmpId()); |
| | | } |
| | | empBaseInfo.setEmpStatus("0"); |
| | | empBaseInfo.setCreator(operatorId); |
| | | empBaseInfo.setModifier(operatorId); |
| | | this.save(empBaseInfo); |
| | | this.saveOrUpdate(empBaseInfo); |
| | | } |
| | | |
| | | @Override |
| | |
| | | List<String> list = new ArrayList<>(Arrays.asList(str)); |
| | | return empBaseInfoMapper.momentToNormal(list, operatorId) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public EmpBaseInfo getEmpBaseInfo(EmpBaseInfo empBaseInfo) { |
| | | QueryWrapper<EmpBaseInfo> queryWrapper = new QueryWrapper<>(); |
| | | if(StringUtils.isNotEmpty(empBaseInfo.getCertificateNumb())){ |
| | | queryWrapper.lambda().eq(EmpBaseInfo::getCertificateNumb, empBaseInfo.getCertificateNumb()); |
| | | } |
| | | |
| | | return this.getOne(queryWrapper); |
| | | } |
| | | } |