bug修改

This commit is contained in:
mash 2023-02-23 16:29:26 +08:00
parent 21eaa2d4ed
commit 9b620cb9db
4 changed files with 62 additions and 30 deletions

View File

@ -9,6 +9,7 @@ import com.ydool.staff.request.PersonnelDeleteRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* <p> * <p>
@ -34,7 +35,7 @@ public interface ICompanyNameService {
void exportEnterpriseIndicators(EnterpriseIndicatorsExportDto enterpriseIndicatorsExportVO, HttpServletResponse response); void exportEnterpriseIndicators(EnterpriseIndicatorsExportDto enterpriseIndicatorsExportVO, HttpServletResponse response);
PersonnelStatementDto perStatement(String id, String firstDate, String finalDate); List<PersonnelStatementDto> perStatement(String id, String firstDate, String finalDate);
AjaxResult getEntityParam(); AjaxResult getEntityParam();

View File

@ -135,25 +135,35 @@ public class CompanyNameServiceImpl extends BaseService<CompanyNameMapper, Compa
} }
@Override @Override
public PersonnelStatementDto perStatement(String id, String firstDate,String finalDate) { public List<PersonnelStatementDto> perStatement(String id, String firstDate,String finalDate) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date first;Date finals; Date first = null;
Date finals = null;
try { try {
if (StrUtil.isNotBlank(firstDate)) {
first = format.parse(firstDate); first = format.parse(firstDate);
}
if (StrUtil.isNotBlank(finalDate)) {
finals = format.parse(finalDate); finals = format.parse(finalDate);
}
} catch (ParseException e) { } catch (ParseException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
CompanyNameMapper companyNameMapper = SpringUtil.getBean(CompanyNameMapper.class); CompanyNameMapper companyNameMapper = SpringUtil.getBean(CompanyNameMapper.class);
PersonnelStatementDto statementDto = new PersonnelStatementDto(); PersonnelStatementDto statementDto = new PersonnelStatementDto();
CompanyName companyName = companyNameMapper.selectById(id); List<PersonnelStatementDto> statementDtos = new ArrayList<>();
Integer count = directorsSupervisorsMapper.selectCount(new LambdaQueryWrapper<DirectorsSupervisors>().eq(DirectorsSupervisors::getAuditState,3).eq(DirectorsSupervisors::getOrganizationId, companyName.getId())); LambdaQueryWrapper<CompanyName> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StrUtil.isNotBlank(id),CompanyName::getId,id);
List<CompanyName> 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<DirectorsSupervisors>().eq(DirectorsSupervisors::getAuditState, 3).eq(DirectorsSupervisors::getOrganizationId, companyName.getId()));
LambdaQueryWrapper<Personnel> wrapper = new LambdaQueryWrapper<Personnel>() LambdaQueryWrapper<Personnel> wrapper = new LambdaQueryWrapper<Personnel>()
.eq(Personnel::getCompanyName, companyName.getId()) .eq(Personnel::getCompanyName, companyName.getId())
.ge(Personnel::getHireDate,first) .ge(ObjectUtil.isNotNull(first), Personnel::getHireDate, first)
.le(Personnel::getHireDate,finals); .le(ObjectUtil.isNotNull(finals), Personnel::getHireDate, finals);
List<Personnel> list = personnelMapper.selectList(wrapper); List<Personnel> listPersonnel = personnelMapper.selectList(wrapper);
statementDto.setSupervisorsNum(count); statementDto.setSupervisorsNum(count);
statementDto.setCompetentDeptName("县发展和改革局"); statementDto.setCompetentDeptName("县发展和改革局");
statementDto.setSocialCreditCode(companyName.getCreditCode()); statementDto.setSocialCreditCode(companyName.getCreditCode());
@ -161,9 +171,12 @@ public class CompanyNameServiceImpl extends BaseService<CompanyNameMapper, Compa
statementDto.setCapital(100); statementDto.setCapital(100);
statementDto.setMechanismNum(5); statementDto.setMechanismNum(5);
statementDto.setEmploymentNum(companyName.getCheckNumber()); statementDto.setEmploymentNum(companyName.getCheckNumber());
statementDto.setNum(Long.valueOf(list.size())); statementDto.setNum(Long.valueOf(listPersonnel.size()));
statementDto.setThereIntoNum(0); statementDto.setThereIntoNum(0);
return statementDto; statementDtos.add(statementDto);
statementDtos.forEach(System.out::println);
}
return statementDtos;
} }
@ -180,17 +193,15 @@ public class CompanyNameServiceImpl extends BaseService<CompanyNameMapper, Compa
@Override @Override
public void export(ExcelPersonnelStatementRequest personnelParam, HttpServletResponse response) { public void export(ExcelPersonnelStatementRequest personnelParam, HttpServletResponse response) {
PersonnelStatementDto dto = perStatement(personnelParam.getId(), personnelParam.getFirstDate(), personnelParam.getFinalDate()); List<PersonnelStatementDto> dtos = perStatement(personnelParam.getId(), personnelParam.getFirstDate(), personnelParam.getFinalDate());
ExcelPersonnelStatement statement = BeanUtil.copyProperties(dto, ExcelPersonnelStatement.class); List<ExcelPersonnelStatement> statement = BeanUtil.copyToList(dtos, ExcelPersonnelStatement.class);
List<ExcelPersonnelStatement> statements = new ArrayList<>();
statements.add(statement);
String fileName = "国有企业人事信息查询表" + System.currentTimeMillis() + ".xlsx"; String fileName = "国有企业人事信息查询表" + System.currentTimeMillis() + ".xlsx";
Set<String> includeColumnFiledNames = new HashSet<>(); Set<String> includeColumnFiledNames = new HashSet<>();
for (String s : personnelParam.getPrams()) { for (String s : personnelParam.getPrams()) {
includeColumnFiledNames.add(s); includeColumnFiledNames.add(s);
} }
//导出 //导出
EasyExcelAlibabaUtil.exportDownload(response, ExcelPersonnelStatement.class, statements, fileName,includeColumnFiledNames); EasyExcelAlibabaUtil.exportDownload(response, ExcelPersonnelStatement.class, statement, fileName,includeColumnFiledNames);
} }

