企业管理-员工信息
This commit is contained in:
parent
94db55c584
commit
603e962aa9
@ -41,4 +41,6 @@ public class BaseConstants {
|
|||||||
public static final Integer UNIQUE_CODE_LEN = 6;
|
public static final Integer UNIQUE_CODE_LEN = 6;
|
||||||
/**企业功能标识*/
|
/**企业功能标识*/
|
||||||
public static final String FUNC_COMPANY = "company";
|
public static final String FUNC_COMPANY = "company";
|
||||||
|
/**批量操作数据量*/
|
||||||
|
public static final Integer BATCH_SIZE = 100;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,55 @@
|
|||||||
|
package cn.iocoder.yudao.module.custom.controller.admin;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.custom.entity.BasePromotion;
|
||||||
|
import cn.iocoder.yudao.module.custom.service.BasePromotionService;
|
||||||
|
import cn.iocoder.yudao.module.custom.vo.BasePromotionReqVO;
|
||||||
|
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.tags.Tag;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推广记录表 控制层
|
||||||
|
*
|
||||||
|
* @author 小李
|
||||||
|
* @date 16:42 2024/8/13
|
||||||
|
**/
|
||||||
|
@Tag(name = "管理后台 - 推广记录")
|
||||||
|
@Validated
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/base/promotion")
|
||||||
|
public class BasePromotionController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BasePromotionService promotionService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询推广记录
|
||||||
|
*
|
||||||
|
* @param pageReqVO 查询条件对象
|
||||||
|
* @param pageNo 页码
|
||||||
|
* @param pageSize 条数
|
||||||
|
* @author 小李
|
||||||
|
* @date 16:50 2024/8/13
|
||||||
|
**/
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "分页查询推广记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('base:promotion:query')")
|
||||||
|
public CommonResult<IPage<?>> getBasePromotionPage(BasePromotionReqVO pageReqVO,
|
||||||
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||||
|
Page<BasePromotion> page = new Page<>(pageNo, pageSize);
|
||||||
|
return success(promotionService.queryListPage(pageReqVO, page));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package cn.iocoder.yudao.module.custom.entity;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||||
|
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 16:31 2024/8/13
|
||||||
|
**/
|
||||||
|
@TableName(value ="base_promotion")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class BasePromotion extends TenantBaseDO {
|
||||||
|
/** 主键标识 */
|
||||||
|
@TableId(type = IdType.ASSIGN_ID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/** 推广用户id(system_users表的id) */
|
||||||
|
private Long oldUserId;
|
||||||
|
|
||||||
|
/** 推广用户姓名 */
|
||||||
|
private String oldUserName;
|
||||||
|
|
||||||
|
/** 推广渠道 */
|
||||||
|
private String promotionChannel;
|
||||||
|
|
||||||
|
/** 被推广用户id(system_users表的id) */
|
||||||
|
private Long newUserId;
|
||||||
|
|
||||||
|
/** 被推广用户姓名 */
|
||||||
|
private String newUserName;
|
||||||
|
|
||||||
|
/** 被推广用户注册时间 */
|
||||||
|
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
|
||||||
|
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||||
|
private Date registerTime;
|
||||||
|
|
||||||
|
/** 被推广用户注册时填写的推广码 */
|
||||||
|
private String uniqueCode;
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package cn.iocoder.yudao.module.custom.mapper;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.custom.entity.BasePromotion;
|
||||||
|
import cn.iocoder.yudao.module.custom.vo.BasePromotionReqVO;
|
||||||
|
import cn.iocoder.yudao.module.custom.vo.BasePromotionRespVO;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推广记录表 Mapper
|
||||||
|
* @author 小李
|
||||||
|
* @date 16:38 2024/8/13
|
||||||
|
**/
|
||||||
|
@Mapper
|
||||||
|
public interface BasePromotionMapper extends BaseMapper<BasePromotion> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询推广记录
|
||||||
|
*
|
||||||
|
* @param pageReqVO 查询条件对象
|
||||||
|
* @author 小李
|
||||||
|
* @date 16:50 2024/8/13
|
||||||
|
**/
|
||||||
|
IPage<BasePromotionRespVO> queryListPage(@Param("map") BasePromotionReqVO pageReqVO, Page<BasePromotion> page);
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package cn.iocoder.yudao.module.custom.service;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.custom.entity.BasePromotion;
|
||||||
|
import cn.iocoder.yudao.module.custom.vo.BasePromotionReqVO;
|
||||||
|
import cn.iocoder.yudao.module.custom.vo.BasePromotionRespVO;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推广记录表 接口服务
|
||||||
|
* @author 小李
|
||||||
|
* @date 16:40 2024/8/13
|
||||||
|
**/
|
||||||
|
public interface BasePromotionService extends IService<BasePromotion> {
|
||||||
|
IPage<BasePromotionRespVO> queryListPage(BasePromotionReqVO pageReqVO, Page<BasePromotion> page);
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package cn.iocoder.yudao.module.custom.service.impl;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.custom.entity.BasePromotion;
|
||||||
|
import cn.iocoder.yudao.module.custom.mapper.BasePromotionMapper;
|
||||||
|
import cn.iocoder.yudao.module.custom.service.BasePromotionService;
|
||||||
|
import cn.iocoder.yudao.module.custom.vo.BasePromotionReqVO;
|
||||||
|
import cn.iocoder.yudao.module.custom.vo.BasePromotionRespVO;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推广记录表 接口实现类
|
||||||
|
* @author 小李
|
||||||
|
* @date 16:41 2024/8/13
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class BasePromotionServiceImpl extends ServiceImpl<BasePromotionMapper, BasePromotion> implements BasePromotionService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询推广记录
|
||||||
|
*
|
||||||
|
* @param pageReqVO 查询条件对象
|
||||||
|
* @author 小李
|
||||||
|
* @date 16:50 2024/8/13
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public IPage<BasePromotionRespVO> queryListPage(BasePromotionReqVO pageReqVO, Page<BasePromotion> page) {
|
||||||
|
return baseMapper.queryListPage(pageReqVO, page);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package cn.iocoder.yudao.module.custom.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.custom.entity.BasePromotion;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推广记录表查询VO
|
||||||
|
* @author 小李
|
||||||
|
* @date 16:36 2024/8/13
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class BasePromotionReqVO extends BasePromotion {
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package cn.iocoder.yudao.module.custom.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.custom.entity.BasePromotion;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推广记录表响应或提交VO
|
||||||
|
* @author 小李
|
||||||
|
* @date 16:37 2024/8/13
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class BasePromotionRespVO extends BasePromotion {
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package cn.iocoder.yudao.scheduled;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
||||||
|
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时提醒企业管理员资质过期
|
||||||
|
* @author 小李
|
||||||
|
* @date 16:02 2024/8/13
|
||||||
|
**/
|
||||||
|
@Component
|
||||||
|
@TenantJob
|
||||||
|
@Slf4j
|
||||||
|
public class NoticeCompanyQualsExpiredJob implements JobHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String execute(String param) throws Exception {
|
||||||
|
// TODO
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
<?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.custom.mapper.BasePromotionMapper">
|
||||||
|
|
||||||
|
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.custom.entity.BasePromotion">
|
||||||
|
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||||
|
<result property="oldUserId" column="old_user_id" jdbcType="BIGINT"/>
|
||||||
|
<result property="oldUserName" column="old_user_name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="promotionChannel" column="promotion_channel" jdbcType="VARCHAR"/>
|
||||||
|
<result property="newUserId" column="new_user_id" jdbcType="BIGINT"/>
|
||||||
|
<result property="newUserName" column="new_user_name" jdbcType="VARCHAR"/>
|
||||||
|
<result property="registerTime" column="register_time" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="uniqueCode" column="unique_code" jdbcType="VARCHAR"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="queryListPage" resultMap="BaseResultMap">
|
||||||
|
select * from base_promotion
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -13,7 +13,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -154,6 +153,8 @@ public class CompanyStaffController {
|
|||||||
* @date 14:59 2024/8/7
|
* @date 14:59 2024/8/7
|
||||||
**/
|
**/
|
||||||
@GetMapping("/labels")
|
@GetMapping("/labels")
|
||||||
|
@Operation(summary = "获取当前功能的标签")
|
||||||
|
@PreAuthorize("@ss.hasPermission('company:staff:query')")
|
||||||
public CommonResult<List<Label>> getLabels() {
|
public CommonResult<List<Label>> getLabels() {
|
||||||
return success(staffService.getLabels());
|
return success(staffService.getLabels());
|
||||||
}
|
}
|
||||||
@ -165,6 +166,8 @@ public class CompanyStaffController {
|
|||||||
* @date 15:54 2024/8/8
|
* @date 15:54 2024/8/8
|
||||||
**/
|
**/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
|
@Operation(summary = "获取当前登录用户部门下所有员工信息")
|
||||||
|
@PreAuthorize("@ss.hasPermission('company:staff:query')")
|
||||||
public CommonResult<List<CompanyStaff>> getStaffList() {
|
public CommonResult<List<CompanyStaff>> getStaffList() {
|
||||||
return success(staffService.getStaffList());
|
return success(staffService.getStaffList());
|
||||||
}
|
}
|
||||||
@ -177,6 +180,8 @@ public class CompanyStaffController {
|
|||||||
* @date 14:03 2024/8/9
|
* @date 14:03 2024/8/9
|
||||||
**/
|
**/
|
||||||
@GetMapping("/checkWorkNo")
|
@GetMapping("/checkWorkNo")
|
||||||
|
@Operation(summary = "验证工号是否重复")
|
||||||
|
@PreAuthorize("@ss.hasPermission('company:staff:query')")
|
||||||
public CommonResult<Boolean> checkWorkNo(@RequestParam("workNo") String workNo) {
|
public CommonResult<Boolean> checkWorkNo(@RequestParam("workNo") String workNo) {
|
||||||
return success(staffService.checkWorkNo(workNo));
|
return success(staffService.checkWorkNo(workNo));
|
||||||
}
|
}
|
||||||
@ -189,6 +194,8 @@ public class CompanyStaffController {
|
|||||||
* @date 16:21 2024/8/9
|
* @date 16:21 2024/8/9
|
||||||
**/
|
**/
|
||||||
@PostMapping("/resetPassword")
|
@PostMapping("/resetPassword")
|
||||||
|
@Operation(summary = "重置员工登录密码")
|
||||||
|
@PreAuthorize("@ss.hasPermission('company:staff:resetPassword')")
|
||||||
public CommonResult resetPassword(@RequestBody CompanyStaffRespVO staffRespVO) {
|
public CommonResult resetPassword(@RequestBody CompanyStaffRespVO staffRespVO) {
|
||||||
staffService.resetPassword(staffRespVO);
|
staffService.resetPassword(staffRespVO);
|
||||||
return CommonResult.ok();
|
return CommonResult.ok();
|
||||||
|
@ -87,4 +87,11 @@ public interface CompanyStaffService extends IService<CompanyStaff> {
|
|||||||
* @param workNo 输入的工号
|
* @param workNo 输入的工号
|
||||||
**/
|
**/
|
||||||
Boolean checkWorkNo(String workNo);
|
Boolean checkWorkNo(String workNo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新员工的工龄和司龄
|
||||||
|
* @author 小李
|
||||||
|
* @date 11:41 2024/8/13
|
||||||
|
**/
|
||||||
|
void updateStaffWorkAndJoinedYears();
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.iocoder.yudao.common.BaseConstants;
|
import cn.iocoder.yudao.common.BaseConstants;
|
||||||
import cn.iocoder.yudao.common.CommonErrorCodeConstants;
|
import cn.iocoder.yudao.common.CommonErrorCodeConstants;
|
||||||
import cn.iocoder.yudao.framework.common.util.io.FileUtils;
|
|
||||||
import cn.iocoder.yudao.framework.datapermission.core.rule.DataPermissionRule;
|
import cn.iocoder.yudao.framework.datapermission.core.rule.DataPermissionRule;
|
||||||
import cn.iocoder.yudao.framework.datapermission.core.rule.dept.DeptDataPermissionRule;
|
|
||||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import cn.iocoder.yudao.module.company.entity.Company;
|
import cn.iocoder.yudao.module.company.entity.Company;
|
||||||
import cn.iocoder.yudao.module.company.service.CompanyService;
|
import cn.iocoder.yudao.module.company.service.CompanyService;
|
||||||
@ -16,7 +13,6 @@ import cn.iocoder.yudao.module.label.entity.Label;
|
|||||||
import cn.iocoder.yudao.module.label.service.BusiLabelService;
|
import cn.iocoder.yudao.module.label.service.BusiLabelService;
|
||||||
import cn.iocoder.yudao.module.label.service.LabelService;
|
import cn.iocoder.yudao.module.label.service.LabelService;
|
||||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
|
import cn.iocoder.yudao.module.staff.entity.CompanyStaff;
|
||||||
import cn.iocoder.yudao.module.staff.entity.CompanyStaffChange;
|
|
||||||
import cn.iocoder.yudao.module.staff.mapper.CompanyStaffMapper;
|
import cn.iocoder.yudao.module.staff.mapper.CompanyStaffMapper;
|
||||||
import cn.iocoder.yudao.module.staff.service.CompanyStaffChangeService;
|
import cn.iocoder.yudao.module.staff.service.CompanyStaffChangeService;
|
||||||
import cn.iocoder.yudao.module.staff.service.CompanyStaffService;
|
import cn.iocoder.yudao.module.staff.service.CompanyStaffService;
|
||||||
@ -37,6 +33,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.Period;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -68,6 +68,7 @@ public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, Com
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private UniqueCodeService uniqueCodeService;
|
private UniqueCodeService uniqueCodeService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private DataPermissionRule dataPermissionRule;
|
private DataPermissionRule dataPermissionRule;
|
||||||
|
|
||||||
@ -140,7 +141,7 @@ public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, Com
|
|||||||
staffRespVO.setCorpId(company.getId());
|
staffRespVO.setCorpId(company.getId());
|
||||||
// 2 生成唯一推广码
|
// 2 生成唯一推广码
|
||||||
String uniqueCode = uniqueCodeService.createUniqueCode();
|
String uniqueCode = uniqueCodeService.createUniqueCode();
|
||||||
if (!ObjectUtil.isNotEmpty(uniqueCode)){
|
if (!ObjectUtil.isNotEmpty(uniqueCode)) {
|
||||||
throw exception(CommonErrorCodeConstants.UNIQUE_CODE_CREATE_REPEAT);
|
throw exception(CommonErrorCodeConstants.UNIQUE_CODE_CREATE_REPEAT);
|
||||||
}
|
}
|
||||||
staffRespVO.setUniqueCode(uniqueCode);
|
staffRespVO.setUniqueCode(uniqueCode);
|
||||||
@ -222,7 +223,7 @@ public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, Com
|
|||||||
|
|
||||||
/* 验证是否已交接工作 */
|
/* 验证是否已交接工作 */
|
||||||
Boolean flag = staffChangeService.checkChangeStatus(staff.getUserId());
|
Boolean flag = staffChangeService.checkChangeStatus(staff.getUserId());
|
||||||
if (!flag){
|
if (!flag) {
|
||||||
throw exception(CommonErrorCodeConstants.STAFF_NOT_CHANGE);
|
throw exception(CommonErrorCodeConstants.STAFF_NOT_CHANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -340,32 +341,35 @@ public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, Com
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前登录用户部门下所有员工信息
|
* 获取当前登录用户部门下所有员工信息
|
||||||
|
*
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 15:54 2024/8/8
|
* @date 15:54 2024/8/8
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public List<CompanyStaff> getStaffList(){
|
public List<CompanyStaff> getStaffList() {
|
||||||
return baseMapper.selectList(new QueryWrapper<>());
|
return baseMapper.selectList(new QueryWrapper<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重置员工登录密码
|
* 重置员工登录密码
|
||||||
|
*
|
||||||
|
* @param staffRespVO 员工对象
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 16:21 2024/8/9
|
* @date 16:21 2024/8/9
|
||||||
* @param staffRespVO 员工对象
|
|
||||||
**/
|
**/
|
||||||
public void resetPassword(CompanyStaffRespVO staffRespVO){
|
public void resetPassword(CompanyStaffRespVO staffRespVO) {
|
||||||
// 修改员工密码
|
// 修改员工密码
|
||||||
adminUserApi.resetPassword(staffRespVO.getUserId(), staffRespVO.getPassword());
|
adminUserApi.resetPassword(staffRespVO.getUserId(), staffRespVO.getPassword());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证工号是否重复
|
* 验证工号是否重复
|
||||||
|
*
|
||||||
|
* @param workNo 输入的工号
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 14:03 2024/8/9
|
* @date 14:03 2024/8/9
|
||||||
* @param workNo 输入的工号
|
|
||||||
**/
|
**/
|
||||||
public Boolean checkWorkNo(String workNo){
|
public Boolean checkWorkNo(String workNo) {
|
||||||
// 获取当前登录用户的部门ID和企业ID
|
// 获取当前登录用户的部门ID和企业ID
|
||||||
AdminUserRespDTO loginUser = getLoginUser();
|
AdminUserRespDTO loginUser = getLoginUser();
|
||||||
DeptRespDTO loginDept = getLoginDept(loginUser.getDeptId());
|
DeptRespDTO loginDept = getLoginDept(loginUser.getDeptId());
|
||||||
@ -379,31 +383,79 @@ public class CompanyStaffServiceImpl extends ServiceImpl<CompanyStaffMapper, Com
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前登录用户的详细信息
|
* 获取当前登录用户的详细信息
|
||||||
|
*
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 17:27 2024/8/9
|
* @date 17:27 2024/8/9
|
||||||
**/
|
**/
|
||||||
private AdminUserRespDTO getLoginUser(){
|
private AdminUserRespDTO getLoginUser() {
|
||||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||||
return adminUserApi.getUser(userId);
|
return adminUserApi.getUser(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前登录用户的部门详细信息
|
* 获取当前登录用户的部门详细信息
|
||||||
|
*
|
||||||
|
* @param deptId 部门ID
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 17:28 2024/8/9
|
* @date 17:28 2024/8/9
|
||||||
* @param deptId 部门ID
|
**/
|
||||||
**/
|
private DeptRespDTO getLoginDept(Long deptId) {
|
||||||
private DeptRespDTO getLoginDept(Long deptId){
|
|
||||||
return deptApi.getDept(deptId);
|
return deptApi.getDept(deptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前登录用户的企业详细信息
|
* 获取当前登录用户的企业详细信息
|
||||||
|
*
|
||||||
|
* @param corpName 企业名称
|
||||||
* @author 小李
|
* @author 小李
|
||||||
* @date 18:03 2024/8/9
|
* @date 18:03 2024/8/9
|
||||||
* @param corpName 企业名称
|
**/
|
||||||
**/
|
private Company getLoginCompany(String corpName) {
|
||||||
private Company getLoginCompany(String corpName){
|
|
||||||
return companyService.getOne(new LambdaQueryWrapper<Company>().eq(Company::getCorpName, corpName));
|
return companyService.getOne(new LambdaQueryWrapper<Company>().eq(Company::getCorpName, corpName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新员工的工龄和司龄
|
||||||
|
*
|
||||||
|
* @author 小李
|
||||||
|
* @date 11:41 2024/8/13
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
@DSTransactional
|
||||||
|
public void updateStaffWorkAndJoinedYears() {
|
||||||
|
LambdaQueryWrapper<CompanyStaff> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
Page<CompanyStaff> page = new Page<>(0, BaseConstants.BATCH_SIZE);
|
||||||
|
while (true) {
|
||||||
|
// 查询一页的数据
|
||||||
|
Page<CompanyStaff> companyStaffPage = baseMapper.selectPage(page, queryWrapper);
|
||||||
|
// 对每一页数据进行操作更新
|
||||||
|
List<CompanyStaff> result = companyStaffPage.getRecords().stream().map(item -> {
|
||||||
|
// 获取当前时间、工作时间、入职时间
|
||||||
|
LocalDate currentDate = LocalDate.now();
|
||||||
|
LocalDate workDate = item.getWorkDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||||
|
LocalDate joinedDate = item.getJoinedDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||||
|
|
||||||
|
// 计算工龄
|
||||||
|
BigDecimal workYear = new BigDecimal(Period.between(workDate, currentDate).getYears());
|
||||||
|
item.setWorkYear(workYear);
|
||||||
|
|
||||||
|
// 计算司龄
|
||||||
|
BigDecimal joinedYear = new BigDecimal(Period.between(joinedDate, currentDate).getYears());
|
||||||
|
item.setJoinedYear(joinedYear);
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 批量更新
|
||||||
|
updateBatchById(result);
|
||||||
|
|
||||||
|
// 没有下一页了就退出
|
||||||
|
if (companyStaffPage.getRecords().isEmpty()){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取一页
|
||||||
|
queryWrapper.gt(CompanyStaff::getId, page.getRecords().get(page.getRecords().size() - 1).getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
package cn.iocoder.yudao.scheduled;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
|
||||||
|
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
|
||||||
|
import cn.iocoder.yudao.module.staff.service.CompanyStaffService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时更新员工的工龄和司龄
|
||||||
|
* @author 小李
|
||||||
|
* @date 14:00 2024/8/13
|
||||||
|
**/
|
||||||
|
@Component
|
||||||
|
@TenantJob
|
||||||
|
@Slf4j
|
||||||
|
public class UpdateCompanyStaffWorkAndJoinedYearsJob implements JobHandler {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CompanyStaffService staffService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String execute(String param) throws Exception {
|
||||||
|
// 执行更新
|
||||||
|
staffService.updateStaffWorkAndJoinedYears();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -97,7 +97,7 @@
|
|||||||
and (cs_old.tel like concat('%', #{map.tel}, '%') or cs_new.tel like concat('%', #{map.tel}, '%'))
|
and (cs_old.tel like concat('%', #{map.tel}, '%') or cs_new.tel like concat('%', #{map.tel}, '%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="map.changeTimeArray != null and map.changeTimeArray.length > 0">
|
<if test="map.changeTimeArray != null and map.changeTimeArray.length > 0">
|
||||||
and (csc.changeTime between #{map.changeTimeArray[0]} and #{map.changeTimeArray[1]})
|
and (csc.change_time between #{map.changeTimeArray[0]} and #{map.changeTimeArray[1]})
|
||||||
</if>
|
</if>
|
||||||
<if test="map.oldUserIds != null and map.oldUserIds.size > 0">
|
<if test="map.oldUserIds != null and map.oldUserIds.size > 0">
|
||||||
and csc.old_user_id in
|
and csc.old_user_id in
|
||||||
|
@ -8,7 +8,7 @@ import java.lang.annotation.Target;
|
|||||||
/**
|
/**
|
||||||
* 多租户 Job 注解
|
* 多租户 Job 注解
|
||||||
*/
|
*/
|
||||||
@Target({ElementType.METHOD})
|
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
public @interface TenantJob {
|
public @interface TenantJob {
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,12 @@ server:
|
|||||||
port: 48080
|
port: 48080
|
||||||
|
|
||||||
--- #################### 数据库相关配置 ####################
|
--- #################### 数据库相关配置 ####################
|
||||||
|
# exclude中少的内容 - org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration # 默认 local 环境,不开启 Quartz 的自动配置
|
||||||
spring:
|
spring:
|
||||||
# 数据源配置项
|
# 数据源配置项
|
||||||
autoconfigure:
|
autoconfigure:
|
||||||
exclude:
|
exclude:
|
||||||
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
|
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
|
||||||
- org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration # 默认 local 环境,不开启 Quartz 的自动配置
|
|
||||||
- de.codecentric.boot.admin.server.config.AdminServerAutoConfiguration # 禁用 Spring Boot Admin 的 Server 的自动配置
|
- de.codecentric.boot.admin.server.config.AdminServerAutoConfiguration # 禁用 Spring Boot Admin 的 Server 的自动配置
|
||||||
- de.codecentric.boot.admin.server.ui.config.AdminServerUiAutoConfiguration # 禁用 Spring Boot Admin 的 Server UI 的自动配置
|
- de.codecentric.boot.admin.server.ui.config.AdminServerUiAutoConfiguration # 禁用 Spring Boot Admin 的 Server UI 的自动配置
|
||||||
- de.codecentric.boot.admin.client.config.SpringBootAdminClientAutoConfiguration # 禁用 Spring Boot Admin 的 Client 的自动配置
|
- de.codecentric.boot.admin.client.config.SpringBootAdminClientAutoConfiguration # 禁用 Spring Boot Admin 的 Client 的自动配置
|
||||||
|
Loading…
Reference in New Issue
Block a user