内部账号添加直销类别字段

This commit is contained in:
曹鹏飞 2026-01-21 14:01:10 +08:00
parent 10e2351a24
commit 34c1ffb170
4 changed files with 37 additions and 0 deletions

View File

@ -54,4 +54,9 @@ public class AccountAddRequest {
*/ */
@JsonProperty("isGongFuHandler") @JsonProperty("isGongFuHandler")
private boolean isGongFuHandler = false; private boolean isGongFuHandler = false;
/**
* 直销类别国内国外字典id
*/
private Long categoryId;
} }

View File

@ -84,5 +84,15 @@ public class AdminUserVO {
@JsonProperty("isGongfu") @JsonProperty("isGongfu")
private boolean isGongfu; private boolean isGongfu;
/**
* 直销类别国内国外字典id
*/
private Long categoryId;
/**
* 直销类别
*/
private String categoryName;
private List<AdminUserVO> children = new ArrayList<>(); private List<AdminUserVO> children = new ArrayList<>();
} }

View File

@ -132,4 +132,9 @@ public class AdminUser implements Serializable {
*/ */
@TableField("is_gongfu") @TableField("is_gongfu")
private boolean gongfu; private boolean gongfu;
/**
* 直销类别国内国外字典id
*/
private Long categoryId;
} }

View File

@ -67,6 +67,9 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
@Resource @Resource
private IDictionaryItemTranslateService dictionaryItemTranslateService; private IDictionaryItemTranslateService dictionaryItemTranslateService;
@Resource
private IDictionaryItemService dictionaryItemService;
@Override @Override
public AdminUser getUser(String userName, String password) { public AdminUser getUser(String userName, String password) {
AdminUser user = lambdaQuery() AdminUser user = lambdaQuery()
@ -99,6 +102,7 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
.setProductLine(request.getProductLine()) .setProductLine(request.getProductLine())
.setGongFuHandler(request.isGongFuHandler()) .setGongFuHandler(request.isGongFuHandler())
.setGongfu(StrUtil.contains(request.getProductLine(), Constant.MOBILE_BROKEN)) .setGongfu(StrUtil.contains(request.getProductLine(), Constant.MOBILE_BROKEN))
.setCategoryId(request.getCategoryId())
.setUpdateBy(AdminUserUtil.getUserId()) .setUpdateBy(AdminUserUtil.getUserId())
.setUpdateTime(LocalDateTime.now()); .setUpdateTime(LocalDateTime.now());
updateById(user); updateById(user);
@ -115,6 +119,7 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
.setProductLine(request.getProductLine()) .setProductLine(request.getProductLine())
.setGongFuHandler(request.isGongFuHandler()) .setGongFuHandler(request.isGongFuHandler())
.setGongfu(StrUtil.contains(request.getProductLine(), Constant.MOBILE_BROKEN)) .setGongfu(StrUtil.contains(request.getProductLine(), Constant.MOBILE_BROKEN))
.setCategoryId(request.getCategoryId())
.setTitleId(request.getTitleId()) .setTitleId(request.getTitleId())
.setCreateBy(AdminUserUtil.getUserId()) .setCreateBy(AdminUserUtil.getUserId())
.setCreateTime(LocalDateTime.now()); .setCreateTime(LocalDateTime.now());
@ -164,6 +169,12 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
List<AdminUser> users = lambdaQuery().list(); List<AdminUser> users = lambdaQuery().list();
List<AdminUserRoleMap> roleMaps = adminUserRoleMapService.lambdaQuery().list(); List<AdminUserRoleMap> roleMaps = adminUserRoleMapService.lambdaQuery().list();
List<AdminRole> roles = roleService.lambdaQuery().list(); List<AdminRole> roles = roleService.lambdaQuery().list();
List<DictionaryItem> categories = dictionaryItemService.lambdaQuery()
.in(DictionaryItem::getId, page.getRecords().stream()
.map(AdminUser::getCategoryId)
.filter(Objects::nonNull)
.collect(Collectors.toList())
).list();
pageData.setItems(page.getRecords().stream().map(u -> { pageData.setItems(page.getRecords().stream().map(u -> {
AdminUser userCreate = users.stream() AdminUser userCreate = users.stream()
.filter(it -> Objects.equals(it.getId(), u.getCreateBy())) .filter(it -> Objects.equals(it.getId(), u.getCreateBy()))
@ -188,6 +199,10 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
.filter(it -> Objects.equals(it.getUserId(), u.getId())) .filter(it -> Objects.equals(it.getUserId(), u.getId()))
.map(AdminUserRoleMap::getRoleId) .map(AdminUserRoleMap::getRoleId)
.collect(Collectors.toSet()); .collect(Collectors.toSet());
DictionaryItem category = categories.stream()
.filter(c -> Objects.equals(c.getId(), u.getCategoryId()))
.findFirst()
.orElse(null);
return new AdminUserVO() return new AdminUserVO()
.setId(u.getId()) .setId(u.getId())
.setUserCode(u.getUserCode()) .setUserCode(u.getUserCode())
@ -209,6 +224,8 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser
.setGongFuHandler(u.isGongFuHandler()) .setGongFuHandler(u.isGongFuHandler())
.setProductLine(u.getProductLine()) .setProductLine(u.getProductLine())
.setGongfu(u.isGongfu()) .setGongfu(u.isGongfu())
.setCategoryId(u.getCategoryId())
.setCategoryName(Objects.isNull(category) ? "" : category.getName())
.setRoles( .setRoles(
roles.stream() roles.stream()
.filter(r -> rmaps.contains(r.getId())) .filter(r -> rmaps.contains(r.getId()))