feat: 一些调整

This commit is contained in:
曹鹏飞 2025-02-24 00:02:33 +08:00
parent 34c71b34b2
commit 17cfb848be
3 changed files with 36 additions and 3 deletions

View File

@ -75,6 +75,9 @@ public class AppUserController extends ControllerBase {
@Resource @Resource
private RedisTemplate<String, String> redisTemplate; private RedisTemplate<String, String> redisTemplate;
@Resource
private ITBasePositionService positionService;
/** /**
* 获取公司列表 * 获取公司列表
* @param userId 用户id * @param userId 用户id
@ -97,6 +100,20 @@ public class AppUserController extends ControllerBase {
return ApiResult.success(appUserService.getSimpleAreas(userId)); return ApiResult.success(appUserService.getSimpleAreas(userId));
} }
/**
* 获取职位列表
* @return 职位列表
**/
@GetMapping("getTitles")
@ApiMark(moduleName = "代理商管理", apiName = "获取职位列表")
public ApiResult<List<TitleVO>> getTitles() {
List<TitleSimpleVO> datas = positionService.getSimpleTitles(2);
List<TitleVO> list = datas.stream()
.map(d -> new TitleVO().setId(d.getId()).setName(d.getName()).setValue(d.getName()))
.collect(Collectors.toList());
return ApiResult.success(list);
}
/** /**
* 添加代理商主账号 * 添加代理商主账号
* @param request 请求参数 * @param request 请求参数

View File

@ -84,6 +84,9 @@ public class AppUserForAdminVO {
//职位 //职位
private String title; private String title;
//职位id
private Integer titleId;
//下级账号 //下级账号
private List<AppUserForAdminVO> children; private List<AppUserForAdminVO> children;
} }

View File

@ -325,6 +325,10 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
} }
List<Integer> companyIds = Arrays.stream(d.getCompanyId().split(",")).filter(StrUtil::isNotBlank).map(Integer::valueOf).collect(Collectors.toList()); List<Integer> companyIds = Arrays.stream(d.getCompanyId().split(",")).filter(StrUtil::isNotBlank).map(Integer::valueOf).collect(Collectors.toList());
List<String> customers = customerService.listByIds(companyIds).stream().map(TBaseCustomer::getAgencyCompanyName).collect(Collectors.toList()); List<String> customers = customerService.listByIds(companyIds).stream().map(TBaseCustomer::getAgencyCompanyName).collect(Collectors.toList());
TBasePosition title = null;
if (Objects.nonNull(d.getTitleId())) {
title = positionService.getById(d.getTitleId());
}
return new AppUserForAdminVO() return new AppUserForAdminVO()
.setKey("u-" + d.getId()) .setKey("u-" + d.getId())
.setId(d.getId()) .setId(d.getId())
@ -348,6 +352,8 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
.setPrimary(true) .setPrimary(true)
.setState(d.getExpireTime().isAfter(ChronoLocalDate.from(LocalDateTime.now())) ? 1 : 2) .setState(d.getExpireTime().isAfter(ChronoLocalDate.from(LocalDateTime.now())) ? 1 : 2)
.setLastLoginTime(d.getLastLoginTime()) .setLastLoginTime(d.getLastLoginTime())
.setTitleId(d.getTitleId())
.setTitle(Objects.isNull(title)?"":title.getPositionName())
.setChildren(getChildrenOfAppUser(d.getId())); .setChildren(getChildrenOfAppUser(d.getId()));
}); });
} }
@ -399,13 +405,16 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
}); });
List<AppUser> datas = baseMapper.selectList(queryWrapper); List<AppUser> datas = baseMapper.selectList(queryWrapper);
List<AppUserForAdminVO> vos = datas.stream().map(d -> { List<AppUserForAdminVO> vos = datas.stream().map(d -> {
AppArea area = appAreaService.getById(d.getAreaId()); String areaName = "";
if (Objects.nonNull(d.getAreaId())) {
areaName = appAreaService.getById(d.getAreaId()).getName();
}
AppUser createUser = getById(d.getCreateBy()); AppUser createUser = getById(d.getCreateBy());
String updateBy = null; String updateBy = null;
if (Objects.nonNull(d.getUpdateBy())) { if (Objects.nonNull(d.getUpdateBy())) {
updateBy = getById(d.getUpdateBy()).getName(); updateBy = getById(d.getUpdateBy()).getName();
} }
TBaseCustomer customer=customerService.getById(d.getCompanyId()); TBaseCustomer customer=customerService.getById(Integer.valueOf(d.getCompanyId()));
TBasePosition title=positionService.getById(d.getTitleId()); TBasePosition title=positionService.getById(d.getTitleId());
return new AppUserForAdminVO() return new AppUserForAdminVO()
.setKey("u-" + d.getId()) .setKey("u-" + d.getId())
@ -414,12 +423,16 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
.setLoginName(d.getLoginName()) .setLoginName(d.getLoginName())
.setUserName(d.getName()) .setUserName(d.getName())
.setCompanyName(customer.getAgencyCompanyName()) .setCompanyName(customer.getAgencyCompanyName())
.setCompanyIds(Collections.singletonList(Integer.valueOf(d.getCompanyId())))
.setName(d.getName()) .setName(d.getName())
.setEmail(d.getEmail()) .setEmail(d.getEmail())
.setPhone(d.getPhone())
.setTitle(title.getPositionName()) .setTitle(title.getPositionName())
.setTitleId(d.getTitleId())
.setLanguageCode(d.getLanguageCode()) .setLanguageCode(d.getLanguageCode())
.setSalesUserName(d.getSalesUserName()) .setSalesUserName(d.getSalesUserName())
.setAreaName(area.getName()) .setAreaName(areaName)
.setAreaId(d.getAreaId())
.setUserState(d.getState()) .setUserState(d.getState())
.setPrimary(false) .setPrimary(false)
.setExpireTime(d.getExpireTime()) .setExpireTime(d.getExpireTime())