Sfoglia il codice sorgente

feat(order): 增加订单业务人员和额度信息功能

- 增加了验证码有效期从2分钟调整为5分钟
- 在订单主服务中增加业务人员、客服人员和业务部门信息的获取和设置
- 添加了客户销售信息中的销售人员、服务人员和所属部门字段
- 增加了订单主VO中的临时额度和剩余额度字段
- 在客户信息服务中增加客户名称的返回
- 优化了伙伴商用户和服务商用户的新增逻辑,统一设置角色ID并处理用户角色关联
- 增加了用户角色新增接口和实现,支持用户角色的精确控制
- 在订单分配服务中增加商品分类名称的传递
- 优化了供应商注册流程,确保系统用户创建和角色分配的完整性
hurx 4 settimane fa
parent
commit
336f994434

+ 15 - 0
ruoyi-api/ruoyi-api-customer/src/main/java/org/dromara/customer/api/domain/vo/RemoteCustomerSalesVo.java

@@ -66,4 +66,19 @@ public class RemoteCustomerSalesVo implements Serializable {
      * 信用支付密码
      */
     private String creditPaymentPassword;
+
+    /**
+     * 销售人员
+     */
+    private Long salesPersonId;
+
+    /**
+     * 服务人员
+     */
+    private Long serviceStaffId;
+
+    /**
+     * 所属部门
+     */
+    private Long belongingDepartmentId;
 }

+ 6 - 0
ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/RemoteUserService.java

