出差申请功能优化:支持多随行人

重构出差申请模块,支持指定多个随行人。修改了BpmOAEvectionCreateReqVO和BpmOAEvectionDO中的字段,将单个随行人用户ID调整为用户ID集合。更新了BpmOAEvectionController中的逻辑,以处理多随行人的情况,包括从集合中转换和合并用户名称。
This commit is contained in:
furongxin 2024-09-23 14:26:42 +08:00
parent b5a3bcac50
commit d55524789a
4 changed files with 20 additions and 10 deletions

View File

@ -1,5 +1,6 @@
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.evection.BpmOAEvectionCreateReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.evection.BpmOAEvectionRespVO;
@ -17,7 +18,11 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
/**
@ -54,9 +59,9 @@ public class BpmOAEvectionController {
BpmOAEvectionRespVO respVO = BpmOAEvectionConvert.INSTANCE.convert(evection);
if (evection.getTogetherUserId() != null) {
AdminUserRespDTO userRespDTO = userApi.getUser(evection.getTogetherUserId()).getCheckedData();
respVO.setTogetherUserName(userRespDTO.getNickname());
if (CollectionUtil.isNotEmpty(evection.getTogetherUserIds())) {
List<AdminUserRespDTO> userRespDTOs = userApi.getUserList(respVO.getTogetherUserIds()).getCheckedData();
respVO.setTogetherUserName(String.join("", convertList(userRespDTOs, AdminUserRespDTO::getNickname)));
}
return success(respVO);
@ -71,9 +76,9 @@ public class BpmOAEvectionController {
BpmOAEvectionRespVO respVO = BpmOAEvectionConvert.INSTANCE.convert(evection);
if (evection.getTogetherUserId() != null) {
AdminUserRespDTO userRespDTO = userApi.getUser(evection.getTogetherUserId()).getCheckedData();
respVO.setTogetherUserName(userRespDTO.getNickname());
if (CollectionUtil.isNotEmpty(evection.getTogetherUserIds())) {
List<AdminUserRespDTO> userRespDTOs = userApi.getUserList(evection.getTogetherUserIds()).getCheckedData();
respVO.setTogetherUserName(String.join("", convertList(userRespDTOs, AdminUserRespDTO::getNickname)));
}
return success(respVO);

View File

@ -11,6 +11,7 @@ import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ -30,7 +31,7 @@ public class BpmOAEvectionCreateReqVO {
private String reason;
@Schema(description = "随行人用户编号")
private Long togetherUserId;
private Set<Long> togetherUserIds;
@Schema(description = "出差起点", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "出差起点不能为空")

View File

@ -12,6 +12,7 @@ import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ -29,7 +30,7 @@ public class BpmOAEvectionRespVO extends BpmOABaseRespVO {
private String reason;
@Schema(description = "随行人用户编号")
private Long togetherUserId;
private Set<Long> togetherUserIds;
@Schema(description = "随行人用户名称")
private String togetherUserName;

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.dal.dataobject.oa;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.common.pojo.UploadUserFile;
import cn.iocoder.yudao.framework.mybatis.core.type.JsonLongSetTypeHandler;
import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
@ -12,6 +13,7 @@ import lombok.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
/**
* OA 出差申请 DO
@ -48,9 +50,10 @@ public class BpmOAEvectionDO extends BaseDO {
private String reason;
/**
* 随行人用户编号
* 随行人用户编号
*/
private Long togetherUserId;
@TableField(typeHandler = JsonLongSetTypeHandler.class)
private Set<Long> togetherUserIds;
/**
* 出差地点 起点