feat(wms): 添加用户昵称显示功能
- 在WmsCoilPendingActionMapper.xml中关联sys_user表获取创建人和操作人昵称 - 在WmsMaterialCoilMapper.xml中关联sys_user表获取创建人和更新人昵称 - 在WmsCoilPendingActionVo.java和WmsMaterialCoilVo.java中添加createByName和updateByName字段 - 在WmsDeliveryPlanServiceImpl.java中实现根据用户名获取用户昵称的逻辑 - 在WmsMaterialCoilServiceImpl.java中实现批量获取操作人昵称的功能 - 在pom.xml中添加klp-system依赖以支持用户服务调用
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.klp.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.klp.common.core.domain.entity.SysUser;
|
||||
import com.klp.common.core.page.TableDataInfo;
|
||||
import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -11,6 +12,7 @@ import com.klp.domain.vo.WmsDeliveryPlanStatisticsVo;
|
||||
import com.klp.domain.vo.WmsDeliveryReportByTypeVo;
|
||||
import com.klp.domain.vo.WmsDeliveryReportResultVo;
|
||||
import com.klp.domain.vo.WmsDeliveryReportSummaryVo;
|
||||
import com.klp.system.service.ISysUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.domain.bo.WmsDeliveryPlanBo;
|
||||
@@ -33,6 +35,8 @@ public class WmsDeliveryPlanServiceImpl implements IWmsDeliveryPlanService {
|
||||
|
||||
private final WmsDeliveryPlanMapper baseMapper;
|
||||
|
||||
private final ISysUserService userService;
|
||||
|
||||
/**
|
||||
* 查询发货计划
|
||||
*/
|
||||
@@ -48,9 +52,37 @@ public class WmsDeliveryPlanServiceImpl implements IWmsDeliveryPlanService {
|
||||
public TableDataInfo<WmsDeliveryPlanVo> queryPageList(WmsDeliveryPlanBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsDeliveryPlan> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsDeliveryPlanVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
result.getRecords().forEach(item -> {
|
||||
if (item.getCreateBy() != null) {
|
||||
item.setCreateByName(getUserNickname(item.getCreateBy()));
|
||||
}
|
||||
if (item.getUpdateBy() != null) {
|
||||
item.setUpdateByName(getUserNickname(item.getUpdateBy()));
|
||||
}
|
||||
});
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户名获取用户昵称
|
||||
* @param username 用户名
|
||||
* @return 用户昵称
|
||||
*/
|
||||
private String getUserNickname(String username) {
|
||||
try {
|
||||
// 通过用户名查找用户
|
||||
SysUser user = userService.selectUserByUserName(username);
|
||||
if (user != null) {
|
||||
return user.getNickName();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 出现异常时返回原用户名
|
||||
return username;
|
||||
}
|
||||
// 找不到用户时返回原用户名
|
||||
return username;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询发货计划列表
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user