init
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
package com.newyetai.recruit.talent.controller;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import com.newyetai.common.AlitaResult;
|
||||
import com.newyetai.tkmybatis.pojo.Page;
|
||||
import com.newyetai.recruit.talent.dto.*;
|
||||
import com.newyetai.recruit.talent.service.ImportDetailTalentService;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人才库导入表
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
@Api(tags = "人才库导入表")
|
||||
@RestController
|
||||
@RequestMapping("/import_detail_talent")
|
||||
public class ImportDetailTalentController {
|
||||
|
||||
@Autowired
|
||||
private ImportDetailTalentService importDetailTalentService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("人才库导入表-创建")
|
||||
public AlitaResult<ImportDetailTalentDTO> create(@RequestBody ImportDetailTalentOperatorDTO operatorDTO) {
|
||||
return AlitaResult.success(importDetailTalentService.create(operatorDTO));
|
||||
}
|
||||
|
||||
@PutMapping("/modify")
|
||||
@ApiOperation("人才库导入表-修改")
|
||||
public AlitaResult<ImportDetailTalentDTO> modify(@RequestBody ImportDetailTalentOperatorDTO operatorDTO) {
|
||||
return AlitaResult.success(importDetailTalentService.modify(operatorDTO));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation("人才库导入表-删除")
|
||||
public AlitaResult<ImportDetailTalentDTO> delete(@PathVariable("id") Long id) {
|
||||
return AlitaResult.success(importDetailTalentService.delete(id));
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation("人才库导入表-查询单个")
|
||||
public AlitaResult<ImportDetailTalentDTO> findById(@PathVariable("id") Long id) {
|
||||
return AlitaResult.success(importDetailTalentService.findById(id));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("人才库导入表-列表查询")
|
||||
public AlitaResult<List<ImportDetailTalentDTO>> list(ImportDetailTalentQueryDTO queryDTO) {
|
||||
return AlitaResult.success(importDetailTalentService.list(queryDTO));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("人才库导入表-分页查询")
|
||||
public AlitaResult<Page<ImportDetailTalentDTO>> page(ImportDetailTalentPageQueryDTO queryDTO) {
|
||||
importDetailTalentService.page(queryDTO);
|
||||
return AlitaResult.success(queryDTO.getPageResult());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.newyetai.recruit.talent.controller;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import com.newyetai.common.AlitaResult;
|
||||
import com.newyetai.tkmybatis.pojo.Page;
|
||||
import com.newyetai.recruit.talent.dto.*;
|
||||
import com.newyetai.recruit.talent.service.TalentService;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人才库
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
@Api(tags = "人才库")
|
||||
@RestController
|
||||
@RequestMapping("/talent")
|
||||
public class TalentController {
|
||||
|
||||
@Autowired
|
||||
private TalentService talentService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("人才库-创建")
|
||||
public AlitaResult<TalentDTO> create(@RequestBody @Validated TalentOperatorDTO operatorDTO) {
|
||||
return AlitaResult.success(talentService.create(operatorDTO));
|
||||
}
|
||||
|
||||
@PutMapping("/modify")
|
||||
@ApiOperation("人才库-修改")
|
||||
public AlitaResult<TalentDTO> modify(@RequestBody @Validated TalentOperatorDTO operatorDTO) {
|
||||
return AlitaResult.success(talentService.modify(operatorDTO));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ApiOperation("人才库-删除")
|
||||
public AlitaResult<TalentDTO> delete(@PathVariable("id") Long id) {
|
||||
return AlitaResult.success(talentService.delete(id));
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation("人才库-查询单个")
|
||||
public AlitaResult<TalentDTO> findById(@PathVariable("id") Long id) {
|
||||
return AlitaResult.success(talentService.findById(id));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("人才库-列表查询")
|
||||
public AlitaResult<List<TalentDTO>> list(TalentPageQueryDTO queryDTO) {
|
||||
return AlitaResult.success(talentService.list(queryDTO));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("人才库-分页查询")
|
||||
public AlitaResult<Page<TalentDTO>> page(TalentPageQueryDTO queryDTO) {
|
||||
talentService.page(queryDTO);
|
||||
return AlitaResult.success(queryDTO.getPageResult());
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
@ApiOperation("人才库-导出")
|
||||
public void export(TalentPageQueryDTO queryDTO) {
|
||||
talentService.export(queryDTO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.newyetai.recruit.talent.convert;
|
||||
|
||||
import com.newyetai.recruit.talent.entity.ImportDetailTalent;
|
||||
import com.newyetai.recruit.talent.dto.ImportDetailTalentDTO;
|
||||
import com.newyetai.recruit.talent.dto.ImportDetailTalentOperatorDTO;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 人才库导入表
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
@Mapper
|
||||
public interface ImportDetailTalentConvert {
|
||||
ImportDetailTalentConvert INSTANCE = Mappers.getMapper(ImportDetailTalentConvert.class);
|
||||
|
||||
ImportDetailTalent convert(ImportDetailTalentDTO dto);
|
||||
|
||||
ImportDetailTalentDTO convert(ImportDetailTalent entity);
|
||||
|
||||
ImportDetailTalent convert(ImportDetailTalentOperatorDTO dto);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.newyetai.recruit.talent.convert;
|
||||
|
||||
import com.newyetai.recruit.talent.entity.Talent;
|
||||
import com.newyetai.recruit.talent.dto.TalentDTO;
|
||||
import com.newyetai.recruit.talent.dto.TalentOperatorDTO;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 人才库
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
@Mapper
|
||||
public interface TalentConvert {
|
||||
TalentConvert INSTANCE = Mappers.getMapper(TalentConvert.class);
|
||||
|
||||
Talent convert(TalentDTO dto);
|
||||
|
||||
TalentDTO convert(Talent entity);
|
||||
|
||||
Talent convert(TalentOperatorDTO dto);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.newyetai.recruit.talent.dao;
|
||||
|
||||
import com.newyetai.tkmybatis.mybatis.MyMapper;
|
||||
import com.newyetai.recruit.talent.entity.ImportDetailTalent;
|
||||
import com.newyetai.recruit.talent.dto.ImportDetailTalentDTO;
|
||||
import com.newyetai.recruit.talent.dto.ImportDetailTalentQueryDTO;
|
||||
import com.newyetai.recruit.talent.dto.ImportDetailTalentPageQueryDTO;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人才库导入表
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
@Mapper
|
||||
public interface ImportDetailTalentMapper extends MyMapper<ImportDetailTalent> {
|
||||
|
||||
List<ImportDetailTalentDTO> page(@Param("param") ImportDetailTalentPageQueryDTO queryDTO);
|
||||
|
||||
List<ImportDetailTalentDTO> list(@Param("param") ImportDetailTalentQueryDTO queryDTO);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.newyetai.recruit.talent.dao;
|
||||
|
||||
import com.newyetai.tkmybatis.mybatis.MyMapper;
|
||||
import com.newyetai.recruit.talent.entity.Talent;
|
||||
import com.newyetai.recruit.talent.dto.TalentDTO;
|
||||
import com.newyetai.recruit.talent.dto.TalentPageQueryDTO;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人才库
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
@Mapper
|
||||
public interface TalentMapper extends MyMapper<Talent> {
|
||||
|
||||
List<TalentDTO> page(@Param("param") TalentPageQueryDTO queryDTO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.newyetai.recruit.talent.dto;
|
||||
|
||||
import com.newyetai.component.commonimport.dto.ImportDetailSuperDTO;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 人才库导入表
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
@ApiModel("人才库导入表")
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ImportDetailTalentDTO extends ImportDetailSuperDTO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("导入任务ID")
|
||||
private Long mainId;
|
||||
|
||||
@ApiModelProperty("机构ID")
|
||||
private Long orgId;
|
||||
|
||||
@ApiModelProperty("模板全量数据")
|
||||
private String dataJson;
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty("身份证号")
|
||||
private String cardNo;
|
||||
|
||||
@ApiModelProperty("联系方式")
|
||||
private String contactWay;
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("明细状态")
|
||||
private Integer detailStatus;
|
||||
|
||||
@ApiModelProperty("失败原因")
|
||||
private String failReason;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
public void appendFailMsg(String msg) {
|
||||
if (StrUtil.isEmpty(msg)) {
|
||||
return;
|
||||
}
|
||||
if (StrUtil.isEmpty(getFailReason())) {
|
||||
setFailReason(msg);
|
||||
} else {
|
||||
setFailReason(String.join(",", getFailReason(), msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.newyetai.recruit.talent.dto;
|
||||
|
||||
import com.newyetai.component.commonimport.dto.ImportExecuteSuperDTO;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description: 确定导入dto
|
||||
* @author: guixinman
|
||||
* @create: 2024-04-09 16:19
|
||||
**/
|
||||
@Data
|
||||
public class ImportDetailTalentExecuteDTO extends ImportExecuteSuperDTO {
|
||||
|
||||
/**
|
||||
* 供应商id
|
||||
*/
|
||||
private Long companyId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.newyetai.recruit.talent.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: guixinman
|
||||
* @create: 2024-06-12 14:34
|
||||
**/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ImportDetailTalentExportDTO implements Serializable {
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty("身份证号")
|
||||
private String cardNo;
|
||||
|
||||
@ApiModelProperty("联系方式")
|
||||
private String contactWay;
|
||||
|
||||
@ApiModelProperty("失败原因")
|
||||
private String failReason;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.newyetai.recruit.talent.dto;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.newyetai.common.validation.annotation.IdCard;
|
||||
import com.newyetai.component.commonimport.service.IImportDetailForm;
|
||||
import javax.validation.groups.Default;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description: 人才导入dto
|
||||
* @author: guixinman
|
||||
* @create: 2024-04-09 16:30
|
||||
**/
|
||||
@Data
|
||||
public class ImportDetailTalentListenerDTO implements IImportDetailForm {
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty("身份证")
|
||||
@IdCard(groups = Default.class)
|
||||
private String cardNo;
|
||||
|
||||
@ApiModelProperty("联系方式")
|
||||
private String contactWay;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.newyetai.recruit.talent.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 人才库导入表
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
@ApiModel("人才库导入表")
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ImportDetailTalentOperatorDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("导入任务ID")
|
||||
private Long mainId;
|
||||
|
||||
@ApiModelProperty("机构ID")
|
||||
private Long orgId;
|
||||
|
||||
@ApiModelProperty("模板全量数据")
|
||||
private String dataJson;
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty("身份证号")
|
||||
private String cardNo;
|
||||
|
||||
@ApiModelProperty("联系方式")
|
||||
private String contactWay;
|
||||
|
||||
@ApiModelProperty("明细状态")
|
||||
private Integer detailStatus;
|
||||
|
||||
@ApiModelProperty("失败原因")
|
||||
private String failReason;
|
||||
|
||||
@ApiModelProperty("外部明细id")
|
||||
private Long extraDetailId;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.newyetai.recruit.talent.dto;
|
||||
|
||||
import com.newyetai.common.dto.PageQueryDTO;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 人才库导入表
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
|
||||
@ApiModel("人才库导入表")
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ImportDetailTalentPageQueryDTO extends PageQueryDTO<ImportDetailTalentDTO> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("导入任务ID")
|
||||
private Long mainId;
|
||||
|
||||
@ApiModelProperty("机构ID")
|
||||
private Long orgId;
|
||||
|
||||
@ApiModelProperty("模板全量数据")
|
||||
private String dataJson;
|
||||
|
||||
@ApiModelProperty("姓名 (模糊匹配)")
|
||||
private String realNameLike;
|
||||
|
||||
@ApiModelProperty("身份证号")
|
||||
private String cardNo;
|
||||
|
||||
@ApiModelProperty("联系方式")
|
||||
private String contactWay;
|
||||
|
||||
@ApiModelProperty("明细状态")
|
||||
private Integer detailStatus;
|
||||
|
||||
@ApiModelProperty("失败原因")
|
||||
private String failReason;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("创建时间起,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTimeStart;
|
||||
|
||||
@ApiModelProperty("创建时间止,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTimeEnd;
|
||||
|
||||
@ApiModelProperty("更新时间起,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTimeStart;
|
||||
|
||||
@ApiModelProperty("更新时间止,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTimeEnd;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.newyetai.recruit.talent.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 人才库导入表
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
@ApiModel("人才库导入表")
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ImportDetailTalentQueryDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("导入任务ID")
|
||||
private Long mainId;
|
||||
|
||||
@ApiModelProperty("机构ID")
|
||||
private Long orgId;
|
||||
|
||||
@ApiModelProperty("模板全量数据")
|
||||
private String dataJson;
|
||||
|
||||
@ApiModelProperty("姓名 (模糊匹配)")
|
||||
private String realNameLike;
|
||||
|
||||
@ApiModelProperty("身份证号")
|
||||
private String cardNo;
|
||||
|
||||
@ApiModelProperty("联系方式")
|
||||
private String contactWay;
|
||||
|
||||
@ApiModelProperty("明细状态")
|
||||
private Integer detailStatus;
|
||||
|
||||
@ApiModelProperty("失败原因")
|
||||
private String failReason;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("创建时间起,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTimeStart;
|
||||
|
||||
@ApiModelProperty("创建时间止,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTimeEnd;
|
||||
|
||||
@ApiModelProperty("更新时间起,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTimeStart;
|
||||
|
||||
@ApiModelProperty("更新时间止,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTimeEnd;
|
||||
|
||||
|
||||
}
|
||||
56
src/main/java/com/newyetai/recruit/talent/dto/TalentDTO.java
Normal file
56
src/main/java/com/newyetai/recruit/talent/dto/TalentDTO.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package com.newyetai.recruit.talent.dto;
|
||||
|
||||
import com.newyetai.common.dto.BaseDTO;
|
||||
import com.newyetai.common.util.IdcardUtils;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 人才库
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
@ApiModel("人才库")
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TalentDTO extends BaseDTO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty("年龄")
|
||||
private Integer age;
|
||||
|
||||
@ApiModelProperty("手机号")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty("身份证号")
|
||||
private String cardNo;
|
||||
|
||||
@ApiModelProperty("联系方式")
|
||||
private String contactWay;
|
||||
|
||||
@ApiModelProperty("供应商")
|
||||
private String companyName;
|
||||
|
||||
private Long companyId;
|
||||
|
||||
public void setCardNo(String cardNo) {
|
||||
this.setAge(IdcardUtils.getAgeByIDNumber(cardNo));
|
||||
this.cardNo = cardNo;
|
||||
}
|
||||
|
||||
public String getCardNo() {
|
||||
return cardNo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.newyetai.recruit.talent.dto;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: guixinman
|
||||
* @create: 2024-04-09 15:32
|
||||
**/
|
||||
@ApiModel("人才库导出")
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TalentExportDTO implements Serializable {
|
||||
|
||||
@ExcelProperty("姓名")
|
||||
@ApiModelProperty("姓名")
|
||||
private String realName;
|
||||
|
||||
@ExcelProperty("年龄")
|
||||
@ApiModelProperty("年龄")
|
||||
private Integer age;
|
||||
|
||||
@ExcelProperty("手机号")
|
||||
@ApiModelProperty("手机号")
|
||||
private String phone;
|
||||
|
||||
@ExcelProperty("身份证号")
|
||||
@ApiModelProperty("身份证号")
|
||||
private String cardNo;
|
||||
|
||||
@ExcelProperty("联系方式")
|
||||
@ApiModelProperty("联系方式")
|
||||
private String contactWay;
|
||||
|
||||
@ExcelProperty("供应商")
|
||||
@ApiModelProperty("供应商")
|
||||
private String companyName;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private String createTime;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.newyetai.recruit.talent.dto;
|
||||
|
||||
import com.newyetai.common.annotation.trimAndUpper.TrimAndUpper;
|
||||
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 人才库
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
@ApiModel("人才库")
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TalentOperatorDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@Length(max = 18,message = "身份证号超长")
|
||||
@NotBlank(message = "身份证号不能为空")
|
||||
@TrimAndUpper(value = TrimAndUpper.ExecuteType.ALL)
|
||||
@ApiModelProperty("身份证号")
|
||||
private String cardNo;
|
||||
|
||||
@Length(max = 32,message = "姓名超长")
|
||||
@NotBlank(message = "姓名不能为空")
|
||||
@TrimAndUpper(value = TrimAndUpper.ExecuteType.ALL)
|
||||
@ApiModelProperty("姓名")
|
||||
private String realName;
|
||||
|
||||
@Length(max = 50,message = "联系方式超长")
|
||||
@ApiModelProperty("联系方式")
|
||||
private String contactWay;
|
||||
|
||||
@NotNull(message = "请选择供应商")
|
||||
@ApiModelProperty("供应商id")
|
||||
private Long companyId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.newyetai.recruit.talent.dto;
|
||||
|
||||
import com.newyetai.common.dto.PageQueryDTO;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 人才库
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
|
||||
@ApiModel("人才库")
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TalentPageQueryDTO extends PageQueryDTO<TalentDTO> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("机构id")
|
||||
private Long orgId;
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String realNameLike;
|
||||
|
||||
@ApiModelProperty("身份证号")
|
||||
private String cardNoLike;
|
||||
|
||||
@ApiModelProperty("身份证号")
|
||||
private Set<String> cardNos;
|
||||
|
||||
@ApiModelProperty("手机号")
|
||||
private String phoneLike;
|
||||
|
||||
@ApiModelProperty("联系方式")
|
||||
private String contactWayLike;
|
||||
|
||||
@ApiModelProperty("供应商id")
|
||||
private Long companyId;
|
||||
|
||||
@ApiModelProperty("创建时间起,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTimeStart;
|
||||
|
||||
@ApiModelProperty("创建时间止,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTimeEnd;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.newyetai.recruit.talent.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 人才库
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
@ApiModel("人才库")
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TalentQueryDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("机构id")
|
||||
private Long orgId;
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty("联系方式")
|
||||
private String contactWay;
|
||||
|
||||
@ApiModelProperty("供应商id")
|
||||
private Long companyId;
|
||||
|
||||
@ApiModelProperty("创建时间起,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTimeStart;
|
||||
|
||||
@ApiModelProperty("创建时间止,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTimeEnd;
|
||||
|
||||
@ApiModelProperty("更新时间起,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTimeStart;
|
||||
|
||||
@ApiModelProperty("更新时间止,格式 (yyyy-MM-dd HH:mm:ss)")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTimeEnd;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.newyetai.recruit.talent.entity;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.newyetai.common.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* 人才库导入表
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
@TableName(value = "hr_import_detail_talent")
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ImportDetailTalent extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 导入任务ID
|
||||
*/
|
||||
private Long mainId;
|
||||
/**
|
||||
* 机构ID
|
||||
*/
|
||||
private Long orgId;
|
||||
/**
|
||||
* 模板全量数据
|
||||
*/
|
||||
private String dataJson;
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String realName;
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String cardNo;
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
private String contactWay;
|
||||
/**
|
||||
* 明细状态
|
||||
*/
|
||||
private Integer detailStatus;
|
||||
/**
|
||||
* 失败原因
|
||||
*/
|
||||
private String failReason;
|
||||
/**
|
||||
* 外部明细id
|
||||
*/
|
||||
private Long extraDetailId;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
41
src/main/java/com/newyetai/recruit/talent/entity/Talent.java
Normal file
41
src/main/java/com/newyetai/recruit/talent/entity/Talent.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.newyetai.recruit.talent.entity;
|
||||
|
||||
|
||||
import lombok.*;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import com.newyetai.common.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* 人才库
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
@TableName(value = "hr_talent")
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class Talent extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 机构id
|
||||
*/
|
||||
private Long orgId;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
private String contactWay;
|
||||
/**
|
||||
* 供应商id
|
||||
*/
|
||||
private Long companyId;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.newyetai.recruit.talent.dao.ImportDetailTalentMapper">
|
||||
|
||||
<select id="list" resultType="com.newyetai.recruit.talent.dto.ImportDetailTalentDTO">
|
||||
SELECT t.*
|
||||
<include refid="queryFromSql"></include>
|
||||
</select>
|
||||
|
||||
<select id="page" resultType="com.newyetai.recruit.talent.dto.ImportDetailTalentDTO">
|
||||
SELECT t.*
|
||||
<include refid="queryFromSql"></include>
|
||||
</select>
|
||||
|
||||
<sql id="queryFromSql">
|
||||
FROM
|
||||
hr_import_detail_talent t
|
||||
WHERE t.deleted = 0
|
||||
<if test='param.id != null'>
|
||||
AND t.id = #{param.id}
|
||||
</if>
|
||||
<if test='param.mainId != null'>
|
||||
AND t.main_id = #{param.mainId}
|
||||
</if>
|
||||
<if test='param.orgId != null'>
|
||||
AND t.org_id = #{param.orgId}
|
||||
</if>
|
||||
<if test='param.dataJson != null and param.dataJson.trim() != ""'>
|
||||
AND t.data_json = #{param.dataJson}
|
||||
</if>
|
||||
<if test='param.realNameLike != null and param.realNameLike.trim() != ""'>
|
||||
<bind name="realNameLike" value="'%' + param.realNameLike + '%'"/>
|
||||
AND t.real_name like #{realNameLike}
|
||||
</if>
|
||||
<if test='param.cardNo != null and param.cardNo.trim() != ""'>
|
||||
AND t.card_no = #{param.cardNo}
|
||||
</if>
|
||||
<if test='param.contactWay != null and param.contactWay.trim() != ""'>
|
||||
AND t.contact_way = #{param.contactWay}
|
||||
</if>
|
||||
<if test='param.detailStatus != null'>
|
||||
AND t.detail_status = #{param.detailStatus}
|
||||
</if>
|
||||
<if test='param.failReason != null and param.failReason.trim() != ""'>
|
||||
AND t.fail_reason = #{param.failReason}
|
||||
</if>
|
||||
<if test='param.remark != null and param.remark.trim() != ""'>
|
||||
AND t.remark = #{param.remark}
|
||||
</if>
|
||||
<if test='param.createTimeStart != null'>
|
||||
AND t.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test='param.createTimeEnd != null'>
|
||||
AND t.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<if test='param.updateTimeStart != null'>
|
||||
AND t.update_time >= #{param.updateTimeStart}
|
||||
</if>
|
||||
<if test='param.updateTimeEnd != null'>
|
||||
AND t.update_time <= #{param.updateTimeEnd}
|
||||
</if>
|
||||
ORDER BY t.id DESC
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.newyetai.recruit.talent.dao.TalentMapper">
|
||||
|
||||
<select id="page" resultType="com.newyetai.recruit.talent.dto.TalentDTO">
|
||||
SELECT t.*,
|
||||
u.real_name,
|
||||
u.card_no,
|
||||
u.phone,
|
||||
c.company_name,
|
||||
u.id userId
|
||||
FROM
|
||||
hr_talent t
|
||||
LEFT JOIN uc_user u ON t.user_id = u.id AND u.deleted = 0
|
||||
LEFT JOIN hr_company c ON t.company_id = c.id AND c.deleted = 0
|
||||
WHERE t.deleted = 0
|
||||
|
||||
<if test='param.id != null'>
|
||||
AND t.id = #{param.id}
|
||||
</if>
|
||||
<if test='param.orgId != null'>
|
||||
AND t.org_id = #{param.orgId}
|
||||
</if>
|
||||
<if test='param.realNameLike != null and param.realNameLike.trim() != ""'>
|
||||
<bind name="realNameLike" value="'%' + param.realNameLike + '%'"/>
|
||||
AND u.real_name like #{realNameLike}
|
||||
</if>
|
||||
<if test='param.cardNoLike != null and param.cardNoLike.trim() != ""'>
|
||||
<bind name="cardNoLike" value="'%' + param.cardNoLike + '%'"/>
|
||||
AND u.card_no like #{cardNoLike}
|
||||
</if>
|
||||
<if test="param.cardNos != null and param.cardNos.size()>0">
|
||||
AND u.card_no IN
|
||||
<foreach collection="param.cardNos" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test='param.phoneLike != null and param.phoneLike.trim() != ""'>
|
||||
<bind name="phoneLike" value="'%' + param.phoneLike + '%'"/>
|
||||
AND u.phone like #{phoneLike}
|
||||
</if>
|
||||
<if test='param.companyId != null'>
|
||||
AND t.company_id = #{param.companyId}
|
||||
</if>
|
||||
<if test='param.createTimeStart != null'>
|
||||
AND t.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test='param.createTimeEnd != null'>
|
||||
AND t.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
ORDER BY t.id DESC
|
||||
|
||||
</select>
|
||||
|
||||
<sql id="queryFromSql">
|
||||
FROM
|
||||
hr_talent t
|
||||
WHERE t.deleted = 0
|
||||
<if test='param.id != null'>
|
||||
AND t.id = #{param.id}
|
||||
</if>
|
||||
<if test='param.orgId != null'>
|
||||
AND t.org_id = #{param.orgId}
|
||||
</if>
|
||||
<if test='param.userId != null'>
|
||||
AND t.user_id = #{param.userId}
|
||||
</if>
|
||||
<if test='param.contactWay != null and param.contactWay.trim() != ""'>
|
||||
AND t.contact_way = #{param.contactWay}
|
||||
</if>
|
||||
<if test='param.companyId != null'>
|
||||
AND t.company_id = #{param.companyId}
|
||||
</if>
|
||||
<if test='param.createTimeStart != null'>
|
||||
AND t.create_time >= #{param.createTimeStart}
|
||||
</if>
|
||||
<if test='param.createTimeEnd != null'>
|
||||
AND t.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<if test='param.updateTimeStart != null'>
|
||||
AND t.update_time >= #{param.updateTimeStart}
|
||||
</if>
|
||||
<if test='param.updateTimeEnd != null'>
|
||||
AND t.update_time <= #{param.updateTimeEnd}
|
||||
</if>
|
||||
ORDER BY t.id DESC
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,71 @@
|
||||
|
||||
package com.newyetai.recruit.talent.service;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.newyetai.recruit.talent.dto.*;
|
||||
|
||||
/**
|
||||
* 人才库导入表
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
@Validated(Default.class)
|
||||
public interface ImportDetailTalentService {
|
||||
|
||||
/**
|
||||
* 人才库导入表 - 创建
|
||||
*
|
||||
* @param operatorDto 操作dto
|
||||
* @return {@link ImportDetailTalentDTO}
|
||||
*/
|
||||
ImportDetailTalentDTO create(@Valid ImportDetailTalentOperatorDTO operatorDto);
|
||||
|
||||
/**
|
||||
* 人才库导入表 - 修改
|
||||
*
|
||||
* @param operatorDto 操作dto
|
||||
* @return {@link ImportDetailTalentDTO}
|
||||
*/
|
||||
ImportDetailTalentDTO modify(@Valid ImportDetailTalentOperatorDTO operatorDto);
|
||||
|
||||
/**
|
||||
* 人才库导入表 - 删除
|
||||
*
|
||||
* @param id id
|
||||
* @return {@link ImportDetailTalentDTO}
|
||||
*/
|
||||
ImportDetailTalentDTO delete(Long id);
|
||||
|
||||
/**
|
||||
* 人才库导入表 - 根据ID查询单个
|
||||
*
|
||||
* @param id id
|
||||
* @return {@link ImportDetailTalentDTO}
|
||||
*/
|
||||
ImportDetailTalentDTO findById(Long id);
|
||||
|
||||
/**
|
||||
* 人才库导入表 - 列表查询
|
||||
*
|
||||
* @param queryDTO 列表查询dto
|
||||
* @return {@link List}<{@link ImportDetailTalentDTO}>
|
||||
*/
|
||||
List<ImportDetailTalentDTO> list(ImportDetailTalentQueryDTO queryDTO);
|
||||
|
||||
/**
|
||||
* 人才库导入表 - 分页查询
|
||||
*
|
||||
* @param queryDTO 分页查询dto
|
||||
* @return {@link ImportDetailTalentDTO}
|
||||
*/
|
||||
List<ImportDetailTalentDTO> page(ImportDetailTalentPageQueryDTO queryDTO);
|
||||
|
||||
void batchCreate(List<ImportDetailTalentDTO> importDetailTalentDTOS);
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.newyetai.recruit.talent.service;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.groups.Default;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.newyetai.recruit.talent.dto.*;
|
||||
import com.newyetai.recruit.talent.entity.Talent;
|
||||
|
||||
/**
|
||||
* 人才库
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
@Validated(Default.class)
|
||||
public interface TalentService {
|
||||
|
||||
/**
|
||||
* 人才库 - 创建
|
||||
*
|
||||
* @param operatorDto 操作dto
|
||||
* @return {@link TalentDTO}
|
||||
*/
|
||||
TalentDTO create(@Valid TalentOperatorDTO operatorDto);
|
||||
|
||||
/**
|
||||
* 人才库 - 修改
|
||||
*
|
||||
* @param operatorDto 操作dto
|
||||
* @return {@link TalentDTO}
|
||||
*/
|
||||
TalentDTO modify(@Valid TalentOperatorDTO operatorDto);
|
||||
|
||||
/**
|
||||
* 人才库 - 删除
|
||||
*
|
||||
* @param id id
|
||||
* @return {@link TalentDTO}
|
||||
*/
|
||||
TalentDTO delete(Long id);
|
||||
|
||||
/**
|
||||
* 人才库 - 根据ID查询单个
|
||||
*
|
||||
* @param id id
|
||||
* @return {@link TalentDTO}
|
||||
*/
|
||||
TalentDTO findById(Long id);
|
||||
|
||||
/**
|
||||
* 人才库 - 列表查询
|
||||
*
|
||||
* @param queryDTO 列表查询dto
|
||||
* @return {@link List}<{@link TalentDTO}>
|
||||
*/
|
||||
List<TalentDTO> list(TalentPageQueryDTO queryDTO);
|
||||
|
||||
/**
|
||||
* 人才库 - 分页查询
|
||||
*
|
||||
* @param queryDTO 分页查询dto
|
||||
* @return {@link TalentDTO}
|
||||
*/
|
||||
List<TalentDTO> page(TalentPageQueryDTO queryDTO);
|
||||
|
||||
void export(TalentPageQueryDTO queryDTO);
|
||||
|
||||
/**
|
||||
* @description: 确定导入用的创建
|
||||
* @return: id
|
||||
* @author: guixinman
|
||||
* @param:
|
||||
*/
|
||||
Long importCreate(Talent talent);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,325 @@
|
||||
package com.newyetai.recruit.talent.service.impl;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.read.builder.ExcelReaderBuilder;
|
||||
import com.newyetai.common.dto.ExportHeadDetailInfoDTO;
|
||||
import com.newyetai.common.dto.ExportHeadInfoDTO;
|
||||
import com.newyetai.common.easyexcel.ExcelUtil;
|
||||
import com.newyetai.common.exception.BusinessException;
|
||||
import com.newyetai.common.exception.util.Assert;
|
||||
import com.newyetai.common.util.JsonUtils;
|
||||
import com.newyetai.common.util.UserContextHolder;
|
||||
import com.newyetai.common.validation.util.ValidateUtils;
|
||||
import com.newyetai.component.commonimport.constant.ImportDetailStatusEnum;
|
||||
import com.newyetai.component.commonimport.constant.ImportStatusEnum;
|
||||
import com.newyetai.component.commonimport.constant.ImportTypeEnum;
|
||||
import com.newyetai.component.commonimport.dto.ImportDetailPageDTO;
|
||||
import com.newyetai.component.commonimport.dto.ImportMainDTO;
|
||||
import com.newyetai.component.commonimport.dto.ImportMainQueryDTO;
|
||||
import com.newyetai.component.commonimport.dto.ImportMainUpdateDTO;
|
||||
import com.newyetai.component.commonimport.service.ImportMainService;
|
||||
import com.newyetai.component.commonimport.service.impl.AbstractCommonImportProvider;
|
||||
import com.newyetai.component.dict.util.DictUtils;
|
||||
import com.newyetai.component.file.entity.FileRecord;
|
||||
import com.newyetai.component.file.service.FileRecordService;
|
||||
import com.newyetai.recruit.position.dto.ImportDetailPositionExportDTO;
|
||||
import com.newyetai.recruit.talent.dto.ImportDetailTalentDTO;
|
||||
import com.newyetai.recruit.talent.dto.ImportDetailTalentExecuteDTO;
|
||||
import com.newyetai.recruit.talent.dto.ImportDetailTalentExportDTO;
|
||||
import com.newyetai.recruit.talent.dto.ImportDetailTalentListenerDTO;
|
||||
import com.newyetai.recruit.talent.dto.ImportDetailTalentOperatorDTO;
|
||||
import com.newyetai.recruit.talent.dto.ImportDetailTalentPageQueryDTO;
|
||||
import com.newyetai.recruit.talent.dto.ImportDetailTalentQueryDTO;
|
||||
import com.newyetai.recruit.talent.entity.Talent;
|
||||
import com.newyetai.recruit.talent.service.ImportDetailTalentService;
|
||||
import com.newyetai.recruit.talent.service.TalentService;
|
||||
import com.newyetai.tkmybatis.pojo.Page;
|
||||
import com.newyetai.usercenter.user.dto.OrgUserOperateDTO;
|
||||
import com.newyetai.usercenter.user.dto.SuperRealNameTwoAuthDTO;
|
||||
import com.newyetai.usercenter.user.service.OrgUserService;
|
||||
import com.newyetai.usercenter.user.service.UserRealNameTwoVerificationService;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author: guixinman
|
||||
* @create: 2024-04-09 16:18
|
||||
**/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class ImportDetailTalentProvider extends AbstractCommonImportProvider<ImportDetailTalentExecuteDTO, ImportDetailTalentDTO, ImportDetailTalentListenerDTO> {
|
||||
|
||||
@Autowired
|
||||
private ImportMainService importMainService;
|
||||
|
||||
@Autowired
|
||||
private FileRecordService fileRecordService;
|
||||
|
||||
@Autowired
|
||||
private ImportDetailTalentService importDetailTalentService;
|
||||
|
||||
@Autowired
|
||||
private UserRealNameTwoVerificationService userRealNameTwoVerificationService;
|
||||
|
||||
@Autowired
|
||||
private OrgUserService orgUserService;
|
||||
|
||||
@Autowired
|
||||
private TalentService talentService;
|
||||
|
||||
public ImportDetailTalentProvider(ImportMainService imprImportMainService) {
|
||||
super(imprImportMainService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return ImportTypeEnum.TALENT.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ImportDetailTalentDTO> pageDetail(ImportDetailPageDTO importDetailPageDTO) {
|
||||
ImportDetailTalentPageQueryDTO queryDTO = new ImportDetailTalentPageQueryDTO();
|
||||
BeanUtils.copyProperties(importDetailPageDTO, queryDTO);
|
||||
importDetailTalentService.page(queryDTO);
|
||||
return queryDTO.getPageResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importDetailExport(ImportDetailPageDTO importDetailPageDTO) {
|
||||
ImportDetailTalentPageQueryDTO queryDTO = new ImportDetailTalentPageQueryDTO();
|
||||
BeanUtils.copyProperties(importDetailPageDTO, queryDTO);
|
||||
queryDTO.disablePage();
|
||||
List<ImportDetailTalentDTO> list = importDetailTalentService.page(queryDTO);
|
||||
|
||||
List<ImportDetailTalentExportDTO> exportDTOList = list.stream().map(dto -> {
|
||||
ImportDetailTalentExportDTO exportDTO = JsonUtils.toObject(dto.getDataJson(), ImportDetailTalentExportDTO.class);
|
||||
exportDTO.setRemark(dto.getRemark());
|
||||
exportDTO.setFailReason(dto.getFailReason());
|
||||
return exportDTO;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
if (org.springframework.util.CollectionUtils.isEmpty(exportDTOList)) {
|
||||
return;
|
||||
}
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
|
||||
String commonImportDetailStatus = DictUtils.getCodeNameMap("common_import_detail_status").get(String.valueOf(importDetailPageDTO.getDetailStatus()));
|
||||
String fileName = "人才导入" + ( StringUtils.isNotBlank(commonImportDetailStatus) ? commonImportDetailStatus : "") + "明细导出" + "(" + formatter.format(LocalDateTime.now()) + ")";
|
||||
|
||||
ExportHeadInfoDTO infoDTO = ExportHeadInfoDTO.builder()
|
||||
.fileName(fileName)
|
||||
.build();
|
||||
List<ExportHeadDetailInfoDTO> heads = infoDTO.getHeads();
|
||||
heads.add(ExportHeadDetailInfoDTO.builder().head("姓名").build());
|
||||
heads.add(ExportHeadDetailInfoDTO.builder().head("身份证号").build());
|
||||
heads.add(ExportHeadDetailInfoDTO.builder().head("联系方式").build());
|
||||
heads.add(ExportHeadDetailInfoDTO.builder().head("失败原因").build());
|
||||
heads.add(ExportHeadDetailInfoDTO.builder().head("备注").build());
|
||||
|
||||
List<List> datas = Lists.newArrayList();
|
||||
for (ImportDetailTalentExportDTO dto : exportDTOList) {
|
||||
List objects = Lists.newArrayList();
|
||||
datas.add(objects);
|
||||
objects.add(dto.getRealName());
|
||||
objects.add(dto.getCardNo());
|
||||
objects.add(dto.getContactWay());
|
||||
objects.add(dto.getFailReason());
|
||||
objects.add(dto.getRemark());
|
||||
|
||||
}
|
||||
infoDTO.setDatas(datas);
|
||||
|
||||
ExcelUtil.dynamicExportTemplate(infoDTO);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ImportDetailTalentListenerDTO> analy(Long mainId) {
|
||||
// 解析文件+明细
|
||||
ImportMainDTO importMainDTO = importMainService.find(ImportMainQueryDTO.builder().id(mainId).build());
|
||||
Assert.notNull(importMainDTO, "未查询到导入的数据");
|
||||
|
||||
FileRecord fileRecord;
|
||||
try {
|
||||
fileRecord = fileRecordService.find(FileRecord.builder().fileCode(importMainDTO.getFileCode()).build());
|
||||
} catch (Exception e) {
|
||||
log.info("导入文件异常,", e);
|
||||
fileRecord = null;
|
||||
}
|
||||
Assert.notNull(fileRecord, "上传文件不存在");
|
||||
try (InputStream is = fileRecordService.getFile(importMainDTO.getFileCode())) {
|
||||
ImportTalentExcelListener listener = new ImportTalentExcelListener();
|
||||
ExcelReaderBuilder reader = EasyExcel.read(is, ImportDetailTalentListenerDTO.class, listener);
|
||||
reader.sheet().doRead();
|
||||
List<ImportDetailTalentListenerDTO> importDetailTalentListenerDTOS = listener.getImportDTOs();
|
||||
Assert.isTrue(!importDetailTalentListenerDTOS.isEmpty(), "导入文件无有效数据");
|
||||
return importDetailTalentListenerDTOS;
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void checkAndSave(Long mainId, List<ImportDetailTalentListenerDTO> detailCreateDtos) {
|
||||
//更改状态为校验中
|
||||
ImportMainUpdateDTO updateDto = ImportMainUpdateDTO.builder().id(mainId)
|
||||
.oldStatusSet(Sets.newHashSet(ImportStatusEnum.INIT.getStatus()))
|
||||
.newStatus(ImportStatusEnum.CHECKING.getStatus())
|
||||
.build();
|
||||
importMainService.modify(updateDto);
|
||||
|
||||
List<ImportDetailTalentDTO> importDetailTalentDTOS = new ArrayList<>();
|
||||
|
||||
//存储姓名+身份证号。用于校验 导入的数据中有没有重复的
|
||||
List<String> realNameCardNos = new ArrayList<>();
|
||||
|
||||
for (ImportDetailTalentListenerDTO importDetailTalentListenerDTO : detailCreateDtos) {
|
||||
importDetailTalentListenerDTO.setCardNo(StringUtils.upperCase(StringUtils.trim(importDetailTalentListenerDTO.getCardNo())));
|
||||
importDetailTalentListenerDTO.setRealName(StringUtils.trim(importDetailTalentListenerDTO.getRealName()));
|
||||
|
||||
ImportDetailTalentDTO importDetailTalentDTO = new ImportDetailTalentDTO();
|
||||
|
||||
this.checkAndFill(importDetailTalentDTO, importDetailTalentListenerDTO);
|
||||
|
||||
if (StringUtils.isBlank(importDetailTalentDTO.getFailReason())) {
|
||||
if (realNameCardNos.contains(StringUtils.join(importDetailTalentListenerDTO.getRealName(), importDetailTalentListenerDTO.getCardNo()))) {
|
||||
importDetailTalentDTO.appendFailMsg("姓名+身份证号出现多次");
|
||||
}
|
||||
//存储姓名+身份证号
|
||||
realNameCardNos.add(StringUtils.join(importDetailTalentListenerDTO.getRealName(), importDetailTalentListenerDTO.getCardNo()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(importDetailTalentDTO.getFailReason())) {
|
||||
importDetailTalentDTO.setDetailStatus(ImportDetailStatusEnum.CHECK_FAIL.getStatus());
|
||||
} else {
|
||||
importDetailTalentDTO.setDetailStatus(ImportDetailStatusEnum.CHECK_SUCCESS.getStatus());
|
||||
}
|
||||
importDetailTalentDTO.setMainId(mainId);
|
||||
importDetailTalentDTO.setOrgId(UserContextHolder.getExistLoginOrgId());
|
||||
importDetailTalentDTOS.add(importDetailTalentDTO);
|
||||
}
|
||||
importDetailTalentService.batchCreate(importDetailTalentDTOS);
|
||||
super.finishCheck(mainId, importDetailTalentDTOS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param importDetailTalentDTO 插入导入表对象
|
||||
* @param importDetailTalentListenerDTO 解析导入明细对象
|
||||
* @description: 基础校验 -> 二要素认证 -> 创建个人用户
|
||||
* @return:
|
||||
* @author: guixinman
|
||||
*/
|
||||
private void checkAndFill(ImportDetailTalentDTO importDetailTalentDTO, ImportDetailTalentListenerDTO importDetailTalentListenerDTO) {
|
||||
LinkedHashMap<String, Object> dateJson = new LinkedHashMap();
|
||||
dateJson.put("realName", importDetailTalentListenerDTO.getRealName());
|
||||
dateJson.put("cardNo", importDetailTalentListenerDTO.getCardNo());
|
||||
dateJson.put("contactWay", importDetailTalentListenerDTO.getContactWay());
|
||||
|
||||
BeanUtils.copyProperties(importDetailTalentListenerDTO, importDetailTalentDTO);
|
||||
importDetailTalentDTO.setDataJson(JSONUtil.toJsonStr(dateJson));
|
||||
|
||||
//必填项校验(姓名、身份证号)、基础格式校验(姓名/身份证/联系方式)、实名认证(二要素校验)
|
||||
|
||||
//校验 姓名/身份证/联系方式
|
||||
if (StringUtils.isBlank(importDetailTalentListenerDTO.getRealName())) {
|
||||
importDetailTalentDTO.appendFailMsg("姓名不能为空");
|
||||
} else if (importDetailTalentListenerDTO.getRealName().length() > 32) {
|
||||
importDetailTalentDTO.appendFailMsg("姓名超过最大限制长度");
|
||||
importDetailTalentDTO.setRealName(null);
|
||||
} else if (!ValidateUtils.checkRealName(importDetailTalentListenerDTO.getRealName())) {
|
||||
importDetailTalentDTO.appendFailMsg("姓名格式不正确");
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(importDetailTalentListenerDTO.getCardNo())) {
|
||||
importDetailTalentDTO.appendFailMsg("身份证不能为空");
|
||||
} else if (importDetailTalentListenerDTO.getCardNo().length() > 18) {
|
||||
importDetailTalentDTO.appendFailMsg("身份证号超过最大限制长度");
|
||||
importDetailTalentDTO.setCardNo(null);
|
||||
} else if (!ValidateUtils.isIdCard(importDetailTalentListenerDTO.getCardNo())) {
|
||||
importDetailTalentDTO.appendFailMsg("身份证格式不正确");
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(importDetailTalentListenerDTO.getContactWay()) && importDetailTalentListenerDTO.getContactWay().length() > 50) {
|
||||
importDetailTalentDTO.appendFailMsg("联系方式超过最大限制长度");
|
||||
importDetailTalentDTO.setContactWay(null);
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(importDetailTalentDTO.getFailReason())) {
|
||||
|
||||
Long userId;
|
||||
try {
|
||||
// 直接认证,创建用户
|
||||
userId = userRealNameTwoVerificationService.superAuth(
|
||||
SuperRealNameTwoAuthDTO.builder().realName(importDetailTalentDTO.getRealName()).cardNo(importDetailTalentDTO.getCardNo()).build());
|
||||
importDetailTalentDTO.setUserId(userId);
|
||||
} catch (Exception e) {
|
||||
importDetailTalentDTO.appendFailMsg("实名认证失败: " + e.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
//绑定机构
|
||||
orgUserService.create(
|
||||
OrgUserOperateDTO.builder()
|
||||
.orgId(UserContextHolder.getExistLoginOrgId())
|
||||
.userId(userId)
|
||||
.build());
|
||||
} catch (Exception e) {
|
||||
importDetailTalentDTO.appendFailMsg("个人用户绑定机构失败: " + e.getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public Long execute(ImportDetailTalentExecuteDTO executeDto) {
|
||||
Long mainId = executeDto.getMainId();
|
||||
Assert.notNull(mainId, "参数异常");
|
||||
|
||||
ImportMainDTO importMainDTO = importMainService.find(ImportMainQueryDTO.builder().id(mainId).build());
|
||||
Assert.notNull(importMainDTO, "未查询到导入数据");
|
||||
|
||||
List<ImportDetailTalentDTO> importDetailTalentDTOS = importDetailTalentService.list(ImportDetailTalentQueryDTO.builder().mainId(mainId).detailStatus(ImportDetailStatusEnum.CHECK_SUCCESS.getStatus()).build());
|
||||
if (CollectionUtils.isEmpty(importDetailTalentDTOS)) {
|
||||
throw new BusinessException("未查询到成功的明细数据");
|
||||
}
|
||||
|
||||
for (ImportDetailTalentDTO importDetailTalentDTO : importDetailTalentDTOS) {
|
||||
Talent talent = new Talent();
|
||||
talent.setContactWay(importDetailTalentDTO.getContactWay());
|
||||
talent.setCompanyId(executeDto.getCompanyId());
|
||||
talent.setUserId(importDetailTalentDTO.getUserId());
|
||||
talent.setOrgId(UserContextHolder.getExistLoginOrgId());
|
||||
Long talentId = talentService.importCreate(talent);
|
||||
ImportDetailTalentOperatorDTO updateImportDetailTalentDTO = new ImportDetailTalentOperatorDTO();
|
||||
BeanUtils.copyProperties(importDetailTalentDTO, updateImportDetailTalentDTO);
|
||||
updateImportDetailTalentDTO.setExtraDetailId(talentId);
|
||||
importDetailTalentService.modify(updateImportDetailTalentDTO);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.newyetai.recruit.talent.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import com.newyetai.recruit.talent.convert.ImportDetailTalentConvert;
|
||||
import com.newyetai.recruit.talent.entity.ImportDetailTalent;
|
||||
import com.newyetai.recruit.talent.dto.*;
|
||||
import com.newyetai.recruit.talent.dao.ImportDetailTalentMapper;
|
||||
import com.newyetai.recruit.talent.service.ImportDetailTalentService;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.newyetai.common.util.UserContextHolder;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 人才库导入表
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ImportDetailTalentServiceImpl implements ImportDetailTalentService {
|
||||
|
||||
@Resource
|
||||
private ImportDetailTalentMapper importDetailTalentMapper;
|
||||
|
||||
@Override
|
||||
public ImportDetailTalentDTO create(ImportDetailTalentOperatorDTO operatorDto) {
|
||||
ImportDetailTalent importDetailTalent = ImportDetailTalentConvert.INSTANCE.convert(operatorDto);
|
||||
importDetailTalentMapper.saveEntity(importDetailTalent);
|
||||
return ImportDetailTalentConvert.INSTANCE.convert(importDetailTalent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImportDetailTalentDTO modify(ImportDetailTalentOperatorDTO operatorDto) {
|
||||
ImportDetailTalentDTO importDetailTalentDto = this.findById(operatorDto.getId());
|
||||
if (Objects.isNull(importDetailTalentDto)) {
|
||||
return null;
|
||||
}
|
||||
ImportDetailTalent importDetailTalent = ImportDetailTalentConvert.INSTANCE.convert(operatorDto);
|
||||
importDetailTalentMapper.updateEntitySelective(importDetailTalent);
|
||||
return this.findById(operatorDto.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImportDetailTalentDTO delete(Long id) {
|
||||
ImportDetailTalentDTO importDetailTalentDto = this.findById(id);
|
||||
if (Objects.isNull(importDetailTalentDto)) {
|
||||
return null;
|
||||
}
|
||||
ImportDetailTalent importDetailTalent = ImportDetailTalent.builder().build();
|
||||
importDetailTalent.setId(id);
|
||||
importDetailTalentMapper.deleteEntity(importDetailTalent, UserContextHolder.getLoginUserId());
|
||||
return importDetailTalentDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImportDetailTalentDTO findById(Long id) {
|
||||
ImportDetailTalent importDetailTalent = importDetailTalentMapper.getById(id);
|
||||
if (Objects.isNull(importDetailTalent)) {
|
||||
return null;
|
||||
}
|
||||
return ImportDetailTalentConvert.INSTANCE.convert(importDetailTalent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ImportDetailTalentDTO> list(ImportDetailTalentQueryDTO queryDTO) {
|
||||
return importDetailTalentMapper.list(queryDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ImportDetailTalentDTO> page(ImportDetailTalentPageQueryDTO queryDTO) {
|
||||
return importDetailTalentMapper.page(queryDTO);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void batchCreate(List<ImportDetailTalentDTO> importDetailTalentDTOS) {
|
||||
if (CollectionUtils.isEmpty(importDetailTalentDTOS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<ImportDetailTalent> importDetailTalents = importDetailTalentDTOS.stream().map(dto -> {
|
||||
ImportDetailTalent importDetailTalent = new ImportDetailTalent();
|
||||
BeanUtils.copyProperties(dto, importDetailTalent);
|
||||
return importDetailTalent;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
importDetailTalentMapper.saveEntites(importDetailTalents);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.newyetai.recruit.talent.service.impl;
|
||||
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.event.AnalysisEventListener;
|
||||
import com.newyetai.common.exception.BusinessException;
|
||||
import com.newyetai.common.exception.util.Assert;
|
||||
import com.newyetai.recruit.talent.dto.ImportDetailTalentListenerDTO;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description: 人才库导入
|
||||
* @author: guixinman
|
||||
* @create: 2024-04-09 16:49
|
||||
**/
|
||||
public class ImportTalentExcelListener extends AnalysisEventListener<ImportDetailTalentListenerDTO>{
|
||||
|
||||
private List<ImportDetailTalentListenerDTO> dtos;
|
||||
private Map<Integer, String> headMap = new HashMap<>();
|
||||
public ImportTalentExcelListener() {
|
||||
this.dtos = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(ImportDetailTalentListenerDTO data, AnalysisContext context) {
|
||||
dtos.add(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAfterAllAnalysed(AnalysisContext context) {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void invokeHeadMap(Map headMap, AnalysisContext context) {
|
||||
this.headMap = headMap;
|
||||
if (headMap.isEmpty()) {
|
||||
throw new BusinessException("导入模板表头有误");
|
||||
}
|
||||
//姓名、身份证号、发放金额、备注
|
||||
if (headMap.size() != 3) {
|
||||
throw new BusinessException("导入模板表头有误");
|
||||
}
|
||||
Assert.isTrue(headMap.get(0).toString().contains("姓名"),"导入模板表头有误");
|
||||
Assert.isTrue(headMap.get(1).toString().contains("身份证"),"导入模板表头有误");
|
||||
Assert.isTrue(headMap.get(2).toString().contains("联系方式"),"导入模板表头有误");
|
||||
|
||||
}
|
||||
|
||||
public List<ImportDetailTalentListenerDTO> getImportDTOs(){
|
||||
return this.dtos;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,285 @@
|
||||
package com.newyetai.recruit.talent.service.impl;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.newyetai.common.constant.CommonConstants;
|
||||
import com.newyetai.common.dto.ExportHeadDetailInfoDTO;
|
||||
import com.newyetai.common.dto.ExportHeadInfoDTO;
|
||||
import com.newyetai.common.easyexcel.ExcelUtil;
|
||||
import com.newyetai.common.exception.BusinessException;
|
||||
import com.newyetai.common.exception.util.Assert;
|
||||
import com.newyetai.recruit.company.dto.HrCompanyDTO;
|
||||
import com.newyetai.recruit.company.dto.HrCompanyPageQueryDTO;
|
||||
import com.newyetai.recruit.company.enums.HrCompanyEnum;
|
||||
import com.newyetai.recruit.company.service.IHrCompanyService;
|
||||
import com.newyetai.frame.redis.aop.annotation.AutoUnLock;
|
||||
import com.newyetai.frame.redis.dto.LockDTO;
|
||||
import com.newyetai.frame.redis.redisson.RedissonUtils;
|
||||
import com.newyetai.recruit.talent.convert.TalentConvert;
|
||||
import com.newyetai.recruit.talent.entity.Talent;
|
||||
import com.newyetai.recruit.talent.dto.*;
|
||||
import com.newyetai.recruit.talent.dao.TalentMapper;
|
||||
import com.newyetai.recruit.talent.service.TalentService;
|
||||
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.newyetai.common.util.UserContextHolder;
|
||||
import com.newyetai.usercenter.user.dao.UserMapper;
|
||||
import com.newyetai.usercenter.user.dto.SuperRealNameTwoAuthDTO;
|
||||
import com.newyetai.usercenter.user.entity.User;
|
||||
import com.newyetai.usercenter.user.service.UserRealNameTwoVerificationService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 人才库
|
||||
*
|
||||
* @author guixinman
|
||||
* @since 1.0.0 2024-04-09
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class TalentServiceImpl implements TalentService {
|
||||
|
||||
@Resource
|
||||
private TalentMapper talentMapper;
|
||||
|
||||
@Autowired
|
||||
private UserRealNameTwoVerificationService userRealNameTwoVerificationService;
|
||||
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
|
||||
@Autowired
|
||||
private IHrCompanyService hrCompanyService;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@AutoUnLock
|
||||
@Override
|
||||
public TalentDTO create(TalentOperatorDTO operatorDto) {
|
||||
Assert.isTrue(
|
||||
RedissonUtils.tryLockAutomatically(
|
||||
LockDTO.builder()
|
||||
.tryLockWaitTime(0L)
|
||||
.lockTimeout(60 * 5L)
|
||||
.methodName("talent:create")
|
||||
.arg(operatorDto.getRealName())
|
||||
.arg(operatorDto.getCardNo())
|
||||
.arg(String.valueOf(UserContextHolder.getExistLoginOrgId()))
|
||||
.build()
|
||||
),
|
||||
"请稍后再试");
|
||||
|
||||
HrCompanyDTO hrCompanyDTO = hrCompanyService.find(HrCompanyPageQueryDTO.builder().id(operatorDto.getCompanyId()).companyType(HrCompanyEnum.GYS.getType()).build());
|
||||
Assert.notNull(hrCompanyDTO, "供应商不存在");
|
||||
|
||||
//姓名+身份证号进行实名,且在当前机构下唯一
|
||||
// 直接认证,创建用户
|
||||
Long userId = userRealNameTwoVerificationService.superAuth(
|
||||
SuperRealNameTwoAuthDTO.builder().realName(operatorDto.getRealName()).cardNo(operatorDto.getCardNo()).build());
|
||||
|
||||
|
||||
Talent talent = TalentConvert.INSTANCE.convert(operatorDto);
|
||||
talent.setUserId(userId);
|
||||
talent.setOrgId(UserContextHolder.getExistLoginOrgId());
|
||||
|
||||
List<Talent> talents = talentMapper.selectList(
|
||||
new LambdaQueryWrapper<Talent>()
|
||||
.eq(Talent::getDeleted, false)
|
||||
.eq(Talent::getOrgId, talent.getOrgId())
|
||||
.eq(Talent::getUserId, talent.getUserId())
|
||||
);
|
||||
if (CollectionUtils.isEmpty(talents)) {
|
||||
talentMapper.saveEntity(talent);
|
||||
}
|
||||
|
||||
return TalentConvert.INSTANCE.convert(talentMapper.selectOne(new LambdaQueryWrapper<Talent>()
|
||||
.eq(Talent::getDeleted, false)
|
||||
.eq(Talent::getOrgId, talent.getOrgId())
|
||||
.eq(Talent::getUserId, talent.getUserId())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TalentDTO modify(TalentOperatorDTO operatorDto) {
|
||||
Assert.notNull(operatorDto.getId(), "参数缺失");
|
||||
|
||||
LambdaQueryWrapper<Talent> queryWrapper = new LambdaQueryWrapper<Talent>()
|
||||
.eq(Talent::getDeleted, false)
|
||||
.eq(Talent::getId, operatorDto.getId());
|
||||
|
||||
if (!CommonConstants.PLATFORM_ORG_ID.equals(UserContextHolder.getExistLoginOrgId())) {
|
||||
queryWrapper.eq(Talent::getOrgId, UserContextHolder.getExistLoginOrgId());
|
||||
}
|
||||
|
||||
Talent talent = talentMapper.selectOne(queryWrapper);
|
||||
if (Objects.isNull(talent)) {
|
||||
throw new BusinessException("未查询到数据");
|
||||
}
|
||||
User user = userMapper.getById(talent.getUserId());
|
||||
Assert.notNull(user, "用户不存在");
|
||||
|
||||
HrCompanyDTO hrCompanyDTO = hrCompanyService.find(HrCompanyPageQueryDTO.builder().id(operatorDto.getCompanyId()).companyType(HrCompanyEnum.GYS.getType()).build());
|
||||
Assert.notNull(hrCompanyDTO, "供应商不存在");
|
||||
|
||||
Talent newTalent = new Talent();
|
||||
newTalent.setId(operatorDto.getId());
|
||||
newTalent.setContactWay(operatorDto.getContactWay());
|
||||
newTalent.setCompanyId(operatorDto.getCompanyId());
|
||||
newTalent.setUserId(user.getId());
|
||||
talentMapper.updateEntitySelective(newTalent);
|
||||
return this.findById(operatorDto.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TalentDTO delete(Long id) {
|
||||
TalentDTO talentDto = this.findById(id);
|
||||
if (Objects.isNull(talentDto)) {
|
||||
return null;
|
||||
}
|
||||
Talent talent = Talent.builder().build();
|
||||
talent.setId(id);
|
||||
talentMapper.deleteEntity(talent, UserContextHolder.getLoginUserId());
|
||||
return talentDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TalentDTO findById(Long id) {
|
||||
TalentPageQueryDTO queryDTO = new TalentPageQueryDTO();
|
||||
queryDTO.setId(id);
|
||||
List<TalentDTO> list = this.page(queryDTO);
|
||||
return org.apache.commons.collections.CollectionUtils.isEmpty(list) ? null : list.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TalentDTO> list(TalentPageQueryDTO queryDTO) {
|
||||
queryDTO.disablePage();
|
||||
return this.page(queryDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TalentDTO> page(TalentPageQueryDTO queryDTO) {
|
||||
if (!CommonConstants.PLATFORM_ORG_ID.equals(UserContextHolder.getExistLoginOrgId())) {
|
||||
queryDTO.setOrgId(UserContextHolder.getExistLoginOrgId());
|
||||
}
|
||||
return talentMapper.page(queryDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void export(TalentPageQueryDTO queryDTO) {
|
||||
boolean flag = true;
|
||||
Integer pageNo = 1;
|
||||
Integer pageSize = 100;
|
||||
|
||||
List<TalentDTO> listAll = new ArrayList<>();
|
||||
|
||||
while (flag) {
|
||||
queryDTO.setPageNo(pageNo);
|
||||
queryDTO.setPageSize(pageSize);
|
||||
List<TalentDTO> list = this.page(queryDTO);
|
||||
if (org.springframework.util.CollectionUtils.isEmpty(list)) {
|
||||
flag = false;
|
||||
continue;
|
||||
}
|
||||
if (list.size() < pageSize) {
|
||||
flag = false;
|
||||
}
|
||||
pageNo = pageNo + 1;
|
||||
listAll.addAll(list);
|
||||
}
|
||||
List<TalentExportDTO> collect = listAll.stream().map(dto -> {
|
||||
TalentExportDTO talentExportDTO = new TalentExportDTO();
|
||||
BeanUtils.copyProperties(dto, talentExportDTO);
|
||||
talentExportDTO.setCreateTime(DateUtil.format(dto.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
return talentExportDTO;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
if (org.springframework.util.CollectionUtils.isEmpty(collect)) {
|
||||
return;
|
||||
}
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
|
||||
String fileName = "人才明细导出" + "(" + formatter.format(LocalDateTime.now()) + ")";
|
||||
|
||||
ExportHeadInfoDTO infoDTO = ExportHeadInfoDTO.builder()
|
||||
.fileName(fileName)
|
||||
.build();
|
||||
List<ExportHeadDetailInfoDTO> heads = infoDTO.getHeads();
|
||||
heads.add(ExportHeadDetailInfoDTO.builder().head("姓名").build());
|
||||
heads.add(ExportHeadDetailInfoDTO.builder().head("年龄").build());
|
||||
heads.add(ExportHeadDetailInfoDTO.builder().head("手机号").build());
|
||||
heads.add(ExportHeadDetailInfoDTO.builder().head("身份证号").build());
|
||||
heads.add(ExportHeadDetailInfoDTO.builder().head("联系方式").build());
|
||||
heads.add(ExportHeadDetailInfoDTO.builder().head("供应商").build());
|
||||
heads.add(ExportHeadDetailInfoDTO.builder().head("创建时间").build());
|
||||
|
||||
List<List> datas = Lists.newArrayList();
|
||||
for (TalentExportDTO dto : collect) {
|
||||
List objects = Lists.newArrayList();
|
||||
datas.add(objects);
|
||||
objects.add(dto.getRealName());
|
||||
objects.add(dto.getAge());
|
||||
objects.add(dto.getPhone());
|
||||
objects.add(dto.getCardNo());
|
||||
objects.add(dto.getContactWay());
|
||||
objects.add(dto.getCompanyName());
|
||||
objects.add(dto.getCreateTime());
|
||||
}
|
||||
infoDTO.setDatas(datas);
|
||||
|
||||
ExcelUtil.dynamicExportTemplate(infoDTO);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@AutoUnLock
|
||||
@Override
|
||||
public Long importCreate(Talent talent) {
|
||||
User user = userMapper.getById(talent.getUserId());
|
||||
Assert.notNull(user, "用户不存在");
|
||||
|
||||
Assert.isTrue(
|
||||
RedissonUtils.tryLockAutomatically(
|
||||
LockDTO.builder()
|
||||
.tryLockWaitTime(0L)
|
||||
.lockTimeout(60 * 5L)
|
||||
.methodName("talent:create")
|
||||
.arg(user.getRealName())
|
||||
.arg(user.getCardNo())
|
||||
.arg(String.valueOf(UserContextHolder.getExistLoginOrgId()))
|
||||
.build()
|
||||
),
|
||||
"该用户正在操作中,请检查");
|
||||
|
||||
List<Talent> talents = talentMapper.selectList(
|
||||
new LambdaQueryWrapper<Talent>()
|
||||
.eq(Talent::getDeleted, false)
|
||||
.eq(Talent::getOrgId, talent.getOrgId())
|
||||
.eq(Talent::getUserId, talent.getUserId())
|
||||
);
|
||||
if (CollectionUtils.isEmpty(talents)) {
|
||||
talentMapper.saveEntity(talent);
|
||||
} else {
|
||||
Long companyId = talents.get(0).getCompanyId();
|
||||
if (companyId.longValue() != talent.getCompanyId().longValue()) {
|
||||
Talent updateTalent = new Talent();
|
||||
updateTalent.setId(talents.get(0).getId());
|
||||
updateTalent.setCompanyId(companyId);
|
||||
talentMapper.updateEntitySelective(updateTalent);
|
||||
}
|
||||
}
|
||||
return talent.getId();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user