人员修改/人员选调相关1.0
This commit is contained in:
parent
200ab473e3
commit
c2a66689bc
|
@ -27,6 +27,7 @@ public interface UrlConstant {
|
|||
String MENU = API + "/menu";
|
||||
|
||||
String PERSON = API + "/person";
|
||||
String EXCHANGE = API + "/exchange";
|
||||
|
||||
String COMPANY = API + "/company";
|
||||
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
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.ExchangePageDto;
|
||||
import com.ydool.staff.dto.PersonnelByExchangeDto;
|
||||
import com.ydool.staff.dto.PersonnelDto;
|
||||
import com.ydool.staff.entity.Exchange;
|
||||
import com.ydool.staff.request.ExchangeRequest;
|
||||
import com.ydool.staff.request.PersonnelDeleteRequest;
|
||||
import com.ydool.staff.request.PersonnelRequest;
|
||||
import com.ydool.staff.request.PersonnelUpdateRequest;
|
||||
import com.ydool.staff.service.IExchangeService;
|
||||
import com.ydool.staff.service.IPersonnelService;
|
||||
import io.swagger.annotations.Api;
|
||||
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.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 javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author msh
|
||||
* @version 1.0
|
||||
* @date 2023/2/2 17:02
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(UrlConstant.EXCHANGE)
|
||||
@Api(tags = "人员选调", value = "人员选调")
|
||||
@ApiSupport(order = 5)
|
||||
public class ExchangeController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private IExchangeService exchangeService;
|
||||
@Resource
|
||||
private IPersonnelService personnelService;
|
||||
|
||||
|
||||
@GetMapping("exchangePage")
|
||||
@ApiOperation(value = "人员选调列表,传id查一条",response = ExchangePageDto.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "current", value = "当前页"),
|
||||
@ApiImplicitParam(name = "size", value = "每页条数"),
|
||||
@ApiImplicitParam(name = "id", value = "人员选调id")})
|
||||
public AjaxResult exchangePage(String id){
|
||||
return exchangeService.exchangePage(getPage(),id);
|
||||
}
|
||||
|
||||
@PostMapping("saveExchange")
|
||||
@ApiOperation(value = "新增人员选调",response = ExchangeRequest.class)
|
||||
public AjaxResult saveExchange(@Validated @RequestBody ExchangeRequest exchangeRequest){
|
||||
return exchangeService.saveExchange(exchangeRequest);
|
||||
}
|
||||
@GetMapping("personnelByExchangeList")
|
||||
@ApiOperation(value = "点击姓名返人员列表",response = PersonnelByExchangeDto.class)
|
||||
public AjaxResult personnelByExchangeList(){
|
||||
return personnelService.personnelByExchangeList();
|
||||
}
|
||||
|
||||
@GetMapping("deleteExchange")
|
||||
@ApiOperation(value = "删除人员选调",response = PersonnelDeleteRequest.class)
|
||||
public AjaxResult deleteExchange(@RequestBody PersonnelDeleteRequest request){
|
||||
return exchangeService.deleteExchangeById(request);
|
||||
}
|
||||
|
||||
}
|
|
@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -33,10 +34,10 @@ import java.util.List;
|
|||
@Api(tags = "人员", value = "人员")
|
||||
@ApiSupport(order = 6)
|
||||
public class PersonnelController extends BaseController {
|
||||
@Autowired
|
||||
@Resource
|
||||
private IPersonnelService personnelService;
|
||||
|
||||
@GetMapping(value = "personnelList")
|
||||
@GetMapping( "personnelList")
|
||||
@ApiOperation(value = "人员列表,传id查一条",response = PersonnelDto.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "current", value = "当前页"),
|
||||
|
@ -52,9 +53,9 @@ public class PersonnelController extends BaseController {
|
|||
return personnelService.savePersonnel(personnelRequest);
|
||||
}
|
||||
@PostMapping(value = "deletePersonnel")
|
||||
@ApiOperation(value = "删除/批量删除人员")
|
||||
public AjaxResult deletePersonnel(@RequestBody PersonnelDeleteRequest personnelDeleteRequest){
|
||||
return personnelService.deleteByIds(personnelDeleteRequest);
|
||||
@ApiOperation(value = "删除/批量删除人员",response = PersonnelDeleteRequest.class)
|
||||
public AjaxResult deletePersonnel(@RequestBody PersonnelDeleteRequest request){
|
||||
return personnelService.deleteByIds(request);
|
||||
}
|
||||
@PostMapping(value = "updatePersonnel")
|
||||
@ApiOperation(value = "修改人员")
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package com.ydool.staff.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author msh
|
||||
* @version 1.0
|
||||
* @date 2023/2/2 17:15
|
||||
*/
|
||||
@Data
|
||||
public class ExchangePageDto {
|
||||
|
||||
@ApiModelProperty(value = "员工id")
|
||||
private String personnelId;
|
||||
|
||||
@ApiModelProperty(value = "调入企业名称")
|
||||
private String willCompanyName;
|
||||
|
||||
@ApiModelProperty(value = "调出企业名称")
|
||||
private String originalCompanyName;
|
||||
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty(value = "身份证号")
|
||||
private String cardId;
|
||||
|
||||
@ApiModelProperty(value = "现所在部门")
|
||||
private String nowDept;
|
||||
|
||||
@ApiModelProperty(value = "拟所在部门")
|
||||
private String willDept;
|
||||
|
||||
@ApiModelProperty(value = "现任岗位职务")
|
||||
private String nowPosition;
|
||||
|
||||
@ApiModelProperty(value = "拟任岗位职务")
|
||||
private String willPosition;
|
||||
|
||||
@ApiModelProperty(value = "填报人")
|
||||
private String written;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
@ApiModelProperty(value = "填报时间")
|
||||
private LocalDateTime createdAt;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.ydool.staff.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author msh
|
||||
* @version 1.0
|
||||
* @date 2023/2/3 11:02
|
||||
*/
|
||||
@Data
|
||||
public class PersonnelByExchangeDto {
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty(value = "身份证号")
|
||||
private String numberId;
|
||||
|
||||
@ApiModelProperty(value = "统一社会信用代码")
|
||||
private String socialCreditCode;
|
||||
|
||||
@ApiModelProperty(value = "企业名称")
|
||||
private String companyName;
|
||||
|
||||
@ApiModelProperty(value = "所在部门")
|
||||
private String presentDept;
|
||||
|
||||
@ApiModelProperty(value = "岗位职务")
|
||||
private String position;
|
||||
}
|
|
@ -38,10 +38,6 @@ public class PersonnelDto {
|
|||
@ApiModelProperty(value = "人员类型")
|
||||
private String personnelType;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_at", fill = FieldFill.INSERT)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private LocalDateTime createdAt;
|
||||
|
|
|
@ -31,10 +31,10 @@ public class Attachment extends BaseEntity{
|
|||
private String targetType;
|
||||
|
||||
@ApiModelProperty(value = "附件名")
|
||||
private String title;
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "附件路径")
|
||||
private String attachment;
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty(value = "文件大小")
|
||||
private String size;
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
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;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 人员选调表
|
||||
* </p>
|
||||
*
|
||||
* @author msh
|
||||
* @since 2023-02-02
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("t_lc_exchange")
|
||||
@ApiModel(value="Exchange对象", description="人员选调表")
|
||||
public class Exchange extends BaseEntity{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "员工id")
|
||||
@NotBlank(message = "员工姓名不能为空")
|
||||
private String personnelId;
|
||||
|
||||
@ApiModelProperty(value = "调入企业id")
|
||||
@NotBlank(message = "调入企业名称不能为空")
|
||||
private String willCompanyId;
|
||||
|
||||
@ApiModelProperty(value = "拟所在部门")
|
||||
@NotBlank(message = "拟所在部门不能为空")
|
||||
private String willDept;
|
||||
|
||||
@ApiModelProperty(value = "拟任岗位职务")
|
||||
@NotBlank(message = "拟任岗位职务不能为空")
|
||||
private String willPosition;
|
||||
|
||||
@ApiModelProperty(value = "选调理由")
|
||||
private String excReason;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "选调相关附件")
|
||||
private String excFile;
|
||||
|
||||
@ApiModelProperty(value = "审批状态")
|
||||
private String auditState;
|
||||
|
||||
}
|
|
@ -31,6 +31,13 @@ public class Personnel extends BaseEntity {
|
|||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
public static final String CARD_FILE = "card";
|
||||
public static final String ENGAGE_FILE = "engage";
|
||||
public static final String JOBTITLE_FILE = "jobtitle";
|
||||
public static final String EDUCATION_FILE = "education";
|
||||
public static final String AUDIT_FILE = "audit";
|
||||
|
||||
@ApiModelProperty(value = "统一社会信用代码")
|
||||
private String socialCreditCode;
|
||||
|
||||
|
@ -60,7 +67,7 @@ public class Personnel extends BaseEntity {
|
|||
private String education;
|
||||
|
||||
@ApiModelProperty(value = "是否应届毕业生")
|
||||
private Integer freshGraduate;
|
||||
private boolean freshGraduate;
|
||||
|
||||
@ApiModelProperty(value = "毕业院校")
|
||||
private String academy;
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package com.ydool.staff.mapper;
|
||||
|
||||
import com.ydool.staff.entity.Exchange;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 人员选调表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author msh
|
||||
* @since 2023-02-02
|
||||
*/
|
||||
@Mapper
|
||||
public interface ExchangeMapper extends MPJBaseMapper<Exchange> {
|
||||
|
||||
}
|
|
@ -11,15 +11,12 @@ import lombok.Data;
|
|||
@Data
|
||||
public class AttachmentRequest {
|
||||
|
||||
@ApiModelProperty(value = "附件类型", required = true)
|
||||
private String targetType;
|
||||
|
||||
@ApiModelProperty(value = "文件名", required = true)
|
||||
@ApiModelProperty(value = "文件名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "路径", required = true)
|
||||
@ApiModelProperty(value = "路径")
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty(value = "大小", required = true)
|
||||
@ApiModelProperty(value = "大小")
|
||||
private String size;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package com.ydool.staff.request;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author msh
|
||||
* @version 1.0
|
||||
* @date 2023/2/3 9:56
|
||||
*/
|
||||
@Data
|
||||
public class ExchangeRequest {
|
||||
@ApiModelProperty(value = "员工id")
|
||||
@NotBlank(message = "员工姓名不能为空")
|
||||
private String personnelId;
|
||||
|
||||
@ApiModelProperty(value = "调入企业id")
|
||||
@NotBlank(message = "调入企业名称不能为空")
|
||||
private String willCompanyId;
|
||||
|
||||
@ApiModelProperty(value = "拟所在部门")
|
||||
@NotBlank(message = "拟所在部门不能为空")
|
||||
private String willDept;
|
||||
|
||||
@ApiModelProperty(value = "拟任岗位职务")
|
||||
@NotBlank(message = "拟任岗位职务不能为空")
|
||||
private String willPosition;
|
||||
|
||||
@ApiModelProperty(value = "选调理由")
|
||||
private String excReason;
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "选调相关附件")
|
||||
private List<AttachmentRequest> attachmentList;
|
||||
|
||||
}
|
|
@ -31,8 +31,8 @@ public class PersonnelRequest {
|
|||
private String companyName;
|
||||
|
||||
@ApiModelProperty(value = "性别")
|
||||
@NotBlank(message = "性别不能为空")
|
||||
private String gender;
|
||||
@NotNull(message = "性别不能为空")
|
||||
private Boolean gender;
|
||||
|
||||
@ApiModelProperty(value = "出生日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
|
@ -55,8 +55,8 @@ public class PersonnelRequest {
|
|||
private String education;
|
||||
|
||||
@ApiModelProperty(value = "是否应届毕业生")
|
||||
@NotBlank(message = "是否应届毕业生不能为空")
|
||||
private String freshGraduate;
|
||||
@NotNull(message = "是否应届毕业生不能为空")
|
||||
private Boolean freshGraduate;
|
||||
|
||||
@ApiModelProperty(value = "毕业院校")
|
||||
@NotBlank(message = "毕业院校不能为空")
|
||||
|
@ -110,13 +110,6 @@ public class PersonnelRequest {
|
|||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date hiredate;
|
||||
|
||||
@ApiModelProperty(value = "退休时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date retirementTime;
|
||||
|
||||
@ApiModelProperty(value = "离职时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date resignationTime;
|
||||
|
||||
@ApiModelProperty(value = "退休返聘开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
|
@ -133,12 +126,18 @@ public class PersonnelRequest {
|
|||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "初审意见")
|
||||
private String firstTrialRemark;
|
||||
@ApiModelProperty(value = "身份证附件")
|
||||
private List<AttachmentRequest> cardFile;
|
||||
|
||||
@ApiModelProperty(value = "终审意见")
|
||||
private String finalTrialRemark;
|
||||
@ApiModelProperty(value = "聘任证书附件")
|
||||
private List<AttachmentRequest> engageFile;
|
||||
|
||||
@ApiModelProperty(value = "相关附件")
|
||||
private List<AttachmentRequest> attachmentList;
|
||||
@ApiModelProperty(value = "职称证书附件")
|
||||
private List<AttachmentRequest> jobTitleFile;
|
||||
|
||||
@ApiModelProperty(value = "学历证书附件")
|
||||
private List<AttachmentRequest> educationFile;
|
||||
|
||||
@ApiModelProperty(value = "审批资料附件")
|
||||
private List<AttachmentRequest> auditFile;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public class PersonnelUpdateRequest {
|
|||
|
||||
@ApiModelProperty(value = "是否应届毕业生")
|
||||
@NotBlank(message = "是否应届毕业生不能为空")
|
||||
private Integer freshGraduate;
|
||||
private Boolean freshGraduate;
|
||||
|
||||
@ApiModelProperty(value = "毕业院校")
|
||||
@NotBlank(message = "毕业院校不能为空")
|
||||
|
@ -56,6 +56,13 @@ public class PersonnelUpdateRequest {
|
|||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty(value = "相关附件")
|
||||
private List<AttachmentRequest> attachmentList;
|
||||
@ApiModelProperty(value = "身份证附件")
|
||||
private List<AttachmentRequest> cardFile;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "学历证书附件")
|
||||
private List<AttachmentRequest> educationFile;
|
||||
|
||||
@ApiModelProperty(value = "审批资料附件")
|
||||
private List<AttachmentRequest> auditFile;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package com.ydool.staff.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ydool.common.data.dto.AjaxResult;
|
||||
import com.ydool.staff.request.ExchangeRequest;
|
||||
import com.ydool.staff.request.PersonnelDeleteRequest;
|
||||
import com.ydool.staff.request.PersonnelUpdateRequest;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 人员选调表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author msh
|
||||
* @since 2023-02-02
|
||||
*/
|
||||
public interface IExchangeService {
|
||||
|
||||
AjaxResult exchangePage(Page page, String id);
|
||||
|
||||
AjaxResult saveExchange(ExchangeRequest exchangeRequest);
|
||||
|
||||
AjaxResult deleteExchangeById(PersonnelDeleteRequest request);
|
||||
}
|
||||
|
|
@ -23,6 +23,8 @@ public interface IPersonnelService {
|
|||
*/
|
||||
AjaxResult personnelList(Page page , String id);
|
||||
|
||||
AjaxResult personnelByExchangeList();
|
||||
|
||||
/**
|
||||
* 新增保存
|
||||
* @param personnelRequest
|
||||
|
@ -43,5 +45,8 @@ public interface IPersonnelService {
|
|||
* @return
|
||||
*/
|
||||
AjaxResult updatePersonnel(PersonnelUpdateRequest personnelDeleteRequest);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public class AttachmentServiceImpl extends BaseService<AttachmentMapper, Attachm
|
|||
|
||||
@Override
|
||||
public Attachment selectFile(String path, String id) {
|
||||
return getOne(new LambdaQueryWrapper<Attachment>().eq(Attachment::getAttachment, path).eq(Attachment::getTargetId,id));
|
||||
return getOne(new LambdaQueryWrapper<Attachment>().eq(Attachment::getPath, path).eq(Attachment::getTargetId,id));
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
package com.ydool.staff.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ydool.common.data.dto.AjaxResult;
|
||||
import com.ydool.staff.dto.ExchangePageDto;
|
||||
import com.ydool.staff.entity.Attachment;
|
||||
import com.ydool.staff.entity.Exchange;
|
||||
import com.ydool.common.base.BaseService;
|
||||
import com.ydool.staff.entity.Organization;
|
||||
import com.ydool.staff.entity.Personnel;
|
||||
import com.ydool.staff.mapper.AttachmentMapper;
|
||||
import com.ydool.staff.mapper.ExchangeMapper;
|
||||
import com.ydool.staff.mapper.OrganizationMapper;
|
||||
import com.ydool.staff.mapper.PersonnelMapper;
|
||||
import com.ydool.staff.request.AttachmentRequest;
|
||||
import com.ydool.staff.request.ExchangeRequest;
|
||||
import com.ydool.staff.request.PersonnelDeleteRequest;
|
||||
import com.ydool.staff.request.PersonnelUpdateRequest;
|
||||
import com.ydool.staff.service.IExchangeService;
|
||||
import com.ydool.system.entity.User;
|
||||
import com.ydool.system.mapper.UserMapper;
|
||||
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;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 人员选调表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author msh
|
||||
* @since 2023-02-02
|
||||
*/
|
||||
@Service
|
||||
public class ExchangeServiceImpl extends BaseService<ExchangeMapper, Exchange> implements IExchangeService {
|
||||
|
||||
@Resource
|
||||
private PersonnelMapper personnelMapper;
|
||||
@Resource
|
||||
private AttachmentMapper attachmentMapper;
|
||||
@Resource
|
||||
private OrganizationMapper organizationMapper;
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
@Override
|
||||
public AjaxResult exchangePage(Page page, String id) {
|
||||
if (ObjectUtil.isNotNull(id)){
|
||||
return AjaxResult.ok().data(get(id));
|
||||
}
|
||||
Page exchangePage = page(page, new LambdaQueryWrapper<>());
|
||||
List<Exchange> list = exchangePage.getRecords();
|
||||
exchangePage.setRecords(list.stream().map(e->{
|
||||
ExchangePageDto dto = BeanUtil.copyProperties(e, ExchangePageDto.class);
|
||||
Personnel personnel = personnelMapper.selectById(dto.getPersonnelId());
|
||||
Organization organization = organizationMapper.selectById(e.getWillCompanyId());
|
||||
User user = userMapper.selectById((String)StpUtil.getLoginId());
|
||||
dto.setUserName(personnel.getUserName());
|
||||
dto.setOriginalCompanyName(personnel.getCompanyName());
|
||||
dto.setWillCompanyName(organization.getCompanyName());
|
||||
dto.setCardId(personnel.getNumberId());
|
||||
dto.setNowDept(personnel.getPresentDept());
|
||||
dto.setNowPosition(personnel.getPosition());
|
||||
dto.setWritten(user.getUserName());
|
||||
return dto;
|
||||
}).collect(Collectors.toList()));
|
||||
return AjaxResult.ok().data(exchangePage);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult saveExchange(ExchangeRequest exchangeRequest) {
|
||||
List<AttachmentRequest> attachmentList = exchangeRequest.getAttachmentList();
|
||||
ArrayList<String> s = new ArrayList<>();
|
||||
Exchange exchange = BeanUtil.copyProperties(exchangeRequest, Exchange.class);
|
||||
for (AttachmentRequest request : attachmentList) {
|
||||
s.add(request.getPath());
|
||||
exchange.setExcFile(StringUtils.join(s,','));
|
||||
}
|
||||
boolean save = save(exchange);
|
||||
for (AttachmentRequest request : attachmentList) {
|
||||
Attachment attachment = BeanUtil.copyProperties(request, Attachment.class);
|
||||
attachment.setTargetId(exchange.getId());
|
||||
attachmentMapper.insert(attachment);
|
||||
}
|
||||
return save ?AjaxResult.ok().msg("保存成功!"):AjaxResult.fail().msg("保存失败!");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult deleteExchangeById(PersonnelDeleteRequest request) {
|
||||
List<String> ids = request.getIds();
|
||||
boolean flag = false;
|
||||
if (1<ids.size()){
|
||||
for (String id : ids) {
|
||||
flag = removeById(id);
|
||||
}
|
||||
return flag?AjaxResult.ok().msg("批量删除成功!"):AjaxResult.fail().msg("批量删除失败!");
|
||||
}
|
||||
flag = removeById(ids.get(0));
|
||||
return flag?AjaxResult.ok().msg("删除成功!"):AjaxResult.fail().msg("删除失败!");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ydool.common.base.BaseService;
|
||||
import com.ydool.common.data.dto.AjaxResult;
|
||||
import com.ydool.staff.dto.PersonnelByExchangeDto;
|
||||
import com.ydool.staff.dto.PersonnelDto;
|
||||
import com.ydool.staff.entity.Attachment;
|
||||
import com.ydool.staff.entity.Personnel;
|
||||
|
@ -16,14 +17,12 @@ import com.ydool.staff.request.PersonnelRequest;
|
|||
import com.ydool.staff.request.PersonnelUpdateRequest;
|
||||
import com.ydool.staff.service.IAttachmentService;
|
||||
import com.ydool.staff.service.IPersonnelService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
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.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -47,11 +46,9 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|||
@Override
|
||||
public AjaxResult personnelList(Page page , String id) {
|
||||
if (ObjectUtil.isNotNull(id)){
|
||||
Personnel personnel = get(id);
|
||||
return AjaxResult.ok().data(personnel);
|
||||
return AjaxResult.ok().data(get(id));
|
||||
}
|
||||
LambdaQueryWrapper<Personnel> wrapper = new LambdaQueryWrapper<>();
|
||||
Page personnelPage = page(page, wrapper);
|
||||
Page personnelPage = page(page, new LambdaQueryWrapper<>());
|
||||
List<Personnel> list = personnelPage.getRecords();
|
||||
personnelPage.setRecords(list.stream().map(e->{
|
||||
PersonnelDto dto = BeanUtil.copyProperties(e, PersonnelDto.class);
|
||||
|
@ -63,6 +60,13 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult personnelByExchangeList() {
|
||||
List<Personnel> list = list();
|
||||
List<PersonnelByExchangeDto> dtos = BeanUtil.copyToList(list, PersonnelByExchangeDto.class);
|
||||
return AjaxResult.ok().data(dtos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增人员申报
|
||||
* @return
|
||||
|
@ -70,42 +74,18 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult savePersonnel(PersonnelRequest personnelRequest) {
|
||||
List<AttachmentRequest> attachmentList = personnelRequest.getAttachmentList();
|
||||
Personnel personnel = BeanUtil.copyProperties(personnelRequest, Personnel.class);
|
||||
ArrayList<String> card = new ArrayList<>();
|
||||
ArrayList<String> engage = new ArrayList<>();
|
||||
ArrayList<String> jobTitle = new ArrayList<>();
|
||||
ArrayList<String> education = new ArrayList<>();
|
||||
ArrayList<String> audit = new ArrayList<>();
|
||||
for (AttachmentRequest request : attachmentList) {
|
||||
if ("card".equals(request.getTargetType())){
|
||||
card.add(request.getPath());
|
||||
personnel.setCardFile(StringUtils.join(card,','));
|
||||
}else if ("engage".equals(request.getTargetType())){
|
||||
engage.add(request.getPath());
|
||||
personnel.setEngageFile(StringUtils.join(engage,','));
|
||||
}else if ("jobTitle".equals(request.getTargetType())){
|
||||
jobTitle.add(request.getPath());
|
||||
personnel.setJobTitleFile(StringUtils.join(jobTitle,','));
|
||||
}else if ("education".equals(request.getTargetType())){
|
||||
education.add(request.getPath());
|
||||
personnel.setEducationFile(StringUtils.join(education,','));
|
||||
}else if ("audit".equals(request.getTargetType())){
|
||||
audit.add(request.getPath());
|
||||
personnel.setAuditFile(StringUtils.join(audit,','));
|
||||
}
|
||||
}
|
||||
personnel.setCardFile(StringUtils.join(saveFilePath(personnelRequest.getCardFile(),Personnel.CARD_FILE,"",""),','));
|
||||
personnel.setEngageFile(StringUtils.join(saveFilePath(personnelRequest.getEngageFile(),Personnel.ENGAGE_FILE,"",""),','));
|
||||
personnel.setJobTitleFile(StringUtils.join(saveFilePath(personnelRequest.getJobTitleFile(),Personnel.EDUCATION_FILE,"",""),','));
|
||||
personnel.setEducationFile(StringUtils.join(saveFilePath(personnelRequest.getEducationFile(),Personnel.JOBTITLE_FILE,"",""),','));
|
||||
personnel.setAuditFile(StringUtils.join(saveFilePath(personnelRequest.getAuditFile(),Personnel.AUDIT_FILE,"",""),','));
|
||||
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);
|
||||
}
|
||||
saveAttachment(personnelRequest.getCardFile(),Personnel.CARD_FILE,personnel.getId());
|
||||
saveAttachment(personnelRequest.getEngageFile(),Personnel.ENGAGE_FILE,personnel.getId());
|
||||
saveAttachment(personnelRequest.getEducationFile(),Personnel.EDUCATION_FILE,personnel.getId());
|
||||
saveAttachment(personnelRequest.getJobTitleFile(),Personnel.JOBTITLE_FILE,personnel.getId());
|
||||
saveAttachment(personnelRequest.getAuditFile(),Personnel.AUDIT_FILE,personnel.getId());
|
||||
return save ? AjaxResult.ok().msg("保存成功!"):AjaxResult.fail().msg("保存失败!");
|
||||
}
|
||||
|
||||
|
@ -128,46 +108,51 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult updatePersonnel(PersonnelUpdateRequest updateRequest) {
|
||||
Personnel personnel = BeanUtil.copyProperties(updateRequest, Personnel.class);
|
||||
List<AttachmentRequest> attachmentList = updateRequest.getAttachmentList();
|
||||
ArrayList<String> card = new ArrayList<>();
|
||||
ArrayList<String> engage = new ArrayList<>();
|
||||
ArrayList<String> jobTitle = new ArrayList<>();
|
||||
ArrayList<String> education = new ArrayList<>();
|
||||
ArrayList<String> audit = new ArrayList<>();
|
||||
for (AttachmentRequest request : attachmentList) {
|
||||
if ("card".equals(request.getTargetType())){
|
||||
card.add(request.getPath());
|
||||
personnel.setCardFile(StringUtils.join(card,','));
|
||||
attachmentService.deleteById(request.getTargetType(),updateRequest.getId());
|
||||
}else if ("engage".equals(request.getTargetType())){
|
||||
engage.add(request.getPath());
|
||||
personnel.setEngageFile(StringUtils.join(engage,','));
|
||||
attachmentService.deleteById(request.getTargetType(),updateRequest.getId());
|
||||
}else if ("jobTitle".equals(request.getTargetType())){
|
||||
jobTitle.add(request.getPath());
|
||||
personnel.setJobTitleFile(StringUtils.join(jobTitle,','));
|
||||
attachmentService.deleteById(request.getTargetType(),updateRequest.getId());
|
||||
}else if ("education".equals(request.getTargetType())){
|
||||
education.add(request.getPath());
|
||||
personnel.setEducationFile(StringUtils.join(education,','));
|
||||
attachmentService.deleteById(request.getTargetType(),updateRequest.getId());
|
||||
}else if ("audit".equals(request.getTargetType())){
|
||||
audit.add(request.getPath());
|
||||
personnel.setAuditFile(StringUtils.join(audit,','));
|
||||
attachmentService.deleteById(request.getTargetType(),updateRequest.getId());
|
||||
}
|
||||
}
|
||||
List<AttachmentRequest> cardFile = updateRequest.getCardFile();
|
||||
List<AttachmentRequest> educationFile = updateRequest.getEducationFile();
|
||||
List<AttachmentRequest> auditFile = updateRequest.getAuditFile();
|
||||
personnel.setCardFile(StringUtils.join(saveFilePath(cardFile,Personnel.CARD_FILE,"update",personnel.getId()),','));
|
||||
personnel.setEducationFile(StringUtils.join(saveFilePath(educationFile,Personnel.EDUCATION_FILE,"update",personnel.getId()),','));
|
||||
personnel.setAuditFile(StringUtils.join(saveFilePath(auditFile,Personnel.AUDIT_FILE,"update",personnel.getId()),','));
|
||||
boolean update = updateById(personnel);
|
||||
for (AttachmentRequest request : attachmentList) {
|
||||
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);
|
||||
}
|
||||
saveAttachment(cardFile,Personnel.CARD_FILE,personnel.getId());
|
||||
saveAttachment(educationFile,Personnel.EDUCATION_FILE,personnel.getId());
|
||||
saveAttachment(auditFile,Personnel.AUDIT_FILE,personnel.getId());
|
||||
return update ? AjaxResult.ok().msg("修改成功!"):AjaxResult.fail().msg("修改失败!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存附件
|
||||
* @param file
|
||||
* @param type
|
||||
* @param id
|
||||
*/
|
||||
public void saveAttachment(List<AttachmentRequest> file,String type, String id){
|
||||
for (AttachmentRequest request : file) {
|
||||
Attachment attachment = BeanUtil.copyProperties(request, Attachment.class);
|
||||
attachment.setTargetType(type);
|
||||
attachment.setTargetId(id);
|
||||
attachmentService.savePersonnel(attachment);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存附件返路径
|
||||
* @param file
|
||||
* @param type
|
||||
* @param args
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public ArrayList<String> saveFilePath(List<AttachmentRequest> file, String type, String args, String id){
|
||||
ArrayList<String> path = new ArrayList<>();
|
||||
for (AttachmentRequest request : file) {
|
||||
if ("update".equals(args)){
|
||||
attachmentService.deleteById(type,id);
|
||||
}
|
||||
path.add(request.getPath());
|
||||
}
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue