Merge remote-tracking branch 'origin/master'

This commit is contained in:
lijiaqi 2023-02-06 15:39:07 +08:00
commit 774c7e227d
24 changed files with 616 additions and 125 deletions

View File

@ -27,6 +27,7 @@ public interface UrlConstant {
String MENU = API + "/menu"; String MENU = API + "/menu";
String PERSON = API + "/person"; String PERSON = API + "/person";
String EXCHANGE = API + "/exchange";
String COMPANY = API + "/company"; String COMPANY = API + "/company";

View File

@ -2,10 +2,15 @@ package com.ydool.common.utils;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Date; import java.util.Date;
public class UploadUtils { public class UploadUtils {
@ -31,4 +36,33 @@ public class UploadUtils {
return System.getProperty("user.dir"); return System.getProperty("user.dir");
} }
public static void download(HttpServletResponse response, String fullFilePath, String fileName) {
response.reset();
response.setContentType("application/octet-stream; charset=utf-8");
response.setCharacterEncoding("utf-8");
response.addHeader("Content-Disposition", "attachment; filename*=utf-8'zh_cn'" + encodeUrl(StrUtil.isNotBlank(fileName) ? fileName : FileUtil.getName(fullFilePath)));
try {
IoUtil.copy(FileUtil.getInputStream(fullFilePath), response.getOutputStream());
response.flushBuffer();
} catch (IOException e) {
e.printStackTrace();
}
}
public static String encodeUrl(String part) {
return encodeUrl(part, "UTF-8");
}
public static String encodeUrl(String part, String encoding) {
if (part == null) {
return null;
} else {
try {
return URLEncoder.encode(part, encoding);
} catch (UnsupportedEncodingException ex) {
ex.printStackTrace();
}
return null;
}
}
} }

View File

@ -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);
}
}

View File

