|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
package cn.iocoder.yudao.module.bpm.service.expenseapply;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
|
|
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
|
|
|
@ -8,7 +7,6 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
|
import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils;
|
|
|
|
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
|
|
|
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
|
|
|
|
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
|
|
|
|
import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi;
|
|
|
|
|
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
|
|
|
|
@ -24,6 +22,8 @@ import cn.iocoder.yudao.module.bs.dal.mysql.expenseapply.ExpenseApplyMapper;
|
|
|
|
|
import cn.iocoder.yudao.module.bs.enums.BillTypeEnum;
|
|
|
|
|
import cn.iocoder.yudao.module.bs.enums.ExpenseApplyStatusEnum;
|
|
|
|
|
import cn.iocoder.yudao.module.bpm.service.expenseapplytrip.ExpenseApplyTripService;
|
|
|
|
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
|
|
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
|
|
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|
|
|
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
@ -34,10 +34,8 @@ import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.validation.Validator;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
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;
|
|
|
|
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
|
|
|
@ -61,6 +59,8 @@ public class ExpenseApplyServiceImpl extends ServiceImpl<ExpenseApplyMapper, Exp
|
|
|
|
|
@Resource
|
|
|
|
|
private AdminUserApi adminUserApi;
|
|
|
|
|
@Resource
|
|
|
|
|
private DeptApi deptApi;
|
|
|
|
|
@Resource
|
|
|
|
|
private ExpenseApplyTripService expenseApplyTripService;
|
|
|
|
|
@Resource
|
|
|
|
|
private BpmProcessInstanceApi processInstanceApi;
|
|
|
|
@ -205,4 +205,22 @@ public class ExpenseApplyServiceImpl extends ServiceImpl<ExpenseApplyMapper, Exp
|
|
|
|
|
updateById(apply);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setNickNameField(List<ExpenseApplyDO> list) {
|
|
|
|
|
List<Long> userIds = list.stream().map(ExpenseApplyDO::getUserId).distinct().collect(Collectors.toList());
|
|
|
|
|
Map<Long, String> userMap = adminUserApi.getUserList(userIds).stream().collect(Collectors.toMap(AdminUserRespDTO::getId, user -> user.getNickname()));
|
|
|
|
|
for (ExpenseApplyDO expenseApply : list) {
|
|
|
|
|
expenseApply.setNickname(userMap.get(expenseApply.getUserId()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setDeptNameField(List<ExpenseApplyDO> list) {
|
|
|
|
|
List<Long> deptIds = list.stream().map(ExpenseApplyDO::getDeptId).distinct().collect(Collectors.toList());
|
|
|
|
|
Map<Long, String> deptMap = deptApi.getDeptList(deptIds).stream().collect(Collectors.toMap(DeptRespDTO::getId, dept -> dept.getName()));
|
|
|
|
|
for (ExpenseApplyDO expenseApply : list) {
|
|
|
|
|
expenseApply.setDeptName(deptMap.get(expenseApply.getDeptId()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|