企业管理-员工信息
This commit is contained in:
parent
5be2781ce1
commit
3d4d5d1c2a
@ -23,4 +23,12 @@ public class BaseConstants {
|
||||
public static final String PASSWORD_DEFAULT = "123456";
|
||||
/**租户下部门名称*/
|
||||
public static final String DEPT_NAME_CORP_NAME = "政企客户";
|
||||
/**企业管理-员工管理表名称*/
|
||||
public static final String COMPANY_STAFF = "company_staff";
|
||||
/**员工标识*/
|
||||
public static final String COMPANY_SING_STAFF = "staff";
|
||||
/** 标签默认外观 */
|
||||
public static final String LABEL_TYPE = "default";
|
||||
/** 唯一推广码生成长度 */
|
||||
public static final Integer UNIQUE_CODE_LEN = 6;
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
package cn.iocoder.yudao.common;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
import cn.iocoder.yudao.module.system.enums.ErrorCodeConstants;
|
||||
|
||||
public interface CommonErrorCodeConstants extends ErrorCodeConstants {
|
||||
|
||||
/** 企业管理-员工管理 */
|
||||
ErrorCode UNIQUE_CODE_CREATE_REPEAT = new ErrorCode(2_002_000_000, "唯一推广码生成失败");
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
package cn.iocoder.yudao.module.company.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.label.entity.Label;
|
||||
import cn.iocoder.yudao.module.label.service.LabelService;
|
||||
import cn.iocoder.yudao.module.company.entity.CompanyStaff;
|
||||
import cn.iocoder.yudao.module.company.mapper.CompanyStaffMapper;
|
||||
import cn.iocoder.yudao.module.company.service.CompanyStaffService;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyStaffReqVO;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyStaffRespVO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业管理-员工信息表 服务实现类
|
||||
* @author 小李
|
||||
* @date 16:29 2024/8/6
|
||||
**/
|
||||
@Service
|
||||
public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, CompanyStaff> implements CompanyStaffService {
|
||||
|
||||
@Resource
|
||||
private CompanyStaffMapper staffMapper;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Resource
|
||||
private LabelService labelService;
|
||||
/**
|
||||
* 获得企业管理-员工信息表分页
|
||||
* @author 小李
|
||||
* @date 17:11 2024/8/6
|
||||
* @param pageReqVO 分页查询
|
||||
* @param page 分页对象
|
||||
**/
|
||||
@Override
|
||||
public IPage<CompanyStaff> queryListPage(CompanyStaffReqVO pageReqVO, Page<CompanyStaff> page) {
|
||||
return staffMapper.selectListPage(pageReqVO, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增企业管理-员工管理信息
|
||||
* @author 小李
|
||||
* @date 13:57 2024/8/7
|
||||
* @param staffRespVO 员工对象
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void saveStaff(CompanyStaffRespVO staffRespVO) {
|
||||
// 获取当前登录用户的信息
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
AdminUserRespDTO user = adminUserApi.getUser(loginUser.getId());
|
||||
// 创建UserDTO用于给sys_user插入数据
|
||||
UserDTO userDTO = new UserDTO();
|
||||
userDTO.setUsername(staffRespVO.getLoginAccount());
|
||||
userDTO.setPassword(staffRespVO.getPassword());
|
||||
userDTO.setNickname(staffRespVO.getName());
|
||||
userDTO.setDeptId(user.getDeptId());
|
||||
userDTO.setMobile(staffRespVO.getTel());
|
||||
adminUserApi.createUser(userDTO);
|
||||
// 获取sys_users中刚插入记录ID
|
||||
Long id = userDTO.getId();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStaff(CompanyStaffRespVO staffRespVO) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteStaff(String id) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前功能的标签
|
||||
* @author 小李
|
||||
* @date 14:59 2024/8/7
|
||||
**/
|
||||
@Override
|
||||
public List<Label> getLabels(){
|
||||
return labelService.list(new QueryWrapper<Label>());
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package cn.iocoder.yudao.module.company.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.company.entity.CompanyStaff;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 员工查询VO
|
||||
* @author 小李
|
||||
* @date 16:49 2024/8/6
|
||||
**/
|
||||
@Data
|
||||
public class CompanyStaffReqVO extends CompanyStaff {
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package cn.iocoder.yudao.module.staff.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
|
||||
import cn.iocoder.yudao.module.staff.service.CompanyStaffChangeService;
|
||||
import cn.iocoder.yudao.module.staff.vo.CompanyStaffChangeRespVO;
|
||||
import cn.iocoder.yudao.module.staff.vo.CompanyStaffRespVO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 企业管理-员工交接记录 控制层
|
||||
* @author 小李
|
||||
* @date 16:19 2024/8/8
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping("/company/staffChange")
|
||||
@Tag(name = "管理后台 - 企业管理 - 员工交接")
|
||||
@Validated
|
||||
public class CompanyStaffChangeController {
|
||||
|
||||
@Resource
|
||||
private CompanyStaffChangeService staffChangeService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建企业管理-员工交接表信息")
|
||||
@PreAuthorize("@ss.hasPermission('company:staff:change')")
|
||||
public CommonResult<String> createStaffChange(@RequestBody CompanyStaffChangeRespVO staffChangeRespVO){
|
||||
staffChangeService.createChangeStaff(staffChangeRespVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询交接双方信息
|
||||
* @author 小李
|
||||
* @date 18:26 2024/8/8
|
||||
* @param id 接收方员工ID
|
||||
**/
|
||||
@GetMapping("/changeItem")
|
||||
@Operation(summary = "查询企业管理-员工交接表信息及交接双方")
|
||||
@PreAuthorize("@ss.hasPermission('company:staff:query')")
|
||||
public CommonResult<CompanyStaffChangeRespVO> getChangeStaff(@RequestParam("id") String id){
|
||||
return success(staffChangeService.getChangeStaff(id));
|
||||
}
|
||||
}
|
@ -1,21 +1,20 @@
|
||||
package cn.iocoder.yudao.module.company.controller.admin;
|
||||
package cn.iocoder.yudao.module.staff.controller.admin;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.label.entity.Label;
|
||||
import cn.iocoder.yudao.module.company.entity.CompanyStaff;
|
||||
import cn.iocoder.yudao.module.company.service.CompanyStaffService;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyStaffReqVO;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyStaffRespVO;
|
||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
|
||||
import cn.iocoder.yudao.module.staff.service.CompanyStaffService;
|
||||
import cn.iocoder.yudao.module.staff.vo.CompanyStaffReqVO;
|
||||
import cn.iocoder.yudao.module.staff.vo.CompanyStaffRespVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -23,7 +22,6 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -56,7 +54,7 @@ public class CompanyStaffController {
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得企业管理-员工信息表信息分页")
|
||||
@PreAuthorize("@ss.hasPermission('company:staff:query')")
|
||||
public CommonResult<IPage<?>> getCompanyPage(CompanyStaffReqVO pageReqVO,
|
||||
public CommonResult<IPage<?>> getCompanyStaffPage(CompanyStaffReqVO pageReqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<CompanyStaff> page = new Page<>(pageNo, pageSize);
|
||||
@ -72,7 +70,7 @@ public class CompanyStaffController {
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建企业管理-员工信息表信息")
|
||||
@PreAuthorize("@ss.hasPermission('company:staff:create')")
|
||||
public CommonResult<String> createCompany(@RequestBody CompanyStaffRespVO staffRespVO) {
|
||||
public CommonResult<String> createCompanyStaff(@RequestBody CompanyStaffRespVO staffRespVO) {
|
||||
staffService.saveStaff(staffRespVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
@ -86,7 +84,7 @@ public class CompanyStaffController {
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新企业管理-员工信息表信息")
|
||||
@PreAuthorize("@ss.hasPermission('company:staff:update')")
|
||||
public CommonResult<Boolean> updateCompany(@RequestBody CompanyStaffRespVO staffRespVO) {
|
||||
public CommonResult<Boolean> updateCompanyStaff(@RequestBody CompanyStaffRespVO staffRespVO) {
|
||||
staffService.updateStaff(staffRespVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
@ -101,7 +99,7 @@ public class CompanyStaffController {
|
||||
@Operation(summary = "删除企业管理-员工信息表信息")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('company:staff:delete')")
|
||||
public CommonResult<Boolean> deleteCompany(@RequestParam("id") String id) {
|
||||
public CommonResult<Boolean> deleteCompanyStaff(@RequestParam("id") String id) {
|
||||
staffService.deleteStaff(id);
|
||||
return success(true);
|
||||
}
|
||||
@ -116,12 +114,8 @@ public class CompanyStaffController {
|
||||
@Operation(summary = "获得企业管理-员工信息表信息")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('company:staff:query')")
|
||||
public CommonResult<CompanyStaffRespVO> getCompany(@RequestParam("id") String id) {
|
||||
CompanyStaff staff = staffService.getById(id);
|
||||
CompanyStaffRespVO staffRespVO = BeanUtils.toBean(staff, CompanyStaffRespVO.class);
|
||||
if(StringUtils.isNotEmpty(staffRespVO.getFileIds())){
|
||||
staffRespVO.setFileIdArray(Arrays.asList(staff.getFileIds().split(StrUtil.COMMA)));
|
||||
}
|
||||
public CommonResult<CompanyStaffRespVO> getCompanyStaff(@RequestParam("id") String id) {
|
||||
CompanyStaffRespVO staffRespVO = staffService.getCompanyStaffById(id);
|
||||
return success(staffRespVO);
|
||||
}
|
||||
|
||||
@ -136,7 +130,7 @@ public class CompanyStaffController {
|
||||
@Operation(summary = "导出企业管理-员工信息表 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('company:staff:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportCompanyExcel(CompanyStaffReqVO pageReqVO,
|
||||
public void exportCompanyStaffExcel(CompanyStaffReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<CompanyStaff> list = staffService.list();
|
||||
// 导出 Excel
|
||||
@ -156,4 +150,15 @@ public class CompanyStaffController {
|
||||
public CommonResult<List<Label>> getLabels(){
|
||||
return success(staffService.getLabels());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录用户部门下所有员工信息
|
||||
* @author 小李
|
||||
* @date 15:54 2024/8/8
|
||||
**/
|
||||
@GetMapping("/list")
|
||||
public CommonResult<List<CompanyStaff>> getStaffList(){
|
||||
return success(staffService.getStaffList());
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.module.company.entity;
|
||||
package cn.iocoder.yudao.module.staff.entity;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
@ -7,8 +7,10 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@ -24,7 +26,7 @@ import java.util.Date;
|
||||
@ExcelIgnoreUnannotated
|
||||
public class CompanyStaff extends TenantBaseDO {
|
||||
/** 主键标识 */
|
||||
@TableId(type = IdType.INPUT)
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
/** 企业id(base_company表中的id) */
|
||||
@ -57,6 +59,8 @@ public class CompanyStaff extends TenantBaseDO {
|
||||
private String address;
|
||||
|
||||
/** 工作日期 */
|
||||
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ExcelProperty("工作日期")
|
||||
private Date workDate;
|
||||
|
||||
@ -65,6 +69,8 @@ public class CompanyStaff extends TenantBaseDO {
|
||||
private BigDecimal workYear;
|
||||
|
||||
/** 入职日期 */
|
||||
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ExcelProperty("入职日期")
|
||||
private Date joinedDate;
|
||||
|
||||
@ -84,6 +90,6 @@ public class CompanyStaff extends TenantBaseDO {
|
||||
@ExcelProperty("唯一推广码")
|
||||
private String uniqueCode;
|
||||
|
||||
/** 附件ids(infra_file表中的id,多个英文逗号拼接) */
|
||||
private String fileIds;
|
||||
/** 附件urls(infra_file表中的url,多个英文逗号拼接) */
|
||||
private String fileUrls;
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.staff.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 企业管理-员工交接记录
|
||||
* @author 小李
|
||||
* @date 15:33 2024/8/8
|
||||
**/
|
||||
@TableName("company_staff_change")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CompanyStaffChange extends TenantBaseDO {
|
||||
/** 主键标识 */
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
/** 原用户id(system_users表的id) */
|
||||
private Long oldUserId;
|
||||
|
||||
/** 新用户id(system_users表的id) */
|
||||
private Long newUserId;
|
||||
|
||||
/** 交接时间 */
|
||||
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private Date changeTime;
|
||||
|
||||
/** 附件urls(infra_file表中的url,多个英文逗号拼接) */
|
||||
private String fileUrls;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.staff.entity;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 唯一推广码使用记录表
|
||||
* @author 小李
|
||||
* @date 9:53 2024/8/8
|
||||
**/
|
||||
|
||||
@TableName("unique_code")
|
||||
@Data
|
||||
public class UniqueCode {
|
||||
|
||||
/** 唯一推广码(须保证全平台唯一,规则:字母+数字;字母全大写) */
|
||||
private String uniqueCode;
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.staff.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaffChange;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 企业管理-员工交接记录
|
||||
* @author 小李
|
||||
* @date 15:38 2024/8/8
|
||||
**/
|
||||
@Mapper
|
||||
public interface CompanyStaffChangeMapper extends BaseMapper<CompanyStaffChange> {
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package cn.iocoder.yudao.module.company.mapper;
|
||||
package cn.iocoder.yudao.module.staff.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.company.entity.CompanyStaff;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyStaffReqVO;
|
||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
|
||||
import cn.iocoder.yudao.module.staff.vo.CompanyStaffReqVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.staff.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.staff.entity.UniqueCode;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 唯一推广码使用记录表
|
||||
* @author 小李
|
||||
* @date 9:56 2024/8/8
|
||||
**/
|
||||
@Mapper
|
||||
public interface UniqueCodeMapper extends BaseMapper<UniqueCode> {
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.staff.service;
|
||||
|
||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaffChange;
|
||||
import cn.iocoder.yudao.module.staff.vo.CompanyStaffChangeRespVO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业管理-员工交接记录 接口
|
||||
* @author 小李
|
||||
* @date 15:40 2024/8/8
|
||||
**/
|
||||
public interface CompanyStaffChangeService extends IService<CompanyStaffChange> {
|
||||
|
||||
/**
|
||||
* 创建交接记录
|
||||
* @author 小李
|
||||
* @date 16:15 2024/8/8
|
||||
* @param staffChangeRespVO
|
||||
**/
|
||||
void createChangeStaff(CompanyStaffChangeRespVO staffChangeRespVO);
|
||||
|
||||
/**
|
||||
* 查询交接双方信息
|
||||
* @author 小李
|
||||
* @date 18:26 2024/8/8
|
||||
* @param id 接收方员工ID
|
||||
**/
|
||||
CompanyStaffChangeRespVO getChangeStaff(String id);
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package cn.iocoder.yudao.module.company.service;
|
||||
package cn.iocoder.yudao.module.staff.service;
|
||||
|
||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
|
||||
import cn.iocoder.yudao.module.label.entity.Label;
|
||||
import cn.iocoder.yudao.module.company.entity.CompanyStaff;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyStaffReqVO;
|
||||
import cn.iocoder.yudao.module.company.vo.CompanyStaffRespVO;
|
||||
import cn.iocoder.yudao.module.staff.vo.CompanyStaffReqVO;
|
||||
import cn.iocoder.yudao.module.staff.vo.CompanyStaffRespVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@ -56,4 +56,19 @@ public interface CompanyStaffService extends IService<CompanyStaff> {
|
||||
* @date 14:59 2024/8/7
|
||||
**/
|
||||
List<Label> getLabels();
|
||||
|
||||
/**
|
||||
* 查询员工
|
||||
* @author 小李
|
||||
* @date 17:59 2024/8/6
|
||||
* @param id
|
||||
**/
|
||||
CompanyStaffRespVO getCompanyStaffById(String id);
|
||||
|
||||
/**
|
||||
* 获取当前登录用户部门下所有员工信息
|
||||
* @author 小李
|
||||
* @date 15:54 2024/8/8
|
||||
**/
|
||||
List<CompanyStaff> getStaffList();
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.staff.service;
|
||||
|
||||
import cn.iocoder.yudao.module.staff.entity.UniqueCode;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 唯一推广码使用记录表 服务
|
||||
* @author 小李
|
||||
* @date 9:58 2024/8/8
|
||||
**/
|
||||
public interface UniqueCodeService extends IService<UniqueCode> {
|
||||
|
||||
/**
|
||||
* 新增唯一推广码
|
||||
* @author 小李
|
||||
* @date 9:59 2024/8/8
|
||||
* @param uniqueCode
|
||||
*
|
||||
* @return*/
|
||||
int insertUniqueCode(String uniqueCode);
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package cn.iocoder.yudao.module.staff.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
|
||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaffChange;
|
||||
import cn.iocoder.yudao.module.staff.mapper.CompanyStaffChangeMapper;
|
||||
import cn.iocoder.yudao.module.staff.service.CompanyStaffChangeService;
|
||||
import cn.iocoder.yudao.module.staff.service.CompanyStaffService;
|
||||
import cn.iocoder.yudao.module.staff.vo.CompanyStaffChangeRespVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 企业管理-员工交接记录 接口实现类
|
||||
* @author 小李
|
||||
* @date 15:40 2024/8/8
|
||||
**/
|
||||
@Service
|
||||
public class CompanyStaffChangeServiceImpl extends ServiceImpl<CompanyStaffChangeMapper, CompanyStaffChange> implements CompanyStaffChangeService {
|
||||
|
||||
@Resource
|
||||
private CompanyStaffService staffService;
|
||||
|
||||
/**
|
||||
* 创建交接记录
|
||||
* @author 小李
|
||||
* @date 16:15 2024/8/8
|
||||
* @param staffChangeRespVO
|
||||
**/
|
||||
public void createChangeStaff(CompanyStaffChangeRespVO staffChangeRespVO){
|
||||
baseMapper.insert(staffChangeRespVO);
|
||||
// TODO 交接工作记录待完成
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询交接双方信息
|
||||
* @author 小李
|
||||
* @date 18:26 2024/8/8
|
||||
* @param id 接收方员工ID
|
||||
**/
|
||||
@Override
|
||||
public CompanyStaffChangeRespVO getChangeStaff(String id){
|
||||
/** 构造返回对象 */
|
||||
CompanyStaffChangeRespVO result = null;
|
||||
// 1 根据当前ID获取员工记录
|
||||
CompanyStaff newStaff = staffService.getOne(new QueryWrapper<CompanyStaff>().eq("id", id));
|
||||
// 2 根据获取的员工信息中的userId获取交接记录
|
||||
CompanyStaffChange staffChange = baseMapper.selectOne(new QueryWrapper<CompanyStaffChange>().eq("new_user_id", newStaff.getUserId()));
|
||||
if (ObjectUtil.isNotEmpty(staffChange)){
|
||||
result = new CompanyStaffChangeRespVO();
|
||||
BeanUtil.copyProperties(staffChange, result);
|
||||
// 3 根据交接记录中老员工的userId查老员工信息
|
||||
CompanyStaff oldStaff = staffService.getOne(new QueryWrapper<CompanyStaff>().eq("user_id", staffChange.getOldUserId()));
|
||||
result.setNewStaff(newStaff);
|
||||
result.setOldStaff(oldStaff);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,350 @@
|
||||
package cn.iocoder.yudao.module.staff.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.iocoder.yudao.common.BaseConstants;
|
||||
import cn.iocoder.yudao.common.CommonErrorCodeConstants;
|
||||
import cn.iocoder.yudao.framework.common.util.io.FileUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.company.entity.Company;
|
||||
import cn.iocoder.yudao.module.company.service.CompanyService;
|
||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||
import cn.iocoder.yudao.module.staff.entity.UniqueCode;
|
||||
import cn.iocoder.yudao.module.staff.service.UniqueCodeService;
|
||||
import cn.iocoder.yudao.module.label.entity.BusiLabel;
|
||||
import cn.iocoder.yudao.module.label.entity.Label;
|
||||
import cn.iocoder.yudao.module.label.service.BusiLabelService;
|
||||
import cn.iocoder.yudao.module.label.service.LabelService;
|
||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
|
||||
import cn.iocoder.yudao.module.staff.mapper.CompanyStaffMapper;
|
||||
import cn.iocoder.yudao.module.staff.service.CompanyStaffService;
|
||||
import cn.iocoder.yudao.module.staff.vo.CompanyStaffReqVO;
|
||||
import cn.iocoder.yudao.module.staff.vo.CompanyStaffRespVO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* 企业管理-员工信息表 服务实现类
|
||||
*
|
||||
* @author 小李
|
||||
* @date 16:29 2024/8/6
|
||||
**/
|
||||
@Service
|
||||
public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, CompanyStaff> implements CompanyStaffService {
|
||||
|
||||
@Resource
|
||||
private CompanyStaffMapper staffMapper;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Resource
|
||||
private LabelService labelService;
|
||||
|
||||
@Resource
|
||||
private CompanyService companyService;
|
||||
|
||||
@Resource
|
||||
private BusiLabelService busiLabelService;
|
||||
|
||||
@Resource
|
||||
private UniqueCodeService uniqueCodeService;
|
||||
|
||||
/**
|
||||
* 获得企业管理-员工信息表分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @param page 分页对象
|
||||
* @author 小李
|
||||
* @date 17:11 2024/8/6
|
||||
**/
|
||||
@Override
|
||||
public IPage<CompanyStaff> queryListPage(CompanyStaffReqVO pageReqVO, Page<CompanyStaff> page) {
|
||||
return staffMapper.selectListPage(pageReqVO, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增企业管理-员工管理信息
|
||||
*
|
||||
* @param staffRespVO 员工对象
|
||||
* @author 小李
|
||||
* @date 13:57 2024/8/7
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void saveStaff(CompanyStaffRespVO staffRespVO) {
|
||||
/** 获取当前登录用户的信息 */
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
AdminUserRespDTO user = adminUserApi.getUser(loginUser.getId());
|
||||
|
||||
/** 创建UserDTO用于给sys_user插入数据 */
|
||||
UserDTO userDTO = new UserDTO();
|
||||
userDTO.setUsername(staffRespVO.getLoginAccount());
|
||||
userDTO.setPassword(staffRespVO.getPassword());
|
||||
userDTO.setNickname(staffRespVO.getName());
|
||||
userDTO.setDeptId(user.getDeptId());
|
||||
userDTO.setMobile(staffRespVO.getTel());
|
||||
// 获取sys_users中刚插入记录ID给准备添加的员工
|
||||
Long userId = adminUserApi.createUser(userDTO);
|
||||
staffRespVO.setUserId(userId);
|
||||
// 设置新增员工部门
|
||||
staffRespVO.setDeptId(user.getDeptId());
|
||||
|
||||
/** 插入标签库 */
|
||||
if (ObjectUtil.isNotEmpty(staffRespVO.getLabelsArray())) {
|
||||
// 1 获取标签库中的存在的数据
|
||||
List<Label> labels = getLabelsByLabelName(staffRespVO.getLabelsArray());
|
||||
// 2 如果有标签库中没有的数据,就添加到标签库
|
||||
if (labels.size() < staffRespVO.getLabelsArray().size()) {
|
||||
// 2.1 所有存在的标签的LabelName
|
||||
List<String> names = labels.stream().map(Label::getLabelName).collect(Collectors.toList());
|
||||
// 2.2 获取新的标签的名称
|
||||
List<String> newNames = staffRespVO.getLabelsArray().stream().filter(item -> !names.contains(item)).collect(Collectors.toList());
|
||||
// 2.3 构建新标签对象批量插入
|
||||
List<Label> newLabels = createLabels(newNames);
|
||||
labelService.saveBatch(newLabels);
|
||||
}
|
||||
}
|
||||
|
||||
/** 插入员工库 */
|
||||
// 1 获取当前登录用户的企业信息给添加的员工
|
||||
Company company = companyService.getOne(new QueryWrapper<Company>().eq("mobile_phone", user.getMobile()));
|
||||
staffRespVO.setCorpId(company.getId());
|
||||
// 2 生成唯一推广码
|
||||
int count = 0;
|
||||
// 3 生成时判断是否重复,重复就重新生成,最多生成6次
|
||||
while (true) {
|
||||
// 重复生成和长度一样的次数还是重复,就抛异常
|
||||
if (count == BaseConstants.UNIQUE_CODE_LEN) {
|
||||
throw exception(CommonErrorCodeConstants.UNIQUE_CODE_CREATE_REPEAT);
|
||||
}
|
||||
String code = RandomUtil.randomStringUpper(BaseConstants.UNIQUE_CODE_LEN);
|
||||
// 直接新增唯一推码 新增成功就是可以用,反之就是重复
|
||||
int flag = uniqueCodeService.insertUniqueCode(code);
|
||||
if (flag != 0) {
|
||||
staffRespVO.setUniqueCode(code);
|
||||
break;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
// 3 保存员工信息到数据库
|
||||
this.save(staffRespVO);
|
||||
|
||||
/** 插入标签到业务标签表 */
|
||||
if (ObjectUtil.isNotEmpty(staffRespVO.getLabelsArray())) {
|
||||
// 1 获取所有标签信息
|
||||
List<Label> labels = getLabelsByLabelName(staffRespVO.getLabelsArray());
|
||||
// 构建业务标签对象批量插入
|
||||
List<BusiLabel> busiLabels = createBusiLabels(labels, staffRespVO.getId());
|
||||
busiLabelService.saveBatch(busiLabels);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新员工信息
|
||||
*
|
||||
* @param staffRespVO 员工对象
|
||||
* @author 小李
|
||||
* @date 11:06 2024/8/8
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void updateStaff(CompanyStaffRespVO staffRespVO) {
|
||||
/** 修改标签 */
|
||||
if (ObjectUtil.isNotEmpty(staffRespVO.getLabelsArray())) {
|
||||
/** 检查是否需要新增标签 */
|
||||
// 1 获取标签
|
||||
List<Label> labels = getLabelsByLabelName(staffRespVO.getLabelsArray());
|
||||
List<String> oldLabelNames = labels.stream().map(item -> item.getLabelName()).collect(Collectors.toList());
|
||||
List<String> newLabelNames = staffRespVO.getLabelsArray().stream().filter(item -> !oldLabelNames.contains(item)).collect(Collectors.toList());
|
||||
// 2 如果有,就新增标签
|
||||
if (ObjectUtil.isNotEmpty(newLabelNames)) {
|
||||
// 2.1 获取需要新增的标签名新增标签
|
||||
List<Label> newLabels = createLabels(newLabelNames);
|
||||
labelService.saveBatch(newLabels);
|
||||
}
|
||||
|
||||
/** 检查是否需要更新业务标签 */
|
||||
// 1 获取业务标签表中旧数据
|
||||
List<BusiLabel> busiLabels = getBusiLabelsByMainId(staffRespVO.getId());
|
||||
// 2 检查是否需要更新数据, 如果有就更新
|
||||
List<BusiLabel> oldBusiLabels = busiLabels.stream().filter(item -> !staffRespVO.getLabelsArray().contains(item.getLabelName())).collect(Collectors.toList());
|
||||
List<String> oldBusiLabelNames = oldBusiLabels.stream().map(item -> item.getLabelName()).collect(Collectors.toList());
|
||||
List<String> busiLabelNames = busiLabels.stream().map(item -> item.getLabelName()).collect(Collectors.toList());
|
||||
List<String> newBusiLabelNames = staffRespVO.getLabelsArray().stream().filter(item -> !busiLabelNames.contains(item)).collect(Collectors.toList());
|
||||
// 2.1 是否要需要删除
|
||||
if (ObjectUtil.isNotEmpty(oldBusiLabelNames)) {
|
||||
// 删除需要更新的旧数据
|
||||
busiLabelService.removeBatchByIds(oldBusiLabels);
|
||||
}
|
||||
// 2.2 是否需要新增业务标签
|
||||
if (ObjectUtil.isNotEmpty(newBusiLabelNames)) {
|
||||
// 构建新数据,新增
|
||||
List<Label> newLabel = getLabelsByLabelName(newBusiLabelNames);
|
||||
List<BusiLabel> newBusiLabel = createBusiLabels(newLabel, staffRespVO.getId());
|
||||
busiLabelService.saveBatch(newBusiLabel);
|
||||
}
|
||||
}
|
||||
|
||||
/** 修改员工表 */
|
||||
baseMapper.updateById(staffRespVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除员工
|
||||
*
|
||||
* @param id 员工ID
|
||||
* @author 小李
|
||||
* @date 10:42 2024/8/8
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void deleteStaff(String id) {
|
||||
/** 获取删除记录详细信息 */
|
||||
CompanyStaff staff = baseMapper.selectById(id);
|
||||
|
||||
/** 删除sys_users记录 */
|
||||
adminUserApi.deleteUser(staff.getUserId());
|
||||
|
||||
/** 删除业务标签表记录 */
|
||||
busiLabelService.remove(new QueryWrapper<BusiLabel>().eq("main_id", staff.getId()));
|
||||
|
||||
/** 删除唯一推广码表记录 */
|
||||
uniqueCodeService.remove(new QueryWrapper<UniqueCode>().eq("unique_code", staff.getUniqueCode()));
|
||||
|
||||
/** 删除员工表记录 */
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询员工
|
||||
*
|
||||
* @param id
|
||||
* @author 小李
|
||||
* @date 17:59 2024/8/6
|
||||
**/
|
||||
@Override
|
||||
public CompanyStaffRespVO getCompanyStaffById(String id) {
|
||||
// 获取修改员工的详细信息
|
||||
CompanyStaff staff = baseMapper.selectById(id);
|
||||
// 构建员工响应对象
|
||||
CompanyStaffRespVO staffRespVO = BeanUtil.toBean(staff, CompanyStaffRespVO.class);
|
||||
// 查询业务标签表中属于员工的标签
|
||||
List<BusiLabel> busiLabels = busiLabelService.list(new QueryWrapper<BusiLabel>().eq("main_id", staff.getId()));
|
||||
// 取出标签名给员工响应对象
|
||||
if (ObjectUtil.isNotEmpty(busiLabels)) {
|
||||
List<String> labelsArray = busiLabels.stream().map(item -> item.getLabelName()).collect(Collectors.toList());
|
||||
staffRespVO.setLabelsArray(labelsArray);
|
||||
}
|
||||
return staffRespVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前功能的标签
|
||||
*
|
||||
* @author 小李
|
||||
* @date 14:59 2024/8/7
|
||||
**/
|
||||
@Override
|
||||
public List<Label> getLabels() {
|
||||
return labelService.list(new QueryWrapper<Label>().eq("system_code", BaseConstants.COMPANY_STAFF));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据标签名集合获取标签
|
||||
*
|
||||
* @param labelNames 标签名集合
|
||||
* @author 小李
|
||||
* @date 11:48 2024/8/8
|
||||
**/
|
||||
private List<Label> getLabelsByLabelName(List<String> labelNames) {
|
||||
return labelService.list(new LambdaQueryWrapper<Label>().and(item -> {
|
||||
item.in(Label::getLabelName, labelNames).eq(Label::getSystemCode, BaseConstants.COMPANY_STAFF);
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据员工ID获取业务标签
|
||||
*
|
||||
* @param mainId 员工ID
|
||||
* @author 小李
|
||||
* @date 11:48 2024/8/8
|
||||
**/
|
||||
private List<BusiLabel> getBusiLabelsByMainId(String mainId) {
|
||||
return busiLabelService.list(new QueryWrapper<BusiLabel>().eq("main_id", mainId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据标签名信息创建标签
|
||||
*
|
||||
* @param names 标签名集合
|
||||
* @author 小李
|
||||
* @date 11:52 2024/8/8
|
||||
**/
|
||||
private List<Label> createLabels(List<String> names) {
|
||||
return names.stream().map(item -> {
|
||||
Label label = new Label();
|
||||
label.setLabelName(item);
|
||||
label.setType(BaseConstants.COMPANY_SING_STAFF);
|
||||
label.setLabelDesc(BaseConstants.COMPANY_SING_STAFF);
|
||||
label.setLabelType(BaseConstants.LABEL_TYPE);
|
||||
label.setSystemCode(BaseConstants.COMPANY_STAFF);
|
||||
return label;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据标签信息创建业务标签
|
||||
*
|
||||
* @param labels 标签名集合
|
||||
* @param id 员工ID
|
||||
* @author 小李
|
||||
* @date 11:52 2024/8/8
|
||||
**/
|
||||
private List<BusiLabel> createBusiLabels(List<Label> labels, String id) {
|
||||
return labels.stream().map(item -> {
|
||||
BusiLabel label = new BusiLabel();
|
||||
label.setMainTable(BaseConstants.COMPANY_STAFF);
|
||||
label.setMainId(id);
|
||||
label.setLabelId(item.getId());
|
||||
label.setLabelType(item.getLabelType());
|
||||
label.setLabelName(item.getLabelName());
|
||||
label.setLabelContent(item.getLabelName());
|
||||
label.setSystemCode(BaseConstants.COMPANY_STAFF);
|
||||
return label;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录用户部门下所有员工信息
|
||||
* @author 小李
|
||||
* @date 15:54 2024/8/8
|
||||
**/
|
||||
@Override
|
||||
public List<CompanyStaff> getStaffList(){
|
||||
// 获取当前登录用户的信息,取出部门
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
Long id = loginUser.getId();
|
||||
AdminUserRespDTO user = adminUserApi.getUser(id);
|
||||
Long deptId = user.getDeptId();
|
||||
// 获取所有该部门下的员工信息
|
||||
return baseMapper.selectList(new QueryWrapper<CompanyStaff>().eq("dept_id", deptId));
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.staff.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.module.staff.entity.UniqueCode;
|
||||
import cn.iocoder.yudao.module.staff.mapper.UniqueCodeMapper;
|
||||
import cn.iocoder.yudao.module.staff.service.UniqueCodeService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 唯一推广码使用记录表 服务实现类
|
||||
* @author 小李
|
||||
* @date 9:58 2024/8/8
|
||||
**/
|
||||
@Service
|
||||
public class UniqueCodeServiceImpl extends ServiceImpl<UniqueCodeMapper, UniqueCode> implements UniqueCodeService {
|
||||
|
||||
/**
|
||||
* 检查唯一推广码是否存在于数据库
|
||||
* @author 小李
|
||||
* @date 9:59 2024/8/8
|
||||
* @param uniqueCode
|
||||
*
|
||||
* @return*/
|
||||
@Override
|
||||
public int insertUniqueCode(String uniqueCode){
|
||||
UniqueCode code = new UniqueCode();
|
||||
code.setUniqueCode(uniqueCode);
|
||||
return baseMapper.insert(code);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.staff.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaffChange;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 企业管理-员工交接记录VO
|
||||
* @author 小李
|
||||
* @date 15:36 2024/8/8
|
||||
**/
|
||||
@Data
|
||||
public class CompanyStaffChangeReqVO extends CompanyStaffChange {
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.staff.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
|
||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaffChange;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 企业管理-员工交接记录响应或提交VO
|
||||
* @author 小李
|
||||
* @date 15:37 2024/8/8
|
||||
**/
|
||||
@Data
|
||||
public class CompanyStaffChangeRespVO extends CompanyStaffChange {
|
||||
|
||||
/** 交出方员工信息 */
|
||||
private CompanyStaff oldStaff;
|
||||
|
||||
/** 接收方员工信息 */
|
||||
private CompanyStaff newStaff;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.staff.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
* 员工查询VO
|
||||
* @author 小李
|
||||
* @date 16:49 2024/8/6
|
||||
**/
|
||||
@Data
|
||||
public class CompanyStaffReqVO extends CompanyStaff {
|
||||
|
||||
@Schema(description = "工作日期查询范围")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date[] workDateArray;
|
||||
|
||||
@Schema(description = "入职日期查询范围")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date[] joinedDateArray;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.yudao.module.company.vo;
|
||||
package cn.iocoder.yudao.module.staff.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.company.entity.CompanyStaff;
|
||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@ -23,11 +23,6 @@ public class CompanyStaffRespVO extends CompanyStaff {
|
||||
**/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 员工附件IDS
|
||||
*/
|
||||
List<String> fileIdArray;
|
||||
|
||||
/**
|
||||
* 员工标签
|
||||
**/
|
@ -1,9 +0,0 @@
|
||||
<?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="cn.iocoder.yudao.module.company.mapper.CompanyStaffMapper">
|
||||
<select id="selectListPage" resultType="cn.iocoder.yudao.module.company.entity.CompanyStaff">
|
||||
select * from company_staff
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,6 @@
|
||||
<?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="cn.iocoder.yudao.module.staff.mapper.CompanyStaffChangeMapper">
|
||||
</mapper>
|
@ -0,0 +1,81 @@
|
||||
<?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="cn.iocoder.yudao.module.staff.mapper.CompanyStaffMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.staff.entity.CompanyStaff">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="corpId" column="corp_id" jdbcType="VARCHAR"/>
|
||||
<result property="userId" column="user_id" jdbcType="BIGINT"/>
|
||||
<result property="deptId" column="dept_id" jdbcType="BIGINT"/>
|
||||
<result property="workNo" column="work_no" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="tel" column="tel" jdbcType="VARCHAR"/>
|
||||
<result property="sex" column="sex" jdbcType="VARCHAR"/>
|
||||
<result property="address" column="address" jdbcType="VARCHAR"/>
|
||||
<result property="workDate" column="work_date" jdbcType="DATE"/>
|
||||
<result property="workYear" column="work_year" jdbcType="DECIMAL"/>
|
||||
<result property="joinedDate" column="joined_date" jdbcType="DATE"/>
|
||||
<result property="joinedYear" column="joined_year" jdbcType="DECIMAL"/>
|
||||
<result property="education" column="education" jdbcType="VARCHAR"/>
|
||||
<result property="content" column="content" jdbcType="VARCHAR"/>
|
||||
<result property="uniqueCode" column="unique_code" jdbcType="VARCHAR"/>
|
||||
<result property="fileUrls" column="file_urls" jdbcType="VARCHAR"/>
|
||||
<result property="tenantId" column="tenant_id" jdbcType="VARCHAR"/>
|
||||
<result property="deleted" column="deleted" jdbcType="BIT"/>
|
||||
<result property="creator" column="creator" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updater" column="updater" jdbcType="VARCHAR"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_SQL">
|
||||
select
|
||||
id,corp_id,user_id,
|
||||
dept_id,work_no,name,
|
||||
tel,sex,address,
|
||||
work_date,work_year,joined_date,
|
||||
joined_year,education,content,
|
||||
unique_code,file_urls,tenant_id,
|
||||
deleted,creator,create_time,
|
||||
updater,update_time
|
||||
from company_staff cs where deleted = '0'
|
||||
</sql>
|
||||
<select id="selectListPage" resultMap="BaseResultMap">
|
||||
<include refid="Base_SQL" />
|
||||
<if test="map.name != null and map.name != ''">
|
||||
and cs.name like concat('%', #{map.name}, '%')
|
||||
</if>
|
||||
<if test="map.workNo != null and map.workNo != ''">
|
||||
and cs.work_no like concat('%', #{map.workNo}, '%')
|
||||
</if>
|
||||
<if test="map.tel != null and map.tel != ''">
|
||||
and cs.tel like concat('%', #{map.tel}, '%')
|
||||
</if>
|
||||
<if test="map.sex != null and map.sex != ''">
|
||||
and cs.sex = #{map.sex}
|
||||
</if>
|
||||
<if test="map.address != null and map.address != ''">
|
||||
and cs.address like concat('%', #{map.address}, '%')
|
||||
</if>
|
||||
<if test="map.workYear != null">
|
||||
and cs.work_year = #{map.workYear}
|
||||
</if>
|
||||
<if test="map.joinedYear != null">
|
||||
and cs.joined_year = #{map.joinedYear}
|
||||
</if>
|
||||
<if test="map.education != null">
|
||||
and cs.education = #{map.education}
|
||||
</if>
|
||||
<if test="map.uniqueCode != null and map.uniqueCode != ''">
|
||||
and cs.unique_code like concat('%', #{map.uniqueCode}, '%')
|
||||
</if>
|
||||
<if test="map.workDateArray.length > 0">
|
||||
and cs.work_date between #{map.workDateArray[0]} and #{map.workDateArray[1]}
|
||||
</if>
|
||||
<if test="map.joinedDateArray.length > 0">
|
||||
and cs.joined_date between #{map.joinedDateArray[0]} and #{map.joinedDateArray[1]}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,6 @@
|
||||
<?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="cn.iocoder.yudao.module.staff.mapper.UniqueCodeMapper">
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user