@ -21,6 +21,12 @@ public class OrganizationController extends BaseController {
@Autowired @Autowired
IOrganizationService organizationService; IOrganizationService organizationService;
@GetMapping("/selectOrganization")
@ApiOperation(value = "企业名称列表")
public AjaxResult selectOrganization() {
return organizationService.selectOrganization();
}
@GetMapping("/selectOrganizationByName") @GetMapping("/selectOrganizationByName")
@ApiOperation(value = "企业名称查企业信息") @ApiOperation(value = "企业名称查企业信息")
@ApiImplicitParams({@ApiImplicitParam(name = "companyName", value = "企业名称", required = true)}) @ApiImplicitParams({@ApiImplicitParam(name = "companyName", value = "企业名称", required = true)})

View File

@ -1,13 +1,17 @@
package com.ydool.staff.controller; package com.ydool.staff.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiSupport; import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.ydool.common.base.BaseController; import com.ydool.common.base.BaseController;
import com.ydool.common.constant.UrlConstant; import com.ydool.common.constant.UrlConstant;
import com.ydool.common.data.dto.AjaxResult; import com.ydool.common.data.dto.AjaxResult;
import com.ydool.common.utils.UploadUtils;
import com.ydool.staff.dto.PersonnelDto; import com.ydool.staff.dto.PersonnelDto;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.request.PersonnelDeleteRequest; import com.ydool.staff.request.PersonnelDeleteRequest;
import com.ydool.staff.request.PersonnelRequest; import com.ydool.staff.request.PersonnelRequest;
import com.ydool.staff.request.PersonnelUpdateRequest; import com.ydool.staff.request.PersonnelUpdateRequest;
import com.ydool.staff.service.IAttachmentService;
import com.ydool.staff.service.IPersonnelService; import com.ydool.staff.service.IPersonnelService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
@ -15,12 +19,9 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
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;
import java.util.List; import java.util.List;
/** /**
@ -33,10 +34,12 @@ import java.util.List;
@Api(tags = "人员", value = "人员") @Api(tags = "人员", value = "人员")
@ApiSupport(order = 6) @ApiSupport(order = 6)
public class PersonnelController extends BaseController { public class PersonnelController extends BaseController {
@Autowired @Resource
private IPersonnelService personnelService; private IPersonnelService personnelService;
@Autowired
IAttachmentService attachmentService;
@GetMapping(value = "personnelList") @GetMapping( "personnelList")
@ApiOperation(value = "人员列表,传id查一条",response = PersonnelDto.class) @ApiOperation(value = "人员列表,传id查一条",response = PersonnelDto.class)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "current", value = "当前页"), @ApiImplicitParam(name = "current", value = "当前页"),
@ -52,9 +55,9 @@ public class PersonnelController extends BaseController {
return personnelService.savePersonnel(personnelRequest); return personnelService.savePersonnel(personnelRequest);
} }
@PostMapping(value = "deletePersonnel") @PostMapping(value = "deletePersonnel")
@ApiOperation(value = "删除/批量删除人员") @ApiOperation(value = "删除/批量删除人员",response = PersonnelDeleteRequest.class)
public AjaxResult deletePersonnel(@RequestBody PersonnelDeleteRequest personnelDeleteRequest){ public AjaxResult deletePersonnel(@RequestBody PersonnelDeleteRequest request){
return personnelService.deleteByIds(personnelDeleteRequest); return personnelService.deleteByIds(request);
} }
@PostMapping(value = "updatePersonnel") @PostMapping(value = "updatePersonnel")
@ApiOperation(value = "修改人员") @ApiOperation(value = "修改人员")
@ -62,4 +65,18 @@ public class PersonnelController extends BaseController {
return personnelService.updatePersonnel(personnelDeleteRequest); return personnelService.updatePersonnel(personnelDeleteRequest);
} }
@GetMapping("/download")
@ApiOperation(value = "下载文件")
@ApiImplicitParams({@ApiImplicitParam(name = "path", value = "文件路径"), @ApiImplicitParam(name = "fileName", value = "文件名")})
public void download(String path, String fileName) {
String fullFilePath = UploadUtils.getWebRoot() + path;
UploadUtils.download(response, fullFilePath, fileName);
}
@GetMapping("/fileList")
@ApiOperation(value = "文件列表")
@ApiImplicitParams({@ApiImplicitParam(name = "current", value = "当前页"), @ApiImplicitParam(name = "size", value = "每页条数"), @ApiImplicitParam(name = "id", value = "人员id", required = true)})
public AjaxResult fileList(String id) {
return attachmentService.fileList(new Page<Attachment>(getPageNum(), getPageSize()), id);
}
} }

View File

@ -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;
}

View File

@ -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;
}

View File

@ -38,10 +38,6 @@ public class PersonnelDto {
@ApiModelProperty(value = "人员类型") @ApiModelProperty(value = "人员类型")
private String personnelType; private String personnelType;
/**
* 创建时间
*/
@TableField(value = "created_at", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private LocalDateTime createdAt; private LocalDateTime createdAt;

View File

@ -31,10 +31,10 @@ public class Attachment extends BaseEntity{
private String targetType; private String targetType;
@ApiModelProperty(value = "附件名") @ApiModelProperty(value = "附件名")
private String title; private String name;
@ApiModelProperty(value = "附件路径") @ApiModelProperty(value = "附件路径")
private String attachment; private String path;
@ApiModelProperty(value = "文件大小") @ApiModelProperty(value = "文件大小")
private String size; private String size;

View File

@ -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;
}

View File

@ -31,6 +31,13 @@ public class Personnel extends BaseEntity {
private static final long serialVersionUID = 1L; 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 = "统一社会信用代码") @ApiModelProperty(value = "统一社会信用代码")
private String socialCreditCode; private String socialCreditCode;
@ -60,7 +67,7 @@ public class Personnel extends BaseEntity {
private String education; private String education;
@ApiModelProperty(value = "是否应届毕业生") @ApiModelProperty(value = "是否应届毕业生")
private Integer freshGraduate; private Boolean freshGraduate;
@ApiModelProperty(value = "毕业院校") @ApiModelProperty(value = "毕业院校")
private String academy; private String academy;

View File

@ -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> {
}

View File

@ -11,15 +11,12 @@ import lombok.Data;
@Data @Data
public class AttachmentRequest { public class AttachmentRequest {
@ApiModelProperty(value = "附件类型", required = true) @ApiModelProperty(value = "文件名")
private String targetType;
@ApiModelProperty(value = "文件名", required = true)
private String name; private String name;
@ApiModelProperty(value = "路径", required = true) @ApiModelProperty(value = "路径")
private String path; private String path;
@ApiModelProperty(value = "大小", required = true) @ApiModelProperty(value = "大小")
private String size; private String size;
} }

View File

@ -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;
}

View File

@ -31,8 +31,8 @@ public class PersonnelRequest {
private String companyName; private String companyName;
@ApiModelProperty(value = "性别") @ApiModelProperty(value = "性别")
@NotBlank(message = "性别不能为空") @NotNull(message = "性别不能为空")
private String gender; private Boolean gender;
@ApiModelProperty(value = "出生日期") @ApiModelProperty(value = "出生日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@ -55,8 +55,8 @@ public class PersonnelRequest {
private String education; private String education;
@ApiModelProperty(value = "是否应届毕业生") @ApiModelProperty(value = "是否应届毕业生")
@NotBlank(message = "是否应届毕业生不能为空") @NotNull(message = "是否应届毕业生不能为空")
private String freshGraduate; private Boolean freshGraduate;
@ApiModelProperty(value = "毕业院校") @ApiModelProperty(value = "毕业院校")
@NotBlank(message = "毕业院校不能为空") @NotBlank(message = "毕业院校不能为空")
@ -110,13 +110,6 @@ public class PersonnelRequest {
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date hiredate; 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 = "退休返聘开始时间") @ApiModelProperty(value = "退休返聘开始时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@ -133,12 +126,18 @@ public class PersonnelRequest {
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
@ApiModelProperty(value = "初审意见") @ApiModelProperty(value = "身份证附件")
private String firstTrialRemark; private List<AttachmentRequest> cardFile;
@ApiModelProperty(value = "终审意见") @ApiModelProperty(value = "聘任证书附件")
private String finalTrialRemark; private List<AttachmentRequest> engageFile;
@ApiModelProperty(value = "相关附件") @ApiModelProperty(value = "职称证书附件")
private List<AttachmentRequest> attachmentList; private List<AttachmentRequest> jobTitleFile;
@ApiModelProperty(value = "学历证书附件")
private List<AttachmentRequest> educationFile;
@ApiModelProperty(value = "审批资料附件")
private List<AttachmentRequest> auditFile;
} }

View File

@ -35,7 +35,7 @@ public class PersonnelUpdateRequest {
@ApiModelProperty(value = "是否应届毕业生") @ApiModelProperty(value = "是否应届毕业生")
@NotBlank(message = "是否应届毕业生不能为空") @NotBlank(message = "是否应届毕业生不能为空")
private Integer freshGraduate; private Boolean freshGraduate;
@ApiModelProperty(value = "毕业院校") @ApiModelProperty(value = "毕业院校")
@NotBlank(message = "毕业院校不能为空") @NotBlank(message = "毕业院校不能为空")
@ -56,6 +56,13 @@ public class PersonnelUpdateRequest {
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
@ApiModelProperty(value = "相关附件") @ApiModelProperty(value = "身份证附件")
private List<AttachmentRequest> attachmentList; private List<AttachmentRequest> cardFile;
@ApiModelProperty(value = "学历证书附件")
private List<AttachmentRequest> educationFile;
@ApiModelProperty(value = "审批资料附件")
private List<AttachmentRequest> auditFile;
} }

View File

@ -1,5 +1,7 @@
package com.ydool.staff.service; package com.ydool.staff.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.Attachment; import com.ydool.staff.entity.Attachment;
import com.ydool.staff.request.AttachmentRequest; import com.ydool.staff.request.AttachmentRequest;
@ -18,5 +20,7 @@ public interface IAttachmentService {
boolean deleteById(String targetType,String id); boolean deleteById(String targetType,String id);
Attachment selectFile(String path, String id); Attachment selectFile(String path, String id);
AjaxResult fileList(Page<Attachment> page, String id);
} }

View File

@ -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);
}

