修改 入职申请
新增用户后 自动分配普通角色
This commit is contained in:
parent
878272307e
commit
1db394a39a
@ -47,7 +47,7 @@ public class BpmProcessDefinitionController {
|
||||
BpmProcessDefinitionListReqVO listReqVO) {
|
||||
|
||||
List<BpmProcessDefinitionRespVO> respVOS = bpmDefinitionService.getProcessDefinitionList(listReqVO);
|
||||
respVOS = respVOS.stream().filter(data -> !data.getId().contains("work_task") && !data.getId().contains("oa_entry")).collect(Collectors.toList());
|
||||
respVOS = respVOS.stream().filter(data -> !data.getId().contains("work_task")).collect(Collectors.toList());
|
||||
return success(respVOS);
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,11 @@
|
||||
package cn.iocoder.yudao.module.bpm.controller.admin.oa;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.entry.BpmOAEntryCreateReqVO;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.entry.BpmOAEntryRespVO;
|
||||
import cn.iocoder.yudao.module.bpm.convert.oa.BpmOAEntryConvert;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAEntryDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmTaskExtDO;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import cn.iocoder.yudao.module.bpm.service.oa.BpmOAEntryService;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.PostApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
@ -23,7 +19,6 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@ -47,9 +42,6 @@ public class BpmOAEntryController {
|
||||
@Resource
|
||||
private PostApi postApi;
|
||||
|
||||
@Resource
|
||||
private BpmTaskService bpmTaskService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建请求申请")
|
||||
@PermitAll
|
||||
@ -74,38 +66,6 @@ public class BpmOAEntryController {
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
@GetMapping("/getByOpenId")
|
||||
@Operation(summary = "获得入职申请")
|
||||
@Parameter(name = "openId", description = "编号", required = true, example = "1024")
|
||||
@PermitAll
|
||||
public CommonResult<BpmOAEntryRespVO> getEntryByOpenId(@RequestParam("openId") String openId) {
|
||||
|
||||
// 查询当前openId 是否存在
|
||||
List<BpmOAEntryDO> entryList = entryService.getEntryByOpenId(openId);
|
||||
|
||||
if (CollectionUtil.isEmpty(entryList)) {
|
||||
return success(null);
|
||||
}
|
||||
|
||||
BpmOAEntryDO entry = entryList.get(0);
|
||||
BpmOAEntryRespVO respVO = BpmOAEntryConvert.INSTANCE.convert(entry);
|
||||
if (entry.getResult().equals(BpmProcessInstanceResultEnum.REJECT.getResult())) {
|
||||
|
||||
// 获得取消流程的 task
|
||||
BpmTaskExtDO taskExtDO = bpmTaskService.getTaskByProcessInstanceIdAndResult(entry.getProcessInstanceId(),
|
||||
BpmProcessInstanceResultEnum.REJECT.getResult());
|
||||
|
||||
respVO.setRemark(taskExtDO.getReason());
|
||||
}
|
||||
|
||||
// 设备部门名称
|
||||
respVO.setEntryDeptName(getDept(entry.getEntryDeptId()).getName());
|
||||
// 设备岗位名称
|
||||
respVO.setEntryPostName(getPost(entry.getEntryPostId()).getName());
|
||||
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得部门信息
|
||||
* @param deptId 部门id
|
||||
|
@ -27,9 +27,6 @@ public class BpmOAEntryCreateReqVO {
|
||||
@NotNull(message = "发起人的用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "新入职用户编号", example = "6311")
|
||||
private Long entryUserId;
|
||||
|
||||
@Schema(description = "新入职用户部门编号", example = "10237")
|
||||
private Long entryDeptId;
|
||||
|
||||
@ -40,6 +37,10 @@ public class BpmOAEntryCreateReqVO {
|
||||
@NotEmpty(message = "用户昵称不能为空")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "合同公司 | 字典值参考bpm_entry_company", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "合同公司不能为空")
|
||||
private Integer contractCompany;
|
||||
|
||||
@Schema(description = "手机号码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "手机号码不能为空")
|
||||
private String mobile;
|
||||
@ -52,11 +53,12 @@ public class BpmOAEntryCreateReqVO {
|
||||
@DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate entryDate;
|
||||
|
||||
@Schema(description = "人脸图片地址")
|
||||
private String faceImg;
|
||||
@Schema(description = "面试评价", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "面试评价不能为空")
|
||||
private String interviewEvaluation;
|
||||
|
||||
@Schema(description = "openId", example = "27005")
|
||||
private String openId;
|
||||
@Schema(description = "薪资情况", example = "27005")
|
||||
private String salary;
|
||||
|
||||
@Schema(description = "上传文件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<UploadUserFile> fileItems;
|
||||
|
@ -24,9 +24,6 @@ public class BpmOAEntryRespVO extends BpmOABaseRespVO {
|
||||
@NotNull(message = "发起人的用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "新入职用户编号", example = "6311")
|
||||
private Long entryUserId;
|
||||
|
||||
@Schema(description = "新入职用户部门编号", example = "10237")
|
||||
private Long entryDeptId;
|
||||
|
||||
@ -43,6 +40,10 @@ public class BpmOAEntryRespVO extends BpmOABaseRespVO {
|
||||
@NotEmpty(message = "用户昵称不能为空")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "合同公司 | 字典值参考bpm_entry_company", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "合同公司不能为空")
|
||||
private Integer contractCompany;
|
||||
|
||||
@Schema(description = "手机号码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "手机号码不能为空")
|
||||
private String mobile;
|
||||
@ -54,11 +55,12 @@ public class BpmOAEntryRespVO extends BpmOABaseRespVO {
|
||||
@NotEmpty(message = "入职时间不能为空")
|
||||
private LocalDate entryDate;
|
||||
|
||||
@Schema(description = "人脸图片地址")
|
||||
private String faceImg;
|
||||
@Schema(description = "面试评价", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "面试评价不能为空")
|
||||
private String interviewEvaluation;
|
||||
|
||||
@Schema(description = "openId", example = "27005")
|
||||
private String openId;
|
||||
@Schema(description = "薪资情况", example = "27005")
|
||||
private String salary;
|
||||
|
||||
@Schema(description = "上传文件", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<UploadUserFile> fileItems;
|
||||
|
@ -52,6 +52,10 @@ public class BpmOAEntryDO extends BaseDO {
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickname;
|
||||
/**
|
||||
* 合同公司 | 字典值参考bpm_entry_company
|
||||
*/
|
||||
private Integer contractCompany;
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
@ -65,13 +69,13 @@ public class BpmOAEntryDO extends BaseDO {
|
||||
*/
|
||||
private LocalDate entryDate;
|
||||
/**
|
||||
* 人脸图片地址
|
||||
* 面试评价
|
||||
*/
|
||||
private String faceImg;
|
||||
private String interviewEvaluation;
|
||||
/**
|
||||
* openId
|
||||
* 薪资情况
|
||||
*/
|
||||
private String openId;
|
||||
private String salary;
|
||||
/**
|
||||
* 附件基本信息
|
||||
*/
|
||||
|
@ -4,7 +4,6 @@ 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.util.List;
|
||||
|
||||
public interface BpmOAEntryService {
|
||||
|
||||
@ -31,11 +30,4 @@ public interface BpmOAEntryService {
|
||||
* @return 入职申请信息
|
||||
*/
|
||||
BpmOAEntryDO getEntry(Long id);
|
||||
|
||||
/**
|
||||
* 获得指定入职申请
|
||||
* @param openId openId
|
||||
* @return 入职申请信息
|
||||
*/
|
||||
List<BpmOAEntryDO> getEntryByOpenId(String openId);
|
||||
}
|
||||
|
@ -3,17 +3,14 @@ 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.framework.web.config.WebProperties;
|
||||
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;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.upload.UploadUserFile;
|
||||
import cn.iocoder.yudao.module.bpm.convert.message.BpmMessageConvert;
|
||||
import cn.iocoder.yudao.module.bpm.convert.oa.BpmOAEntryConvert;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOAEntryDO;
|
||||
import cn.iocoder.yudao.module.bpm.dal.mysql.oa.BpmOAEntryMapper;
|
||||
import cn.iocoder.yudao.module.bpm.enums.message.BpmMessageEnum;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
|
||||
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
|
||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||
@ -136,23 +133,6 @@ public class BpmOAEntryServiceImpl implements BpmOAEntryService{
|
||||
.setUrls(convertList(uploadUserFiles, UploadUserFile::getUrl))
|
||||
.setUserId(userId);
|
||||
fileApi.updateUserFileUserId(updateReqDTO);
|
||||
|
||||
// 同步修改business_file文件 更新用户编号
|
||||
fileApi.updateBusinessFileFormEntry(entry.getFaceImg(), String.valueOf(userId));
|
||||
|
||||
try {
|
||||
// 同步插入用户拓展表
|
||||
usersExtApi.createUsersExt(userId, entry.getNickname(), entry.getEntryDeptId(), entry.getFaceImg());
|
||||
} catch (Exception e) {
|
||||
|
||||
Map<String, Object> templateParams = new HashMap<>();
|
||||
templateParams.put("userName", entry.getNickname());
|
||||
templateParams.put("detailUrl", webProperties.getAdminUi().getUrl() + "/attendance/user?userName=" + entry.getNickname());
|
||||
|
||||
// 发送站内信 通知流程发起人, 新员工人脸图片上传失败
|
||||
notifyMessageSendApi.sendSingleMessageToAdmin(BpmMessageConvert.INSTANCE.convert1(
|
||||
entry.getUserId(), BpmMessageEnum.BPM_OA_ENTRY_MESSAGE.getSmsTemplateCode(), templateParams));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,12 +155,4 @@ public class BpmOAEntryServiceImpl implements BpmOAEntryService{
|
||||
|
||||
return entryMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BpmOAEntryDO> getEntryByOpenId(String openId) {
|
||||
|
||||
return entryMapper.selectList(new LambdaQueryWrapperX<BpmOAEntryDO>()
|
||||
.eq(BpmOAEntryDO::getOpenId, openId)
|
||||
.orderByDesc(BpmOAEntryDO::getCreateTime));
|
||||
}
|
||||
}
|
||||
|
@ -753,8 +753,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||
|
||||
//如果当前审批人是流程发起人,且流程不是入职申请时
|
||||
// 则自动通过当前审批节点
|
||||
if (processInstance.getStartUserId().equals(task.getAssignee())
|
||||
&& !processInstance.getProcessDefinitionId().contains("oa_entry")) {
|
||||
if (processInstance.getStartUserId().equals(task.getAssignee())) {
|
||||
|
||||
BpmTaskApproveReqVO reqVO = new BpmTaskApproveReqVO();
|
||||
reqVO.setId(task.getId());
|
||||
|
@ -115,6 +115,12 @@ public class AdminUserDO extends TenantBaseDO {
|
||||
*/
|
||||
private Integer userNature;
|
||||
|
||||
/**
|
||||
* 用户编制
|
||||
* 5:试用 6:实习 7:在职 8:离职
|
||||
*/
|
||||
private Integer userStaffing;
|
||||
|
||||
/**
|
||||
* 最后登录IP
|
||||
*/
|
||||
|
@ -26,6 +26,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.cache.annotation.Caching;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -57,6 +58,7 @@ public class PermissionServiceImpl implements PermissionService {
|
||||
@Resource
|
||||
private DeptService deptService;
|
||||
@Resource
|
||||
@Lazy // 延迟,避免循环依赖报错
|
||||
private AdminUserService userService;
|
||||
|
||||
@Override
|
||||
|
@ -71,6 +71,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
@Resource
|
||||
private PostService postService;
|
||||
@Resource
|
||||
@Lazy // 延迟,避免循环依赖报错
|
||||
private PermissionService permissionService;
|
||||
@Resource
|
||||
private PasswordEncoder passwordEncoder;
|
||||
@ -116,11 +117,16 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启
|
||||
user.setPassword(encodePassword(createReqVO.getPassword())); // 加密密码
|
||||
userMapper.insert(user);
|
||||
|
||||
// 插入关联岗位
|
||||
if (CollectionUtil.isNotEmpty(user.getPostIds())) {
|
||||
userPostMapper.insertBatch(convertList(user.getPostIds(),
|
||||
postId -> new UserPostDO().setUserId(user.getId()).setPostId(postId)));
|
||||
}
|
||||
|
||||
// 默认赋予用户 普通角色
|
||||
permissionService.assignUserRole(user.getId(), Collections.singleton(2L));
|
||||
|
||||
return user.getId();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user