| | |
| | | import cc.mrbird.febs.server.hr.service.IEmpDimissionLogService; |
| | | import cc.mrbird.febs.server.hr.service.IEmpJobChangeService; |
| | | import cc.mrbird.febs.server.hr.util.PoiExportExcel; |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.IdcardUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | @Override |
| | | public IPage<EmpBaseInfo> findZsEmpBaseInfos(QueryRequest request, EmpBaseInfo empBaseInfo) { |
| | | Page<EmpBaseInfo> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | SortUtil.handlePageSort(request, page, "createTime", FebsConstant.ORDER_DESC, true); |
| | | SortUtil.handlePageSort(request, page, "entryDate", FebsConstant.ORDER_ASC, true); |
| | | IPage<EmpBaseInfo> iPage = empBaseInfoMapper.selectPageVo(page, createQueryWrapper(empBaseInfo)); |
| | | //设置部门 |
| | | // List<EmpBaseInfo> list = setDeptName(iPage.getRecords()); |
| | |
| | | public void createEmpBaseInfo(EmpBaseInfo empBaseInfo) { |
| | | String operatorId = Optional.of(FebsUtil.getUserId()).orElse("1"); |
| | | EmpBaseInfo dbInfo = this.getEmpBaseInfo(empBaseInfo); |
| | | if (dbInfo == null) { |
| | | empBaseInfo.setEmpId(SequenceUtil.generateId(0L, ModuleCode.HR_EMPLOYEE)); |
| | | Long empId = SequenceUtil.generateId(0L, ModuleCode.HR_EMPLOYEE); |
| | | boolean saveDimissionLog = true; |
| | | if (dbInfo == null) { |
| | | empBaseInfo.setEmpId(empId); |
| | | // saveDimissionLog = true; |
| | | } else { |
| | | empBaseInfo.setEmpId(dbInfo.getEmpId()); |
| | | } |
| | |
| | | empBaseInfo.setCreator(operatorId); |
| | | empBaseInfo.setModifier(operatorId); |
| | | this.saveOrUpdate(empBaseInfo); |
| | | |
| | | EmpDimissionLog dimissionLog = new EmpDimissionLog(); |
| | | dimissionLog.setCloseId(SequenceUtil.generateId(0L, ModuleCode.HR_EMPLOYEE)); |
| | | dimissionLog.setEmpId(empId); |
| | | dimissionLog.setEntryDate(empBaseInfo.getEntryDate()); |
| | | dimissionLog.setDimissionType("20"); |
| | | dimissionLog.setRemark(empBaseInfo.getRemark()); |
| | | dimissionLog.setCreator(operatorId); |
| | | dimissionLog.setModifier(operatorId); |
| | | |
| | | dimissionLogService.save(dimissionLog); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateEmpBaseInfo(EmpBaseInfo empBaseInfo) { |
| | | String operatorId = Optional.of(FebsUtil.getUserId()).orElse("1"); |
| | | if (StrUtil.isNotBlank(empBaseInfo.getImagePath())) { |
| | | if (StrUtil.isNotBlank(empBaseInfo.getImagePath())&&empBaseInfo.getImagePath().indexOf(",")>0) { |
| | | String path = properties.getEmpBaseInfoPath() + empBaseInfo.getEmpId() + ".png"; |
| | | if (MyUtil.generateImage(empBaseInfo.getImagePath(), path)) { |
| | | empBaseInfo.setImagePath(empBaseInfo.getEmpId() + ".png"); |
| | |
| | | empBaseInfo.setJobId(position.getPositionId()); |
| | | empBaseInfo.setJobName(list.get(3).toString()); |
| | | empBaseInfo.setEmpName(list.get(4).toString()); |
| | | empBaseInfo.setCertificateNumb(list.get(5).toString()); |
| | | try { |
| | | if(StrUtil.isNotBlank(list.get(5).toString())){ |
| | | empBaseInfo.setCertificateNumb(list.get(5).toString()); |
| | | if (IdcardUtil.isValidCard(list.get(5).toString())){ |
| | | empBaseInfo.setAge(IdcardUtil.getAgeByIdCard(list.get(5).toString())); |
| | | empBaseInfo.setBirthdate(IdcardUtil.getBirthDate(list.get(5).toString())); |
| | | } |
| | | } |
| | | |
| | | }catch (Exception e){ |
| | | log.error("导入人员身份证异常:{}",e); |
| | | returnList.add(StrUtil.format("导入员工基本信息异常: 出现位置第{}行, 原因:{}检查身份证是否正确", listObject.indexOf(list) + 1, list.get(5).toString())); |
| | | continue; |
| | | } |
| | | |
| | | |
| | | empBaseInfo.setSex("男".equals(list.get(6).toString()) ? "1" : "2"); |
| | | |
| | | //民族 |
| | |
| | | |
| | | empBaseInfo.setCensusAddress(list.get(15).toString()); |
| | | empBaseInfo.setCurrentAddress(list.get(16).toString()); |
| | | |
| | | //员工类型 |
| | | dicItem =dicItems.parallelStream().filter(j->StrUtil.equalsIgnoreCase(j.getDicCode(),"empType")&&StrUtil.equals(j.getDicItemName(),list.get(17).toString())).findFirst().orElse(null); |
| | | if (null!=dicItem){ |
| | | empBaseInfo.setEmpType(dicItem.getDicItemCode()); |
| | |
| | | empBaseInfo.setEmpCardStatus(dicItem.getDicItemCode()); |
| | | } |
| | | |
| | | //相关证件 |
| | | List<DicItem> dicItemList = new ArrayList<>(); |
| | | String[] certificateList = list.get(30).toString().split(StringConstant.COMMA); |
| | | if (null != certificateList){ |
| | | for (String s : certificateList) { |
| | | dicItem = dicItems.parallelStream().filter(j->StrUtil.equalsIgnoreCase(j.getDicCode(),"certificateList")&&StrUtil.equals(j.getDicItemName(),s)).findFirst().orElse(null); |
| | | if (null!=dicItem){ |
| | | dicItemList.add(dicItem); |
| | | } |
| | | } |
| | | } |
| | | |
| | | empBaseInfo.setCertificateList(list.get(30).toString()); |
| | | if(CollUtil.isNotEmpty(dicItemList)){ |
| | | empBaseInfo.setCertificateList(dicItemList.stream().map(i->i.getDicItemCode()).collect(Collectors.joining(StringConstant.COMMA))); |
| | | } |
| | | |
| | | |
| | | empBaseInfo.setDelFlag(2); |
| | | //入职类型 |
| | | dicItem =dicItems.parallelStream().filter(j->StrUtil.equalsIgnoreCase(j.getDicCode(),"lztype")&&StrUtil.equals(j.getDicItemName(),list.get(31).toString())).findFirst().orElse(null); |
| | |
| | | if (StrUtil.isBlank(empBaseInfo.getImagePath())) { |
| | | return; |
| | | } |
| | | String path = properties.getEmpBaseInfoPath() + empBaseInfo.getEmpId() + ".png"; |
| | | String path = properties.getEmpBaseInfoPath() + empBaseInfo.getImagePath(); |
| | | try (InputStream inputStream = new FileInputStream(path); OutputStream out = response.getOutputStream()) { |
| | | |
| | | //byte数组用于存放图片字节数据 |
| | |
| | | inputStream.read(buff); |
| | | inputStream.close(); |
| | | |
| | | //设置发送到客户端的响应内容类型 |
| | | response.setContentType("image/png"); |
| | | |
| | | String contentType = empBaseInfo.getImagePath().substring(empBaseInfo.getImagePath().lastIndexOf(".")+1); |
| | | if (contentType.equals("tif")){ |
| | | //设置发送到客户端的响应内容类型 |
| | | response.setContentType("image/tiff"); |
| | | }else if (contentType.equals("bmp")){ |
| | | response.setContentType("application/x-bmp"); |
| | | }else if (contentType.equals("jpg")){ |
| | | response.setContentType("image/jpeg"); |
| | | }else if (contentType.equals("gif")){ |
| | | response.setContentType("image/gif"); |
| | | }else{ |
| | | response.setContentType("image/png"); |
| | | } |
| | | out.write(buff); |
| | | } |
| | | } |
| | |
| | | public EmpBaseInfo addInEmpBaseInfo(EmpBaseInfo empBaseInfo) { |
| | | EmpBaseInfo dbEmpInfo = this.getEmpBaseInfo(empBaseInfo); |
| | | if (dbEmpInfo == null) { |
| | | empBaseInfo.setDelFlag(0); |
| | | this.createEmpBaseInfo(empBaseInfo); |
| | | return null; |
| | | } else { |