View File

@ -22,5 +22,7 @@ public interface IOrganizationService {
AjaxResult deleteOrganization(IdsRequest id); AjaxResult deleteOrganization(IdsRequest id);
AjaxResult selectOrganizationByName(String companyName); AjaxResult selectOrganizationByName(String companyName);
AjaxResult selectOrganization();
} }

View File

@ -23,6 +23,8 @@ public interface IPersonnelService {
*/ */
AjaxResult personnelList(Page page , String id); AjaxResult personnelList(Page page , String id);
AjaxResult personnelByExchangeList();
/** /**
* 新增保存 * 新增保存
* @param personnelRequest * @param personnelRequest
@ -43,5 +45,8 @@ public interface IPersonnelService {
* @return * @return
*/ */
AjaxResult updatePersonnel(PersonnelUpdateRequest personnelDeleteRequest); AjaxResult updatePersonnel(PersonnelUpdateRequest personnelDeleteRequest);
} }

View File

@ -1,13 +1,18 @@
package com.ydool.staff.service.impl; package com.ydool.staff.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.base.BaseService;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.Attachment; import com.ydool.staff.entity.Attachment;
import com.ydool.staff.mapper.AttachmentMapper; import com.ydool.staff.mapper.AttachmentMapper;
import com.ydool.staff.request.AttachmentRequest; import com.ydool.staff.request.AttachmentRequest;
import com.ydool.staff.service.IAttachmentService; import com.ydool.staff.service.IAttachmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* <p> * <p>
* 附件表 服务类 * 附件表 服务类
@ -20,6 +25,9 @@ import org.springframework.stereotype.Service;
public class AttachmentServiceImpl extends BaseService<AttachmentMapper, Attachment> implements IAttachmentService { public class AttachmentServiceImpl extends BaseService<AttachmentMapper, Attachment> implements IAttachmentService {
@Autowired
AttachmentMapper attachmentMapper;
@Override @Override
public boolean savePersonnel(Attachment entity) { public boolean savePersonnel(Attachment entity) {
return save(entity); return save(entity);
@ -32,9 +40,12 @@ public class AttachmentServiceImpl extends BaseService<AttachmentMapper, Attachm
@Override @Override
public Attachment selectFile(String path, String id) { 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));
}
@Override
public AjaxResult fileList(Page<Attachment> page, String id) {
return AjaxResult.ok().data(attachmentMapper.selectPage(page, new LambdaQueryWrapper<Attachment>().eq(Attachment::getTargetId, id)));
} }
} }

