新入职用户API:添加获取当日及昨日外出用户编号的接口添加一个新的getGoOutByTime接口,该接口允许按指定日期检索当日及昨日外出的用户编号。此增强功能旨在优化对外出用户数据的访问和管理。相关代码更改:

- 新增`BpmOAEntryApi`接口,提供`getEntryListByTime`方法。
- 实现`BpmOAEntryApiImpl`类,对接口方法进行具体实现。
-扩展`BpmOAEntryService`接口,增加`getEntryListByTime`服务方法。
- 在`BpmOAEntryServiceImpl`中实现新服务方法的具体逻辑。
This commit is contained in:
furongxin 2024-09-20 15:52:34 +08:00
parent 9fc18abf1c
commit 6d04114723
5 changed files with 148 additions and 0 deletions

View File

@ -0,0 +1,29 @@
package cn.iocoder.yudao.module.bpm.api.oa;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.bpm.api.oa.vo.BpmOAEntryDTO;
import cn.iocoder.yudao.module.bpm.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.security.PermitAll;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿fallbackFactory =
@Tag(name = "RPC 服务 - 流程实例")
public interface BpmOAEntryApi {
String PREFIX = ApiConstants.PREFIX + "/oa/entry";
@GetMapping(PREFIX + "/getGoOutByTime")
@Operation(summary = "获取当日以及昨日外出的用户编号")
@Parameter(name = "entryDate", description = "时间格式yyyy-MM-dd", required = true, example = "2024-05-11")
@PermitAll
CommonResult<List<BpmOAEntryDTO>> getEntryListByTime(@RequestParam(name = "entryDate") LocalDate entryDate);
}

View File

@ -0,0 +1,66 @@
package cn.iocoder.yudao.module.bpm.api.oa.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
@Data
public class BpmOAEntryDTO {
@Schema(description = "入职申请表单主键", example = "1")
private Long id;
@Schema(description = "新入职用户用户编号", example = "16315")
@NotNull(message = "新入职用户用户编号不能为空")
private Long entryUserId;
@Schema(description = "新入职用户部门编号", example = "10237")
private Long entryDeptId;
@Schema(description = "新入职用户部门名称", example = "研发部")
private String entryDeptName;
@Schema(description = "新入职用户职称编号", example = "10237")
private Long entryPostId;
@Schema(description = "新入职用户职称名称", example = "职工")
private String entryPostName;
@Schema(description = "新入职用户岗位编号", example = "10237")
private Long entryPositionId;
@Schema(description = "新入职用户岗位名称", example = "职工")
private String entryPositionName;
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@NotEmpty(message = "用户昵称不能为空")
private String nickname;
@Schema(description = "合同公司", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "合同公司不能为空")
private Long contractCompany;
@Schema(description = "合同公司名称")
private String contractCompanyName;
@Schema(description = "手机号码", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "手机号码不能为空")
private String mobile;
@Schema(description = "身份证号码")
private String idcard;
@Schema(description = "入职时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "入职时间不能为空")
private LocalDate entryDate;
@Schema(description = "面试评价", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "面试评价不能为空")
private String interviewEvaluation;
@Schema(description = "薪资情况", example = "27005")
private String salary;
}

View File

@ -0,0 +1,34 @@
package cn.iocoder.yudao.module.bpm.api.oa;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.bpm.api.oa.vo.BpmOAEntryDTO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAEntryDO;
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAEntryService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* Flowable 流程实例 Api 实现类
*/
@RestController
@Validated
public class BpmOAEntryApiImpl implements BpmOAEntryApi{
@Resource
private BpmOAEntryService entryService;
@Override
public CommonResult<List<BpmOAEntryDTO>> getEntryListByTime(LocalDate entryDate) {
List<BpmOAEntryDO> entryDOS = entryService.getEntryListByTime(entryDate);
return success(BeanUtils.toBean(entryDOS, BpmOAEntryDTO.class));
}
}

View File

@ -4,6 +4,8 @@ import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.entry.BpmOAEntryCreate
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAEntryDO;
import javax.validation.Valid;
import java.time.LocalDate;
import java.util.List;
public interface BpmOAEntryService {
@ -38,4 +40,10 @@ public interface BpmOAEntryService {
*/
BpmOAEntryDO getEntryByProcessInstanceId(String processInstanceId);
/**
* 获得指定入职时间的 入职申请信息
* @param entryDate 入职时间
* @return 入职申请列表
*/
List<BpmOAEntryDO> getEntryListByTime(LocalDate entryDate);
}

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.bpm.service.oa;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.common.util.string.DTO.IdCardDO;
import cn.iocoder.yudao.framework.common.util.string.StrUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.entry.BpmOAEntryCreateReqVO;
@ -24,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@ -116,6 +118,7 @@ public class BpmOAEntryServiceImpl implements BpmOAEntryService{
saveRespDTO.setPositionId(entry.getEntryPositionId());
saveRespDTO.setPostIds(Collections.singleton(entry.getEntryPostId()));
saveRespDTO.setPassword("123456");
saveRespDTO.setStatus(1); // 默认设置关闭
// 解析身份证号码
IdCardDO idCardDO = StrUtils.IdCardAnalysis(saveRespDTO.getIdcard());
@ -162,4 +165,12 @@ public class BpmOAEntryServiceImpl implements BpmOAEntryService{
return entryMapper.selectOne(BpmOAEntryDO::getProcessInstanceId, processInstanceId);
}
@Override
public List<BpmOAEntryDO> getEntryListByTime(LocalDate entryDate) {
return entryMapper.selectList(new LambdaQueryWrapperX<BpmOAEntryDO>()
.eq(BpmOAEntryDO::getEntryDate, entryDate)
.eq(BpmOAEntryDO::getResult, BpmProcessInstanceResultEnum.APPROVE.getResult()));
}
}