diff --git a/src/main/java/com/ydool/common/constant/UrlConstant.java b/src/main/java/com/ydool/common/constant/UrlConstant.java
index 493d98a..f9b2f66 100644
--- a/src/main/java/com/ydool/common/constant/UrlConstant.java
+++ b/src/main/java/com/ydool/common/constant/UrlConstant.java
@@ -27,6 +27,7 @@ public interface UrlConstant {
String MENU = API + "/menu";
String PERSON = API + "/person";
+ String EXCHANGE = API + "/exchange";
String COMPANY = API + "/company";
diff --git a/src/main/java/com/ydool/staff/controller/ExchangeController.java b/src/main/java/com/ydool/staff/controller/ExchangeController.java
new file mode 100644
index 0000000..66c28d2
--- /dev/null
+++ b/src/main/java/com/ydool/staff/controller/ExchangeController.java
@@ -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);
+ }
+
+}
diff --git a/src/main/java/com/ydool/staff/controller/PersonnelController.java b/src/main/java/com/ydool/staff/controller/PersonnelController.java
index 5c6fbe5..ac4a64d 100644
--- a/src/main/java/com/ydool/staff/controller/PersonnelController.java
+++ b/src/main/java/com/ydool/staff/controller/PersonnelController.java
@@ -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 = "修改人员")
diff --git a/src/main/java/com/ydool/staff/dto/ExchangePageDto.java b/src/main/java/com/ydool/staff/dto/ExchangePageDto.java
new file mode 100644
index 0000000..55a5e94
--- /dev/null
+++ b/src/main/java/com/ydool/staff/dto/ExchangePageDto.java
@@ -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;
+}
diff --git a/src/main/java/com/ydool/staff/dto/PersonnelByExchangeDto.java b/src/main/java/com/ydool/staff/dto/PersonnelByExchangeDto.java
new file mode 100644
index 0000000..e3e6ddf
--- /dev/null
+++ b/src/main/java/com/ydool/staff/dto/PersonnelByExchangeDto.java
@@ -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;
+}
diff --git a/src/main/java/com/ydool/staff/dto/PersonnelDto.java b/src/main/java/com/ydool/staff/dto/PersonnelDto.java
index 78ed142..4fde5a0 100644
--- a/src/main/java/com/ydool/staff/dto/PersonnelDto.java
+++ b/src/main/java/com/ydool/staff/dto/PersonnelDto.java
@@ -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;
diff --git a/src/main/java/com/ydool/staff/entity/Attachment.java b/src/main/java/com/ydool/staff/entity/Attachment.java
index 9b185b8..a37de9b 100644
--- a/src/main/java/com/ydool/staff/entity/Attachment.java
+++ b/src/main/java/com/ydool/staff/entity/Attachment.java
@@ -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;
diff --git a/src/main/java/com/ydool/staff/entity/Exchange.java b/src/main/java/com/ydool/staff/entity/Exchange.java
new file mode 100644
index 0000000..b530aaa
--- /dev/null
+++ b/src/main/java/com/ydool/staff/entity/Exchange.java
@@ -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;
+
+/**
+ *
+ * 人员选调表
+ *
+ *
+ * @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;
+
+}
diff --git a/src/main/java/com/ydool/staff/entity/Personnel.java b/src/main/java/com/ydool/staff/entity/Personnel.java
index 5351543..d20c508 100644
--- a/src/main/java/com/ydool/staff/entity/Personnel.java
+++ b/src/main/java/com/ydool/staff/entity/Personnel.java
@@ -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;
diff --git a/src/main/java/com/ydool/staff/mapper/ExchangeMapper.java b/src/main/java/com/ydool/staff/mapper/ExchangeMapper.java
new file mode 100644
index 0000000..7723160
--- /dev/null
+++ b/src/main/java/com/ydool/staff/mapper/ExchangeMapper.java
@@ -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;
+
+/**
+ *
+ * 人员选调表 Mapper 接口
+ *
+ *
+ * @author msh
+ * @since 2023-02-02
+ */
+@Mapper
+public interface ExchangeMapper extends MPJBaseMapper {
+
+}
diff --git a/src/main/java/com/ydool/staff/request/AttachmentRequest.java b/src/main/java/com/ydool/staff/request/AttachmentRequest.java
index 85c99ac..6186a79 100644
--- a/src/main/java/com/ydool/staff/request/AttachmentRequest.java
+++ b/src/main/java/com/ydool/staff/request/AttachmentRequest.java
@@ -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;
}
diff --git a/src/main/java/com/ydool/staff/request/ExchangeRequest.java b/src/main/java/com/ydool/staff/request/ExchangeRequest.java
new file mode 100644
index 0000000..c8b02da
--- /dev/null
+++ b/src/main/java/com/ydool/staff/request/ExchangeRequest.java
@@ -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 attachmentList;
+
+}
diff --git a/src/main/java/com/ydool/staff/request/PersonnelRequest.java b/src/main/java/com/ydool/staff/request/PersonnelRequest.java
index a26cbc8..fb3a66d 100644
--- a/src/main/java/com/ydool/staff/request/PersonnelRequest.java
+++ b/src/main/java/com/ydool/staff/request/PersonnelRequest.java
@@ -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 cardFile;
- @ApiModelProperty(value = "终审意见")
- private String finalTrialRemark;
+ @ApiModelProperty(value = "聘任证书附件")
+ private List engageFile;
- @ApiModelProperty(value = "相关附件")
- private List attachmentList;
+ @ApiModelProperty(value = "职称证书附件")
+ private List jobTitleFile;
+
+ @ApiModelProperty(value = "学历证书附件")
+ private List educationFile;
+
+ @ApiModelProperty(value = "审批资料附件")
+ private List auditFile;
}
diff --git a/src/main/java/com/ydool/staff/request/PersonnelUpdateRequest.java b/src/main/java/com/ydool/staff/request/PersonnelUpdateRequest.java
index 001e10a..9fcf273 100644
--- a/src/main/java/com/ydool/staff/request/PersonnelUpdateRequest.java
+++ b/src/main/java/com/ydool/staff/request/PersonnelUpdateRequest.java
@@ -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 attachmentList;
+ @ApiModelProperty(value = "身份证附件")
+ private List cardFile;
+
+
+ @ApiModelProperty(value = "学历证书附件")
+ private List educationFile;
+
+ @ApiModelProperty(value = "审批资料附件")
+ private List auditFile;
}
diff --git a/src/main/java/com/ydool/staff/service/IExchangeService.java b/src/main/java/com/ydool/staff/service/IExchangeService.java
new file mode 100644
index 0000000..e0b62aa
--- /dev/null
+++ b/src/main/java/com/ydool/staff/service/IExchangeService.java
@@ -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;
+
+/**
+ *
+ * 人员选调表 服务类
+ *
+ *
+ * @author msh
+ * @since 2023-02-02
+ */
+public interface IExchangeService {
+
+ AjaxResult exchangePage(Page page, String id);
+
+ AjaxResult saveExchange(ExchangeRequest exchangeRequest);
+
+ AjaxResult deleteExchangeById(PersonnelDeleteRequest request);
+}
+
diff --git a/src/main/java/com/ydool/staff/service/IPersonnelService.java b/src/main/java/com/ydool/staff/service/IPersonnelService.java
index cac4497..b0dc9fb 100644
--- a/src/main/java/com/ydool/staff/service/IPersonnelService.java
+++ b/src/main/java/com/ydool/staff/service/IPersonnelService.java
@@ -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);
+
+
+
}
diff --git a/src/main/java/com/ydool/staff/service/impl/AttachmentServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/AttachmentServiceImpl.java
index fae491c..c91c89b 100644
--- a/src/main/java/com/ydool/staff/service/impl/AttachmentServiceImpl.java
+++ b/src/main/java/com/ydool/staff/service/impl/AttachmentServiceImpl.java
@@ -32,7 +32,7 @@ public class AttachmentServiceImpl extends BaseService().eq(Attachment::getAttachment, path).eq(Attachment::getTargetId,id));
+ return getOne(new LambdaQueryWrapper().eq(Attachment::getPath, path).eq(Attachment::getTargetId,id));
}
diff --git a/src/main/java/com/ydool/staff/service/impl/ExchangeServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/ExchangeServiceImpl.java
new file mode 100644
index 0000000..202646a
--- /dev/null
+++ b/src/main/java/com/ydool/staff/service/impl/ExchangeServiceImpl.java
@@ -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;
+
+/**
+ *
+ * 人员选调表 服务类
+ *
+ *
+ * @author msh
+ * @since 2023-02-02
+ */
+@Service
+public class ExchangeServiceImpl extends BaseService 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 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 attachmentList = exchangeRequest.getAttachmentList();
+ ArrayList 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 ids = request.getIds();
+ boolean flag = false;
+ if (1 wrapper = new LambdaQueryWrapper<>();
- Page personnelPage = page(page, wrapper);
+ Page personnelPage = page(page, new LambdaQueryWrapper<>());
List 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 list = list();
+ List dtos = BeanUtil.copyToList(list, PersonnelByExchangeDto.class);
+ return AjaxResult.ok().data(dtos);
+ }
+
/**
* 新增人员申报
* @return
@@ -70,42 +74,18 @@ public class PersonnelServiceImpl extends BaseService attachmentList = personnelRequest.getAttachmentList();
Personnel personnel = BeanUtil.copyProperties(personnelRequest, Personnel.class);
- ArrayList card = new ArrayList<>();
- ArrayList engage = new ArrayList<>();
- ArrayList jobTitle = new ArrayList<>();
- ArrayList education = new ArrayList<>();
- ArrayList 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 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 attachmentList = updateRequest.getAttachmentList();
- ArrayList card = new ArrayList<>();
- ArrayList engage = new ArrayList<>();
- ArrayList jobTitle = new ArrayList<>();
- ArrayList education = new ArrayList<>();
- ArrayList 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 cardFile = updateRequest.getCardFile();
+ List educationFile = updateRequest.getEducationFile();
+ List 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());
+ 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 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);
}
- return update ? AjaxResult.ok().msg("修改成功!"):AjaxResult.fail().msg("修改失败!");
+ }
+
+ /**
+ * 保存附件返路径
+ * @param file
+ * @param type
+ * @param args
+ * @param id
+ * @return
+ */
+ public ArrayList saveFilePath(List file, String type, String args, String id){
+ ArrayList path = new ArrayList<>();
+ for (AttachmentRequest request : file) {
+ if ("update".equals(args)){
+ attachmentService.deleteById(type,id);
+ }
+ path.add(request.getPath());
+ }
+ return path;
}
}