View File

@ -145,6 +145,13 @@ public class ExchangeServiceImpl extends BaseService<ExchangeMapper, Exchange> i
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult deleteExchangeById(PersonnelDeleteRequest ids) { public AjaxResult deleteExchangeById(PersonnelDeleteRequest ids) {
List<String> asList = Arrays.asList(ids.getIds()); List<String> asList = Arrays.asList(ids.getIds());
for (String s : asList) {
Exchange exchange = exchangeMapper.selectOne(new LambdaQueryWrapper<Exchange>().eq(Exchange::getId,s)
.in(Exchange::getAuditState,1,2));
if (ObjectUtil.isNotEmpty(exchange)){
return AjaxResult.fail().msg("该人员有变更中或待审批数据,不能删除!");
}
}
if (CollectionUtil.isEmpty(asList)) { if (CollectionUtil.isEmpty(asList)) {
return AjaxResult.fail().msg("Id不能为空"); return AjaxResult.fail().msg("Id不能为空");
} else { } else {

View File

@ -178,7 +178,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Override @Override
public AjaxResult personnelByExchangeList() { public AjaxResult personnelByExchangeList() {
List<Personnel> list = list(); List<Personnel> list = list(new LambdaQueryWrapper<Personnel>().eq(Personnel::getState,"2").eq(Personnel::getWorkState,"在职"));
List<PersonnelByExchangeDto> dtos = BeanUtil.copyToList(list, PersonnelByExchangeDto.class); List<PersonnelByExchangeDto> dtos = BeanUtil.copyToList(list, PersonnelByExchangeDto.class);
return AjaxResult.ok().data(dtos); return AjaxResult.ok().data(dtos);
} }
@ -214,6 +214,13 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult deleteByIds(PersonnelDeleteRequest ids) { public AjaxResult deleteByIds(PersonnelDeleteRequest ids) {
List<String> asList = Arrays.asList(ids.getIds()); List<String> asList = Arrays.asList(ids.getIds());
for (String s : asList) {
Personnel personnel = personnelMapper.selectOne(new LambdaQueryWrapper<Personnel>().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)) { if (CollectionUtil.isEmpty(asList)) {
return AjaxResult.fail().msg("Id不能为空"); return AjaxResult.fail().msg("Id不能为空");
} else { } else {
@ -555,11 +562,16 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
} }
auditMapper.insert(audit); auditMapper.insert(audit);
} }
if (ArgsConst.PERSONNEL.equals(request.getType())||ArgsConst.CHANGE.equals(request.getType())){ if (ArgsConst.PERSONNEL.equals(request.getType())){
Personnel personnel = get(id); Personnel personnel = get(id);
personnel.setAuditState(1); personnel.setAuditState(1);
updateById(personnel); updateById(personnel);
} }
if (ArgsConst.CHANGE.equals(request.getType())){
Personnel personnel = get(id);
personnel.setChangeAuditState(1);
updateById(personnel);
}
if (ArgsConst.EXCHANGE.equals(request.getType())){ if (ArgsConst.EXCHANGE.equals(request.getType())){
Exchange exchange = exchangeMapper.selectById(id); Exchange exchange = exchangeMapper.selectById(id);
exchange.setAuditState(1); exchange.setAuditState(1);
@ -617,6 +629,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
} }
}else if (ArgsConst.EXCHANGE.equals(type)) { }else if (ArgsConst.EXCHANGE.equals(type)) {
Exchange exchange = exchangeMapper.selectById(id); Exchange exchange = exchangeMapper.selectById(id);
System.out.println("exchange = " + exchange);
Personnel personnel = get(exchange.getPersonnelId()); Personnel personnel = get(exchange.getPersonnelId());
if ("1".equals(personnel.getAlterationSign())||"1".equals(personnel.getChangeAlterationSign())){ if ("1".equals(personnel.getAlterationSign())||"1".equals(personnel.getChangeAlterationSign())){
return message="该人员有变更数据,不能进行选调!"; return message="该人员有变更数据,不能进行选调!";