人员相关
This commit is contained in:
parent
8de1f7891e
commit
792eb5f84a
|
@ -17,6 +17,8 @@ public interface UrlConstant {
|
|||
|
||||
String ROLE = API + "/role";
|
||||
|
||||
String PERSON = API + "/person";
|
||||
|
||||
|
||||
/**
|
||||
* 重要说明:该值为项目生成后的缺省密钥
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package com.ydool.staff.controller;
|
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import com.ydool.common.base.BaseController;
|
||||
import com.ydool.common.constant.UrlConstant;
|
||||
import com.ydool.common.data.dto.AjaxResult;
|
||||
import com.ydool.staff.dto.PersonnelDto;
|
||||
import com.ydool.staff.request.PersonnelDeleteRequest;
|
||||
import com.ydool.staff.request.PersonnelRequest;
|
||||
import com.ydool.staff.service.IPersonnelService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author msh
|
||||
* @version 1.0
|
||||
* @date 2023/1/31 11:41
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(UrlConstant.PERSON)
|
||||
@Api(tags = "人员", value = "人员")
|
||||
@ApiSupport(order = 6)
|
||||
public class PersonnelController extends BaseController {
|
||||
@Autowired
|
||||
private IPersonnelService personnelService;
|
||||
|
||||
@GetMapping(value = "personnelList")
|
||||
@ApiOperation(value = "人员列表",response = PersonnelDto.class)
|
||||
public AjaxResult personnelList(){
|
||||
return personnelService.personnelList();
|
||||
}
|
||||
|
||||
@PostMapping(value = "savePersonnel")
|
||||
@ApiOperation(value = "新增人员申报",response = PersonnelRequest.class)
|
||||
public AjaxResult savePersonnel(@Validated @RequestBody PersonnelRequest personnelRequest){
|
||||
return personnelService.savePersonnel(personnelRequest);
|
||||
}
|
||||
@PostMapping(value = "deletePersonnel")
|
||||
@ApiOperation(value = "删除/批量删除人员")
|
||||
public AjaxResult deletePersonnel(@RequestBody PersonnelDeleteRequest personnelDeleteRequest){
|
||||
return personnelService.deleteByIds(personnelDeleteRequest);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.ydool.staff.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author msh
|
||||
* @version 1.0
|
||||
* @date 2023/1/31 13:43
|
||||
*/
|
||||
@Data
|
||||
public class PersonnelDto {
|
||||
@ApiModelProperty(value = "变更标志")
|
||||
private String alterationSign;
|
||||
|
||||
@ApiModelProperty(value = "企业名称")
|
||||
private String companyName;
|
||||
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "身份证号")
|
||||
private String numberId;
|
||||
|
||||
@ApiModelProperty(value = "所在部门")
|
||||
private String presentDept;
|
||||
|
||||
@ApiModelProperty(value = "人员类型")
|
||||
private String personnelType;
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.ydool.staff.entity;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ydool.common.base.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 附件表
|
||||
* </p>
|
||||
*
|
||||
* @author msh
|
||||
* @since 2023-01-30
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("t_sys_attachment")
|
||||
@ApiModel(value="Attachment对象", description="附件表")
|
||||
public class Attachment extends BaseEntity{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "关联id")
|
||||
private String targetId;
|
||||
|
||||
@ApiModelProperty(value = "附件类型")
|
||||
private String targetType;
|
||||
|
||||
@ApiModelProperty(value = "附件名")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "附件路径")
|
||||
private String attachment;
|
||||
|
||||
@ApiModelProperty(value = "文件大小")
|
||||
private String size;
|
||||
|
||||
}
|
|
@ -34,7 +34,7 @@ public class Personnel extends BaseEntity {
|
|||
private String socialCreditCode;
|
||||
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private String username;
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty(value = "企业名称")
|
||||
private String companyName;
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package com.ydool.staff.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.ydool.staff.entity.Attachment;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 附件表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author msh
|
||||
* @since 2023-01-30
|
||||
*/
|
||||
@Mapper
|
||||
public interface AttachmentMapper extends MPJBaseMapper<Attachment> {
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.ydool.staff.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author msh
|
||||
* @version 1.0
|
||||
* @date 2023/1/31 16:15
|
||||
*/
|
||||
@Data
|
||||
public class AttachmentRequest {
|
||||
|
||||
@ApiModelProperty(value = "附件类型", required = true)
|
||||
private String targetType;
|
||||
|
||||
@ApiModelProperty(value = "文件名", required = true)
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "路径", required = true)
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty(value = "大小", required = true)
|
||||
private String size;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.ydool.staff.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author msh
|
||||
* @version 1.0
|
||||
* @date 2023/2/1 11:23
|
||||
*/
|
||||
@Data
|
||||
public class PersonnelDeleteRequest {
|
||||
@ApiModelProperty(value = "id")
|
||||
private List<String> ids;
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
package com.ydool.staff.request;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author msh
|
||||
* @version 1.0
|
||||
* @date 2023/1/31 15:23
|
||||
*/
|
||||
@Data
|
||||
public class PersonnelRequest {
|
||||
|
||||
@ApiModelProperty(value = "统一社会信用代码")
|
||||
@NotBlank(message = "统一社会信用代码不能为空")
|
||||
private String socialCreditCode;
|
||||
|
||||
@ApiModelProperty(value = "姓名")
|
||||
@NotBlank(message = "姓名不能为空")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty(value = "企业名称")
|
||||
@NotBlank(message = "企业名称不能为空")
|
||||
private String companyName;
|
||||
|
||||
@ApiModelProperty(value = "性别")
|
||||
@NotBlank(message = "性别不能为空")
|
||||
private String gender;
|
||||
|
||||
@ApiModelProperty(value = "出生日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date birthday;
|
||||
|
||||
@ApiModelProperty(value = "身份证号")
|
||||
@NotBlank(message = "身份证号不能为空")
|
||||
private String numberId;
|
||||
|
||||
@ApiModelProperty(value = "民族")
|
||||
@NotBlank(message = "民族不能为空")
|
||||
private String nation;
|
||||
|
||||
@ApiModelProperty(value = "政治面貌")
|
||||
@NotBlank(message = "政治面貌不能为空")
|
||||
private String politicsStatus;
|
||||
|
||||
@ApiModelProperty(value = "学历")
|
||||
@NotBlank(message = "学历不能为空")
|
||||
private String education;
|
||||
|
||||
@ApiModelProperty(value = "是否应届毕业生")
|
||||
@NotBlank(message = "是否应届毕业生不能为空")
|
||||
private String freshGraduate;
|
||||
|
||||
@ApiModelProperty(value = "毕业院校")
|
||||
@NotBlank(message = "毕业院校不能为空")
|
||||
private String academy;
|
||||
|
||||
@ApiModelProperty(value = "专业")
|
||||
@NotBlank(message = "专业不能为空")
|
||||
private String specialty;
|
||||
|
||||
@ApiModelProperty(value = "录用方式")
|
||||
@NotBlank(message = "录用方式不能为空")
|
||||
private String hireType;
|
||||
|
||||
@ApiModelProperty(value = "执业资格")
|
||||
@NotBlank(message = "执业资格不能为空")
|
||||
private String qualification;
|
||||
|
||||
@ApiModelProperty(value = "专业技术职称")
|
||||
@NotBlank(message = "专业技术职称不能为空")
|
||||
private String jobTitle;
|
||||
|
||||
@ApiModelProperty(value = "所在部门")
|
||||
@NotBlank(message = "所在部门不能为空")
|
||||
private String presentDept;
|
||||
|
||||
@ApiModelProperty(value = "岗位职务")
|
||||
@NotBlank(message = "岗位职务不能为空")
|
||||
private String position;
|
||||
|
||||
@ApiModelProperty(value = "合同形式")
|
||||
@NotBlank(message = "合同形式不能为空")
|
||||
private String contractModality;
|
||||
|
||||
@ApiModelProperty(value = "人员类型")
|
||||
@NotBlank(message = "人员类型不能为空")
|
||||
private String personnelType;
|
||||
|
||||
@ApiModelProperty(value = "工作状态")
|
||||
@NotBlank(message = "工作状态不能为空")
|
||||
private String workState;
|
||||
|
||||
@ApiModelProperty(value = "人员性质")
|
||||
@NotBlank(message = "人员性质不能为空")
|
||||
private String personnelCharacter;
|
||||
|
||||
@ApiModelProperty(value = "年薪")
|
||||
@NotNull(message = "年薪不能为空")
|
||||
private BigDecimal annualSalary;
|
||||
|
||||
@ApiModelProperty(value = "入职时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date hiredate;
|
||||
|
||||
@ApiModelProperty(value = "退休时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date retirementTime;
|
||||
|
||||
@ApiModelProperty(value = "离职时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date resignationTime;
|
||||
|
||||
@ApiModelProperty(value = "退休返聘开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date txfpStartTime;
|
||||
|
||||
@ApiModelProperty(value = "退休返聘结束时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date txfpEndTime;
|
||||
|
||||
@ApiModelProperty(value = "人员招聘单号")
|
||||
@NotBlank(message = "人员招聘单号不能为空")
|
||||
private String recruitNumber;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "初审意见")
|
||||
private String firstTrialRemark;
|
||||
|
||||
@ApiModelProperty(value = "终审意见")
|
||||
private String finalTrialRemark;
|
||||
|
||||
@ApiModelProperty(value = "相关附件")
|
||||
private List<AttachmentRequest> attachmentList;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.ydool.staff.service;
|
||||
|
||||
import com.ydool.staff.entity.Attachment;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 附件表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author msh
|
||||
* @since 2023-01-30
|
||||
*/
|
||||
public interface IAttachmentService {
|
||||
|
||||
boolean savePersonnel(Attachment attachment);
|
||||
}
|
||||
|
|
@ -1,5 +1,11 @@
|
|||
package com.ydool.staff.service;
|
||||
|
||||
import com.ydool.common.data.dto.AjaxResult;
|
||||
import com.ydool.staff.request.PersonnelDeleteRequest;
|
||||
import com.ydool.staff.request.PersonnelRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 人员表 服务类
|
||||
|
@ -9,6 +15,15 @@ package com.ydool.staff.service;
|
|||
* @since 2023-02-01
|
||||
*/
|
||||
public interface IPersonnelService {
|
||||
/**
|
||||
* 人员列表
|
||||
* @return
|
||||
*/
|
||||
AjaxResult personnelList();
|
||||
|
||||
AjaxResult savePersonnel(PersonnelRequest personnelRequest);
|
||||
|
||||
AjaxResult deleteByIds(PersonnelDeleteRequest personnelDeleteRequest);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package com.ydool.staff.service.impl;
|
||||
|
||||
import com.ydool.common.base.BaseService;
|
||||
import com.ydool.staff.entity.Attachment;
|
||||
import com.ydool.staff.mapper.AttachmentMapper;
|
||||
import com.ydool.staff.service.IAttachmentService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 附件表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author msh
|
||||
* @since 2023-01-30
|
||||
*/
|
||||
@Service
|
||||
public class AttachmentServiceImpl extends BaseService<AttachmentMapper, Attachment> implements IAttachmentService {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean savePersonnel(Attachment entity) {
|
||||
return save(entity);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,24 @@
|
|||
package com.ydool.staff.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.ydool.common.data.dto.AjaxResult;
|
||||
import com.ydool.staff.dto.PersonnelDto;
|
||||
import com.ydool.staff.entity.Attachment;
|
||||
import com.ydool.staff.entity.Personnel;
|
||||
import com.ydool.common.base.BaseService;
|
||||
import com.ydool.staff.mapper.PersonnelMapper;
|
||||
import com.ydool.staff.request.AttachmentRequest;
|
||||
import com.ydool.staff.request.PersonnelDeleteRequest;
|
||||
import com.ydool.staff.request.PersonnelRequest;
|
||||
import com.ydool.staff.service.IAttachmentService;
|
||||
import com.ydool.staff.service.IPersonnelService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.thymeleaf.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
@ -16,6 +30,67 @@ import org.springframework.stereotype.Service;
|
|||
*/
|
||||
@Service
|
||||
public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel> implements IPersonnelService {
|
||||
@Resource
|
||||
private IAttachmentService attachmentService;
|
||||
|
||||
/**
|
||||
* 人员列表
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult personnelList() {
|
||||
List<Personnel> list = list();
|
||||
List<PersonnelDto> personnelDtos = new ArrayList<>();
|
||||
for (Personnel personnel : list) {
|
||||
PersonnelDto dto = new PersonnelDto();
|
||||
dto.setAlterationSign(personnel.getAlterationSign());
|
||||
dto.setCompanyName(personnel.getCompanyName());
|
||||
dto.setName(personnel.getUserName());
|
||||
dto.setNumberId(personnel.getNumberId());
|
||||
dto.setPresentDept(personnel.getPresentDept());
|
||||
dto.setPersonnelType(personnel.getPersonnelType());
|
||||
personnelDtos.add(dto);
|
||||
}
|
||||
return AjaxResult.ok().data(personnelDtos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增人员申报
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult savePersonnel(PersonnelRequest personnelRequest) {
|
||||
List<AttachmentRequest> attachmentList = personnelRequest.getAttachmentList();
|
||||
Personnel personnel = BeanUtil.copyProperties(personnelRequest, Personnel.class);
|
||||
ArrayList<String> s = new ArrayList<>();
|
||||
for (AttachmentRequest request : attachmentList) {
|
||||
s.add(request.getPath());
|
||||
personnel.setAttachmentFile(StringUtils.join(s,','));
|
||||
}
|
||||
boolean save = save(personnel);
|
||||
List<AttachmentRequest> list = personnelRequest.getAttachmentList();
|
||||
for (AttachmentRequest request : list) {
|
||||
Attachment attachment = new Attachment();
|
||||
attachment.setTargetType(request.getTargetType());
|
||||
attachment.setSize(request.getSize());
|
||||
attachment.setAttachment(request.getPath());
|
||||
attachment.setTitle(request.getName());
|
||||
attachment.setTargetId(personnel.getId());
|
||||
attachmentService.savePersonnel(attachment);
|
||||
}
|
||||
return save ? AjaxResult.ok().msg("保存成功!"):AjaxResult.fail().msg("保存失败!");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult deleteByIds(PersonnelDeleteRequest personnelDeleteRequest) {
|
||||
List<String> ids = personnelDeleteRequest.getIds();
|
||||
boolean flag = false;
|
||||
for (String id : ids) {
|
||||
flag = removeById(id);
|
||||
}
|
||||
return flag?AjaxResult.ok().msg("删除成功!"):AjaxResult.fail().msg("删除失败!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue