add 人员退休模块
This commit is contained in:
parent
916306b165
commit
ef232a9bac
|
@ -11,6 +11,7 @@
|
|||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="lcOa" target="1.8" />
|
||||
<module name="ydool-demo" target="1.8" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
|
@ -10,4 +11,7 @@
|
|||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="jpab" />
|
||||
</component>
|
||||
</project>
|
|
@ -5,8 +5,10 @@ import org.springframework.boot.SpringApplication;
|
|||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableScheduling//开启定时任务
|
||||
@EnableCaching
|
||||
@EnableAsync
|
||||
public class YdoolApplication {
|
||||
|
|
|
@ -39,6 +39,11 @@ public class ArgsConst {
|
|||
* 附件所属:变更
|
||||
*/
|
||||
public static final String CHANGE = "change";
|
||||
|
||||
/**
|
||||
* 附件所属:变更
|
||||
*/
|
||||
public static final String RETIRE = "retire";
|
||||
/**
|
||||
* 附件所属:人员
|
||||
*/
|
||||
|
|
|
@ -14,7 +14,7 @@ public class SaTokenConfig implements WebMvcConfigurer {
|
|||
// 注册 Sa-Token 拦截器,校验规则为 StpUtil.checkLogin() 登录校验。
|
||||
registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin()))
|
||||
.addPathPatterns(UrlConstant.API + "/**")
|
||||
.excludePathPatterns(UrlConstant.AUTH+"/login");
|
||||
.excludePathPatterns(UrlConstant.AUTH+"/login",UrlConstant.PERSON+"/getPersonnelRetire");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,6 +20,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
|||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
@ -54,9 +55,10 @@ public class PersonnelController extends BaseController {
|
|||
@ApiImplicitParam(name = "orderBy", value = "排序顺序 降序:desc,升序:asc"),
|
||||
@ApiImplicitParam(name = "column", value = "排序字段 字段名"),
|
||||
@ApiImplicitParam(name = "current", value = "当前页"),
|
||||
@ApiImplicitParam(name = "size", value = "每页条数")})
|
||||
public AjaxResult personnelList(@RequestBody SelectRequest request, String orderBy,String column){
|
||||
return personnelService.personnelList(getPage(),request,orderBy,column);
|
||||
@ApiImplicitParam(name = "size", value = "每页条数"),
|
||||
@ApiImplicitParam(name = "isInfo", value = "是否退休列表")})
|
||||
public AjaxResult personnelList(@RequestBody SelectRequest request, String orderBy,String column,Boolean isInfo){
|
||||
return personnelService.personnelList(getPage(),request,orderBy,column,isInfo);
|
||||
}
|
||||
|
||||
@GetMapping("getById")
|
||||
|
@ -123,6 +125,19 @@ public class PersonnelController extends BaseController {
|
|||
return personnelService.giveAudit(request);
|
||||
}
|
||||
|
||||
@GetMapping("getPersonnelRetire")
|
||||
@ApiOperation(value = "查看近两月是否有人退休")
|
||||
//@Scheduled(cron = "0 0 7 * * ?") /*每天7点更新一次*/
|
||||
//@Scheduled(cron = "0 */1 * * * ?") /*每天7点更新一次*/
|
||||
public void getPersonnelRetire(){
|
||||
personnelService.getPersonnelRetire();
|
||||
}
|
||||
|
||||
@GetMapping("updatePersonnelRetire")
|
||||
@ApiOperation(value = "处理退休事件")
|
||||
@ApiImplicitParam(name = "id",value = "人员id")
|
||||
public AjaxResult updatePersonnelRetire(String id){
|
||||
return personnelService.updatePersonnelRetire(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
|
@ -39,6 +40,10 @@ public class PersonnelDto {
|
|||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
@ApiModelProperty(value = "退休时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private LocalDate retirementTime;
|
||||
|
||||
@ApiModelProperty(value = "审批状态 0 未审批 1 待审批,2已通过,3已拒绝")
|
||||
private Integer auditState;
|
||||
|
||||
|
@ -52,5 +57,4 @@ public class PersonnelDto {
|
|||
private String workState;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -162,4 +162,9 @@ public class Personnel extends BaseEntity {
|
|||
@ApiModelProperty(value = "数据状态:0:历史数据 ,1:暂存数据,2:当前数据")
|
||||
private String state;
|
||||
|
||||
@ApiModelProperty(value = "是否退休列表")
|
||||
private Boolean isInfo;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public interface IPersonnelService {
|
|||
* 人员列表
|
||||
* @return
|
||||
*/
|
||||
AjaxResult personnelList(Page page , SelectRequest request, String orderBy,String column);
|
||||
AjaxResult personnelList(Page page , SelectRequest request, String orderBy, String column, Boolean isInfo);
|
||||
|
||||
AjaxResult getById(String id,String type,String personnelType);
|
||||
AjaxResult personnelByExchangeList();
|
||||
|
@ -70,5 +70,8 @@ public interface IPersonnelService {
|
|||
|
||||
List<AttachmentDto> nameAndPath(String file, String id);
|
||||
|
||||
void getPersonnelRetire();
|
||||
|
||||
AjaxResult updatePersonnelRetire(String id);
|
||||
}
|
||||
|
||||
|
|
|
@ -252,16 +252,14 @@ public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements
|
|||
if (ArgsConst.PERSONNEL.equals(type)) {
|
||||
personnel.setAuditState(4);
|
||||
personnel.setAlterationSign("2");
|
||||
Places places = placesMapper.selectOne(new LambdaQueryWrapper<Places>().eq(Places::getOdd, personnel.getRecruitNumber()));
|
||||
places.setStatus(false);
|
||||
placesMapper.updateById(places);
|
||||
personnel.setRecruitNumber("0");
|
||||
workFlow(personnel.getCreatedId(), ArgsConst.PERSONNEL, personnel.getId(), "企业人员申报", false);
|
||||
} else if (ArgsConst.CHANGE.equals(type)) {
|
||||
personnel.setChangeAuditState(4);
|
||||
personnel.setChangeAlterationSign("2");
|
||||
workFlow(personnel.getCreatedId(), ArgsConst.CHANGE, personnel.getId(), "人员变更申报", false);
|
||||
}
|
||||
|
||||
System.out.println("personnel = " + personnel);
|
||||
personnelMapper.updateById(personnel);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -62,6 +63,9 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
|
|||
@Autowired
|
||||
WorkFlowNoticeService workFlowNoticeService;
|
||||
|
||||
@Autowired
|
||||
PersonnelServiceImpl personnelService;
|
||||
|
||||
@Override
|
||||
public AjaxResult selectOrganizationList(Page<Organization> page, OrganizationSearch organizationSearch) {
|
||||
LambdaQueryWrapper<Organization> organizationLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -162,11 +166,19 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
|
|||
|
||||
@Override
|
||||
public AjaxResult approval(String id) {
|
||||
List<PlacesDto> dtoList = new ArrayList<>();
|
||||
List<Places> places = placesMapper.selectList(Wrappers.lambdaQuery(Places.class)
|
||||
.eq(Places::getCompanyId, id)
|
||||
.eq(Places::getStatus, Boolean.FALSE)
|
||||
.orderByAsc(Places::getOdd));
|
||||
return AjaxResult.ok().data(BeanUtil.copyToList(places, PlacesDto.class));
|
||||
for (Places place : places) {
|
||||
int count = personnelService.count(new LambdaQueryWrapper<Personnel>().eq(Personnel::getRecruitNumber, place.getOdd()));
|
||||
if (count<place.getSum()){
|
||||
PlacesDto dto = BeanUtil.copyProperties(place, PlacesDto.class);
|
||||
dtoList.add(dto);
|
||||
}
|
||||
}
|
||||
return AjaxResult.ok().data(dtoList);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.ydool.staff.service.impl;
|
|||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
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.IdcardUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
|
@ -29,7 +31,6 @@ import com.ydool.staff.entity.CompanyName;
|
|||
import com.ydool.staff.entity.Exchange;
|
||||
import com.ydool.staff.entity.Personnel;
|
||||
import com.ydool.staff.entity.PersonnelMiddle;
|
||||
import com.ydool.staff.entity.Places;
|
||||
import com.ydool.staff.entity.SelectRequest;
|
||||
import com.ydool.staff.excel.ExcelPersonnel;
|
||||
import com.ydool.staff.excel.PersonnelExportVO;
|
||||
|
@ -105,6 +106,8 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|||
@Resource
|
||||
private AuditMapper auditMapper;
|
||||
|
||||
@Resource
|
||||
private AuditServiceImpl auditImplService;
|
||||
@Resource
|
||||
private IAuditService auditService;
|
||||
|
||||
|
@ -129,8 +132,8 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult personnelList(Page page, SelectRequest request, String orderBy, String column) {
|
||||
QueryWrapper wrapper = selectWrapper(request, orderBy, column);
|
||||
public AjaxResult personnelList(Page page, SelectRequest request, String orderBy, String column, Boolean isInfo) {
|
||||
QueryWrapper wrapper = selectWrapper(request, orderBy, column,isInfo);
|
||||
Page personnelPage = page(page, wrapper);
|
||||
List<Personnel> list = personnelPage.getRecords();
|
||||
personnelPage.setRecords(list.stream().map(e -> {
|
||||
|
@ -231,9 +234,6 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|||
personnel.setEducationFile(StringUtils.join(saveFilePath(personnelRequest.getEducationFile(), ArgsConst.JOBTITLE_FILE, ArgsConst.SAVE, ""), ','));
|
||||
personnel.setAuditFile(StringUtils.join(saveFilePath(personnelRequest.getAuditFile(), ArgsConst.AUDIT_FILE, ArgsConst.SAVE, ""), ','));
|
||||
boolean save = save(personnel);
|
||||
Places places = placesMapper.selectOne(new LambdaQueryWrapper<Places>().eq(Places::getOdd, personnel.getRecruitNumber()));
|
||||
places.setStatus(true);
|
||||
placesMapper.updateById(places);
|
||||
saveAttachment(personnelRequest.getCardFile(), ArgsConst.CARD_FILE, personnel.getId(), ArgsConst.SAVE);
|
||||
saveAttachment(personnelRequest.getEngageFile(), ArgsConst.ENGAGE_FILE, personnel.getId(), ArgsConst.SAVE);
|
||||
saveAttachment(personnelRequest.getEducationFile(), ArgsConst.EDUCATION_FILE, personnel.getId(), ArgsConst.SAVE);
|
||||
|
@ -274,12 +274,6 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult updatePersonnel(PersonnelUpdateRequest updateRequest) {
|
||||
Personnel personnel = get(updateRequest.getId());
|
||||
if (!personnel.getRecruitNumber().equals(updateRequest.getRecruitNumber())){
|
||||
Places places = placesMapper.selectOne(new LambdaQueryWrapper<Places>().eq(Places::getOdd, personnel.getRecruitNumber()));
|
||||
places.setStatus(false);
|
||||
placesMapper.updateById(places);
|
||||
}
|
||||
Personnel per = BeanUtil.copyProperties(updateRequest, Personnel.class);
|
||||
List<AttachmentRequest> cardFile = updateRequest.getCardFileList();
|
||||
List<AttachmentRequest> educationFile = updateRequest.getEducationFileList();
|
||||
|
@ -314,11 +308,6 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|||
per.setState("2");
|
||||
per.setAlterationSign("1");
|
||||
boolean update = updateById(per);
|
||||
if (update){
|
||||
Places places = placesMapper.selectOne(new LambdaQueryWrapper<Places>().eq(Places::getOdd, updateRequest.getRecruitNumber()));
|
||||
places.setStatus(true);
|
||||
placesMapper.updateById(places);
|
||||
}
|
||||
if("audit".equals(updateRequest.getType())){
|
||||
GiveAuditRequest request = new GiveAuditRequest();
|
||||
String[] ids = new String[]{per.getId()};
|
||||
|
@ -553,14 +542,12 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|||
return null;
|
||||
}
|
||||
|
||||
public QueryWrapper selectWrapper(SelectRequest request,String orderBy,String column){
|
||||
public QueryWrapper selectWrapper(SelectRequest request, String orderBy, String column, Boolean isInfo){
|
||||
QueryWrapper<Personnel> wrapper = new QueryWrapper<>();
|
||||
if(ArgsConst.PERSONNEL.equals(request.getType())){
|
||||
wrapper.lambda().ne(Personnel::getAuditState,"3");
|
||||
}else{
|
||||
wrapper.lambda().eq(Personnel::getAuditState,"3").ne(Personnel::getState,1).ne(Personnel::getState,0);
|
||||
|
||||
|
||||
wrapper.lambda().eq(isInfo,Personnel::getIsInfo,true).eq(Personnel::getAuditState,"3").ne(Personnel::getState,1).ne(Personnel::getState,0);
|
||||
}
|
||||
wrapper.lambda().eq(StrUtil.isNotBlank(request.getPersonnelType()),Personnel::getPersonnelType,request.getPersonnelType())
|
||||
.eq(StrUtil.isNotBlank(request.getPresentDept()),Personnel::getPresentDept,request.getPresentDept())
|
||||
|
@ -803,6 +790,46 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getPersonnelRetire() {
|
||||
DateTime date = DateUtil.date();
|
||||
DateTime time = DateUtil.offsetMonth(date, +2);
|
||||
String nowDate = DateUtil.format(date, "yyyy-MM-dd");
|
||||
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));
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
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()));
|
||||
for (Personnel personnel : list) {
|
||||
if (!personnel.getIsInfo()) {
|
||||
WorkFlowNotice workFlowNotice = new WorkFlowNotice();
|
||||
workFlowNotice.setStatus(Boolean.FALSE);
|
||||
workFlowNotice.setUserId(user.getId());
|
||||
workFlowNotice.setTitle("企业人员"+personnel.getUserName()+"待退休");
|
||||
workFlowNotice.setFlowType(ArgsConst.RETIRE);
|
||||
workFlowNotice.setFlowId(personnel.getId());
|
||||
boolean save = workFlowNoticeService.save(workFlowNotice);
|
||||
if (save) {
|
||||
personnel.setIsInfo(true);
|
||||
updateById(personnel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult updatePersonnelRetire(String id) {
|
||||
Personnel personnel = getById(id);
|
||||
if (!"退休".equals(personnel.getWorkState())){
|
||||
return AjaxResult.fail("该人员未办理退休变更,请先办理退休变更!");
|
||||
}
|
||||
personnel.setIsInfo(false);
|
||||
boolean b = updateById(personnel);
|
||||
return b ?AjaxResult.ok().msg("处理成功!"):AjaxResult.fail("处理失败!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ spring:
|
|||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
url: jdbc:mysql://192.168.2.24:3306/lc_oa?useSSL=false&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF8&autoReconnect=true&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||
url: jdbc:mysql://localhost:3306/lc_oa?useSSL=false&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF8&autoReconnect=true&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: Wang09211108
|
||||
password: root
|
||||
druid:
|
||||
# 下面为连接池的补充设置,应用到上面所有数据源中
|
||||
# 初始化大小,最小,最大
|
||||
|
|
Loading…
Reference in New Issue