This commit is contained in:
mash 2024-11-19 10:05:08 +08:00
parent bb80af7508
commit df3caa27e1
5 changed files with 120 additions and 21 deletions

View File

@ -31,6 +31,9 @@ public class ConfigCache {
public static final String SYS_USER_LEADERSHIP = "sys.user.leadership";
public static final String SYS_USER_RETIRE = "sys.user.retire";
public static final String SYS_USER_PERSONNEL_DIRECTOR= "sys.user.personnel.director";
/**

View File

@ -209,10 +209,9 @@ public class PersonnelController extends BaseController {
return personnelService.giveAudit(request);
}
@GetMapping("getPersonnelRetire")
@ApiOperation(value = "查看近两月是否有人退休")
@Scheduled(cron = "0 0 7 * * ?") /*每天7点更新一次*/
//@Scheduled(cron = "0 */1 * * * ?") /*每分钟更新一次*/
@Scheduled(cron = "0 0 8 * * ?") /*每天8点更新一次*/
// @Scheduled(cron = "0 */1 * * * ?") /*每分钟更新一次*/
public void getPersonnelRetire() {
personnelService.getPersonnelRetire();
}
@ -224,4 +223,16 @@ public class PersonnelController extends BaseController {
return personnelService.updatePersonnelRetire(id);
}
@GetMapping("retirementList")
@ApiOperation(value = "退休名单")
@ApiImplicitParams({
@ApiImplicitParam(name = "userName", value = "姓名"),
@ApiImplicitParam(name = "presentDept", value = "所在部门"),
@ApiImplicitParam(name = "personnelType", value = "人员类型"),
@ApiImplicitParam(name = "workState", value = "工作状态"),
})
public AjaxResult retirementList(String userName, String presentDept, String personnelType, String workState, String orderBy, String column) {
return personnelService.retirementList(getPage(), userName, presentDept, personnelType, workState, orderBy, column);
}
}

View File

