| | |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | import cc.mrbird.febs.common.core.entity.constant.FebsConstant; |
| | | import cc.mrbird.febs.common.core.utils.SortUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | |
| | | queryWrapper.like("a.DeptName", empLeaveinfo.getDeptName()); |
| | | } |
| | | if (StringUtils.isNotBlank(empLeaveinfo.getEmpStatus())) { |
| | | queryWrapper.eq("a.EmpStatus", empLeaveinfo.getEmpStatus()); |
| | | queryWrapper.in("a.EmpStatus", empLeaveinfo.getEmpStatus().split(",")); |
| | | } |
| | | if (StringUtils.isNotBlank(empLeaveinfo.getLeaveDateStr())) { |
| | | queryWrapper.ge("a.BeginTime", empLeaveinfo.getLeaveDateStr().split(",")[0]); |
| | |
| | | } |
| | | queryWrapper.in("c.dept_Id", remoteDeptService.userRightDepts().split(StringConstant.COMMA)); |
| | | Page<EmpLeaveInfo> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | SortUtil.handlePageSort(request, page, "beginTime", FebsConstant.ORDER_ASC, true); |
| | | IPage<EmpLeaveInfo> iPage = empLeaveinfoMapper.selectPageVo(page, queryWrapper); |
| | | iPage.setRecords(this.convertDicItemName(iPage.getRecords())); |
| | | return iPage; |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void importEmpLeaveInfo(List<List<Object>> listObject,List<String> returnList) { |
| | | public void importEmpLeaveInfo(List<List<Object>> listObject,List<String> returnList,List<DicItem> dicItems ) { |
| | | for (List<Object> list : listObject) { |
| | | if (list.size()==0){ |
| | | if (list.size()==0||StrUtil.isBlank(list.get(0).toString())){ |
| | | continue; |
| | | } |
| | | EmpLeaveInfo leaveInfo = new EmpLeaveInfo(); |
| | | leaveInfo.setLeaveId(SequenceUtil.generateId(0L, ModuleCode.HR_EMPLOYEE)); |
| | | leaveInfo.setEmpNumb(list.get(0).toString()); |
| | | List<Dept> depts = CastUtil.castList(redisService.get("depts"), Dept.class); |
| | | if(null == depts){ |
| | | depts =remoteDeptService.setDeptRedis(); |
| | | } |
| | | Dept dept = depts.stream().filter(d -> d.getDeptName().equals(list.get(1).toString())).findFirst().orElse(null); |
| | | if (null == dept) { |
| | | returnList.add(StrUtil.format("导入员工请假记录异常: 出现位置第{}行, 原因:{}部门不存在",listObject.indexOf(list)+1,list.get(1).toString())); |
| | |
| | | returnList.add(StrUtil.format("导入员工请假记录异常: 出现位置第{}行, 原因:{}员工编号不存在",listObject.indexOf(list)+1,list.get(0).toString())); |
| | | continue; |
| | | } |
| | | leaveInfo.setDelFlag(2); |
| | | leaveInfo.setDelFlag(0); |
| | | leaveInfo.setEmpId(empBaseInfo.getEmpId()); |
| | | leaveInfo.setDeptName(list.get(1).toString()); |
| | | leaveInfo.setDeptId(dept.getDeptId()); |
| | |
| | | if (StringUtils.isNotBlank(list.get(7).toString())) { |
| | | leaveInfo.setLeaveDay(new BigDecimal(list.get(7).toString())); |
| | | } |
| | | leaveInfo.setLeaveType(list.get(8).toString()); |
| | | //请假类型 |
| | | DicItem dicItem =dicItems.parallelStream().filter(j->StrUtil.equalsIgnoreCase(j.getDicCode(),"leavetype")&&StrUtil.equals(j.getDicItemName(),list.get(8).toString())).findFirst().orElse(null); |
| | | if (null!=dicItem){ |
| | | leaveInfo.setLeaveType(dicItem.getDicItemCode()); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(list.get(9).toString())) { |
| | | leaveInfo.setReturnDate(DateUtil.parseDate(list.get(9).toString())); |
| | | } |