| | |
| | | package cc.mrbird.febs.server.hr.service.impl; |
| | | |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.util.*; |
| | | |
| | | import cc.mrbird.febs.common.core.entity.system.SysConfig; |
| | | import cc.mrbird.febs.common.core.utils.MyUtil; |
| | | import cc.mrbird.febs.server.hr.entity.EmpDimissionLog; |
| | | import cc.mrbird.febs.server.hr.entity.EmpJobChange; |
| | | import cc.mrbird.febs.server.hr.properties.FebsServerHrProperties; |
| | | import cc.mrbird.febs.server.hr.service.IEmpDimissionLogService; |
| | | import cc.mrbird.febs.server.hr.service.IEmpJobChangeService; |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cc.mrbird.febs.server.hr.entity.*; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | |
| | | import cc.mrbird.febs.server.hr.mapper.EmpBaseInfoMapper; |
| | | import cc.mrbird.febs.server.hr.service.IEmpBaseInfoService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.util.FileSystemUtils; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * name:EmpBaseinfo |
| | |
| | | private final EmpBaseInfoMapper empBaseInfoMapper; |
| | | private final IEmpDimissionLogService dimissionLogService; |
| | | private final IEmpJobChangeService jobChangeService; |
| | | |
| | | private final FebsServerHrProperties properties; |
| | | private final String operatorId = Optional.ofNullable(FebsUtil.getCurrentUser()) |
| | | .map(u -> u.getUserId().toString()) |
| | | .orElse("1"); |
| | |
| | | iPage.setRecords(list); |
| | | return iPage; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public IPage<EmpBaseInfo> findZsEmpBaseInfos(QueryRequest request, EmpBaseInfo empBaseInfo) { |
| | | LambdaQueryWrapper<EmpBaseInfo> queryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | } else{ |
| | | empBaseInfo.setEmpId(dbInfo.getEmpId()); |
| | | } |
| | | if (StrUtil.isNotBlank(empBaseInfo.getImagePath())){ |
| | | String path = properties.getEmpBaseInfoPath()+empBaseInfo.getEmpId()+".png"; |
| | | if ( MyUtil.generateImage(empBaseInfo.getImagePath(),path)) { |
| | | empBaseInfo.setImagePath(empBaseInfo.getEmpId()+".png"); |
| | | }; |
| | | } |
| | | empBaseInfo.setCreator(operatorId); |
| | | empBaseInfo.setModifier(operatorId); |
| | | this.saveOrUpdate(empBaseInfo); |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateEmpBaseInfo(EmpBaseInfo empBaseInfo) { |
| | | if (StrUtil.isNotBlank(empBaseInfo.getImagePath())){ |
| | | String path = properties.getEmpBaseInfoPath()+empBaseInfo.getEmpId()+".png"; |
| | | if ( MyUtil.generateImage(empBaseInfo.getImagePath(),path)) { |
| | | empBaseInfo.setImagePath(empBaseInfo.getEmpId()+".png"); |
| | | } |
| | | |
| | | } |
| | | EmpBaseInfo dbData = this.getById(empBaseInfo.getEmpId()); |
| | | empBaseInfo.setCreateTime(dbData.getCreateTime()); |
| | | empBaseInfo.setCreator(dbData.getCreator()); |
| | |
| | | if (tempEmpBaseInfo == null) { |
| | | return false; |
| | | } |
| | | return !empBaseInfo.getEmpId().equals(tempEmpBaseInfo.getEmpId()); |
| | | return !empBaseInfo.getEmpNumb().equals(tempEmpBaseInfo.getEmpNumb()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | for (List<Object> list : listObject) { |
| | | EmpBaseInfo empBaseInfo = new EmpBaseInfo(); |
| | | empBaseInfo.setEmpId(SequenceUtil.generateId(0L, ModuleCode.HR_EMPLOYEE)); |
| | | empBaseInfo.setEmpNumb(list.get(0).toString()); |
| | | empBaseInfo.setArchivesNumb(list.get(0).toString()); |
| | | empBaseInfo.setEmpNumb(list.get(1).toString()); |
| | | empBaseInfo.setEmpName(list.get(2).toString()); |
| | | List<Dept> depts = CastUtil.castList(redisService.get("depts"), Dept.class); |
| | | empBaseInfo.setDeptName(list.get(1).toString()); |
| | | Long deptId=depts.stream().filter(d -> d.getDeptName().equals(list.get(1).toString())).findFirst().get().getDeptId(); |
| | | empBaseInfo.setDeptName(list.get(3).toString()); |
| | | Long deptId = depts.stream().filter(d -> d.getDeptName().equals(list.get(3).toString())).findFirst().get() |
| | | .getDeptId(); |
| | | empBaseInfo.setDeptId(deptId); |
| | | empBaseInfo.setJobName(list.get(2).toString()); |
| | | empBaseInfo.setEmpName(list.get(3).toString()); |
| | | empBaseInfo.setCertificateNumb(list.get(4).toString()); |
| | | empBaseInfo.setSex("男".equals(list.get(5).toString())?"1":"0"); |
| | | if (StringUtils.isNotBlank(list.get(6).toString())) { |
| | | empBaseInfo.setAge(Integer.valueOf(list.get(6).toString())); |
| | | } |
| | | empBaseInfo.setEducation(list.get(7).toString()); |
| | | empBaseInfo.setNativePlace(list.get(8).toString()); |
| | | empBaseInfo.setTelePhone(list.get(9).toString()); |
| | | empBaseInfo.setJobName(list.get(4).toString()); |
| | | empBaseInfo.setEmpType(list.get(5).toString()); |
| | | empBaseInfo.setSex("男".equals(list.get(6).toString()) ? "1" : "2"); |
| | | empBaseInfo.setNation(list.get(7).toString()); |
| | | empBaseInfo.setCertificateNumb(list.get(8).toString()); |
| | | empBaseInfo.setMarriage(list.get(9).toString()); |
| | | if (StringUtils.isNotBlank(list.get(10).toString())) { |
| | | empBaseInfo.setEntryDate(DateUtil.parseDate(list.get(10).toString())); |
| | | empBaseInfo.setStature(Integer.valueOf(list.get(10).toString())); |
| | | } |
| | | empBaseInfo.setPolitics(list.get(11).toString()); |
| | | if (StringUtils.isNotBlank(list.get(12).toString())) { |
| | | empBaseInfo.setEntryDate(DateUtil.parseDate(list.get(12).toString())); |
| | | } |
| | | empBaseInfo.setEducation(list.get(13).toString()); |
| | | if (StringUtils.isNotBlank(list.get(14).toString())) { |
| | | empBaseInfo.setSeniority(Integer.valueOf(list.get(14).toString())); |
| | | } |
| | | empBaseInfo.setNativePlace(list.get(15).toString()); |
| | | empBaseInfo.setCensusAddress(list.get(16).toString()); |
| | | empBaseInfo.setCurrentAddress(list.get(17).toString()); |
| | | empBaseInfo.setGuardNumb(list.get(18).toString()); |
| | | empBaseInfo.setReturnReceipt(list.get(19).toString()); |
| | | empBaseInfo.setTelePhone(list.get(20).toString()); |
| | | empBaseInfo.setIntroducer(list.get(21).toString()); |
| | | empBaseInfo.setBankName(list.get(22).toString()); |
| | | empBaseInfo.setBankNumb(list.get(23).toString()); |
| | | empBaseInfo.setInsuranceType(list.get(24).toString()); |
| | | empBaseInfo.setSocialNumb(list.get(25).toString()); |
| | | empBaseInfo.setFamily(list.get(26).toString()); |
| | | empBaseInfo.setUrgencyPhone(list.get(27).toString()); |
| | | empBaseInfo.setHandbookStatus(list.get(28).toString()); |
| | | empBaseInfo.setEmpCardStatus(list.get(29).toString()); |
| | | empBaseInfo.setCertificateList(list.get(30).toString()); |
| | | empBaseInfo.setEmpStatus("0"); |
| | | this.save(empBaseInfo); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void getImage(String empId, HttpServletResponse response) throws Exception { |
| | | EmpBaseInfo empBaseInfo = this.getById(empId); |
| | | if (StrUtil.isBlank(empBaseInfo.getImagePath())){ |
| | | return; |
| | | } |
| | | String path = properties.getEmpBaseInfoPath()+empBaseInfo.getEmpId()+".png"; |
| | | try (InputStream inputStream = new FileInputStream(path); OutputStream out = response.getOutputStream()) { |
| | | |
| | | //byte数组用于存放图片字节数据 |
| | | byte[] buff = new byte[inputStream.available()]; |
| | | |
| | | inputStream.read(buff); |
| | | inputStream.close(); |
| | | |
| | | //设置发送到客户端的响应内容类型 |
| | | response.setContentType("image/png"); |
| | | |
| | | out.write(buff); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | |
| | | manOld=sysConfig.get(0).getConfigValue(); |
| | | womanOld=sysConfig.get(1).getConfigValue(); |
| | | } |
| | | //在职员工,正式员工,临时员工,正常离职,自动离职,公司辞退 判断条件离职申请日期 |
| | | //在职员工,正式员工,临时员工,超龄员工 |
| | | Map<String, Object> stringObjectMap = this.baseMapper.countBaseInfoList(index,btime,etime,manOld,womanOld); |
| | | //正常离职,自动离职,公司辞退 判断条件创建日期 |
| | | Map<String, Object> zclzObjectMap =this.baseMapper.countZcygBaseInfoList(index,btime,etime); |
| | | if(zclzObjectMap!=null){ |
| | | stringObjectMap.put("zclz",zclzObjectMap.get("zclz").toString()); |
| | | stringObjectMap.put("zdlz",zclzObjectMap.get("zdlz").toString()); |
| | | stringObjectMap.put("gsct",zclzObjectMap.get("gsct").toString()); |
| | | } |
| | | //新进员工 判断条件入职日期 |
| | | Integer xjygObjectMap =this.baseMapper.countXjygBaseInfoList(index,btime,etime); |
| | | if(xjygObjectMap!=null){ |
| | | stringObjectMap.put("xjyg",xjygObjectMap); |
| | | } |
| | | //离职员工总数,解除合同 判断条件离职申请日期 |
| | | |
| | | //离职员工总数 |
| | | Integer empStatus = this.baseMapper.selectCount(new QueryWrapper<EmpBaseInfo>().eq("empStatus", 1)); |
| | | if(empStatus!=null){ |
| | | stringObjectMap.put("lzyg",empStatus); |
| | | } |
| | | //解除合同 判断条件离职申请日期 |
| | | Map<String, Object> lzygObjectMap =this.baseMapper.countLzygBaseInfoList(index,btime,etime); |
| | | if(lzygObjectMap!=null){ |
| | | stringObjectMap.put("lzyg",lzygObjectMap.get("lzyg").toString()); |
| | | stringObjectMap.put("jcht",lzygObjectMap.get("jcht").toString()); |
| | | } |
| | | //辞职申请员工总数 判断条件辞职申请日期 |
| | |
| | | if(czygObjectMap!=null){ |
| | | stringObjectMap.put("czyg",czygObjectMap); |
| | | } |
| | | //有效合同,新签合同,续签合同 判断条件合同签订日期 |
| | | //有效合同 判断条件合同签订日期 |
| | | Map<String, Object> yxhtObjectMap =this.baseMapper.countYxhtBaseInfoList(index,btime,etime); |
| | | if(yxhtObjectMap!=null){ |
| | | stringObjectMap.put("yxht",yxhtObjectMap.get("yxht").toString()); |
| | | stringObjectMap.put("xinqht",yxhtObjectMap.get("xinqht").toString()); |
| | | stringObjectMap.put("xqht",yxhtObjectMap.get("xqht").toString()); |
| | | } |
| | | //新签合同,续签合同 判断条件合同签订日期 |
| | | Map<String, Object> xqhtObjectMap =this.baseMapper.countXqhtBaseInfoList(index,btime,etime); |
| | | if(yxhtObjectMap!=null){ |
| | | stringObjectMap.put("xinqht",xqhtObjectMap.get("xinqht").toString()); |
| | | stringObjectMap.put("xqht",xqhtObjectMap.get("xqht").toString()); |
| | | } |
| | | //到期合同 判断条件合同结束时间 |
| | | Integer dqhtObjectMap =this.baseMapper.countDqhtBaseInfoList(index,btime,etime); |
| | |
| | | } |
| | | return stringObjectMap; |
| | | } |
| | | } |
| | | } |