@ -36,7 +36,7 @@ public class PersonnelDto {
@ApiModelProperty(value = "人员类型")
private String personnelType;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty(value = "创建时间")
private LocalDateTime createdAt;
@ -56,5 +56,11 @@ public class PersonnelDto {
@ApiModelProperty(value = "工作状态")
private String workState;
@ApiModelProperty(value = "是否退休列表")
private Boolean isInfo;
@ApiModelProperty(value = "退休状态")
private String retireState;
}

View File

@ -26,9 +26,10 @@ public interface IPersonnelService {
* 人员列表
* @return
*/
AjaxResult personnelList(Page page , SelectRequest request, String orderBy, String column, Boolean isInfo,String deptId);
AjaxResult personnelList(Page page, SelectRequest request, String orderBy, String column, Boolean isInfo, String deptId);
AjaxResult getById(String id, String type, String personnelType);
AjaxResult getById(String id,String type,String personnelType);
AjaxResult personnelByExchangeList();
/**
@ -60,7 +61,7 @@ public interface IPersonnelService {
*/
AjaxResult updateChange(PersonnelUpdateRequest request);
void export(PersonnelDeleteRequest param,HttpServletResponse response);
void export(PersonnelDeleteRequest param, HttpServletResponse response);
AjaxResult importPersonnel(MultipartFile excl);
@ -73,5 +74,7 @@ public interface IPersonnelService {
void getPersonnelRetire();
AjaxResult updatePersonnelRetire(String id);
AjaxResult retirementList(Page page, String userName, String presentDept, String personnelType, String workState, String orderBy, String column);
}

View File

@ -6,6 +6,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.DesensitizedUtil;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@ -19,6 +20,7 @@ import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.common.exception.ResultException;
import com.ydool.common.utils.CacheUtil;
import com.ydool.common.utils.CodecUtils;
import com.ydool.common.utils.ColumnUtil;
import com.ydool.common.utils.EasyExcelAlibabaUtil;
import com.ydool.oa.workFlow.data.entity.WorkFlowNotice;
@ -391,11 +393,19 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
per.setPoliticsStatus(saveAlteration("政治面貌更改", per.getPoliticsStatus(), request.getPoliticsStatus(), type, id, ColumnUtil.getFieldName(Personnel::getPoliticsStatus)).toString());
per.setEducation(saveAlteration("学历更改", per.getEducation(), request.getEducation(), type, id, ColumnUtil.getFieldName(Personnel::getEducation)).toString());
per.setFreshGraduate(saveAlteration("是否应届毕业生更改", per.getFreshGraduate(), request.getFreshGraduate(), type, id, ColumnUtil.getFieldName(Personnel::getFreshGraduate)).toString());
per.setAcademy(saveAlteration("毕业院校更改", per.getAcademy(), request.getAcademy(), type, id, ColumnUtil.getFieldName(Personnel::getAcademy)).toString());
per.setSpecialty(saveAlteration("专业更改", per.getSpecialty(), request.getSpecialty(), type, id, ColumnUtil.getFieldName(Personnel::getSpecialty)).toString());
if (ObjectUtil.isNotNull(per.getAcademy())) {
per.setAcademy(saveAlteration("毕业院校更改", per.getAcademy(), request.getAcademy(), type, id, ColumnUtil.getFieldName(Personnel::getAcademy)).toString());
}
if (ObjectUtil.isNotNull(per.getSpecialty())) {
per.setSpecialty(saveAlteration("专业更改", per.getSpecialty(), request.getSpecialty(), type, id, ColumnUtil.getFieldName(Personnel::getSpecialty)).toString());
}
per.setHireType(saveAlteration("录用方式更改", per.getHireType(), request.getHireType(), type, id, ColumnUtil.getFieldName(Personnel::getHireType)).toString());
per.setQualification(saveAlteration("执业资格更改", per.getQualification(), request.getQualification(), type, id, ColumnUtil.getFieldName(Personnel::getQualification)).toString());
per.setJobTitle(saveAlteration("专业技术职称更改", per.getJobTitle(), request.getJobTitle(), type, id, ColumnUtil.getFieldName(Personnel::getJobTitle)).toString());
if (ObjectUtil.isNotNull(per.getQualification())) {
per.setQualification(saveAlteration("执业资格更改", per.getQualification(), request.getQualification(), type, id, ColumnUtil.getFieldName(Personnel::getQualification)).toString());
}
if (ObjectUtil.isNotNull(per.getJobTitle())) {
per.setJobTitle(saveAlteration("专业技术职称更改", per.getJobTitle(), request.getJobTitle(), type, id, ColumnUtil.getFieldName(Personnel::getJobTitle)).toString());
}
per.setContractModality(saveAlteration("合同形式更改", per.getContractModality(), request.getContractModality(), type, id, ColumnUtil.getFieldName(Personnel::getContractModality)).toString());
per.setPersonnelType(saveAlteration("人员类型更改", per.getPersonnelType(), request.getPersonnelType(), type, id, ColumnUtil.getFieldName(Personnel::getPersonnelType)).toString());
per.setWorkState(saveAlteration("工作状态更改", per.getWorkState(), request.getWorkState(), type, id, ColumnUtil.getFieldName(Personnel::getWorkState)).toString());
@ -416,7 +426,9 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
if (ObjectUtil.isNotNull(per.getTxfpEndTime())) {
per.setTxfpEndTime(LocalDate.parse(saveAlteration("退休返聘结束时间更改", per.getTxfpEndTime(), request.getTxfpEndTime(), type, id, ColumnUtil.getFieldName(Personnel::getTxfpEndTime)).toString()));
}
per.setRemark(saveAlteration("备注更改", per.getRemark(), request.getRemark(), type, id, ColumnUtil.getFieldName(Personnel::getRemark)).toString());
if (StrUtil.isNotBlank(per.getRemark())) {
per.setRemark(saveAlteration("备注更改", per.getRemark(), request.getRemark(), type, id, ColumnUtil.getFieldName(Personnel::getRemark)).toString());
}
if (StrUtil.isNotBlank(card)) {
per.setCardFile(saveAlteration("身份证附件更改", per.getCardFile(), card, type, id, ColumnUtil.getFieldName(Personnel::getCardFile)).toString());
}
@ -902,11 +914,15 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
String starTime = DateUtil.format(time, "yyyy-MM-dd");
List<Personnel> list = list(new LambdaQueryWrapper<Personnel>()
.ne(Personnel::getAlterationSign, 1).eq(Personnel::getAuditState, 3).eq(Personnel::getState, 2)
.eq(Personnel::getWorkState, "在职").between(Personnel::getRetirementTime, nowDate, starTime).eq(Personnel::getIsInfo, false).orderByDesc(Personnel::getRetirementTime));
.eq(Personnel::getWorkState, "在职").between(Personnel::getRetirementTime, nowDate, starTime)
.eq(Personnel::getIsInfo, false).orderByDesc(Personnel::getRetirementTime));
if (CollectionUtil.isNotEmpty(list)) {
CacheUtil.put(ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, ConfigCache.SCHEDULED_CODE_PERSONNEL_RETIRE, "scheduled", true);
Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_LEADERSHIP));
User user = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getLoginName, config.getParamValue()));
Config config = configMapper.selectOne(new LambdaQueryWrapper<Config>().eq(Config::getParamKey, ConfigCache.SYS_USER_RETIRE).last("limit 1"));
User user = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getPhone, CodecUtils.encrypt(config.getParamValue())).last("limit 1"));
if (user == null) {
throw new ResultException("用户不存在!");
}
for (Personnel personnel : list) {
if (!personnel.getIsInfo()) {
WorkFlowNotice workFlowNotice = new WorkFlowNotice();
@ -915,11 +931,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
workFlowNotice.setTitle("企业人员" + personnel.getUserName() + "待退休");
workFlowNotice.setFlowType(ArgsConst.RETIRE);
workFlowNotice.setFlowId(personnel.getId());
boolean save = workFlowNoticeService.save(workFlowNotice);
if (save) {
personnel.setIsInfo(true);
updateById(personnel);
}
workFlowNoticeService.save(workFlowNotice);
}
}
}
@ -931,9 +943,73 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
if (!"退休".equals(personnel.getWorkState())) {
return AjaxResult.fail("该人员未办理退休变更,请先办理退休变更!");
}
personnel.setIsInfo(false);
personnel.setIsInfo(true);
boolean b = updateById(personnel);
return b ? AjaxResult.ok().msg("处理成功!") : AjaxResult.fail("处理失败!");
}
@Override
public AjaxResult retirementList(Page page, String userName, String presentDept, String personnelType, String workState, String orderBy, String column) {
QueryWrapper<Personnel> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(Personnel::getState, "2").eq(Personnel::getAuditState, "3");
wrapper.lambda()
.like(StrUtil.isNotBlank(userName), Personnel::getUserName, userName)
.eq(StrUtil.isNotBlank(personnelType), Personnel::getPersonnelType, personnelType)
.eq(StrUtil.isNotBlank(workState), Personnel::getWorkState, workState)
.eq(StrUtil.isNotBlank(presentDept), Personnel::getPresentDept, presentDept);
if ("desc".equals(orderBy) && StrUtil.isNotBlank(column)) {
wrapper.orderByDesc(column);
}
if ("asc".equals(orderBy) && StrUtil.isNotBlank(column)) {
wrapper.orderByAsc(column);
}
wrapper.lambda().orderByAsc(Personnel::getRetirementTime);
Page selectedPage = personnelMapper.selectPage(page, wrapper);
List<Personnel> records = selectedPage.getRecords();
selectedPage.setRecords(records.stream().map(e -> {
PersonnelDto dto = BeanUtil.copyProperties(e, PersonnelDto.class);
CompanyName companyName = companyNameMapper.selectById(e.getCompanyName());
if (companyName != null) {
dto.setCompanyName(companyName.getCompanyName());
}
Dept dept = deptMapper.selectById(e.getPresentDept());
if (dept != null) {
dto.setPresentDept(dept.getName());
}
dto.setNumberId(DesensitizedUtil.idCardNum(e.getNumberId(), 1, 2));
dto.setAlterationSign(getSignDescription(e.getAlterationSign()));
dto.setChangeAlterationSign(getSignDescription(e.getChangeAlterationSign()));
dto.setRetireState(getRetirementTime(e.getRetirementTime(), e.getIsInfo()));
return dto;
}).collect(Collectors.toList()));
return AjaxResult.ok().data(selectedPage);
}
private String getRetirementTime(LocalDate retirementTime, Boolean isInfo) {
LocalDate localDate = LocalDate.now();
LocalDate plusMonths = localDate.plusMonths(2);
if (isInfo) {
return "grey";
} else if (retirementTime.isAfter(plusMonths)) {
return "green";
} else if (retirementTime.isEqual(localDate) || retirementTime.isEqual(plusMonths) || (retirementTime.isAfter(localDate) && retirementTime.isBefore(plusMonths))) {
return "red";
}
return "unknown";
}
private String getSignDescription(String sign) {
switch (sign) {
case "0":
return "未变更";
case "1":
return "变更中";
default:
return "变更完成";
}
}
}