@@ -194,6 +194,12 @@ public interface RemoteUserService {
      */
     Long addUser(RemoteUserBo remoteUserBo) throws ServiceException;
 
+    /**
+     * 新增用户角色
+     */
+    Integer addUserRole(RemoteUserBo remoteUserBo) throws ServiceException;
+
+
     /**
      * 编辑用户
      */

+ 1 - 1
ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/constant/Constants.java

@@ -65,7 +65,7 @@ public interface Constants {
     /**
      * 验证码有效期(分钟)
      */
-    Integer CAPTCHA_EXPIRATION = 2;
+    Integer CAPTCHA_EXPIRATION = 5;
 
     /**
      * 顶级部门id

+ 2 - 1
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerInfoServiceImpl.java

@@ -965,7 +965,7 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
         boolean insertSuccess = false;
         int maxRetries = 3;
 
-// 1. 执行带重试的客户插入逻辑
+        // 1. 执行带重试的客户插入逻辑
         for (int i = 0; i < maxRetries; i++) {
             try {
                 // 生成编号 (注意:每次重试都要重新生成,避免使用冲突的号码)
@@ -1061,6 +1061,7 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
         remoteUserBo.setUserName(bo.getPurchasePhone());
         remoteUserBo.setNickName(bo.getPurchaseName());
         remoteUserBo.setPhonenumber(bo.getPurchasePhone());
+        remoteUserBo.setRoleId(1996816313015631873L);
         remoteUserBo.setPassword(BCrypt.hashpw(bo.getPassword()));
         remoteUserBo.setUserSonType("3"); // 商城用户
         remoteUserBo.setTenantId(LoginHelper.getTenantId());

+ 10 - 4
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/PartnerUserServiceImpl.java

@@ -2,6 +2,7 @@ package org.dromara.customer.service.impl;
 
 import cn.hutool.crypto.digest.BCrypt;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.dromara.common.core.exception.ServiceException;
 import org.dromara.common.core.utils.MapstructUtils;
 import org.dromara.common.core.utils.StringUtils;
 import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -34,7 +35,7 @@ import java.util.Collection;
 @Slf4j
 @RequiredArgsConstructor
 @Service
-public class PartnerUserServiceImpl  extends ServiceImpl<PartnerUserMapper, PartnerUser> implements IPartnerUserService {
+public class PartnerUserServiceImpl extends ServiceImpl<PartnerUserMapper, PartnerUser> implements IPartnerUserService {
 
     private final PartnerUserMapper baseMapper;
     private final RemoteUserService remoteUserService;
@@ -46,7 +47,7 @@ public class PartnerUserServiceImpl  extends ServiceImpl<PartnerUserMapper, Part
      * @return 伙伴商用户
      */
     @Override
-    public PartnerUserVo queryById(Long id){
+    public PartnerUserVo queryById(Long id) {
         return baseMapper.selectVoById(id);
     }
 
@@ -115,6 +116,7 @@ public class PartnerUserServiceImpl  extends ServiceImpl<PartnerUserMapper, Part
             remoteUserBo.setPassword(BCrypt.hashpw(bo.getPassword()));
             remoteUserBo.setPhonenumber(bo.getPhone());
             remoteUserBo.setEmail(bo.getEmail());
+            remoteUserBo.setRoleId(1996816313015631873L);//默认伙伴商的角色
             remoteUserBo.setNickName(bo.getName());
             remoteUserBo.setTenantId(add.getTenantId()); // 从实体对象获取 tenantId
             remoteUserBo.setUserSonType("2"); // 2=伙伴商
@@ -124,6 +126,10 @@ public class PartnerUserServiceImpl  extends ServiceImpl<PartnerUserMapper, Part
 
             // 调用远程服务新增用户
             Long sysUserId = remoteUserService.addUser(remoteUserBo);
+            remoteUserBo.setUserId(sysUserId);
+            if (remoteUserService.addUserRole(remoteUserBo) <= 0) {
+                throw new ServiceException("伙伴商角色信息新增失败");
+            }
 
             // 更新 sys_user_id
             add.setSysUserId(sysUserId);
@@ -149,7 +155,7 @@ public class PartnerUserServiceImpl  extends ServiceImpl<PartnerUserMapper, Part
     /**
      * 保存前的数据校验
      */
-    private void validEntityBeforeSave(PartnerUser entity){
+    private void validEntityBeforeSave(PartnerUser entity) {
         //TODO 做一些数据校验,如唯一约束
     }
 
@@ -162,7 +168,7 @@ public class PartnerUserServiceImpl  extends ServiceImpl<PartnerUserMapper, Part
      */
     @Override
     public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
-        if(isValid){
+        if (isValid) {
             //TODO 做一些业务上的校验,判断是否需要校验
         }
         return baseMapper.deleteByIds(ids) > 0;

+ 15 - 9
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/SupplierContactServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.crypto.digest.BCrypt;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.dubbo.config.annotation.DubboReference;
+import org.dromara.common.core.exception.ServiceException;
 import org.dromara.common.core.utils.MapstructUtils;
 import org.dromara.common.core.utils.StringUtils;
 import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -44,7 +45,7 @@ import java.util.stream.Collectors;
 @Slf4j
 @RequiredArgsConstructor
 @Service
-public class SupplierContactServiceImpl  extends ServiceImpl<SupplierContactMapper, SupplierContact> implements ISupplierContactService {
+public class SupplierContactServiceImpl extends ServiceImpl<SupplierContactMapper, SupplierContact> implements ISupplierContactService {
 
     private final SupplierContactMapper baseMapper;
 
@@ -60,7 +61,7 @@ public class SupplierContactServiceImpl  extends ServiceImpl<SupplierContactMapp
      * @return 联系人
      */
     @Override
-    public SupplierContactVo queryById(Long id){
+    public SupplierContactVo queryById(Long id) {
         SupplierContactVo supplierContactVo = baseMapper.selectVoById(id);
         SupplierInfo one = supplierInfoService.getOne(new LambdaQueryWrapper<SupplierInfo>().eq(SupplierInfo::getId, supplierContactVo.getSupplierId()));
         one.getEnterpriseName();
@@ -77,7 +78,7 @@ public class SupplierContactServiceImpl  extends ServiceImpl<SupplierContactMapp
      */
     @Override
     public TableDataInfo<SupplierContactVo> queryPageList(SupplierContactBo bo, PageQuery pageQuery) {
-        if (bo.getSupplierName()!= null){
+        if (bo.getSupplierName() != null) {
             SupplierInfo one = supplierInfoService.getOne(new LambdaQueryWrapper<SupplierInfo>().eq(SupplierInfo::getEnterpriseName, bo.getSupplierName()));
             bo.setSupplierId(one.getId());
         }
@@ -86,6 +87,7 @@ public class SupplierContactServiceImpl  extends ServiceImpl<SupplierContactMapp
         setSupplierNames(result.getRecords());
         return TableDataInfo.build(result);
     }
+
     private void setSupplierNames(List<SupplierContactVo> records) {
         if (records == null || records.isEmpty()) {
             return;
@@ -123,8 +125,8 @@ public class SupplierContactServiceImpl  extends ServiceImpl<SupplierContactMapp
     @Override
     public TableDataInfo<SupplierContactVo> queryPageListById(SupplierContactBo bo, PageQuery pageQuery) {
         LambdaQueryWrapper<SupplierContact> lqw = buildQueryWrapper(bo);
-        lqw.eq(bo.getSupplierId()!=null , SupplierContact::getSupplierId , bo.getSupplierId());
-        lqw.eq(bo.getUserId()!=null , SupplierContact::getUserId , bo.getUserId());
+        lqw.eq(bo.getSupplierId() != null, SupplierContact::getSupplierId, bo.getSupplierId());
+        lqw.eq(bo.getUserId() != null, SupplierContact::getUserId, bo.getUserId());
         Page<SupplierContactVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
         setSupplierNames(result.getRecords());
         return TableDataInfo.build(result);
@@ -144,7 +146,6 @@ public class SupplierContactServiceImpl  extends ServiceImpl<SupplierContactMapp
     }
 
 
-
     private LambdaQueryWrapper<SupplierContact> buildQueryWrapper(SupplierContactBo bo) {
         Map<String, Object> params = bo.getParams();
         LambdaQueryWrapper<SupplierContact> lqw = Wrappers.lambdaQuery();
@@ -154,7 +155,7 @@ public class SupplierContactServiceImpl  extends ServiceImpl<SupplierContactMapp
         lqw.like(StringUtils.isNotBlank(bo.getUserName()), SupplierContact::getUserName, bo.getUserName());
         lqw.eq(StringUtils.isNotBlank(bo.getPhone()), SupplierContact::getPhone, bo.getPhone());
         lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SupplierContact::getStatus, bo.getStatus());
-        lqw.eq(StringUtils.isNotBlank(bo.getUserNo()),SupplierContact::getUserNo,bo.getUserNo());
+        lqw.eq(StringUtils.isNotBlank(bo.getUserNo()), SupplierContact::getUserNo, bo.getUserNo());
         return lqw;
     }
 
@@ -194,6 +195,11 @@ public class SupplierContactServiceImpl  extends ServiceImpl<SupplierContactMapp
         remoteUserBo.setTenantId(LoginHelper.getTenantId());
         Long userId = remoteUserService.addUser(remoteUserBo);
 
+        remoteUserBo.setUserId(userId);
+        if (remoteUserService.addUserRole(remoteUserBo) <= 0) {
+            throw new ServiceException("供应商角色信息新增失败");
+        }
+
         // 查询最大的用户编号
         LambdaQueryWrapper<SupplierContact> lqw = Wrappers.lambdaQuery();
         lqw.select(SupplierContact::getUserNo)
@@ -229,7 +235,7 @@ public class SupplierContactServiceImpl  extends ServiceImpl<SupplierContactMapp
 
             baseMapper.update(null, updateWrapper);
         }
-        if (update.getUserId() != null){
+        if (update.getUserId() != null) {
             RemoteUserBo remoteUserBo = new RemoteUserBo();
             remoteUserBo.setNickName(bo.getUserName());
             remoteUserBo.setUserName(bo.getPhone());
@@ -255,7 +261,7 @@ public class SupplierContactServiceImpl  extends ServiceImpl<SupplierContactMapp
      */
     @Override
     public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
-        if(isValid){
+        if (isValid) {
             //TODO 做一些业务上的校验,判断是否需要校验
         }
         return baseMapper.deleteByIds(ids) > 0;

+ 19 - 16
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/SupplierInfoServiceImpl.java

@@ -180,7 +180,6 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
     }
 
 
-
     /**
      * 修改供应商信息
      *
@@ -626,7 +625,6 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
     }
 
 
-
     /**
      * 分页查询供应商信息列表
      *
@@ -1569,7 +1567,6 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
     }
 
 
-
     private SupplierInfoVo handleProcurementInfo(SupplierInfoVo records) {
 
         // 查询管理人员和采购人员
@@ -1713,7 +1710,6 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
     }*/
 
 
-
     /**
      * 处理采购员和产品经理信息和品牌和供应商类型
      */
@@ -2207,6 +2203,24 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
         if (supplierBusinessInfoMapper.insert(businessInfo) <= 0) {
             throw new ServiceException("供应商工商信息新增失败");
         }
+        log.info("供应商注册成功,供应商ID:{},供应商名称:{}", supplierId, bo.getEnterpriseName());
+
+        // 创建系统用户
+        RemoteUserBo remoteUserBo = new RemoteUserBo();
+        remoteUserBo.setUserName(bo.getPurchasePhone());
+        remoteUserBo.setNickName(bo.getPurchaseName());
+        remoteUserBo.setRoleId(1996815844478320642L);
+        remoteUserBo.setPhonenumber(bo.getPurchasePhone());
+        remoteUserBo.setPassword(BCrypt.hashpw(bo.getPassword()));
+        remoteUserBo.setUserSonType("3"); // 商城用户
+        remoteUserBo.setTenantId(LoginHelper.getTenantId());
+        remoteUserBo.setStatus("0"); // 正常状态
+
+        Long remoteUserId = remoteUserService.addUser(remoteUserBo);
+        remoteUserBo.setUserId(remoteUserId);
+        if (remoteUserService.addUserRole(remoteUserBo) <= 0) {
+            throw new ServiceException("供应商角色信息新增失败");
+        }
 
         // 添加客户联系人信息
         SupplierContact contact = new SupplierContact();
@@ -2215,6 +2229,7 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
         contact.setUserName(bo.getPurchaseName());
         contact.setPhone(bo.getPurchasePhone());
         contact.setPhone(bo.getPurchasePhone());
+        contact.setUserId(remoteUserId);
         contact.setIsPrimaryContact("1"); // 设为主联系人
         contact.setIsRegister("1");
         contact.setStatus("0");
@@ -2255,19 +2270,7 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
             throw new ServiceException("供应商供应区域信息批量新增失败");
         }
 
-        // 创建系统用户
-        RemoteUserBo remoteUserBo = new RemoteUserBo();
-        remoteUserBo.setUserName(bo.getPurchasePhone());
-        remoteUserBo.setNickName(bo.getPurchaseName());
-        remoteUserBo.setPhonenumber(bo.getPurchasePhone());
-        remoteUserBo.setPassword(BCrypt.hashpw(bo.getPassword()));
-        remoteUserBo.setUserSonType("3"); // 商城用户
-        remoteUserBo.setTenantId(LoginHelper.getTenantId());
-        remoteUserBo.setStatus("0"); // 正常状态
-
-        remoteUserService.addUser(remoteUserBo);
 
-        log.info("供应商注册成功,供应商ID:{},供应商名称:{}", supplierId, bo.getEnterpriseName());
         return true;
     }
 

+ 11 - 0
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/domain/vo/OrderMainVo.java

@@ -124,6 +124,17 @@ public class OrderMainVo implements Serializable {
     @ExcelDictFormat(readConverterExp = "元=")
     private BigDecimal creditLimit;
 
+    /**
+     * 临时额度(元)
+     */
+    private BigDecimal temporaryQuota;
+
+    /**
+     * 剩余额度(元)
+     */
+    private BigDecimal remainingQuota;
+
+
     /**
      * 预计送达时间
      */

+ 1 - 0
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/service/impl/OrderAssignmentServiceImpl.java

@@ -336,6 +336,7 @@ public class OrderAssignmentServiceImpl extends ServiceImpl<OrderAssignmentMappe
                 childProduct.setProductUnitId(parentItem.getProductUnitId());
                 childProduct.setProductUnit(parentItem.getProductUnit());
                 childProduct.setProductImage(parentItem.getProductImage());
+                childProduct.setCategoryName(parentItem.getCategoryName());
 
                 // 价格信息
                 childProduct.setPlatformPrice(parentItem.getPlatformPrice());

+ 36 - 5
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/service/impl/OrderMainServiceImpl.java

@@ -42,9 +42,7 @@ import org.dromara.order.utils.kd100.domain.QueryTrackDTO;
 import org.dromara.order.utils.kd100.domain.TrackData;
 import org.dromara.order.utils.kd100.domain.TrackVO;
 import org.dromara.product.api.RemoteProductShoppingCartService;
-import org.dromara.system.api.RemoteComLogisticsCompanyService;
-import org.dromara.system.api.RemoteDeptService;
-import org.dromara.system.api.RemoteUserService;
+import org.dromara.system.api.*;
 import org.mybatis.spring.MyBatisSystemException;
 import org.springframework.dao.DuplicateKeyException;
 import org.springframework.stereotype.Service;
@@ -79,6 +77,11 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
     @DubboReference
     private RemoteCustomerSalesService remoteCustomerSalesService;
 
+    @DubboReference
+    private RemoteComStaffService remoteComStaffService;
+    @DubboReference
+    private RemoteComDeptService remoteComDeptService;
+
     //客户订单流程
     private final IOrderCustomerFlowService orderCustomerFlowService;
 
@@ -135,6 +138,12 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
         customerIds.add(orderMainVo.getCustomerId());
         Map<Long, String> map = remoteCustomerService.selectCustomerNameByIds(customerIds);
         orderMainVo.setCustomerName(map.get(orderMainVo.getCustomerId()));
+        RemoteCustomerSalesVo remoteCustomerSalesVo = remoteCustomerSalesService.selectCustomerSalesInfoByCustomerId(orderMainVo.getCustomerId());
+        if (null != remoteCustomerSalesVo) {
+            orderMainVo.setCreditLimit(remoteCustomerSalesVo.getCreditAmount());
+            orderMainVo.setRemainingQuota(remoteCustomerSalesVo.getRemainingQuota());
+            orderMainVo.setTemporaryQuota(remoteCustomerSalesVo.getTemporaryQuota());
+        }
 
         orderMainVo.setDeliverProductList(
             orderDeliverProductMapper.selectDeliverProductsByOrderId(orderMainVo.getId())
@@ -178,7 +187,6 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
                 orderMainVo.setCreateDeptName(deptMap.get(orderMainVo.getCreateDept()));
                 orderMainVo.setCustomerName(customerMap.get(orderMainVo.getCustomerId()));
             });
-
         }
         return TableDataInfo.build(result);
     }
@@ -478,9 +486,32 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Long insertOrder(PcSubmitOrderBo bo, OrderMainBo mainBo) {
+        RemoteCustomerSalesVo remoteCustomerSalesVo = remoteCustomerSalesService.selectCustomerSalesInfoByCustomerId(mainBo.getCustomerId());
+        if (null != remoteCustomerSalesVo) {
+            Long salesPersonId = remoteCustomerSalesVo.getSalesPersonId();//销售人员id
+            Long serviceStaffId = remoteCustomerSalesVo.getServiceStaffId();//服务人员
+            Long belongingDepartmentId = remoteCustomerSalesVo.getBelongingDepartmentId();//所属部门
+            Set<Long> staffIds = new HashSet<>();
+            Set<Long> deptIds = new HashSet<>();
+
+            staffIds.add(salesPersonId);
+            staffIds.add(serviceStaffId);
+            deptIds.add(belongingDepartmentId);
+
+            Map<Long, String> staffMap = staffIds.isEmpty()
+                ? Collections.emptyMap()
+                : remoteComStaffService.selectStaffNameByIds(staffIds);
+
+            Map<Long, String> deptMap = deptIds.isEmpty()
+                ? Collections.emptyMap()
+                : remoteDeptService.selectDeptNameByIds(deptIds);
+
+            mainBo.setBusinessStaff(staffMap.get(salesPersonId));
+            mainBo.setCustomerService(staffMap.get(serviceStaffId));
+            mainBo.setBusinessDept(deptMap.get(belongingDepartmentId));
+        }
         // 1. 插入主订单,获取生成的 ID
         Long orderId = this.insertByBo(mainBo);
-
         // 2. 校验插入是否成功
         if (orderId != null && orderId > 0) {
             // 3. 初始化审批流程

+ 4 - 3
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysUserController.java

@@ -123,8 +123,9 @@ public class SysUserController extends BaseController {
         userInfoVo.setUser(user);
         userInfoVo.setPermissions(loginUser.getMenuPermission());
         userInfoVo.setRoles(loginUser.getRolePermission());
-        if(ObjectUtil.isNotEmpty(loginUser.getCustomerId())){
+        if (ObjectUtil.isNotEmpty(loginUser.getCustomerId())) {
             userInfoVo.setCompanyName(remoteCustomerService.selectCompanyNameByCustomerId(loginUser.getCustomerId()));
+            userInfoVo.setCustomerName(remoteCustomerService.selectCustomerInfoById(loginUser.getCustomerId()).getCustomerName());
         }
 
         return R.ok(userInfoVo);
@@ -165,7 +166,7 @@ public class SysUserController extends BaseController {
     @SaCheckPermission("system:user:add")
     @Log(title = "用户管理", businessType = BusinessType.INSERT)
     @PostMapping
-    public R<Void> add(@Validated @RequestBody SysUserBo user ) {
+    public R<Void> add(@Validated @RequestBody SysUserBo user) {
         deptService.checkDeptDataScope(user.getDeptId());
         if (!userService.checkUserNameUnique(user)) {
             return R.fail("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
@@ -285,7 +286,7 @@ public class SysUserController extends BaseController {
     @PutMapping("/authRole")
     public R<Void> insertAuthRole(Long userId, Long[] roleIds) {
         userService.checkUserDataScope(userId);
-        userService.insertUserAuth(userId, roleIds,null);
+        userService.insertUserAuth(userId, roleIds, null);
         return R.ok();
     }
 

+ 7 - 2
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/vo/UserInfoVo.java

@@ -23,10 +23,15 @@ public class UserInfoVo implements Serializable {
     private SysUserVo user;
 
     /**
-    * 客户名称
-    * */
+     * 所属公司名称
+     */
     private String companyName;
 
+    /**
+     * 客户名称
+     */
+    private String customerName;
+
     /**
      * 菜单权限
      */

+ 20 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/dubbo/RemoteUserServiceImpl.java

@@ -32,11 +32,14 @@ import org.dromara.system.domain.vo.SysRoleVo;
 import org.dromara.system.domain.vo.SysUserVo;
 import org.dromara.system.mapper.*;
 import org.dromara.system.service.*;
+import org.springframework.dao.DuplicateKeyException;
 import org.springframework.stereotype.Service;
 
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static org.dromara.common.mybatis.core.mapper.BaseMapperPlus.log;
+
 /**
  * 用户服务
  *
@@ -494,6 +497,23 @@ public class RemoteUserServiceImpl implements RemoteUserService {
         return sysUserBo.getUserId();
     }
 
+    @Override
+    public Integer addUserRole(RemoteUserBo remoteUserBo) throws ServiceException {
+        SysUserRole sysUserRole = new SysUserRole();
+        sysUserRole.setUserId(remoteUserBo.getUserId());
+        sysUserRole.setRoleId(remoteUserBo.getRoleId());
+        try {
+
+            userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>()
+                .eq(SysUserRole::getUserId, sysUserRole.getUserId())
+                .eq(SysUserRole::getRoleId, sysUserRole.getRoleId()));
+
+            return userRoleMapper.insert(sysUserRole);
+        } catch (DuplicateKeyException e) {
+            throw new ServiceException("该用户已分配此角色");
+        }
+    }
+
     /**
      * 编辑用户
      *