feat(bpm): 优化报销单信息获取接口
- 添加付款公司名称字段 - 优化部门信息获取逻辑,提高代码复用性 - 使用 Set 替代 List 存储部门 ID,提高查询效率
This commit is contained in:
parent
837af9a7c8
commit
5d837270ab
@ -38,10 +38,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
@ -356,13 +353,19 @@ public class BpmOAReimbursementServiceImpl extends BpmOABaseService implements B
|
||||
data.setDeptId(userRespDTO.getDeptId());
|
||||
}
|
||||
|
||||
Set<Long> deptIds = convertSet(reimbursements, BpmOAReimbursementItemDO::getDeptId);
|
||||
if (reimbursementDO.getPaymentCompany() != null) {
|
||||
deptIds.add(reimbursementDO.getPaymentCompany());
|
||||
}
|
||||
//获取部门信息map
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(reimbursements, BpmOAReimbursementItemDO::getDeptId));
|
||||
Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(deptIds);
|
||||
|
||||
List<ReimbursementDTO> reimbursementDTOS = BeanUtils.toBean(reimbursements, ReimbursementDTO.class);
|
||||
|
||||
BpmOAReimbursementRespVO bpmOAReimbursementRespVO = BeanUtils.toBean(reimbursementDO, BpmOAReimbursementRespVO.class);
|
||||
bpmOAReimbursementRespVO.setReimbursements(BpmOAReimbursementConvert.INSTANCE.convertList(reimbursementDTOS, deptMap)); //拼接数据
|
||||
// 设置付款公司名称
|
||||
bpmOAReimbursementRespVO.setPaymentCompanyName(deptMap.get(reimbursementDO.getPaymentCompany()) == null ? null : deptMap.get(reimbursementDO.getPaymentCompany()).getName());
|
||||
|
||||
return bpmOAReimbursementRespVO;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user