View File

@ -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("删除失败!");
}
}

View File

@ -45,9 +45,9 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
LambdaQueryWrapper<Organization> organizationLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Organization> organizationLambdaQueryWrapper = new LambdaQueryWrapper<>();
organizationLambdaQueryWrapper.eq(StrUtil.isNotBlank(companyName), Organization::getCompanyName, companyName); organizationLambdaQueryWrapper.eq(StrUtil.isNotBlank(companyName), Organization::getCompanyName, companyName);
Page<Organization> selectPage = organizationMapper.selectPage(page, organizationLambdaQueryWrapper); Page<Organization> selectPage = organizationMapper.selectPage(page, organizationLambdaQueryWrapper);
for (Organization record : selectPage.getRecords()) { // for (Organization record : selectPage.getRecords()) {
record.setUpdatedId(userMapper.selectById(record.getUpdatedId()).getUserName()); // record.setUpdatedId(userMapper.selectById(record.getUpdatedId()).getUserName());
} // }
return AjaxResult.ok().data(selectPage); return AjaxResult.ok().data(selectPage);
} }
@ -80,5 +80,10 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
public AjaxResult selectOrganizationByName(String companyName) { public AjaxResult selectOrganizationByName(String companyName) {
return AjaxResult.ok().data(organizationMapper.selectOne(new LambdaQueryWrapper<Organization>().eq(Organization::getCompanyName, companyName))); return AjaxResult.ok().data(organizationMapper.selectOne(new LambdaQueryWrapper<Organization>().eq(Organization::getCompanyName, companyName)));
} }
@Override
public AjaxResult selectOrganization() {
return AjaxResult.ok().data(organizationMapper.selectList(null));
}
} }

