diff --git a/src/main/java/com/ydool/staff/service/ICompanyNameService.java b/src/main/java/com/ydool/staff/service/ICompanyNameService.java index a44eb5c..fcf362f 100644 --- a/src/main/java/com/ydool/staff/service/ICompanyNameService.java +++ b/src/main/java/com/ydool/staff/service/ICompanyNameService.java @@ -9,6 +9,7 @@ import com.ydool.staff.request.PersonnelDeleteRequest; import javax.servlet.http.HttpServletResponse; import java.util.Date; +import java.util.List; /** *

@@ -34,7 +35,7 @@ public interface ICompanyNameService { void exportEnterpriseIndicators(EnterpriseIndicatorsExportDto enterpriseIndicatorsExportVO, HttpServletResponse response); - PersonnelStatementDto perStatement(String id, String firstDate, String finalDate); + List perStatement(String id, String firstDate, String finalDate); AjaxResult getEntityParam(); diff --git a/src/main/java/com/ydool/staff/service/impl/CompanyNameServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/CompanyNameServiceImpl.java index f0411e1..9ddb92e 100644 --- a/src/main/java/com/ydool/staff/service/impl/CompanyNameServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/CompanyNameServiceImpl.java @@ -135,35 +135,48 @@ public class CompanyNameServiceImpl extends BaseService perStatement(String id, String firstDate,String finalDate) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); - Date first;Date finals; + Date first = null; + Date finals = null; try { - first = format.parse(firstDate); - finals = format.parse(finalDate); - + if (StrUtil.isNotBlank(firstDate)) { + first = format.parse(firstDate); + } + if (StrUtil.isNotBlank(finalDate)) { + finals = format.parse(finalDate); + } } catch (ParseException e) { throw new RuntimeException(e); } CompanyNameMapper companyNameMapper = SpringUtil.getBean(CompanyNameMapper.class); PersonnelStatementDto statementDto = new PersonnelStatementDto(); - CompanyName companyName = companyNameMapper.selectById(id); - Integer count = directorsSupervisorsMapper.selectCount(new LambdaQueryWrapper().eq(DirectorsSupervisors::getAuditState,3).eq(DirectorsSupervisors::getOrganizationId, companyName.getId())); - LambdaQueryWrapper wrapper = new LambdaQueryWrapper() - .eq(Personnel::getCompanyName, companyName.getId()) - .ge(Personnel::getHireDate,first) - .le(Personnel::getHireDate,finals); - List list = personnelMapper.selectList(wrapper); - statementDto.setSupervisorsNum(count); - statementDto.setCompetentDeptName("县发展和改革局"); - statementDto.setSocialCreditCode(companyName.getCreditCode()); - statementDto.setCompetent(companyName.getCompanyName()); - statementDto.setCapital(100); - statementDto.setMechanismNum(5); - statementDto.setEmploymentNum(companyName.getCheckNumber()); - statementDto.setNum(Long.valueOf(list.size())); - statementDto.setThereIntoNum(0); - return statementDto; + List statementDtos = new ArrayList<>(); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(StrUtil.isNotBlank(id),CompanyName::getId,id); + List list = companyNameMapper.selectList(queryWrapper); + list.forEach(System.out::println); + for (CompanyName companyName : list) { + System.out.println("companyName = " + companyName.getId()); + Integer count = directorsSupervisorsMapper.selectCount(new LambdaQueryWrapper().eq(DirectorsSupervisors::getAuditState, 3).eq(DirectorsSupervisors::getOrganizationId, companyName.getId())); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper() + .eq(Personnel::getCompanyName, companyName.getId()) + .ge(ObjectUtil.isNotNull(first), Personnel::getHireDate, first) + .le(ObjectUtil.isNotNull(finals), Personnel::getHireDate, finals); + List listPersonnel = personnelMapper.selectList(wrapper); + statementDto.setSupervisorsNum(count); + statementDto.setCompetentDeptName("县发展和改革局"); + statementDto.setSocialCreditCode(companyName.getCreditCode()); + statementDto.setCompetent(companyName.getCompanyName()); + statementDto.setCapital(100); + statementDto.setMechanismNum(5); + statementDto.setEmploymentNum(companyName.getCheckNumber()); + statementDto.setNum(Long.valueOf(listPersonnel.size())); + statementDto.setThereIntoNum(0); + statementDtos.add(statementDto); + statementDtos.forEach(System.out::println); + } + return statementDtos; } @@ -180,17 +193,15 @@ public class CompanyNameServiceImpl extends BaseService statements = new ArrayList<>(); - statements.add(statement); + List dtos = perStatement(personnelParam.getId(), personnelParam.getFirstDate(), personnelParam.getFinalDate()); + List statement = BeanUtil.copyToList(dtos, ExcelPersonnelStatement.class); String fileName = "国有企业人事信息查询表" + System.currentTimeMillis() + ".xlsx"; Set includeColumnFiledNames = new HashSet<>(); for (String s : personnelParam.getPrams()) { includeColumnFiledNames.add(s); } //导出 - EasyExcelAlibabaUtil.exportDownload(response, ExcelPersonnelStatement.class, statements, fileName,includeColumnFiledNames); + EasyExcelAlibabaUtil.exportDownload(response, ExcelPersonnelStatement.class, statement, fileName,includeColumnFiledNames); } diff --git a/src/main/java/com/ydool/staff/service/impl/ExchangeServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/ExchangeServiceImpl.java index 5a070aa..154a4f2 100644 --- a/src/main/java/com/ydool/staff/service/impl/ExchangeServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/ExchangeServiceImpl.java @@ -145,6 +145,13 @@ public class ExchangeServiceImpl extends BaseService i @Transactional(rollbackFor = Exception.class) public AjaxResult deleteExchangeById(PersonnelDeleteRequest ids) { List asList = Arrays.asList(ids.getIds()); + for (String s : asList) { + Exchange exchange = exchangeMapper.selectOne(new LambdaQueryWrapper().eq(Exchange::getId,s) + .in(Exchange::getAuditState,1,2)); + if (ObjectUtil.isNotEmpty(exchange)){ + return AjaxResult.fail().msg("该人员有变更中或待审批数据,不能删除!"); + } + } if (CollectionUtil.isEmpty(asList)) { return AjaxResult.fail().msg("Id不能为空!"); } else { diff --git a/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java index a7ba1e5..9831c52 100644 --- a/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java @@ -178,7 +178,7 @@ public class PersonnelServiceImpl extends BaseService list = list(); + List list = list(new LambdaQueryWrapper().eq(Personnel::getState,"2").eq(Personnel::getWorkState,"在职")); List dtos = BeanUtil.copyToList(list, PersonnelByExchangeDto.class); return AjaxResult.ok().data(dtos); } @@ -214,6 +214,13 @@ public class PersonnelServiceImpl extends BaseService asList = Arrays.asList(ids.getIds()); + for (String s : asList) { + Personnel personnel = personnelMapper.selectOne(new LambdaQueryWrapper().eq(Personnel::getId,s).eq(Personnel::getAlterationSign,"1") + .eq(Personnel::getChangeAlterationSign,"1").in(Personnel::getAuditState,1,2).in(Personnel::getChangeAuditState,1,2)); + if (ObjectUtil.isNotEmpty(personnel)){ + return AjaxResult.fail().msg("该人员有变更中或待审批数据,不能删除!"); + } + } if (CollectionUtil.isEmpty(asList)) { return AjaxResult.fail().msg("Id不能为空!"); } else { @@ -555,11 +562,16 @@ public class PersonnelServiceImpl extends BaseService