文件夹整理

This commit is contained in:
wkc
2026-02-09 14:28:25 +08:00
parent 056d239041
commit 02249c402e
2429 changed files with 3159 additions and 239710 deletions

View File

@@ -1,16 +1,16 @@
package com.ruoyi.ccdi.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.ccdi.domain.dto.CcdiEmployeeAddDTO;
import com.ruoyi.ccdi.domain.dto.CcdiEmployeeEditDTO;
import com.ruoyi.ccdi.domain.dto.CcdiEmployeeQueryDTO;
import com.ruoyi.ccdi.domain.excel.CcdiEmployeeExcel;
import com.ruoyi.ccdi.domain.vo.CcdiEmployeeVO;
import com.ruoyi.ccdi.domain.dto.CcdiBaseStaffAddDTO;
import com.ruoyi.ccdi.domain.dto.CcdiBaseStaffEditDTO;
import com.ruoyi.ccdi.domain.dto.CcdiBaseStaffQueryDTO;
import com.ruoyi.ccdi.domain.excel.CcdiBaseStaffExcel;
import com.ruoyi.ccdi.domain.vo.CcdiBaseStaffVO;
import com.ruoyi.ccdi.domain.vo.ImportFailureVO;
import com.ruoyi.ccdi.domain.vo.ImportResultVO;
import com.ruoyi.ccdi.domain.vo.ImportStatusVO;
import com.ruoyi.ccdi.service.ICcdiEmployeeImportService;
import com.ruoyi.ccdi.service.ICcdiEmployeeService;
import com.ruoyi.ccdi.service.ICcdiBaseStaffImportService;
import com.ruoyi.ccdi.service.ICcdiBaseStaffService;
import com.ruoyi.ccdi.utils.EasyExcelUtil;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
@@ -38,26 +38,26 @@ import java.util.List;
*/
@Tag(name = "员工信息管理")
@RestController
@RequestMapping("/ccdi/employee")
public class CcdiEmployeeController extends BaseController {
@RequestMapping("/ccdi/baseStaff")
public class CcdiBaseStaffController extends BaseController {
@Resource
private ICcdiEmployeeService employeeService;
private ICcdiBaseStaffService baseStaffService;
@Resource
private ICcdiEmployeeImportService importAsyncService;
private ICcdiBaseStaffImportService importAsyncService;
/**
* 查询员工列表
*/
@Operation(summary = "查询员工列表")
@PreAuthorize("@ss.hasPermi('ccdi:employee:list')")
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:list')")
@GetMapping("/list")
public TableDataInfo list(CcdiEmployeeQueryDTO queryDTO) {
public TableDataInfo list(CcdiBaseStaffQueryDTO queryDTO) {
// 使用MyBatis Plus分页
PageDomain pageDomain = TableSupport.buildPageRequest();
Page<CcdiEmployeeVO> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
Page<CcdiEmployeeVO> result = employeeService.selectEmployeePage(page, queryDTO);
Page<CcdiBaseStaffVO> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
Page<CcdiBaseStaffVO> result = baseStaffService.selectBaseStaffPage(page, queryDTO);
return getDataTable(result.getRecords(), result.getTotal());
}
@@ -65,55 +65,55 @@ public class CcdiEmployeeController extends BaseController {
* 导出员工列表
*/
@Operation(summary = "导出员工列表")
@PreAuthorize("@ss.hasPermi('ccdi:employee:export')")
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:export')")
@Log(title = "员工信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CcdiEmployeeQueryDTO queryDTO) {
List<CcdiEmployeeExcel> list = employeeService.selectEmployeeListForExport(queryDTO);
EasyExcelUtil.exportExcel(response, list, CcdiEmployeeExcel.class, "员工信息");
public void export(HttpServletResponse response, CcdiBaseStaffQueryDTO queryDTO) {
List<CcdiBaseStaffExcel> list = baseStaffService.selectBaseStaffListForExport(queryDTO);
EasyExcelUtil.exportExcel(response, list, CcdiBaseStaffExcel.class, "员工信息");
}
/**
* 获取员工详细信息
*/
@Operation(summary = "获取员工详细信息")
@PreAuthorize("@ss.hasPermi('ccdi:employee:query')")
@GetMapping(value = "/{employeeId}")
public AjaxResult getInfo(@PathVariable Long employeeId) {
return success(employeeService.selectEmployeeById(employeeId));
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:query')")
@GetMapping(value = "/{staffId}")
public AjaxResult getInfo(@PathVariable Long staffId) {
return success(baseStaffService.selectBaseStaffById(staffId));
}
/**
* 新增员工
*/
@Operation(summary = "新增员工")
@PreAuthorize("@ss.hasPermi('ccdi:employee:add')")
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:add')")
@Log(title = "员工信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody CcdiEmployeeAddDTO addDTO) {
return toAjax(employeeService.insertEmployee(addDTO));
public AjaxResult add(@Validated @RequestBody CcdiBaseStaffAddDTO addDTO) {
return toAjax(baseStaffService.insertBaseStaff(addDTO));
}
/**
* 修改员工
*/
@Operation(summary = "修改员工")
@PreAuthorize("@ss.hasPermi('ccdi:employee:edit')")
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:edit')")
@Log(title = "员工信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody CcdiEmployeeEditDTO editDTO) {
return toAjax(employeeService.updateEmployee(editDTO));
public AjaxResult edit(@Validated @RequestBody CcdiBaseStaffEditDTO editDTO) {
return toAjax(baseStaffService.updateBaseStaff(editDTO));
}
/**
* 删除员工
*/
@Operation(summary = "删除员工")
@PreAuthorize("@ss.hasPermi('ccdi:employee:remove')")
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:remove')")
@Log(title = "员工信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{employeeIds}")
public AjaxResult remove(@PathVariable Long[] employeeIds) {
return toAjax(employeeService.deleteEmployeeByIds(employeeIds));
@DeleteMapping("/{staffIds}")
public AjaxResult remove(@PathVariable Long[] staffIds) {
return toAjax(baseStaffService.deleteBaseStaffByIds(staffIds));
}
/**
@@ -123,25 +123,25 @@ public class CcdiEmployeeController extends BaseController {
@Operation(summary = "下载导入模板")
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response) {
EasyExcelUtil.importTemplateWithDictDropdown(response, CcdiEmployeeExcel.class, "员工信息");
EasyExcelUtil.importTemplateWithDictDropdown(response, CcdiBaseStaffExcel.class, "员工信息");
}
/**
* 导入员工信息(异步)
*/
@Operation(summary = "导入员工信息")
@PreAuthorize("@ss.hasPermi('ccdi:employee:import')")
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:import')")
@Log(title = "员工信息", businessType = BusinessType.IMPORT)
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
List<CcdiEmployeeExcel> list = EasyExcelUtil.importExcel(file.getInputStream(), CcdiEmployeeExcel.class);
List<CcdiBaseStaffExcel> list = EasyExcelUtil.importExcel(file.getInputStream(), CcdiBaseStaffExcel.class);
if (list == null || list.isEmpty()) {
return error("至少需要一条数据");
}
// 提交异步任务
String taskId = employeeService.importEmployee(list, updateSupport);
String taskId = baseStaffService.importBaseStaff(list, updateSupport);
// 立即返回,不等待后台任务完成
ImportResultVO result = new ImportResultVO();
@@ -156,7 +156,7 @@ public class CcdiEmployeeController extends BaseController {
* 查询导入状态
*/
@Operation(summary = "查询员工导入状态")
@PreAuthorize("@ss.hasPermi('ccdi:employee:import')")
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:import')")
@GetMapping("/importStatus/{taskId}")
public AjaxResult getImportStatus(@PathVariable String taskId) {
try {
@@ -171,14 +171,14 @@ public class CcdiEmployeeController extends BaseController {
* 查询导入失败记录
*/
@Operation(summary = "查询导入失败记录")
@PreAuthorize("@ss.hasPermi('ccdi:employee:import')")
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:import')")
@GetMapping("/importFailures/{taskId}")
public TableDataInfo getImportFailures(
@PathVariable String taskId,
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize) {
List<ImportFailureVO> failures = importAsyncService.getImportFailures( taskId);
List<ImportFailureVO> failures = importAsyncService.getImportFailures(taskId);
// 手动分页
int fromIndex = (pageNum - 1) * pageSize;

View File

@@ -1,9 +1,6 @@
package com.ruoyi.ccdi.domain;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.io.Serial;
@@ -11,20 +8,21 @@ import java.io.Serializable;
import java.util.Date;
/**
* 员工信息对象 dpc_employee
* 员工信息对象 ccdi_base_staff
*
* @author ruoyi
* @date 2026-01-28
*/
@Data
public class CcdiEmployee implements Serializable {
@TableName("ccdi_base_staff")
public class CcdiBaseStaff implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/** 员工ID(柜员号,7位数字) */
/** 员工ID */
@TableId(type = IdType.INPUT)
private Long employeeId;
private Long staffId;
/** 姓名 */
private String name;

View File

@@ -0,0 +1,107 @@
package com.ruoyi.ccdi.domain;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* 员工亲属关系信息对象 ccdi_staff_fmy_relation
*
* @author ruoyi
* @date 2026-02-09
*/
@Data
public class CcdiStaffFmyRelation implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/** 主键ID */
@TableId(type = IdType.AUTO)
private Long id;
/** 员工身份证号 */
private String personId;
/** 关系类型 */
private String relationType;
/** 关系人姓名 */
private String relationName;
/** 性别 */
private String gender;
/** 出生日期 */
private Date birthDate;
/** 证件类型 */
private String relationCertType;
/** 证件号码 */
private String relationCertNo;
/** 手机号码1 */
private String mobilePhone1;
/** 手机号码2 */
private String mobilePhone2;
/** 微信名称1 */
private String wechatNo1;
/** 微信名称2 */
private String wechatNo2;
/** 微信名称3 */
private String wechatNo3;
/** 详细联系地址 */
private String contactAddress;
/** 关系详细描述 */
private String relationDesc;
/** 状态0-无效、1-有效 */
private Integer status;
/** 关系生效日期 */
private Date effectiveDate;
/** 关系失效日期 */
private Date invalidDate;
/** 备注信息 */
private String remark;
/** 数据来源 */
private String dataSource;
/** 是否是员工的家庭关系0-否 1-是 */
private Integer isEmpFamily;
/** 是否是信贷客户的家庭关系0-否 1-是 */
private Integer isCustFamily;
/** 创建时间 */
@TableField(fill = FieldFill.INSERT)
private Date createTime;
/** 更新时间 */
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
/** 创建人 */
@TableField(fill = FieldFill.INSERT)
private String createdBy;
/** 更新人 */
@TableField(fill = FieldFill.INSERT_UPDATE)
private String updatedBy;
}

View File

@@ -1,7 +1,5 @@
package com.ruoyi.ccdi.domain.dto;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
@@ -19,7 +17,7 @@ import java.util.Date;
* @date 2026-01-28
*/
@Data
public class CcdiEmployeeAddDTO implements Serializable {
public class CcdiBaseStaffAddDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@@ -29,11 +27,9 @@ public class CcdiEmployeeAddDTO implements Serializable {
@Size(max = 100, message = "姓名长度不能超过100个字符")
private String name;
/** 员工ID(柜员号,7位数字) */
@NotNull(message = "柜员号不能为空")
@Min(value = 1000000L, message = "柜员号必须为7位数字")
@Max(value = 9999999L, message = "柜员号必须为7位数字")
private Long employeeId;
/** 员工ID */
@NotNull(message = "员工ID不能为空")
private Long staffId;
/** 所属部门ID */
@NotNull(message = "所属部门不能为空")

View File

@@ -17,14 +17,14 @@ import java.util.Date;
* @date 2026-01-28
*/
@Data
public class CcdiEmployeeEditDTO implements Serializable {
public class CcdiBaseStaffEditDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/** 员工ID */
@NotNull(message = "员工ID不能为空")
private Long employeeId;
private Long staffId;
/** 姓名 */
@Size(max = 100, message = "姓名长度不能超过100个字符")

View File

@@ -12,7 +12,7 @@ import java.io.Serializable;
* @date 2026-01-28
*/
@Data
public class CcdiEmployeeQueryDTO implements Serializable {
public class CcdiBaseStaffQueryDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@@ -20,8 +20,8 @@ public class CcdiEmployeeQueryDTO implements Serializable {
/** 姓名(模糊查询) */
private String name;
/** 员工ID(柜员号,精确查询) */
private Long employeeId;
/** 员工ID(精确查询) */
private Long staffId;
/** 所属部门ID */
private Long deptId;

View File

@@ -0,0 +1,122 @@
package com.ruoyi.ccdi.domain.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* 员工亲属关系信息新增DTO
*
* @author ruoyi
* @date 2026-02-09
*/
@Data
@Schema(description = "员工亲属关系信息新增")
public class CcdiStaffFmyRelationAddDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/** 员工身份证号 */
@NotBlank(message = "员工身份证号不能为空")
@Pattern(regexp = "^\\d{17}[\\dXx]$", message = "员工身份证号格式不正确")
@Schema(description = "员工身份证号")
private String personId;
/** 关系类型 */
@NotBlank(message = "关系类型不能为空")
@Size(max = 50, message = "关系类型长度不能超过50个字符")
@Schema(description = "关系类型")
private String relationType;
/** 关系人姓名 */
@NotBlank(message = "关系人姓名不能为空")
@Size(max = 100, message = "关系人姓名长度不能超过100个字符")
@Schema(description = "关系人姓名")
private String relationName;
/** 性别 */
@Pattern(regexp = "^[MFO]$", message = "性别只能是M、F或O")
@Schema(description = "性别M-男 F-女 O-其他")
private String gender;
/** 出生日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Schema(description = "出生日期")
private Date birthDate;
/** 证件类型 */
@NotBlank(message = "证件类型不能为空")
@Size(max = 50, message = "证件类型长度不能超过50个字符")
@Schema(description = "证件类型")
private String relationCertType;
/** 证件号码 */
@NotBlank(message = "证件号码不能为空")
@Size(max = 50, message = "证件号码长度不能超过50个字符")
@Schema(description = "证件号码")
private String relationCertNo;
/** 手机号码1 */
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号码1格式不正确")
@Schema(description = "手机号码1")
private String mobilePhone1;
/** 手机号码2 */
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号码2格式不正确")
@Schema(description = "手机号码2")
private String mobilePhone2;
/** 微信名称1 */
@Size(max = 100, message = "微信名称1长度不能超过100个字符")
@Schema(description = "微信名称1")
private String wechatNo1;
/** 微信名称2 */
@Size(max = 100, message = "微信名称2长度不能超过100个字符")
@Schema(description = "微信名称2")
private String wechatNo2;
/** 微信名称3 */
@Size(max = 100, message = "微信名称3长度不能超过100个字符")
@Schema(description = "微信名称3")
private String wechatNo3;
/** 详细联系地址 */
@Size(max = 255, message = "详细联系地址长度不能超过255个字符")
@Schema(description = "详细联系地址")
private String contactAddress;
/** 关系详细描述 */
@Size(max = 500, message = "关系详细描述长度不能超过500个字符")
@Schema(description = "关系详细描述")
private String relationDesc;
/** 状态 */
@NotNull(message = "状态不能为空")
@Schema(description = "状态0-无效、1-有效")
private Integer status;
/** 关系生效日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "关系生效日期")
private Date effectiveDate;
/** 关系失效日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "关系失效日期")
private Date invalidDate;
/** 备注信息 */
@Size(max = 500, message = "备注信息长度不能超过500个字符")
@Schema(description = "备注信息")
private String remark;
}

View File

@@ -0,0 +1,127 @@
package com.ruoyi.ccdi.domain.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* 员工亲属关系信息编辑DTO
*
* @author ruoyi
* @date 2026-02-09
*/
@Data
@Schema(description = "员工亲属关系信息编辑")
public class CcdiStaffFmyRelationEditDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/** 主键ID */
@NotNull(message = "主键ID不能为空")
@Schema(description = "主键ID")
private Long id;
/** 员工身份证号 */
@NotBlank(message = "员工身份证号不能为空")
@Pattern(regexp = "^\\d{17}[\\dXx]$", message = "员工身份证号格式不正确")
@Schema(description = "员工身份证号")
private String personId;
/** 关系类型 */
@NotBlank(message = "关系类型不能为空")
@Size(max = 50, message = "关系类型长度不能超过50个字符")
@Schema(description = "关系类型")
private String relationType;
/** 关系人姓名 */
@NotBlank(message = "关系人姓名不能为空")
@Size(max = 100, message = "关系人姓名长度不能超过100个字符")
@Schema(description = "关系人姓名")
private String relationName;
/** 性别 */
@Pattern(regexp = "^[MFO]$", message = "性别只能是M、F或O")
@Schema(description = "性别M-男 F-女 O-其他")
private String gender;
/** 出生日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Schema(description = "出生日期")
private Date birthDate;
/** 证件类型 */
@NotBlank(message = "证件类型不能为空")
@Size(max = 50, message = "证件类型长度不能超过50个字符")
@Schema(description = "证件类型")
private String relationCertType;
/** 证件号码 */
@NotBlank(message = "证件号码不能为空")
@Size(max = 50, message = "证件号码长度不能超过50个字符")
@Schema(description = "证件号码")
private String relationCertNo;
/** 手机号码1 */
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号码1格式不正确")
@Schema(description = "手机号码1")
private String mobilePhone1;
/** 手机号码2 */
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号码2格式不正确")
@Schema(description = "手机号码2")
private String mobilePhone2;
/** 微信名称1 */
@Size(max = 100, message = "微信名称1长度不能超过100个字符")
@Schema(description = "微信名称1")
private String wechatNo1;
/** 微信名称2 */
@Size(max = 100, message = "微信名称2长度不能超过100个字符")
@Schema(description = "微信名称2")
private String wechatNo2;
/** 微信名称3 */
@Size(max = 100, message = "微信名称3长度不能超过100个字符")
@Schema(description = "微信名称3")
private String wechatNo3;
/** 详细联系地址 */
@Size(max = 255, message = "详细联系地址长度不能超过255个字符")
@Schema(description = "详细联系地址")
private String contactAddress;
/** 关系详细描述 */
@Size(max = 500, message = "关系详细描述长度不能超过500个字符")
@Schema(description = "关系详细描述")
private String relationDesc;
/** 状态 */
@NotNull(message = "状态不能为空")
@Schema(description = "状态0-无效、1-有效")
private Integer status;
/** 关系生效日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "关系生效日期")
private Date effectiveDate;
/** 关系失效日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "关系失效日期")
private Date invalidDate;
/** 备注信息 */
@Size(max = 500, message = "备注信息长度不能超过500个字符")
@Schema(description = "备注信息")
private String remark;
}

View File

@@ -0,0 +1,41 @@
package com.ruoyi.ccdi.domain.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 员工亲属关系信息查询DTO
*
* @author ruoyi
* @date 2026-02-09
*/
@Data
@Schema(description = "员工亲属关系信息查询条件")
public class CcdiStaffFmyRelationQueryDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/** 员工身份证号 */
@Schema(description = "员工身份证号")
private String personId;
/** 关系人姓名 */
@Schema(description = "关系人姓名")
private String relationName;
/** 关系类型 */
@Schema(description = "关系类型")
private String relationType;
/** 证件号码 */
@Schema(description = "证件号码")
private String relationCertNo;
/** 状态 */
@Schema(description = "状态0-无效、1-有效")
private Integer status;
}

View File

@@ -17,7 +17,7 @@ import java.util.Date;
* @date 2026-01-28
*/
@Data
public class CcdiEmployeeExcel implements Serializable {
public class CcdiBaseStaffExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@@ -28,11 +28,11 @@ public class CcdiEmployeeExcel implements Serializable {
@Required
private String name;
/** 员工ID(柜员号) */
@ExcelProperty(value = "柜员号", index = 1)
/** 员工ID */
@ExcelProperty(value = "员工ID", index = 1)
@ColumnWidth(15)
@Required
private Long employeeId;
private Long staffId;
/** 所属部门ID */
@ExcelProperty(value = "所属部门ID", index = 2)

View File

@@ -0,0 +1,124 @@
package com.ruoyi.ccdi.domain.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.ruoyi.common.annotation.DictDropdown;
import com.ruoyi.common.annotation.Required;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* 员工亲属关系信息Excel导入导出对象
*
* @author ruoyi
* @date 2026-02-09
*/
@Data
public class CcdiStaffFmyRelationExcel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/** 员工身份证号 */
@ExcelProperty(value = "员工身份证号", index = 0)
@ColumnWidth(20)
@Required
private String personId;
/** 关系类型 */
@ExcelProperty(value = "关系类型", index = 1)
@ColumnWidth(15)
@Required
@DictDropdown(dictType = "ccdi_relation_type")
private String relationType;
/** 关系人姓名 */
@ExcelProperty(value = "关系人姓名", index = 2)
@ColumnWidth(15)
@Required
private String relationName;
/** 性别 */
@ExcelProperty(value = "性别", index = 3)
@ColumnWidth(10)
@DictDropdown(dictType = "sys_user_sex")
private String gender;
/** 出生日期 */
@ExcelProperty(value = "出生日期", index = 4)
@ColumnWidth(15)
private Date birthDate;
/** 证件类型 */
@ExcelProperty(value = "证件类型", index = 5)
@ColumnWidth(15)
@Required
@DictDropdown(dictType = "ccdi_cert_type")
private String relationCertType;
/** 证件号码 */
@ExcelProperty(value = "证件号码", index = 6)
@ColumnWidth(20)
@Required
private String relationCertNo;
/** 手机号码1 */
@ExcelProperty(value = "手机号码1", index = 7)
@ColumnWidth(15)
private String mobilePhone1;
/** 手机号码2 */
@ExcelProperty(value = "手机号码2", index = 8)
@ColumnWidth(15)
private String mobilePhone2;
/** 微信名称1 */
@ExcelProperty(value = "微信名称1", index = 9)
@ColumnWidth(15)
private String wechatNo1;
/** 微信名称2 */
@ExcelProperty(value = "微信名称2", index = 10)
@ColumnWidth(15)
private String wechatNo2;
/** 微信名称3 */
@ExcelProperty(value = "微信名称3", index = 11)
@ColumnWidth(15)
private String wechatNo3;
/** 详细联系地址 */
@ExcelProperty(value = "详细联系地址", index = 12)
@ColumnWidth(25)
private String contactAddress;
/** 关系详细描述 */
@ExcelProperty(value = "关系详细描述", index = 13)
@ColumnWidth(20)
private String relationDesc;
/** 状态 */
@ExcelProperty(value = "状态", index = 14)
@ColumnWidth(10)
@Required
@DictDropdown(dictType = "ccdi_status", defaultValue = "1")
private Integer status;
/** 关系生效日期 */
@ExcelProperty(value = "关系生效日期", index = 15)
@ColumnWidth(20)
private Date effectiveDate;
/** 关系失效日期 */
@ExcelProperty(value = "关系失效日期", index = 16)
@ColumnWidth(20)
private Date invalidDate;
/** 备注信息 */
@ExcelProperty(value = "备注信息", index = 17)
@ColumnWidth(25)
private String remark;
}

View File

@@ -13,13 +13,13 @@ import java.util.Date;
* @date 2026-01-28
*/
@Data
public class CcdiEmployeeVO implements Serializable {
public class CcdiBaseStaffVO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/** 员工ID(柜员号) */
private Long employeeId;
/** 员工ID */
private Long staffId;
/** 姓名 */
private String name;

View File

@@ -0,0 +1,117 @@
package com.ruoyi.ccdi.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/**
* 员工亲属关系信息VO
*
* @author ruoyi
* @date 2026-02-09
*/
@Data
@Schema(description = "员工亲属关系信息")
public class CcdiStaffFmyRelationVO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/** 主键ID */
@Schema(description = "主键ID")
private Long id;
/** 员工身份证号 */
@Schema(description = "员工身份证号")
private String personId;
/** 关系类型 */
@Schema(description = "关系类型")
private String relationType;
/** 关系人姓名 */
@Schema(description = "关系人姓名")
private String relationName;
/** 性别 */
@Schema(description = "性别M-男 F-女 O-其他")
private String gender;
/** 出生日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Schema(description = "出生日期")
private String birthDate;
/** 证件类型 */
@Schema(description = "证件类型")
private String relationCertType;
/** 证件号码 */
@Schema(description = "证件号码")
private String relationCertNo;
/** 手机号码1 */
@Schema(description = "手机号码1")
private String mobilePhone1;
/** 手机号码2 */
@Schema(description = "手机号码2")
private String mobilePhone2;
/** 微信名称1 */
@Schema(description = "微信名称1")
private String wechatNo1;
/** 微信名称2 */
@Schema(description = "微信名称2")
private String wechatNo2;
/** 微信名称3 */
@Schema(description = "微信名称3")
private String wechatNo3;
/** 详细联系地址 */
@Schema(description = "详细联系地址")
private String contactAddress;
/** 关系详细描述 */
@Schema(description = "关系详细描述")
private String relationDesc;
/** 状态 */
@Schema(description = "状态0-无效、1-有效")
private Integer status;
/** 关系生效日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "关系生效日期")
private String effectiveDate;
/** 关系失效日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Schema(description = "关系失效日期")
private String invalidDate;
/** 备注信息 */
@Schema(description = "备注信息")
private String remark;
/** 创建时间 */
@Schema(description = "创建时间")
private String createTime;
/** 更新时间 */
@Schema(description = "更新时间")
private String updateTime;
/** 创建人 */
@Schema(description = "创建人")
private String createdBy;
/** 更新人 */
@Schema(description = "更新人")
private String updatedBy;
}

View File

@@ -0,0 +1,51 @@
package com.ruoyi.ccdi.domain.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
* 员工亲属关系信息导入失败记录VO
*
* @author ruoyi
* @date 2026-02-09
*/
@Data
@Schema(description = "员工亲属关系信息导入失败记录")
public class StaffFmyRelationImportFailureVO {
/** 员工身份证号 */
@Schema(description = "员工身份证号")
private String personId;
/** 关系类型 */
@Schema(description = "关系类型")
private String relationType;
/** 关系人姓名 */
@Schema(description = "关系人姓名")
private String relationName;
/** 性别 */
@Schema(description = "性别")
private String gender;
/** 证件类型 */
@Schema(description = "证件类型")
private String relationCertType;
/** 证件号码 */
@Schema(description = "证件号码")
private String relationCertNo;
/** 手机号码1 */
@Schema(description = "手机号码1")
private String mobilePhone1;
/** 状态 */
@Schema(description = "状态")
private Integer status;
/** 错误信息 */
@Schema(description = "错误信息")
private String errorMessage;
}

View File

@@ -2,9 +2,9 @@ package com.ruoyi.ccdi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.ccdi.domain.CcdiEmployee;
import com.ruoyi.ccdi.domain.dto.CcdiEmployeeQueryDTO;
import com.ruoyi.ccdi.domain.vo.CcdiEmployeeVO;
import com.ruoyi.ccdi.domain.CcdiBaseStaff;
import com.ruoyi.ccdi.domain.dto.CcdiBaseStaffQueryDTO;
import com.ruoyi.ccdi.domain.vo.CcdiBaseStaffVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -15,7 +15,7 @@ import java.util.List;
* @author ruoyi
* @date 2026-01-28
*/
public interface CcdiEmployeeMapper extends BaseMapper<CcdiEmployee> {
public interface CcdiBaseStaffMapper extends BaseMapper<CcdiBaseStaff> {
/**
* 分页查询员工列表包含部门名称
@@ -24,12 +24,10 @@ public interface CcdiEmployeeMapper extends BaseMapper<CcdiEmployee> {
* @param queryDTO 查询条件
* @return 员工VO分页结果
*/
Page<CcdiEmployeeVO> selectEmployeePageWithDept(@Param("page") Page<CcdiEmployeeVO> page,
@Param("query") CcdiEmployeeQueryDTO queryDTO);
Page<CcdiBaseStaffVO> selectBaseStaffPageWithDept(@Param("page") Page<CcdiBaseStaffVO> page,
@Param("query") CcdiBaseStaffQueryDTO queryDTO);
int insertOrUpdateBatch(@Param("list") List<CcdiEmployee> list);
int insertOrUpdateBatch(@Param("list") List<CcdiBaseStaff> list);
/**
* 批量插入员工信息
@@ -37,5 +35,5 @@ public interface CcdiEmployeeMapper extends BaseMapper<CcdiEmployee> {
* @param list 员工信息列表
* @return 影响行数
*/
int insertBatch(@Param("list") List<CcdiEmployee> list);
int insertBatch(@Param("list") List<CcdiBaseStaff> list);
}

View File

@@ -0,0 +1,53 @@
package com.ruoyi.ccdi.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.ccdi.domain.CcdiStaffFmyRelation;
import com.ruoyi.ccdi.domain.dto.CcdiStaffFmyRelationQueryDTO;
import com.ruoyi.ccdi.domain.vo.CcdiStaffFmyRelationVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 员工亲属关系信息 数据层
*
* @author ruoyi
* @date 2026-02-09
*/
public interface CcdiStaffFmyRelationMapper extends BaseMapper<CcdiStaffFmyRelation> {
/**
* 分页查询员工亲属关系列表
*
* @param page 分页对象
* @param queryDTO 查询条件
* @return 员工亲属关系VO分页结果
*/
Page<CcdiStaffFmyRelationVO> selectRelationPage(@Param("page") Page<CcdiStaffFmyRelationVO> page,
@Param("query") CcdiStaffFmyRelationQueryDTO queryDTO);
/**
* 查询员工亲属关系详情
*
* @param id 主键ID
* @return 员工亲属关系VO
*/
CcdiStaffFmyRelationVO selectRelationById(@Param("id") Long id);
/**
* 查询员工亲属关系列表(用于导出)
*
* @param queryDTO 查询条件
* @return 员工亲属关系Excel实体集合
*/
List<CcdiStaffFmyRelationVO> selectRelationListForExport(@Param("query") CcdiStaffFmyRelationQueryDTO queryDTO);
/**
* 批量插入员工亲属关系数据
*
* @param list 员工亲属关系列表
* @return 插入行数
*/
int insertBatch(@Param("list") List<CcdiStaffFmyRelation> list);
}

View File

@@ -1,6 +1,6 @@
package com.ruoyi.ccdi.service;
import com.ruoyi.ccdi.domain.excel.CcdiEmployeeExcel;
import com.ruoyi.ccdi.domain.excel.CcdiBaseStaffExcel;
import com.ruoyi.ccdi.domain.vo.ImportFailureVO;
import com.ruoyi.ccdi.domain.vo.ImportStatusVO;
@@ -10,9 +10,7 @@ import java.util.List;
* @Author: wkc
* @CreateTime: 2026-02-06
*/
public interface ICcdiEmployeeImportService {
public interface ICcdiBaseStaffImportService {
/**
* 异步导入员工数据
@@ -20,7 +18,7 @@ public interface ICcdiEmployeeImportService {
* @param excelList Excel数据列表
* @param isUpdateSupport 是否更新已存在的数据
*/
void importEmployeeAsync(List<CcdiEmployeeExcel> excelList, Boolean isUpdateSupport, String taskId);
void importBaseStaffAsync(List<CcdiBaseStaffExcel> excelList, Boolean isUpdateSupport, String taskId);
/**
* 查询导入状态

View File

@@ -1,11 +1,11 @@
package com.ruoyi.ccdi.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.ccdi.domain.dto.CcdiEmployeeAddDTO;
import com.ruoyi.ccdi.domain.dto.CcdiEmployeeEditDTO;
import com.ruoyi.ccdi.domain.dto.CcdiEmployeeQueryDTO;
import com.ruoyi.ccdi.domain.excel.CcdiEmployeeExcel;
import com.ruoyi.ccdi.domain.vo.CcdiEmployeeVO;
import com.ruoyi.ccdi.domain.dto.CcdiBaseStaffAddDTO;
import com.ruoyi.ccdi.domain.dto.CcdiBaseStaffEditDTO;
import com.ruoyi.ccdi.domain.dto.CcdiBaseStaffQueryDTO;
import com.ruoyi.ccdi.domain.excel.CcdiBaseStaffExcel;
import com.ruoyi.ccdi.domain.vo.CcdiBaseStaffVO;
import java.util.List;
@@ -15,7 +15,7 @@ import java.util.List;
* @author ruoyi
* @date 2026-01-28
*/
public interface ICcdiEmployeeService {
public interface ICcdiBaseStaffService {
/**
* 查询员工列表
@@ -23,7 +23,7 @@ public interface ICcdiEmployeeService {
* @param queryDTO 查询条件
* @return 员工VO集合
*/
List<CcdiEmployeeVO> selectEmployeeList(CcdiEmployeeQueryDTO queryDTO);
List<CcdiBaseStaffVO> selectBaseStaffList(CcdiBaseStaffQueryDTO queryDTO);
/**
* 分页查询员工列表
@@ -32,7 +32,7 @@ public interface ICcdiEmployeeService {
* @param queryDTO 查询条件
* @return 员工VO分页结果
*/
Page<CcdiEmployeeVO> selectEmployeePage(Page<CcdiEmployeeVO> page, CcdiEmployeeQueryDTO queryDTO);
Page<CcdiBaseStaffVO> selectBaseStaffPage(Page<CcdiBaseStaffVO> page, CcdiBaseStaffQueryDTO queryDTO);
/**
* 查询员工列表用于导出
@@ -40,15 +40,15 @@ public interface ICcdiEmployeeService {
* @param queryDTO 查询条件
* @return 员工Excel实体集合
*/
List<CcdiEmployeeExcel> selectEmployeeListForExport(CcdiEmployeeQueryDTO queryDTO);
List<CcdiBaseStaffExcel> selectBaseStaffListForExport(CcdiBaseStaffQueryDTO queryDTO);
/**
* 查询员工详情
*
* @param employeeId 员工ID
* @param staffId 员工ID
* @return 员工VO
*/
CcdiEmployeeVO selectEmployeeById(Long employeeId);
CcdiBaseStaffVO selectBaseStaffById(Long staffId);
/**
* 新增员工
@@ -56,7 +56,7 @@ public interface ICcdiEmployeeService {
* @param addDTO 新增DTO
* @return 结果
*/
int insertEmployee(CcdiEmployeeAddDTO addDTO);
int insertBaseStaff(CcdiBaseStaffAddDTO addDTO);
/**
* 修改员工
@@ -64,15 +64,15 @@ public interface ICcdiEmployeeService {
* @param editDTO 编辑DTO
* @return 结果
*/
int updateEmployee(CcdiEmployeeEditDTO editDTO);
int updateBaseStaff(CcdiBaseStaffEditDTO editDTO);
/**
* 批量删除员工
*
* @param employeeIds 需要删除的员工ID
* @param staffIds 需要删除的员工ID
* @return 结果
*/
int deleteEmployeeByIds(Long[] employeeIds);
int deleteBaseStaffByIds(Long[] staffIds);
/**
* 导入员工数据
@@ -81,6 +81,6 @@ public interface ICcdiEmployeeService {
* @param isUpdateSupport 是否更新支持
* @return 结果
*/
String importEmployee(List<CcdiEmployeeExcel> excelList, Boolean isUpdateSupport);
String importBaseStaff(List<CcdiBaseStaffExcel> excelList, Boolean isUpdateSupport);
}

View File

@@ -0,0 +1,41 @@
package com.ruoyi.ccdi.service;
import com.ruoyi.ccdi.domain.excel.CcdiStaffFmyRelationExcel;
import com.ruoyi.ccdi.domain.vo.ImportStatusVO;
import com.ruoyi.ccdi.domain.vo.StaffFmyRelationImportFailureVO;
import java.util.List;
/**
* 员工亲属关系信息异步导入服务层
*
* @author ruoyi
* @date 2026-02-09
*/
public interface ICcdiStaffFmyRelationImportService {
/**
* 异步导入员工亲属关系数据
*
* @param excelList Excel数据列表
* @param taskId 任务ID
* @param userName 当前用户名
*/
void importRelationAsync(List<CcdiStaffFmyRelationExcel> excelList, String taskId, String userName);
/**
* 查询导入状态
*
* @param taskId 任务ID
* @return 导入状态信息
*/
ImportStatusVO getImportStatus(String taskId);
/**
* 获取导入失败记录
*
* @param taskId 任务ID
* @return 失败记录列表
*/
List<StaffFmyRelationImportFailureVO> getImportFailures(String taskId);
}

View File

@@ -0,0 +1,84 @@
package com.ruoyi.ccdi.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.ccdi.domain.dto.CcdiStaffFmyRelationAddDTO;
import com.ruoyi.ccdi.domain.dto.CcdiStaffFmyRelationEditDTO;
import com.ruoyi.ccdi.domain.dto.CcdiStaffFmyRelationQueryDTO;
import com.ruoyi.ccdi.domain.excel.CcdiStaffFmyRelationExcel;
import com.ruoyi.ccdi.domain.vo.CcdiStaffFmyRelationVO;
import java.util.List;
/**
* 员工亲属关系信息 服务层
*
* @author ruoyi
* @date 2026-02-09
*/
public interface ICcdiStaffFmyRelationService {
/**
* 查询员工亲属关系列表
*
* @param queryDTO 查询条件
* @return 员工亲属关系VO集合
*/
List<CcdiStaffFmyRelationVO> selectRelationList(CcdiStaffFmyRelationQueryDTO queryDTO);
/**
* 分页查询员工亲属关系列表
*
* @param page 分页对象
* @param queryDTO 查询条件
* @return 员工亲属关系VO分页结果
*/
Page<CcdiStaffFmyRelationVO> selectRelationPage(Page<CcdiStaffFmyRelationVO> page, CcdiStaffFmyRelationQueryDTO queryDTO);
/**
* 查询员工亲属关系列表(用于导出)
*
* @param queryDTO 查询条件
* @return 员工亲属关系Excel实体集合
*/
List<CcdiStaffFmyRelationExcel> selectRelationListForExport(CcdiStaffFmyRelationQueryDTO queryDTO);
/**
* 查询员工亲属关系详情
*
* @param id 主键ID
* @return 员工亲属关系VO
*/
CcdiStaffFmyRelationVO selectRelationById(Long id);
/**
* 新增员工亲属关系
*
* @param addDTO 新增DTO
* @return 结果
*/
int insertRelation(CcdiStaffFmyRelationAddDTO addDTO);
/**
* 修改员工亲属关系
*
* @param editDTO 编辑DTO
* @return 结果
*/
int updateRelation(CcdiStaffFmyRelationEditDTO editDTO);
/**
* 批量删除员工亲属关系
*
* @param ids 需要删除的主键ID数组
* @return 结果
*/
int deleteRelationByIds(Long[] ids);
/**
* 导入员工亲属关系数据(异步)
*
* @param excelList Excel实体列表
* @return 任务ID
*/
String importRelation(List<CcdiStaffFmyRelationExcel> excelList);
}

View File

@@ -2,14 +2,14 @@ package com.ruoyi.ccdi.service.impl;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.ccdi.domain.CcdiEmployee;
import com.ruoyi.ccdi.domain.dto.CcdiEmployeeAddDTO;
import com.ruoyi.ccdi.domain.excel.CcdiEmployeeExcel;
import com.ruoyi.ccdi.domain.CcdiBaseStaff;
import com.ruoyi.ccdi.domain.dto.CcdiBaseStaffAddDTO;
import com.ruoyi.ccdi.domain.excel.CcdiBaseStaffExcel;
import com.ruoyi.ccdi.domain.vo.ImportFailureVO;
import com.ruoyi.ccdi.domain.vo.ImportResult;
import com.ruoyi.ccdi.domain.vo.ImportStatusVO;
import com.ruoyi.ccdi.mapper.CcdiEmployeeMapper;
import com.ruoyi.ccdi.service.ICcdiEmployeeImportService;
import com.ruoyi.ccdi.mapper.CcdiBaseStaffMapper;
import com.ruoyi.ccdi.service.ICcdiBaseStaffImportService;
import com.ruoyi.common.utils.IdCardUtil;
import com.ruoyi.common.utils.StringUtils;
import jakarta.annotation.Resource;
@@ -29,78 +29,76 @@ import java.util.stream.Collectors;
*/
@Service
@EnableAsync
public class CcdiEmployeeImportServiceImpl implements ICcdiEmployeeImportService {
public class CcdiBaseStaffImportServiceImpl implements ICcdiBaseStaffImportService {
@Resource
private CcdiEmployeeMapper employeeMapper;
private CcdiBaseStaffMapper baseStaffMapper;
@Resource
private RedisTemplate<String, Object> redisTemplate;
@Override
@Async
public void importEmployeeAsync(List<CcdiEmployeeExcel> excelList, Boolean isUpdateSupport, String taskId) {
List<CcdiEmployee> newRecords = new ArrayList<>();
List<CcdiEmployee> updateRecords = new ArrayList<>();
public void importBaseStaffAsync(List<CcdiBaseStaffExcel> excelList, Boolean isUpdateSupport, String taskId) {
List<CcdiBaseStaff> newRecords = new ArrayList<>();
List<CcdiBaseStaff> updateRecords = new ArrayList<>();
List<ImportFailureVO> failures = new ArrayList<>();
// 批量查询已存在的柜员号和身份证号
Set<Long> existingIds = getExistingEmployeeIds(excelList);
// 批量查询已存在的员工ID和身份证号
Set<Long> existingIds = getExistingStaffIds(excelList);
Set<String> existingIdCards = getExistingIdCards(excelList);
// 用于跟踪Excel文件内已处理的主键
Set<Long> processedEmployeeIds = new HashSet<>();
Set<Long> processedStaffIds = new HashSet<>();
Set<String> processedIdCards = new HashSet<>();
// 分类数据
for (int i = 0; i < excelList.size(); i++) {
CcdiEmployeeExcel excel = excelList.get(i);
CcdiBaseStaffExcel excel = excelList.get(i);
try {
// 转换为AddDTO进行验证
CcdiEmployeeAddDTO addDTO = new CcdiEmployeeAddDTO();
CcdiBaseStaffAddDTO addDTO = new CcdiBaseStaffAddDTO();
BeanUtils.copyProperties(excel, addDTO);
// 验证数据(支持更新模式)
validateEmployeeData(addDTO, isUpdateSupport, existingIds, existingIdCards);
validateStaffData(addDTO, isUpdateSupport, existingIds, existingIdCards);
CcdiEmployee employee = new CcdiEmployee();
BeanUtils.copyProperties(excel, employee);
CcdiBaseStaff staff = new CcdiBaseStaff();
BeanUtils.copyProperties(excel, staff);
// 统一检查Excel内重复更新和新增两个分支都需要检查
if (processedEmployeeIds.contains(excel.getEmployeeId())) {
throw new RuntimeException(String.format("柜员号[%d]在导入文件中重复,已跳过此条记录", excel.getEmployeeId()));
if (processedStaffIds.contains(excel.getStaffId())) {
throw new RuntimeException(String.format("员工ID[%d]在导入文件中重复,已跳过此条记录", excel.getStaffId()));
}
if (StringUtils.isNotEmpty(excel.getIdCard()) &&
processedIdCards.contains(excel.getIdCard())) {
throw new RuntimeException(String.format("身份证号[%s]在导入文件中重复,已跳过此条记录", excel.getIdCard()));
}
// 检查柜员号是否在数据库中已存在
if (existingIds.contains(excel.getEmployeeId())) {
// 柜员号已存在于数据库
// 检查员工ID是否在数据库中已存在
if (existingIds.contains(excel.getStaffId())) {
// 员工ID已存在于数据库
if (!isUpdateSupport) {
throw new RuntimeException("柜员号已存在且未启用更新支持");
throw new RuntimeException("员工ID已存在且未启用更新支持");
}
// 通过检查,添加到更新列表
updateRecords.add(employee);
updateRecords.add(staff);
} else {
// 柜员号不存在,添加到新增列表
newRecords.add(employee);
// 员工ID不存在,添加到新增列表
newRecords.add(staff);
}
// 统一标记为已处理只有成功添加到列表后才会执行到这里
if (excel.getEmployeeId() != null) {
processedEmployeeIds.add(excel.getEmployeeId());
if (excel.getStaffId() != null) {
processedStaffIds.add(excel.getStaffId());
}
if (StringUtils.isNotEmpty(excel.getIdCard())) {
processedIdCards.add(excel.getIdCard());
}
} catch (Exception e) {
ImportFailureVO failure = new ImportFailureVO();
BeanUtils.copyProperties(excel, failure);
@@ -116,12 +114,12 @@ public class CcdiEmployeeImportServiceImpl implements ICcdiEmployeeImportService
// 批量更新已有数据先删除再插入
if (!updateRecords.isEmpty() && isUpdateSupport) {
employeeMapper.insertOrUpdateBatch(updateRecords);
baseStaffMapper.insertOrUpdateBatch(updateRecords);
}
// 保存失败记录到Redis
if (!failures.isEmpty()) {
String failuresKey = "import:employee:" + taskId + ":failures";
String failuresKey = "import:baseStaff:" + taskId + ":failures";
redisTemplate.opsForValue().set(failuresKey, failures, 7, TimeUnit.DAYS);
}
@@ -132,7 +130,7 @@ public class CcdiEmployeeImportServiceImpl implements ICcdiEmployeeImportService
// 更新最终状态
String finalStatus = result.getFailureCount() == 0 ? "SUCCESS" : "PARTIAL_SUCCESS";
updateImportStatus("employee", taskId, finalStatus, result);
updateImportStatus("baseStaff", taskId, finalStatus, result);
}
/**
@@ -142,8 +140,8 @@ public class CcdiEmployeeImportServiceImpl implements ICcdiEmployeeImportService
* @return 失败记录列表
*/
@Override
public List<ImportFailureVO> getImportFailures( String taskId) {
String key = "import:employee:" + taskId + ":failures";
public List<ImportFailureVO> getImportFailures(String taskId) {
String key = "import:baseStaff:" + taskId + ":failures";
Object failuresObj = redisTemplate.opsForValue().get(key);
if (failuresObj == null) {
@@ -161,7 +159,7 @@ public class CcdiEmployeeImportServiceImpl implements ICcdiEmployeeImportService
*/
@Override
public ImportStatusVO getImportStatus(String taskId) {
String key = "import:employee:" + taskId;
String key = "import:baseStaff:" + taskId;
Boolean hasKey = redisTemplate.hasKey(key);
if (Boolean.FALSE.equals(hasKey)) {
@@ -188,7 +186,7 @@ public class CcdiEmployeeImportServiceImpl implements ICcdiEmployeeImportService
* 更新导入状态
*/
private void updateImportStatus(String taskType, String taskId, String status, ImportResult result) {
String key = "import:employee:" + taskId;
String key = "import:baseStaff:" + taskId;
Map<String, Object> statusData = new HashMap<>();
statusData.put("status", status);
statusData.put("successCount", result.getSuccessCount());
@@ -208,19 +206,19 @@ public class CcdiEmployeeImportServiceImpl implements ICcdiEmployeeImportService
/**
* 批量查询已存在的员工ID
*/
private Set<Long> getExistingEmployeeIds(List<CcdiEmployeeExcel> excelList) {
List<Long> employeeIds = excelList.stream()
.map(CcdiEmployeeExcel::getEmployeeId)
private Set<Long> getExistingStaffIds(List<CcdiBaseStaffExcel> excelList) {
List<Long> staffIds = excelList.stream()
.map(CcdiBaseStaffExcel::getStaffId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (employeeIds.isEmpty()) {
if (staffIds.isEmpty()) {
return Collections.emptySet();
}
List<CcdiEmployee> existingEmployees = employeeMapper.selectBatchIds(employeeIds);
return existingEmployees.stream()
.map(CcdiEmployee::getEmployeeId)
List<CcdiBaseStaff> existingStaff = baseStaffMapper.selectBatchIds(staffIds);
return existingStaff.stream()
.map(CcdiBaseStaff::getStaffId)
.collect(Collectors.toSet());
}
@@ -229,9 +227,9 @@ public class CcdiEmployeeImportServiceImpl implements ICcdiEmployeeImportService
* @param excelList Excel数据列表
* @return 已存在的身份证号集合
*/
private Set<String> getExistingIdCards(List<CcdiEmployeeExcel> excelList) {
private Set<String> getExistingIdCards(List<CcdiBaseStaffExcel> excelList) {
List<String> idCards = excelList.stream()
.map(CcdiEmployeeExcel::getIdCard)
.map(CcdiBaseStaffExcel::getIdCard)
.filter(StringUtils::isNotEmpty)
.collect(Collectors.toList());
@@ -239,24 +237,24 @@ public class CcdiEmployeeImportServiceImpl implements ICcdiEmployeeImportService
return Collections.emptySet();
}
LambdaQueryWrapper<CcdiEmployee> wrapper = new LambdaQueryWrapper<>();
wrapper.in(CcdiEmployee::getIdCard, idCards);
List<CcdiEmployee> existingEmployees = employeeMapper.selectList(wrapper);
LambdaQueryWrapper<CcdiBaseStaff> wrapper = new LambdaQueryWrapper<>();
wrapper.in(CcdiBaseStaff::getIdCard, idCards);
List<CcdiBaseStaff> existingStaff = baseStaffMapper.selectList(wrapper);
return existingEmployees.stream()
.map(CcdiEmployee::getIdCard)
return existingStaff.stream()
.map(CcdiBaseStaff::getIdCard)
.collect(Collectors.toSet());
}
/**
* 批量保存
*/
private void saveBatch(List<CcdiEmployee> list, int batchSize) {
private void saveBatch(List<CcdiBaseStaff> list, int batchSize) {
// 使用真正的批量插入,分批次执行以提高性能
for (int i = 0; i < list.size(); i += batchSize) {
int end = Math.min(i + batchSize, list.size());
List<CcdiEmployee> subList = list.subList(i, end);
employeeMapper.insertBatch(subList);
List<CcdiBaseStaff> subList = list.subList(i, end);
baseStaffMapper.insertBatch(subList);
}
}
@@ -268,13 +266,13 @@ public class CcdiEmployeeImportServiceImpl implements ICcdiEmployeeImportService
* @param existingIds 已存在的员工ID集合(导入场景使用,传null表示单条新增)
* @param existingIdCards 已存在的身份证号集合(导入场景使用,传null表示单条新增)
*/
public void validateEmployeeData(CcdiEmployeeAddDTO addDTO, Boolean isUpdateSupport, Set<Long> existingIds, Set<String> existingIdCards) {
public void validateStaffData(CcdiBaseStaffAddDTO addDTO, Boolean isUpdateSupport, Set<Long> existingIds, Set<String> existingIdCards) {
// 验证必填字段
if (StringUtils.isEmpty(addDTO.getName())) {
throw new RuntimeException("姓名不能为空");
}
if (addDTO.getEmployeeId() == null) {
throw new RuntimeException("柜员号不能为空");
if (addDTO.getStaffId() == null) {
throw new RuntimeException("员工ID不能为空");
}
if (addDTO.getDeptId() == null) {
throw new RuntimeException("所属部门不能为空");
@@ -295,22 +293,22 @@ public class CcdiEmployeeImportServiceImpl implements ICcdiEmployeeImportService
throw new RuntimeException(idCardError);
}
// 单条新增场景:检查柜员号和身份证号唯一性
// 单条新增场景:检查员工ID和身份证号唯一性
if (existingIds == null) {
// 检查柜员号(employeeId)唯一性
if (employeeMapper.selectById(addDTO.getEmployeeId()) != null) {
throw new RuntimeException("柜员号已存在");
// 检查员工ID唯一性
if (baseStaffMapper.selectById(addDTO.getStaffId()) != null) {
throw new RuntimeException("员工ID已存在");
}
// 检查身份证号唯一性
LambdaQueryWrapper<CcdiEmployee> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CcdiEmployee::getIdCard, addDTO.getIdCard());
if (employeeMapper.selectCount(wrapper) > 0) {
LambdaQueryWrapper<CcdiBaseStaff> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CcdiBaseStaff::getIdCard, addDTO.getIdCard());
if (baseStaffMapper.selectCount(wrapper) > 0) {
throw new RuntimeException("该身份证号已存在");
}
} else {
// 导入场景:如果柜员号不存在,才检查身份证号唯一性
if (!existingIds.contains(addDTO.getEmployeeId())) {
// 导入场景:如果员工ID不存在,才检查身份证号唯一性
if (!existingIds.contains(addDTO.getStaffId())) {
// 使用批量查询的结果检查身份证号唯一性
if (existingIdCards != null && existingIdCards.contains(addDTO.getIdCard())) {
throw new RuntimeException("该身份证号已存在");

View File

@@ -0,0 +1,236 @@
package com.ruoyi.ccdi.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.ccdi.domain.CcdiBaseStaff;
import com.ruoyi.ccdi.domain.dto.CcdiBaseStaffAddDTO;
import com.ruoyi.ccdi.domain.dto.CcdiBaseStaffEditDTO;
import com.ruoyi.ccdi.domain.dto.CcdiBaseStaffQueryDTO;
import com.ruoyi.ccdi.domain.excel.CcdiBaseStaffExcel;
import com.ruoyi.ccdi.domain.vo.CcdiBaseStaffVO;
import com.ruoyi.ccdi.enums.EmployeeStatus;
import com.ruoyi.ccdi.mapper.CcdiBaseStaffMapper;
import com.ruoyi.ccdi.service.ICcdiBaseStaffImportService;
import com.ruoyi.ccdi.service.ICcdiBaseStaffService;
import com.ruoyi.common.utils.StringUtils;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
/**
* 员工信息 服务层处理
*
* @author ruoyi
* @date 2026-01-28
*/
@Service
public class CcdiBaseStaffServiceImpl implements ICcdiBaseStaffService {
@Resource
private CcdiBaseStaffMapper baseStaffMapper;
@Resource
private ICcdiBaseStaffImportService importAsyncService;
@Resource
private RedisTemplate<String, Object> redisTemplate;
/**
* 查询员工列表
*
* @param queryDTO 查询条件
* @return 员工VO集合
*/
@Override
public List<CcdiBaseStaffVO> selectBaseStaffList(CcdiBaseStaffQueryDTO queryDTO) {
LambdaQueryWrapper<CcdiBaseStaff> wrapper = buildQueryWrapper(queryDTO);
List<CcdiBaseStaff> list = baseStaffMapper.selectList(wrapper);
List<CcdiBaseStaffVO> voList = new ArrayList<>();
for (CcdiBaseStaff staff : list) {
voList.add(convertToVO(staff));
}
return voList;
}
/**
* 分页查询员工列表
*
* @param page 分页对象
* @param queryDTO 查询条件
* @return 员工VO分页结果
*/
@Override
public Page<CcdiBaseStaffVO> selectBaseStaffPage(Page<CcdiBaseStaffVO> page, CcdiBaseStaffQueryDTO queryDTO) {
// 使用关联查询获取部门名称
Page<CcdiBaseStaffVO> voPage = new Page<>(page.getCurrent(), page.getSize());
Page<CcdiBaseStaffVO> resultPage = baseStaffMapper.selectBaseStaffPageWithDept(voPage, queryDTO);
// 设置状态描述
resultPage.getRecords().forEach(vo ->
vo.setStatusDesc(EmployeeStatus.getDescByCode(vo.getStatus()))
);
return resultPage;
}
/**
* 查询员工列表(用于导出)
*
* @param queryDTO 查询条件
* @return 员工Excel实体集合
*/
@Override
public List<CcdiBaseStaffExcel> selectBaseStaffListForExport(CcdiBaseStaffQueryDTO queryDTO) {
LambdaQueryWrapper<CcdiBaseStaff> wrapper = buildQueryWrapper(queryDTO);
List<CcdiBaseStaff> list = baseStaffMapper.selectList(wrapper);
return list.stream().map(staff -> {
CcdiBaseStaffExcel excel = new CcdiBaseStaffExcel();
BeanUtils.copyProperties(staff, excel);
return excel;
}).toList();
}
/**
* 查询员工详情
*
* @param staffId 员工ID
* @return 员工VO
*/
@Override
public CcdiBaseStaffVO selectBaseStaffById(Long staffId) {
CcdiBaseStaff staff = baseStaffMapper.selectById(staffId);
return convertToVO(staff);
}
/**
* 新增员工
*
* @param addDTO 新增DTO
* @return 结果
*/
@Override
@Transactional
public int insertBaseStaff(CcdiBaseStaffAddDTO addDTO) {
// 检查员工ID唯一性
if (baseStaffMapper.selectById(addDTO.getStaffId()) != null) {
throw new RuntimeException("该员工ID已存在");
}
// 检查身份证号唯一性
LambdaQueryWrapper<CcdiBaseStaff> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CcdiBaseStaff::getIdCard, addDTO.getIdCard());
if (baseStaffMapper.selectCount(wrapper) > 0) {
throw new RuntimeException("该身份证号已存在");
}
CcdiBaseStaff staff = new CcdiBaseStaff();
BeanUtils.copyProperties(addDTO, staff);
int result = baseStaffMapper.insert(staff);
return result;
}
/**
* 修改员工
*
* @param editDTO 编辑DTO
* @return 结果
*/
@Override
@Transactional
public int updateBaseStaff(CcdiBaseStaffEditDTO editDTO) {
// 检查身份证号唯一性(排除自己)
if (StringUtils.isNotEmpty(editDTO.getIdCard())) {
LambdaQueryWrapper<CcdiBaseStaff> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CcdiBaseStaff::getIdCard, editDTO.getIdCard())
.ne(CcdiBaseStaff::getStaffId, editDTO.getStaffId());
if (baseStaffMapper.selectCount(wrapper) > 0) {
throw new RuntimeException("该身份证号已存在");
}
}
CcdiBaseStaff staff = new CcdiBaseStaff();
BeanUtils.copyProperties(editDTO, staff);
int result = baseStaffMapper.updateById(staff);
return result;
}
/**
* 批量删除员工
*
* @param staffIds 需要删除的员工ID
* @return 结果
*/
@Override
@Transactional
public int deleteBaseStaffByIds(Long[] staffIds) {
return baseStaffMapper.deleteBatchIds(List.of(staffIds));
}
/**
* 导入员工数据
*
* @param excelList Excel实体列表
* @param isUpdateSupport 是否更新支持
* @return 结果
*/
@Override
@Transactional
public String importBaseStaff(List<CcdiBaseStaffExcel> excelList, Boolean isUpdateSupport) {
String taskId = UUID.randomUUID().toString();
long startTime = System.currentTimeMillis();
// 初始化Redis状态
String statusKey = "import:baseStaff:" + taskId;
Map<String, Object> statusData = new HashMap<>();
statusData.put("taskId", taskId);
statusData.put("status", "PROCESSING");
statusData.put("totalCount", excelList.size());
statusData.put("successCount", 0);
statusData.put("failureCount", 0);
statusData.put("progress", 0);
statusData.put("startTime", startTime);
statusData.put("message", "正在处理...");
redisTemplate.opsForHash().putAll(statusKey, statusData);
redisTemplate.expire(statusKey, 7, java.util.concurrent.TimeUnit.DAYS);
importAsyncService.importBaseStaffAsync(excelList, isUpdateSupport, taskId);
return taskId;
}
/**
* 构建查询条件
*/
private LambdaQueryWrapper<CcdiBaseStaff> buildQueryWrapper(CcdiBaseStaffQueryDTO queryDTO) {
LambdaQueryWrapper<CcdiBaseStaff> wrapper = new LambdaQueryWrapper<>();
wrapper.like(StringUtils.isNotEmpty(queryDTO.getName()), CcdiBaseStaff::getName, queryDTO.getName())
.eq(queryDTO.getStaffId() != null, CcdiBaseStaff::getStaffId, queryDTO.getStaffId())
.eq(queryDTO.getDeptId() != null, CcdiBaseStaff::getDeptId, queryDTO.getDeptId())
.like(StringUtils.isNotEmpty(queryDTO.getIdCard()), CcdiBaseStaff::getIdCard, queryDTO.getIdCard())
.eq(StringUtils.isNotEmpty(queryDTO.getStatus()), CcdiBaseStaff::getStatus, queryDTO.getStatus())
.orderByDesc(CcdiBaseStaff::getCreateTime);
return wrapper;
}
/**
* 转换为VO对象
*/
public CcdiBaseStaffVO convertToVO(CcdiBaseStaff staff) {
if (staff == null) {
return null;
}
CcdiBaseStaffVO vo = new CcdiBaseStaffVO();
BeanUtils.copyProperties(staff, vo);
vo.setStatusDesc(EmployeeStatus.getDescByCode(staff.getStatus()));
return vo;
}
}

View File

@@ -1,249 +0,0 @@
package com.ruoyi.ccdi.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.ccdi.domain.CcdiEmployee;
import com.ruoyi.ccdi.domain.dto.CcdiEmployeeAddDTO;
import com.ruoyi.ccdi.domain.dto.CcdiEmployeeEditDTO;
import com.ruoyi.ccdi.domain.dto.CcdiEmployeeQueryDTO;
import com.ruoyi.ccdi.domain.excel.CcdiEmployeeExcel;
import com.ruoyi.ccdi.domain.vo.CcdiEmployeeVO;
import com.ruoyi.ccdi.enums.EmployeeStatus;
import com.ruoyi.ccdi.mapper.CcdiEmployeeMapper;
import com.ruoyi.ccdi.service.ICcdiEmployeeImportService;
import com.ruoyi.ccdi.service.ICcdiEmployeeService;
import com.ruoyi.common.utils.StringUtils;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
* 员工信息 服务层处理
*
* @author ruoyi
* @date 2026-01-28
*/
@Service
public class CcdiEmployeeServiceImpl implements ICcdiEmployeeService {
@Resource
private CcdiEmployeeMapper employeeMapper;
@Resource
private ICcdiEmployeeImportService importAsyncService;
@Resource
private RedisTemplate<String, Object> redisTemplate;
/**
* 查询员工列表
*
* @param queryDTO 查询条件
* @return 员工VO集合
*/
@Override
public List<CcdiEmployeeVO> selectEmployeeList(CcdiEmployeeQueryDTO queryDTO) {
LambdaQueryWrapper<CcdiEmployee> wrapper = buildQueryWrapper(queryDTO);
List<CcdiEmployee> list = employeeMapper.selectList(wrapper);
List<CcdiEmployeeVO> voList = new ArrayList<>();
for (CcdiEmployee employee : list) {
voList.add(convertToVO(employee));
}
return voList;
}
/**
* 分页查询员工列表
*
* @param page 分页对象
* @param queryDTO 查询条件
* @return 员工VO分页结果
*/
@Override
public Page<CcdiEmployeeVO> selectEmployeePage(Page<CcdiEmployeeVO> page, CcdiEmployeeQueryDTO queryDTO) {
// 使用关联查询获取部门名称
Page<CcdiEmployeeVO> voPage = new Page<>(page.getCurrent(), page.getSize());
Page<CcdiEmployeeVO> resultPage = employeeMapper.selectEmployeePageWithDept(voPage, queryDTO);
// 设置状态描述
resultPage.getRecords().forEach(vo ->
vo.setStatusDesc(EmployeeStatus.getDescByCode(vo.getStatus()))
);
return resultPage;
}
/**
* 查询员工列表(用于导出)
*
* @param queryDTO 查询条件
* @return 员工Excel实体集合
*/
@Override
public List<CcdiEmployeeExcel> selectEmployeeListForExport(CcdiEmployeeQueryDTO queryDTO) {
LambdaQueryWrapper<CcdiEmployee> wrapper = buildQueryWrapper(queryDTO);
List<CcdiEmployee> list = employeeMapper.selectList(wrapper);
return list.stream().map(employee -> {
CcdiEmployeeExcel excel = new CcdiEmployeeExcel();
BeanUtils.copyProperties(employee, excel);
return excel;
}).toList();
}
/**
* 查询员工详情
*
* @param employeeId 员工ID
* @return 员工VO
*/
@Override
public CcdiEmployeeVO selectEmployeeById(Long employeeId) {
CcdiEmployee employee = employeeMapper.selectById(employeeId);
return convertToVO(employee);
}
/**
* 新增员工
*
* @param addDTO 新增DTO
* @return 结果
*/
@Override
@Transactional
public int insertEmployee(CcdiEmployeeAddDTO addDTO) {
// 检查柜员号(employeeId)唯一性
if (employeeMapper.selectById(addDTO.getEmployeeId()) != null) {
throw new RuntimeException("该柜员号已存在");
}
// 检查身份证号唯一性
LambdaQueryWrapper<CcdiEmployee> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CcdiEmployee::getIdCard, addDTO.getIdCard());
if (employeeMapper.selectCount(wrapper) > 0) {
throw new RuntimeException("该身份证号已存在");
}
CcdiEmployee employee = new CcdiEmployee();
BeanUtils.copyProperties(addDTO, employee);
int result = employeeMapper.insert(employee);
return result;
}
/**
* 修改员工
*
* @param editDTO 编辑DTO
* @return 结果
*/
@Override
@Transactional
public int updateEmployee(CcdiEmployeeEditDTO editDTO) {
// 检查身份证号唯一性(排除自己)
if (StringUtils.isNotEmpty(editDTO.getIdCard())) {
LambdaQueryWrapper<CcdiEmployee> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CcdiEmployee::getIdCard, editDTO.getIdCard())
.ne(CcdiEmployee::getEmployeeId, editDTO.getEmployeeId());
if (employeeMapper.selectCount(wrapper) > 0) {
throw new RuntimeException("该身份证号已存在");
}
}
CcdiEmployee employee = new CcdiEmployee();
BeanUtils.copyProperties(editDTO, employee);
int result = employeeMapper.updateById(employee);
return result;
}
/**
* 批量删除员工
*
* @param employeeIds 需要删除的员工ID
* @return 结果
*/
@Override
@Transactional
public int deleteEmployeeByIds(Long[] employeeIds) {
return employeeMapper.deleteBatchIds(List.of(employeeIds));
}
/**
* 导入员工数据
*
* @param excelList Excel实体列表
* @param isUpdateSupport 是否更新支持
* @return 结果
*/
@Override
@Transactional
public String importEmployee(List<CcdiEmployeeExcel> excelList, Boolean isUpdateSupport) {
String taskId = UUID.randomUUID().toString();
long startTime = System.currentTimeMillis();
// 初始化Redis状态
String statusKey = "import:employee:" + taskId;
Map<String, Object> statusData = new HashMap<>();
statusData.put("taskId", taskId);
statusData.put("status", "PROCESSING");
statusData.put("totalCount", excelList.size());
statusData.put("successCount", 0);
statusData.put("failureCount", 0);
statusData.put("progress", 0);
statusData.put("startTime", startTime);
statusData.put("message", "正在处理...");
redisTemplate.opsForHash().putAll(statusKey, statusData);
redisTemplate.expire(statusKey, 7, TimeUnit.DAYS);
importAsyncService.importEmployeeAsync(excelList, isUpdateSupport, taskId);
return taskId;
}
/**
* 构建查询条件
*/
private LambdaQueryWrapper<CcdiEmployee> buildQueryWrapper(CcdiEmployeeQueryDTO queryDTO) {
LambdaQueryWrapper<CcdiEmployee> wrapper = new LambdaQueryWrapper<>();
wrapper.like(StringUtils.isNotEmpty(queryDTO.getName()), CcdiEmployee::getName, queryDTO.getName())
.eq(queryDTO.getEmployeeId() != null, CcdiEmployee::getEmployeeId, queryDTO.getEmployeeId())
.eq(queryDTO.getDeptId() != null, CcdiEmployee::getDeptId, queryDTO.getDeptId())
.like(StringUtils.isNotEmpty(queryDTO.getIdCard()), CcdiEmployee::getIdCard, queryDTO.getIdCard())
.eq(StringUtils.isNotEmpty(queryDTO.getStatus()), CcdiEmployee::getStatus, queryDTO.getStatus())
.orderByDesc(CcdiEmployee::getCreateTime);
return wrapper;
}
/**
* 转换为VO对象
*/
public CcdiEmployeeVO convertToVO(CcdiEmployee employee) {
if (employee == null) {
return null;
}
CcdiEmployeeVO vo = new CcdiEmployeeVO();
BeanUtils.copyProperties(employee, vo);
vo.setStatusDesc(EmployeeStatus.getDescByCode(employee.getStatus()));
return vo;
}
}

View File

@@ -2,13 +2,12 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.ccdi.mapper.CcdiEmployeeMapper">
<mapper namespace="com.ruoyi.ccdi.mapper.CcdiBaseStaffMapper">
<!-- 员工基本信息ResultMap用于列表查询不包含亲属 -->
<resultMap type="com.ruoyi.ccdi.domain.vo.CcdiEmployeeVO" id="CcdiEmployeeVOResult">
<id property="employeeId" column="employee_id"/>
<resultMap type="com.ruoyi.ccdi.domain.vo.CcdiBaseStaffVO" id="CcdiBaseStaffVOResult">
<id property="staffId" column="staff_id"/>
<result property="name" column="name"/>
<result property="tellerNo" column="teller_no"/>
<result property="deptId" column="dept_id"/>
<result property="deptName" column="dept_name"/>
<result property="idCard" column="id_card"/>
@@ -18,18 +17,18 @@
<result property="createTime" column="create_time"/>
</resultMap>
<select id="selectEmployeePageWithDept" resultMap="CcdiEmployeeVOResult">
<select id="selectBaseStaffPageWithDept" resultMap="CcdiBaseStaffVOResult">
SELECT
e.employee_id, e.name, e.dept_id, e.id_card, e.phone, e.hire_date, e.status, e.create_time,
e.staff_id, e.name, e.dept_id, e.id_card, e.phone, e.hire_date, e.status, e.create_time,
d.dept_name
FROM ccdi_employee e
FROM ccdi_base_staff e
LEFT JOIN sys_dept d ON e.dept_id = d.dept_id
<where>
<if test="query.name != null and query.name != ''">
AND e.name LIKE CONCAT('%', #{query.name}, '%')
</if>
<if test="query.employeeId != null">
AND e.employee_id = #{query.employeeId}
<if test="query.staffId != null">
AND e.staff_id = #{query.staffId}
</if>
<if test="query.deptId != null">
AND e.dept_id = #{query.deptId}
@@ -46,12 +45,12 @@
<!-- 批量插入或更新员工信息只更新非null字段 -->
<insert id="insertOrUpdateBatch" parameterType="java.util.List">
INSERT INTO ccdi_employee
(employee_id, name, dept_id, id_card, phone, hire_date, status,
INSERT INTO ccdi_base_staff
(staff_id, name, dept_id, id_card, phone, hire_date, status,
create_time, create_by, update_by, update_time)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.employeeId}, #{item.name}, #{item.deptId}, #{item.idCard},
(#{item.staffId}, #{item.name}, #{item.deptId}, #{item.idCard},
#{item.phone}, #{item.hireDate}, #{item.status}, NOW(),
#{item.createBy}, #{item.updateBy}, NOW())
</foreach>
@@ -67,12 +66,12 @@
<!-- 批量插入员工信息 -->
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO ccdi_employee
(employee_id, name, dept_id, id_card, phone, hire_date, status,
INSERT INTO ccdi_base_staff
(staff_id, name, dept_id, id_card, phone, hire_date, status,
create_time, create_by, update_by, update_time)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.employeeId}, #{item.name}, #{item.deptId}, #{item.idCard},
(#{item.staffId}, #{item.name}, #{item.deptId}, #{item.idCard},
#{item.phone}, #{item.hireDate}, #{item.status}, NOW(),
#{item.createBy}, #{item.updateBy}, NOW())
</foreach>

View File

@@ -0,0 +1,149 @@
<?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.ruoyi.ccdi.mapper.CcdiStaffFmyRelationMapper">
<!-- 员工亲属关系信息ResultMap -->
<resultMap type="com.ruoyi.ccdi.domain.vo.CcdiStaffFmyRelationVO" id="CcdiStaffFmyRelationVOResult">
<id property="id" column="id"/>
<result property="personId" column="person_id"/>
<result property="relationType" column="relation_type"/>
<result property="relationName" column="relation_name"/>
<result property="gender" column="gender"/>
<result property="birthDate" column="birth_date"/>
<result property="relationCertType" column="relation_cert_type"/>
<result property="relationCertNo" column="relation_cert_no"/>
<result property="mobilePhone1" column="mobile_phone1"/>
<result property="mobilePhone2" column="mobile_phone2"/>
<result property="wechatNo1" column="wechat_no1"/>
<result property="wechatNo2" column="wechat_no2"/>
<result property="wechatNo3" column="wechat_no3"/>
<result property="contactAddress" column="contact_address"/>
<result property="relationDesc" column="relation_desc"/>
<result property="status" column="status"/>
<result property="effectiveDate" column="effective_date"/>
<result property="invalidDate" column="invalid_date"/>
<result property="remark" column="remark"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="createdBy" column="created_by"/>
<result property="updatedBy" column="updated_by"/>
</resultMap>
<!-- 分页查询员工亲属关系列表 -->
<select id="selectRelationPage" resultMap="CcdiStaffFmyRelationVOResult">
SELECT
id, person_id, relation_type, relation_name, gender,
DATE_FORMAT(birth_date, '%Y-%m-%d') as birth_date,
relation_cert_type, relation_cert_no,
mobile_phone1, mobile_phone2,
wechat_no1, wechat_no2, wechat_no3,
contact_address, relation_desc, status,
DATE_FORMAT(effective_date, '%Y-%m-%d %H:%i:%s') as effective_date,
DATE_FORMAT(invalid_date, '%Y-%m-%d %H:%i:%s') as invalid_date,
remark,
DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') as create_time,
DATE_FORMAT(update_time, '%Y-%m-%d %H:%i:%s') as update_time,
created_by, updated_by
FROM ccdi_staff_fmy_relation
<where>
<if test="query.personId != null and query.personId != ''">
AND person_id = #{query.personId}
</if>
<if test="query.relationName != null and query.relationName != ''">
AND relation_name LIKE CONCAT('%', #{query.relationName}, '%')
</if>
<if test="query.relationType != null and query.relationType != ''">
AND relation_type = #{query.relationType}
</if>
<if test="query.relationCertNo != null and query.relationCertNo != ''">
AND relation_cert_no LIKE CONCAT('%', #{query.relationCertNo}, '%')
</if>
<if test="query.status != null">
AND status = #{query.status}
</if>
</where>
ORDER BY create_time DESC
</select>
<!-- 查询员工亲属关系详情 -->
<select id="selectRelationById" resultMap="CcdiStaffFmyRelationVOResult">
SELECT
id, person_id, relation_type, relation_name, gender,
DATE_FORMAT(birth_date, '%Y-%m-%d') as birth_date,
relation_cert_type, relation_cert_no,
mobile_phone1, mobile_phone2,
wechat_no1, wechat_no2, wechat_no3,
contact_address, relation_desc, status,
DATE_FORMAT(effective_date, '%Y-%m-%d %H:%i:%s') as effective_date,
DATE_FORMAT(invalid_date, '%Y-%m-%d %H:%i:%s') as invalid_date,
remark,
DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') as create_time,
DATE_FORMAT(update_time, '%Y-%m-%d %H:%i:%s') as update_time,
created_by, updated_by
FROM ccdi_staff_fmy_relation
WHERE id = #{id}
</select>
<!-- 查询员工亲属关系列表(用于导出) -->
<select id="selectRelationListForExport" resultMap="CcdiStaffFmyRelationVOResult">
SELECT
id, person_id, relation_type, relation_name, gender,
DATE_FORMAT(birth_date, '%Y-%m-%d') as birth_date,
relation_cert_type, relation_cert_no,
mobile_phone1, mobile_phone2,
wechat_no1, wechat_no2, wechat_no3,
contact_address, relation_desc, status,
DATE_FORMAT(effective_date, '%Y-%m-%d %H:%i:%s') as effective_date,
DATE_FORMAT(invalid_date, '%Y-%m-%d %H:%i:%s') as invalid_date,
remark,
DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') as create_time,
DATE_FORMAT(update_time, '%Y-%m-%d %H:%i:%s') as update_time,
created_by, updated_by
FROM ccdi_staff_fmy_relation
<where>
<if test="query.personId != null and query.personId != ''">
AND person_id = #{query.personId}
</if>
<if test="query.relationName != null and query.relationName != ''">
AND relation_name LIKE CONCAT('%', #{query.relationName}, '%')
</if>
<if test="query.relationType != null and query.relationType != ''">
AND relation_type = #{query.relationType}
</if>
<if test="query.relationCertNo != null and query.relationCertNo != ''">
AND relation_cert_no LIKE CONCAT('%', #{query.relationCertNo}, '%')
</if>
<if test="query.status != null">
AND status = #{query.status}
</if>
</where>
ORDER BY create_time DESC
</select>
<!-- 批量插入员工亲属关系数据 -->
<insert id="insertBatch">
INSERT INTO ccdi_staff_fmy_relation
(person_id, relation_type, relation_name, gender, birth_date,
relation_cert_type, relation_cert_no,
mobile_phone1, mobile_phone2,
wechat_no1, wechat_no2, wechat_no3,
contact_address, relation_desc, status,
effective_date, invalid_date, remark,
data_source, is_emp_family, is_cust_family,
created_by, create_time, updated_by, update_time)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.personId}, #{item.relationType}, #{item.relationName}, #{item.gender}, #{item.birthDate},
#{item.relationCertType}, #{item.relationCertNo},
#{item.mobilePhone1}, #{item.mobilePhone2},
#{item.wechatNo1}, #{item.wechatNo2}, #{item.wechatNo3},
#{item.contactAddress}, #{item.relationDesc}, #{item.status},
#{item.effectiveDate}, #{item.invalidDate}, #{item.remark},
#{item.dataSource}, #{item.isEmpFamily}, #{item.isCustFamily},
#{item.createdBy}, NOW(), #{item.updatedBy}, NOW())
</foreach>
</insert>
</mapper>