View File

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.base.BaseService; import com.ydool.common.base.BaseService;
import com.ydool.common.data.dto.AjaxResult; import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.dto.PersonnelByExchangeDto;
import com.ydool.staff.dto.PersonnelDto; import com.ydool.staff.dto.PersonnelDto;
import com.ydool.staff.entity.Attachment; import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.Personnel; 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.request.PersonnelUpdateRequest;
import com.ydool.staff.service.IAttachmentService; import com.ydool.staff.service.IAttachmentService;
import com.ydool.staff.service.IPersonnelService; import com.ydool.staff.service.IPersonnelService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.thymeleaf.util.StringUtils; import org.thymeleaf.util.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -47,11 +46,9 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Override @Override
public AjaxResult personnelList(Page page , String id) { public AjaxResult personnelList(Page page , String id) {
if (ObjectUtil.isNotNull(id)){ if (ObjectUtil.isNotNull(id)){
Personnel personnel = get(id); return AjaxResult.ok().data(get(id));
return AjaxResult.ok().data(personnel);
} }
LambdaQueryWrapper<Personnel> wrapper = new LambdaQueryWrapper<>(); Page personnelPage = page(page, new LambdaQueryWrapper<>());
Page personnelPage = page(page, wrapper);
List<Personnel> list = personnelPage.getRecords(); List<Personnel> list = personnelPage.getRecords();
personnelPage.setRecords(list.stream().map(e->{ personnelPage.setRecords(list.stream().map(e->{
PersonnelDto dto = BeanUtil.copyProperties(e, PersonnelDto.class); 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 * @return
@ -70,42 +74,18 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult savePersonnel(PersonnelRequest personnelRequest) { public AjaxResult savePersonnel(PersonnelRequest personnelRequest) {
List<AttachmentRequest> attachmentList = personnelRequest.getAttachmentList();
Personnel personnel = BeanUtil.copyProperties(personnelRequest, Personnel.class); Personnel personnel = BeanUtil.copyProperties(personnelRequest, Personnel.class);
ArrayList<String> card = new ArrayList<>(); personnel.setCardFile(StringUtils.join(saveFilePath(personnelRequest.getCardFile(),Personnel.CARD_FILE,"",""),','));
ArrayList<String> engage = new ArrayList<>(); personnel.setEngageFile(StringUtils.join(saveFilePath(personnelRequest.getEngageFile(),Personnel.ENGAGE_FILE,"",""),','));
ArrayList<String> jobTitle = new ArrayList<>(); personnel.setJobTitleFile(StringUtils.join(saveFilePath(personnelRequest.getJobTitleFile(),Personnel.EDUCATION_FILE,"",""),','));
ArrayList<String> education = new ArrayList<>(); personnel.setEducationFile(StringUtils.join(saveFilePath(personnelRequest.getEducationFile(),Personnel.JOBTITLE_FILE,"",""),','));
ArrayList<String> audit = new ArrayList<>(); personnel.setAuditFile(StringUtils.join(saveFilePath(personnelRequest.getAuditFile(),Personnel.AUDIT_FILE,"",""),','));
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,','));
}
}
boolean save = save(personnel); boolean save = save(personnel);
List<AttachmentRequest> list = personnelRequest.getAttachmentList(); saveAttachment(personnelRequest.getCardFile(),Personnel.CARD_FILE,personnel.getId());
for (AttachmentRequest request : list) { saveAttachment(personnelRequest.getEngageFile(),Personnel.ENGAGE_FILE,personnel.getId());
Attachment attachment = new Attachment(); saveAttachment(personnelRequest.getEducationFile(),Personnel.EDUCATION_FILE,personnel.getId());
attachment.setTargetType(request.getTargetType()); saveAttachment(personnelRequest.getJobTitleFile(),Personnel.JOBTITLE_FILE,personnel.getId());
attachment.setSize(request.getSize()); saveAttachment(personnelRequest.getAuditFile(),Personnel.AUDIT_FILE,personnel.getId());
attachment.setAttachment(request.getPath());
attachment.setTitle(request.getName());
attachment.setTargetId(personnel.getId());
attachmentService.savePersonnel(attachment);
}
return save ? AjaxResult.ok().msg("保存成功!"):AjaxResult.fail().msg("保存失败!"); return save ? AjaxResult.ok().msg("保存成功!"):AjaxResult.fail().msg("保存失败!");
} }
@ -128,46 +108,51 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult updatePersonnel(PersonnelUpdateRequest updateRequest) { public AjaxResult updatePersonnel(PersonnelUpdateRequest updateRequest) {
Personnel personnel = BeanUtil.copyProperties(updateRequest, Personnel.class); Personnel personnel = BeanUtil.copyProperties(updateRequest, Personnel.class);
List<AttachmentRequest> attachmentList = updateRequest.getAttachmentList(); List<AttachmentRequest> cardFile = updateRequest.getCardFile();
ArrayList<String> card = new ArrayList<>(); List<AttachmentRequest> educationFile = updateRequest.getEducationFile();
ArrayList<String> engage = new ArrayList<>(); List<AttachmentRequest> auditFile = updateRequest.getAuditFile();
ArrayList<String> jobTitle = new ArrayList<>(); personnel.setCardFile(StringUtils.join(saveFilePath(cardFile,Personnel.CARD_FILE,"update",personnel.getId()),','));
ArrayList<String> education = new ArrayList<>(); personnel.setEducationFile(StringUtils.join(saveFilePath(educationFile,Personnel.EDUCATION_FILE,"update",personnel.getId()),','));
ArrayList<String> audit = new ArrayList<>(); personnel.setAuditFile(StringUtils.join(saveFilePath(auditFile,Personnel.AUDIT_FILE,"update",personnel.getId()),','));
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());
}
}
boolean update = updateById(personnel); boolean update = updateById(personnel);
for (AttachmentRequest request : attachmentList) { saveAttachment(cardFile,Personnel.CARD_FILE,personnel.getId());
Attachment attachment = new Attachment(); saveAttachment(educationFile,Personnel.EDUCATION_FILE,personnel.getId());
attachment.setTargetType(request.getTargetType()); saveAttachment(auditFile,Personnel.AUDIT_FILE,personnel.getId());
attachment.setSize(request.getSize()); return update ? AjaxResult.ok().msg("修改成功!"):AjaxResult.fail().msg("修改失败!");
attachment.setAttachment(request.getPath()); }
attachment.setTitle(request.getName());
attachment.setTargetId(personnel.getId()); /**
* 保存附件
* @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); attachmentService.savePersonnel(attachment);
} }
return update ? AjaxResult.ok().msg("修改成功!"):AjaxResult.fail().msg("修改失败!"); }
/**
* 保存附件返路径
* @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;
} }
} }