|
|
@@ -0,0 +1,485 @@
|
|
|
+package com.zhongzheng.modules.staff.service.impl;
|
|
|
+
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.zhongzheng.common.exception.CustomException;
|
|
|
+import com.zhongzheng.common.utils.DateUtils;
|
|
|
+import com.zhongzheng.common.utils.poi.EasyPoiUtil;
|
|
|
+import com.zhongzheng.modules.company.domain.Company;
|
|
|
+import com.zhongzheng.modules.company.domain.CompanyDepartment;
|
|
|
+import com.zhongzheng.modules.company.service.ICompanyDepartmentService;
|
|
|
+import com.zhongzheng.modules.company.service.ICompanyService;
|
|
|
+import com.zhongzheng.modules.staff.bo.*;
|
|
|
+import com.zhongzheng.modules.staff.domain.*;
|
|
|
+import com.zhongzheng.modules.staff.service.*;
|
|
|
+import com.zhongzheng.modules.staff.vo.ExcelStaffVo;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.github.pagehelper.Page;
|
|
|
+import com.zhongzheng.modules.staff.mapper.StaffMapper;
|
|
|
+import com.zhongzheng.modules.staff.vo.StaffVo;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 企业部门员工Service业务层处理
|
|
|
+ *
|
|
|
+ * @author ruoyi
|
|
|
+ * @date 2024-03-21
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class StaffServiceImpl extends ServiceImpl<StaffMapper, Staff> implements IStaffService {
|
|
|
+ @Autowired
|
|
|
+ private IStaffEduBgService iStaffEduBgService;
|
|
|
+ @Autowired
|
|
|
+ private IStaffEmergencyContactService iStaffEmergencyContactService;
|
|
|
+ @Autowired
|
|
|
+ private IStaffBankInfoService iStaffBankInfoService;
|
|
|
+ @Autowired
|
|
|
+ private IStaffContractArchivesService iStaffContractArchivesService;
|
|
|
+ @Autowired
|
|
|
+ private IStaffCertificateService iStaffCertificateService;
|
|
|
+ @Autowired
|
|
|
+ private ICompanyService iCompanyService;
|
|
|
+ @Autowired
|
|
|
+ private ICompanyDepartmentService iCompanyDepartmentService;
|
|
|
+ @Override
|
|
|
+ public StaffVo queryById(Long staffId) {
|
|
|
+ Staff db = this.baseMapper.selectById(staffId);
|
|
|
+ return BeanUtil.toBean(db, StaffVo.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<StaffVo> queryList(StaffQueryBo bo) {
|
|
|
+ LambdaQueryWrapper<Staff> lqw = Wrappers.lambdaQuery();
|
|
|
+ lqw.eq(bo.getCompanyId() != null, Staff::getCompanyId, bo.getCompanyId());
|
|
|
+ lqw.eq(bo.getDepartmentId() != null, Staff::getDepartmentId, bo.getDepartmentId());
|
|
|
+ lqw.like(StrUtil.isNotBlank(bo.getStaffName()), Staff::getStaffName, bo.getStaffName());
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getIdCard()), Staff::getIdCard, bo.getIdCard());
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getTelephone()), Staff::getTelephone, bo.getTelephone());
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getEmail()), Staff::getEmail, bo.getEmail());
|
|
|
+ lqw.eq(bo.getSex() != null, Staff::getSex, bo.getSex());
|
|
|
+ lqw.eq(bo.getBirthday() != null, Staff::getBirthday, bo.getBirthday());
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getNation()), Staff::getNation, bo.getNation());
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getPoliticsFace()), Staff::getPoliticsFace, bo.getPoliticsFace());
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getHkLocation()), Staff::getHkLocation, bo.getHkLocation());
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getStaffNumber()), Staff::getStaffNumber, bo.getStaffNumber());
|
|
|
+ lqw.like(StrUtil.isNotBlank(bo.getCompanyName()), Staff::getCompanyName, bo.getCompanyName());
|
|
|
+ lqw.like(StrUtil.isNotBlank(bo.getDepartmentName()), Staff::getDepartmentName, bo.getDepartmentName());
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getPosition()), Staff::getPosition, bo.getPosition());
|
|
|
+ lqw.eq(bo.getPositionStatus() != null, Staff::getPositionStatus, bo.getPositionStatus());
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getRecruitmentChannel()), Staff::getRecruitmentChannel, bo.getRecruitmentChannel());
|
|
|
+ lqw.eq(bo.getWorkDate() != null, Staff::getWorkDate, bo.getWorkDate());
|
|
|
+ lqw.eq(bo.getEntryDate() != null, Staff::getEntryDate, bo.getEntryDate());
|
|
|
+ lqw.eq(bo.getLeaveDate() != null, Staff::getLeaveDate, bo.getLeaveDate());
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getZCard()), Staff::getZCard, bo.getZCard());
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getFCard()), Staff::getFCard, bo.getFCard());
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getIssuingOrganization()), Staff::getIssuingOrganization, bo.getIssuingOrganization());
|
|
|
+ lqw.eq(bo.getStartDate() != null, Staff::getStartDate, bo.getStartDate());
|
|
|
+ lqw.eq(bo.getEndDate() != null, Staff::getEndDate, bo.getEndDate());
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getLabel()), Staff::getLabel, bo.getLabel());
|
|
|
+ lqw.eq(StrUtil.isNotBlank(bo.getRemarks()), Staff::getRemarks, bo.getRemarks());
|
|
|
+ lqw.eq(bo.getStatus() != null, Staff::getStatus, bo.getStatus());
|
|
|
+ return entity2Vo(this.list(lqw));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 实体类转化成视图对象
|
|
|
+ *
|
|
|
+ * @param collection 实体类集合
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<StaffVo> entity2Vo(Collection<Staff> collection) {
|
|
|
+ List<StaffVo> voList = collection.stream()
|
|
|
+ .map(any -> BeanUtil.toBean(any, StaffVo.class))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (collection instanceof Page) {
|
|
|
+ Page<Staff> page = (Page<Staff>) collection;
|
|
|
+ Page<StaffVo> pageVo = new Page<>();
|
|
|
+ BeanUtil.copyProperties(page, pageVo);
|
|
|
+ pageVo.addAll(voList);
|
|
|
+ voList = pageVo;
|
|
|
+ }
|
|
|
+ return voList;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean insertByAddBo(StaffAddBo bo) {
|
|
|
+ Staff add = BeanUtil.toBean(bo, Staff.class);
|
|
|
+ validEntityBeforeSave(add);
|
|
|
+ add.setCreateTime(DateUtils.getNowTime());
|
|
|
+ add.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ boolean save = this.save(add);
|
|
|
+ if (save) {
|
|
|
+ StaffQueryBo staffQueryBo = new StaffQueryBo();
|
|
|
+ List<StaffVo> staffVos = this.queryList(staffQueryBo);
|
|
|
+ List<StaffVo> collect = staffVos.stream().filter(s -> s.getIdCard().equals(bo.getIdCard())).collect(Collectors.toList());
|
|
|
+ StaffVo staffVo = collect.get(0);
|
|
|
+ Long staffId = staffVo.getStaffId();
|
|
|
+ List<StaffEduBgAddBo> staffEduBgList = bo.getStaffEduBgList();
|
|
|
+ if (ObjectUtil.isNotEmpty(staffEduBgList)) {
|
|
|
+ staffEduBgList.forEach(item -> {
|
|
|
+ item.setCompanyId(staffVo.getCompanyId());
|
|
|
+ item.setStaffId(staffId);
|
|
|
+ iStaffEduBgService.insertByAddBo(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ List<StaffEmergencyContactAddBo> staffEmergencyContactList = bo.getStaffEmergencyContactList();
|
|
|
+ if (ObjectUtil.isNotEmpty(staffEmergencyContactList)) {
|
|
|
+ staffEmergencyContactList.forEach(item -> {
|
|
|
+ item.setCompanyId(staffVo.getCompanyId());
|
|
|
+ item.setStaffId(staffId);
|
|
|
+ iStaffEmergencyContactService.insertByAddBo(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ List<StaffBankInfoAddBo> staffBankInfoList = bo.getStaffBankInfoList();
|
|
|
+ if (ObjectUtil.isNotEmpty(staffBankInfoList)) {
|
|
|
+ staffBankInfoList.forEach(item -> {
|
|
|
+ item.setCompanyId(staffVo.getCompanyId());
|
|
|
+ item.setStaffId(staffId);
|
|
|
+ iStaffBankInfoService.insertByAddBo(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ List<StaffContractArchivesAddBo> staffContractArchivesList = bo.getStaffContractArchivesList();
|
|
|
+ if (ObjectUtil.isNotEmpty(staffContractArchivesList)) {
|
|
|
+ staffContractArchivesList.forEach(item -> {
|
|
|
+ item.setCompanyId(staffVo.getCompanyId());
|
|
|
+ item.setStaffId(staffId);
|
|
|
+ iStaffContractArchivesService.insertByAddBo(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new CustomException("保存员工信息错误");
|
|
|
+ }
|
|
|
+ return save;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean updateByEditBo(StaffEditBo bo) {
|
|
|
+ bo.setStatus(1);
|
|
|
+ Staff staff = this.baseMapper.selectById(bo.getStaffId());
|
|
|
+ if (ObjectUtil.isNotEmpty(staff)) {
|
|
|
+ staff.setRemarks(bo.getRemarks());
|
|
|
+ } else {
|
|
|
+ throw new CustomException("员工不存在");
|
|
|
+ }
|
|
|
+ staff.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ return this.updateById(staff);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存前的数据校验
|
|
|
+ *
|
|
|
+ * @param entity 实体类数据
|
|
|
+ */
|
|
|
+ private void validEntityBeforeSave(Staff entity) {
|
|
|
+ //TODO 做一些数据校验,如唯一约束
|
|
|
+ if (ObjectUtil.isNotEmpty(entity.getStaffId())) {
|
|
|
+ this.baseMapper.deleteById(entity.getStaffId());
|
|
|
+ List<StaffEduBg> staffEduBgList = iStaffEduBgService.list(new LambdaQueryWrapper<StaffEduBg>().eq(StaffEduBg::getStaffId, entity.getStaffId()).eq(StaffEduBg::getStatus, 1));
|
|
|
+ if (ObjectUtil.isNotEmpty(staffEduBgList)) {
|
|
|
+ staffEduBgList.forEach(item -> {
|
|
|
+ iStaffEduBgService.removeById(item.getEduBgId());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ List<StaffBankInfo> staffBankInfoList = iStaffBankInfoService.list(new LambdaQueryWrapper<StaffBankInfo>().eq(StaffBankInfo::getStaffId, entity.getStaffId()).eq(StaffBankInfo::getStatus, 1));
|
|
|
+ if (ObjectUtil.isNotEmpty(staffBankInfoList)) {
|
|
|
+ staffBankInfoList.forEach(item -> {
|
|
|
+ iStaffBankInfoService.removeById(item.getInfoId());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ List<StaffContractArchives> staffContractArchivesList = iStaffContractArchivesService.list(new LambdaQueryWrapper<StaffContractArchives>().eq(StaffContractArchives::getStaffId, entity.getStaffId()).eq(StaffContractArchives::getStatus, 1));
|
|
|
+ if (ObjectUtil.isNotEmpty(staffContractArchivesList)) {
|
|
|
+ staffContractArchivesList.forEach(item -> {
|
|
|
+ iStaffContractArchivesService.removeById(item.getArchivesId());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ List<StaffEmergencyContact> staffEmergencyContactList = iStaffEmergencyContactService.list(new LambdaQueryWrapper<StaffEmergencyContact>().eq(StaffEmergencyContact::getStaffId, entity.getStaffId()).eq(StaffEmergencyContact::getStatus, 1));
|
|
|
+ if (ObjectUtil.isNotEmpty(staffEmergencyContactList)) {
|
|
|
+ staffEmergencyContactList.forEach(item -> {
|
|
|
+ iStaffEmergencyContactService.removeById(item.getContactId());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean deleteWithValidByIds(StaffEditBo bo) {
|
|
|
+ List<Long> staffIds = bo.getStaffIds();
|
|
|
+ if (ObjectUtil.isEmpty(staffIds)) {
|
|
|
+ throw new CustomException("请先勾勾选数据");
|
|
|
+ }
|
|
|
+ for (Long id : staffIds) {
|
|
|
+ Staff staff = this.baseMapper.selectById(id);
|
|
|
+ staff.setStatus(0);
|
|
|
+ this.baseMapper.updateById(staff);
|
|
|
+ List<StaffEduBg> staffEduBgList = iStaffEduBgService.list(new LambdaQueryWrapper<StaffEduBg>().eq(StaffEduBg::getStaffId, staff.getStaffId()));
|
|
|
+ if (ObjectUtil.isNotEmpty(staffEduBgList)) {
|
|
|
+ staffEduBgList.forEach(item -> {
|
|
|
+ item.setStatus(0);
|
|
|
+ iStaffEduBgService.updateById(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ List<StaffBankInfo> staffBankInfoList = iStaffBankInfoService.list(new LambdaQueryWrapper<StaffBankInfo>().eq(StaffBankInfo::getStaffId, staff.getStaffId()));
|
|
|
+ if (ObjectUtil.isNotEmpty(staffBankInfoList)) {
|
|
|
+ staffBankInfoList.forEach(item -> {
|
|
|
+ item.setStatus(0);
|
|
|
+ iStaffBankInfoService.updateById(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ List<StaffContractArchives> staffContractArchivesList = iStaffContractArchivesService.list(new LambdaQueryWrapper<StaffContractArchives>().eq(StaffContractArchives::getStaffId, staff.getStaffId()));
|
|
|
+ if (ObjectUtil.isNotEmpty(staffContractArchivesList)) {
|
|
|
+ staffContractArchivesList.forEach(item -> {
|
|
|
+ item.setStatus(0);
|
|
|
+ iStaffContractArchivesService.updateById(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ List<StaffEmergencyContact> staffEmergencyContactList = iStaffEmergencyContactService.list(new LambdaQueryWrapper<StaffEmergencyContact>().eq(StaffEmergencyContact::getStaffId, staff.getStaffId()));
|
|
|
+ if (ObjectUtil.isNotEmpty(staffEmergencyContactList)) {
|
|
|
+ staffEmergencyContactList.forEach(item -> {
|
|
|
+ item.setStatus(0);
|
|
|
+ iStaffEmergencyContactService.updateById(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ List<StaffCertificate> staffCertificateList = iStaffCertificateService.list(new LambdaQueryWrapper<StaffCertificate>().eq(StaffCertificate::getStaffId, staff.getStaffId()));
|
|
|
+ if (ObjectUtil.isNotEmpty(staffCertificateList)) {
|
|
|
+ staffCertificateList.forEach(item -> {
|
|
|
+ item.setStatus(0);
|
|
|
+ iStaffCertificateService.updateById(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<StaffVo> selectStaffList(StaffQueryBo bo) {
|
|
|
+ List<StaffVo> staffVos = this.baseMapper.selectAllStaffList(bo);
|
|
|
+ staffVos.forEach(item -> {
|
|
|
+ List<StaffEduBg> staffEduBgList = iStaffEduBgService.list(new LambdaQueryWrapper<StaffEduBg>().eq(StaffEduBg::getStaffId, item.getStaffId()));
|
|
|
+ List<StaffBankInfo> staffBankInfoList = iStaffBankInfoService.list(new LambdaQueryWrapper<StaffBankInfo>().eq(StaffBankInfo::getStaffId, item.getStaffId()));
|
|
|
+ List<StaffEmergencyContact> staffEmergencyContactList = iStaffEmergencyContactService.list(new LambdaQueryWrapper<StaffEmergencyContact>().eq(StaffEmergencyContact::getStaffId, item.getStaffId()));
|
|
|
+ List<StaffContractArchives> staffContractArchivesList = iStaffContractArchivesService.list(new LambdaQueryWrapper<StaffContractArchives>().eq(StaffContractArchives::getStaffId, item.getStaffId()));
|
|
|
+ List<StaffCertificate> staffCertificateList = iStaffCertificateService.list(new LambdaQueryWrapper<StaffCertificate>().eq(StaffCertificate::getStaffId, item.getStaffId()).eq(StaffCertificate::getStatus, 1));
|
|
|
+ item.setStaffCertificateCount((staffCertificateList.size()));
|
|
|
+ item.setStaffEduBgList(staffEduBgList);
|
|
|
+ item.setStaffBankInfoList(staffBankInfoList);
|
|
|
+ item.setStaffEmergencyContactList(staffEmergencyContactList);
|
|
|
+ item.setStaffContractArchivesList(staffContractArchivesList);
|
|
|
+ });
|
|
|
+ return staffVos;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public Integer getDegreeType(String degree) {
|
|
|
+ //公司类型判断
|
|
|
+ switch (degree) {
|
|
|
+ case "小学":
|
|
|
+ return 1;
|
|
|
+ case "中学":
|
|
|
+ return 2;
|
|
|
+ case "职高":
|
|
|
+ return 3;
|
|
|
+ case "高中":
|
|
|
+ return 4;
|
|
|
+ case "专科":
|
|
|
+ return 5;
|
|
|
+ case "本科":
|
|
|
+ return 6;
|
|
|
+ case "硕士研究生":
|
|
|
+ return 7;
|
|
|
+ case "博士研究生":
|
|
|
+ return 8;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Integer getSexType(String sex) {
|
|
|
+ //公司类型判断
|
|
|
+ switch (sex) {
|
|
|
+ case "男":
|
|
|
+ return 1;
|
|
|
+ case "女":
|
|
|
+ return 2;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Integer getLearnIngType(String learnIngType) {
|
|
|
+ //公司类型判断
|
|
|
+ switch (learnIngType) {
|
|
|
+ case "全日制":
|
|
|
+ return 1;
|
|
|
+ case "非全日制":
|
|
|
+ return 2;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ public Long getArchivesType(String archivesType) {
|
|
|
+ //公司类型判断
|
|
|
+ switch (archivesType) {
|
|
|
+ case "劳动合同":
|
|
|
+ return 1L;
|
|
|
+ case "编外合同":
|
|
|
+ return 2L;
|
|
|
+ case "其他合同":
|
|
|
+ return 3L;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Integer getPositionStatus(String positionStatus) {
|
|
|
+ //公司类型判断
|
|
|
+ switch (positionStatus) {
|
|
|
+ case "全职":
|
|
|
+ return 1;
|
|
|
+ case "离职":
|
|
|
+ return 2;
|
|
|
+ case "编外":
|
|
|
+ return 3;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean importExcelList(MultipartFile file) {
|
|
|
+ List<ExcelStaffVo> excelStaffVos = EasyPoiUtil.importExcel(file, 1, 1, ExcelStaffVo.class);
|
|
|
+ if (ObjectUtil.isEmpty(excelStaffVos)) {
|
|
|
+ throw new CustomException("文档数据为空");
|
|
|
+ }
|
|
|
+ Map<String, List<ExcelStaffVo>> excelList = excelStaffVos.stream().collect(Collectors.groupingBy(ExcelStaffVo::getIdCard));
|
|
|
+ excelList.forEach((k, v) -> {
|
|
|
+ List<ExcelStaffVo> excelStaffVosList = excelList.get(k);
|
|
|
+ ExcelStaffVo excelStaffVo = excelStaffVosList.get(0);
|
|
|
+ if (ObjectUtil.isAllNotEmpty(excelStaffVo.getStaffName(), excelStaffVo.getIdCard(), excelStaffVo.getTelephone(), excelStaffVo.getCompanyName())) {
|
|
|
+ List<Company> companies = iCompanyService.list(new LambdaQueryWrapper<Company>().eq(Company::getCompanyName, excelStaffVo.getCompanyName()).eq(Company::getStatus, 1));
|
|
|
+ if (ObjectUtil.isNotEmpty(companies)) {
|
|
|
+ Company company = companies.get(0);
|
|
|
+ Staff staff = new Staff();
|
|
|
+ staff.setStaffName(excelStaffVo.getStaffName());
|
|
|
+ staff.setIdCard(excelStaffVo.getIdCard());
|
|
|
+ staff.setTelephone(excelStaffVo.getTelephone());
|
|
|
+ staff.setEmail(excelStaffVo.getEmail());
|
|
|
+ if (ObjectUtil.isNotEmpty(excelStaffVo.getSex())) {
|
|
|
+ Integer sexType = getSexType(excelStaffVo.getSex());
|
|
|
+ staff.setSex(Long.valueOf(sexType));
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(excelStaffVo.getBirthday())) {
|
|
|
+ String birthday = excelStaffVo.getBirthday();
|
|
|
+ Long timeSec = DateUtils.dateTimeSec("yyyy/MM/dd", birthday);
|
|
|
+ staff.setBirthday(timeSec);
|
|
|
+ }
|
|
|
+ staff.setNation(excelStaffVo.getNation());
|
|
|
+ staff.setPoliticsFace(excelStaffVo.getPoliticsFace());
|
|
|
+ staff.setHkLocation(excelStaffVo.getHkLocation());
|
|
|
+ staff.setHomeAddress(excelStaffVo.getHomeAddress());
|
|
|
+ staff.setCompanyId(company.getCompanyId());
|
|
|
+ staff.setStaffNumber(excelStaffVo.getStaffNumber());
|
|
|
+ staff.setCompanyName(company.getCompanyName());
|
|
|
+ staff.setDepartmentName(excelStaffVo.getDepartmentName());
|
|
|
+ List<CompanyDepartment> departments = iCompanyDepartmentService.list(new LambdaQueryWrapper<CompanyDepartment>().eq(CompanyDepartment::getDepartmentName, excelStaffVo.getDepartmentName()).eq(CompanyDepartment::getStatus, 1));
|
|
|
+ if (ObjectUtil.isNotEmpty(departments)){
|
|
|
+ CompanyDepartment companyDepartment = departments.get(0);
|
|
|
+ staff.setDepartmentId(companyDepartment.getDepartmentId());
|
|
|
+ }
|
|
|
+ staff.setPosition(excelStaffVo.getPosition());
|
|
|
+ if (ObjectUtil.isNotEmpty(excelStaffVo.getPositionStatus())) {
|
|
|
+ staff.setPositionStatus(Long.valueOf(getPositionStatus(excelStaffVo.getPositionStatus())));
|
|
|
+ }
|
|
|
+ staff.setRecruitmentChannel(excelStaffVo.getRecruitmentChannel());
|
|
|
+ if (ObjectUtil.isNotEmpty(excelStaffVo.getWorkDate())) {
|
|
|
+ staff.setWorkDate(DateUtils.dateTimeSec("yyyy/MM/dd", excelStaffVo.getWorkDate()));
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(excelStaffVo.getEntryDate())) {
|
|
|
+ staff.setEntryDate(DateUtils.dateTimeSec("yyyy/MM/dd", excelStaffVo.getEntryDate()));
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(excelStaffVo.getLeaveDate())) {
|
|
|
+ staff.setLeaveDate(DateUtils.dateTimeSec("yyyy/MM/dd", excelStaffVo.getLeaveDate()));
|
|
|
+ }
|
|
|
+ staff.setIssuingOrganization(excelStaffVo.getIssuingOrganization());
|
|
|
+ if (ObjectUtil.isNotEmpty(excelStaffVo.getStartDate())) {
|
|
|
+ staff.setStartDate(DateUtils.dateTimeSec("yyyy/MM/dd", excelStaffVo.getStartDate()));
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(excelStaffVo.getEndDate())) {
|
|
|
+ staff.setEndDate(DateUtils.dateTimeSec("yyyy/MM/dd", excelStaffVo.getEndDate()));
|
|
|
+ }
|
|
|
+ staff.setCreateTime(DateUtils.getNowTime());
|
|
|
+ staff.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ this.baseMapper.insert(staff);
|
|
|
+ excelStaffVosList.forEach(item -> {
|
|
|
+ List<Staff> staffList = this.baseMapper.selectList(new LambdaQueryWrapper<Staff>().eq(Staff::getIdCard, item.getIdCard()).eq(Staff::getStatus, 1));
|
|
|
+ if (ObjectUtil.isNotEmpty(staffList)) {
|
|
|
+ Staff staff1 = staffList.get(0);
|
|
|
+ StaffEduBg staffEduBg = new StaffEduBg();
|
|
|
+ if (ObjectUtil.isNotEmpty(item.getStartTime())) {
|
|
|
+ staffEduBg.setStartDate(DateUtils.dateTimeSec("yyyy/MM/dd", item.getStartTime()));
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(item.getEndTime())) {
|
|
|
+ staffEduBg.setEndDate(DateUtils.dateTimeSec("yyyy/MM/dd", item.getEndTime()));
|
|
|
+ }
|
|
|
+ staffEduBg.setStaffId(staff1.getStaffId());
|
|
|
+ staffEduBg.setGraduationSchool(item.getGraduationSchool());
|
|
|
+ staffEduBg.setMajor(item.getMajor());
|
|
|
+ staffEduBg.setLearningType(Long.valueOf(getLearnIngType(item.getLearnType())));
|
|
|
+ staffEduBg.setDegree(Long.valueOf(getLearnIngType(item.getLearnType())));
|
|
|
+ staffEduBg.setCreateTime(DateUtils.getNowTime());
|
|
|
+ staffEduBg.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ staffEduBg.setCompanyId(company.getCompanyId());
|
|
|
+ StaffEduBgAddBo staffEduBgAddBo = BeanUtil.toBean(staffEduBg, StaffEduBgAddBo.class);
|
|
|
+ staffEduBgAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
+ staffEduBgAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iStaffEduBgService.insertByAddBo(staffEduBgAddBo);
|
|
|
+ StaffEmergencyContact staffEmergencyContact = new StaffEmergencyContact();
|
|
|
+ staffEmergencyContact.setRelation(item.getRelation());
|
|
|
+ staffEmergencyContact.setCompanyId(company.getCompanyId());
|
|
|
+ staffEmergencyContact.setStaffId(staff1.getStaffId());
|
|
|
+ staffEmergencyContact.setContactName(item.getContactName());
|
|
|
+ staffEmergencyContact.setContactTelephone(item.getContactTelephone());
|
|
|
+ StaffEmergencyContactAddBo staffEmergencyContactAddBo = BeanUtil.toBean(staffEmergencyContact, StaffEmergencyContactAddBo.class);
|
|
|
+ staffEmergencyContactAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
+ staffEmergencyContactAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iStaffEmergencyContactService.insertByAddBo(staffEmergencyContactAddBo);
|
|
|
+ StaffBankInfo staffBankInfo = new StaffBankInfo();
|
|
|
+ staffBankInfo.setStaffId(staff1.getStaffId());
|
|
|
+ staffBankInfo.setCompanyId(company.getCompanyId());
|
|
|
+ staffBankInfo.setOpenName(item.getOpenName());
|
|
|
+ staffBankInfo.setOpenBank(item.getOpenBank());
|
|
|
+ staffBankInfo.setBankNumber(item.getBankNumber());
|
|
|
+ StaffBankInfoAddBo staffBankInfoAddBo = BeanUtil.toBean(staffBankInfo, StaffBankInfoAddBo.class);
|
|
|
+ staffBankInfoAddBo.setCreateTime(DateUtils.getNowTime());
|
|
|
+ staffBankInfoAddBo.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iStaffBankInfoService.insertByAddBo(staffBankInfoAddBo);
|
|
|
+ StaffContractArchives staffContractArchives = new StaffContractArchives();
|
|
|
+ staffContractArchives.setStaffId(staff1.getStaffId());
|
|
|
+ staffContractArchives.setCompanyId(company.getCompanyId());
|
|
|
+ staffContractArchives.setArchivesNumber(item.getArchivesNumber());
|
|
|
+ staffContractArchives.setArchivesName(item.getArchivesName());
|
|
|
+ staffContractArchives.setArchivesType(getArchivesType(item.getArchivesType()));
|
|
|
+ if (ObjectUtil.isNotEmpty(item.getSigningDate())) {
|
|
|
+ staffContractArchives.setSigningDate(DateUtils.dateTimeSec("yyyy/MM/dd", item.getSigningDate()));
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(item.getEffectiveDate())) {
|
|
|
+ staffContractArchives.setEffectiveDate(DateUtils.dateTimeSec("yyyy/MM/dd", item.getEffectiveDate()));
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(item.getOutDate())) {
|
|
|
+ staffContractArchives.setEndDate(DateUtils.dateTimeSec("yyyy/MM/dd", item.getOutDate()));
|
|
|
+ }
|
|
|
+ StaffContractArchivesAddBo staffContractArchivesAddBo = BeanUtil.toBean(staffContractArchives, StaffContractArchivesAddBo.class);
|
|
|
+ iStaffContractArchivesService.insertByAddBo(staffContractArchivesAddBo);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+}
|