沐梦. 3 долоо хоног өмнө
parent
commit
02e5a48bbc
13 өөрчлөгдсөн 103 нэмэгдсэн , 380 устгасан
  1. 0 43
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/CustomerDictController.java
  2. 0 67
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/CustomerDict.java
  3. 7 7
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/VisitPlan.java
  4. 0 63
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/vo/CustomerDictVo.java
  5. 0 13
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/mapper/CustomerDictMapper.java
  6. 0 22
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/ICustomerDictService.java
  7. 0 80
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerDictServiceImpl.java
  8. 36 52
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerInfoServiceImpl.java
  9. 2 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/SalesAnnualFinalizationServiceImpl.java
  10. 2 1
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/SalesleadsServiceImpl.java
  11. 46 2
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/TeamMemberServiceImpl.java
  12. 3 27
      ruoyi-modules/ruoyi-customer/src/main/resources/mapper/customer/TeamMemberMapper.xml
  13. 7 3
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDictTypeServiceImpl.java

+ 0 - 43
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/CustomerDictController.java

@@ -1,43 +0,0 @@
-package org.dromara.customer.controller;
-
-import lombok.RequiredArgsConstructor;
-import org.dromara.common.core.domain.R;
-import org.dromara.common.web.core.BaseController;
-import org.dromara.customer.domain.vo.CustomerDictVo;
-import org.dromara.customer.service.ICustomerDictService;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-
-/**
- * 客户字典控制器
- */
-@Validated
-@RequiredArgsConstructor
-@RestController
-@RequestMapping("/dict")
-public class CustomerDictController extends BaseController {
-
-    private final ICustomerDictService customerDictService;
-
-    /**
-     * 根据字典类型获取数据列表
-     */
-    @GetMapping("/type/{dictType}")
-    public R<List<CustomerDictVo>> getDictByType(@PathVariable String dictType) {
-        return R.ok(customerDictService.selectListByType(dictType));
-    }
-
-    /**
-     * 根据字典code获取通用字典数据列表
-     */
-    @GetMapping("/common/{dictCode}")
-    public R<List<CustomerDictVo>> getCommonDictByCode(@PathVariable String dictCode) {
-        return R.ok(customerDictService.selectListByCode(dictCode));
-    }
-
-}

+ 0 - 67
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/CustomerDict.java

@@ -1,67 +0,0 @@
-package org.dromara.customer.domain;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import io.github.linpeilie.annotations.AutoMapper;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.dromara.common.tenant.core.TenantEntity;
-import org.dromara.customer.domain.vo.CustomerDictVo;
-
-/**
- * 通用字典对象 commondicc
- *
- * @author LionLi
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-@AutoMapper(target = CustomerDictVo.class)
-@TableName("commondicc")
-public class CustomerDict extends TenantEntity {
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 主键ID
-     */
-    @TableId(value = "Id")
-    private Integer id;
-
-    /**
-     * 名称
-     */
-    @TableField("Name")
-    private String name;
-
-    /**
-     * 代码 (对应 dictType)
-     */
-    @TableField("Code")
-    private String code;
-
-    /**
-     * 代码索引 (对应 dictValue)
-     */
-    @TableField("CodeIndex")
-    private Integer codeIndex;
-
-    /**
-     * 值
-     */
-    @TableField("Value")
-    private String value;
-
-    /**
-     * 排序
-     */
-    @TableField("Sort")
-    private Integer sort;
-
-    /**
-     * 备注
-     */
-    @TableField("Remark")
-    private String remark;
-
-}

+ 7 - 7
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/VisitPlan.java

@@ -21,25 +21,25 @@ public class VisitPlan extends TenantEntity {
     @Serial
     private static final long serialVersionUID = 1L;
 
-    @TableId(value = "Id")
+    @TableId(value = "id")
     private Long id;
 
-    @TableField("PlanNo")
+    @TableField("plan_no")
     private String planNo;
 
-    @TableField("CallPeopleNo")
+    @TableField("call_people_no")
     private Long visitorId;
 
-    @TableField("CallPeopleName")
+    @TableField("call_people_name")
     private String visitorName;
 
-    @TableField("StartDate")
+    @TableField("start_data")
     private Date startTime;
 
-    @TableField("EndDate")
+    @TableField("end_data")
     private Date endTime;
 
-    @TableField("Status")
+    @TableField("status")
     private String status;
 
 }

+ 0 - 63
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/vo/CustomerDictVo.java

@@ -1,63 +0,0 @@
-package org.dromara.customer.domain.vo;
-
-
-import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
-import cn.idev.excel.annotation.ExcelProperty;
-import io.github.linpeilie.annotations.AutoMapper;
-import lombok.Data;
-import org.dromara.customer.domain.CustomerDict;
-
-import java.io.Serial;
-import java.io.Serializable;
-
-/**
- * 客户字典视图对象 crm_customer_dict
- *
- * @author LionLi
- * @date 2024-04-07
- */
-@Data
-@ExcelIgnoreUnannotated
-@AutoMapper(target = CustomerDict.class)
-public class CustomerDictVo implements Serializable {
-
-    @Serial
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 主键ID
-     */
-    @ExcelProperty(value = "主键ID")
-    private Long id;
-
-    /**
-     * 字典类型
-     */
-    @ExcelProperty(value = "字典类型")
-    private String dictType;
-
-    /**
-     * 显示名称
-     */
-    @ExcelProperty(value = "显示名称")
-    private String dictLabel;
-
-    /**
-     * 存储值
-     */
-    @ExcelProperty(value = "存储值")
-    private String dictValue;
-
-    /**
-     * 排序
-     */
-    @ExcelProperty(value = "排序")
-    private Integer orderNum;
-
-    /**
-     * 备注
-     */
-    @ExcelProperty(value = "备注")
-    private String remark;
-
-}

+ 0 - 13
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/mapper/CustomerDictMapper.java

@@ -1,13 +0,0 @@
-package org.dromara.customer.mapper;
-
-import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
-import org.dromara.customer.domain.CustomerDict;
-import org.dromara.customer.domain.vo.CustomerDictVo;
-
-/**
- * 客户字典Mapper接口
- *
- * @author LionLi
- */
-public interface CustomerDictMapper extends BaseMapperPlus<CustomerDict, CustomerDictVo> {
-}

+ 0 - 22
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/ICustomerDictService.java

@@ -1,22 +0,0 @@
-package org.dromara.customer.service;
-
-import org.dromara.customer.domain.vo.CustomerDictVo;
-
-import java.util.List;
-
-/**
- * 客户字典Service接口
- *
- * @author LionLi
- */
-public interface ICustomerDictService {
-    /**
-     * 根据字典类型获取数据列表
-     */
-    List<CustomerDictVo> selectListByType(String dictType);
-
-    /**
-     * 根据字典code获取通用字典数据列表
-     */
-    List<CustomerDictVo> selectListByCode(String dictCode);
-}

+ 0 - 80
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerDictServiceImpl.java

@@ -1,80 +0,0 @@
-package org.dromara.customer.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import lombok.RequiredArgsConstructor;
-import org.dromara.customer.domain.CustomerDict;
-import org.dromara.customer.domain.vo.CustomerDictVo;
-import org.dromara.customer.mapper.CustomerDictMapper;
-import org.dromara.customer.service.ICustomerDictService;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * 客户字典Service业务层处理
- */
-@RequiredArgsConstructor
-@Service
-public class CustomerDictServiceImpl implements ICustomerDictService {
-
-    private final CustomerDictMapper customerDictMapper;
-
-    @Override
-    public List<CustomerDictVo> selectListByType(String dictType) {
-        String typeLower = dictType.toLowerCase();
-        String code = dictType;
-        if (typeLower.endsWith("enterprise_type")) {
-            code = "Q0001";
-        } else if (typeLower.endsWith("cooperation_status")) {
-            code = "COOPERATION_STATUS";
-        } else if (typeLower.endsWith("schedule_status")) {
-            code = "schedule_status";
-        } else if (typeLower.endsWith("importance_level")) {
-            code = "importance_level";
-        } else if (typeLower.endsWith("visit_type")) {
-            code = "visit_type";
-        }
-
-        List<CustomerDict> list = customerDictMapper.selectList(new LambdaQueryWrapper<CustomerDict>()
-            .eq(CustomerDict::getCode, code)
-            .orderByAsc(CustomerDict::getSort));
-
-        return list.stream().map(d -> {
-            CustomerDictVo vo = new CustomerDictVo();
-            vo.setId(Long.valueOf(d.getId()));
-            vo.setDictLabel(d.getName());
-            // 优先取 Value 字段,如果为空则参考 CodeIndex (通常对应数值 ID)
-            String val = d.getValue();
-            if (val == null || val.isEmpty()) {
-                val = d.getCodeIndex() != null ? String.valueOf(d.getCodeIndex()) : "";
-            }
-            vo.setDictValue(val);
-            vo.setOrderNum(d.getSort());
-            vo.setRemark(d.getRemark());
-            return vo;
-        }).collect(Collectors.toList());
-    }
-
-    @Override
-    public List<CustomerDictVo> selectListByCode(String dictCode) {
-        List<CustomerDict> list = customerDictMapper.selectList(new LambdaQueryWrapper<CustomerDict>()
-            .eq(CustomerDict::getCode, dictCode)
-            .orderByAsc(CustomerDict::getSort));
-
-        return list.stream().map(d -> {
-            CustomerDictVo vo = new CustomerDictVo();
-            vo.setId(Long.valueOf(d.getId()));
-            vo.setDictLabel(d.getName());
-            // 优先取 Value 字段,如果为空则参考 CodeIndex
-            String val = d.getValue();
-            if (val == null || val.isEmpty()) {
-                val = d.getCodeIndex() != null ? String.valueOf(d.getCodeIndex()) : "";
-            }
-            vo.setDictValue(val);
-            vo.setOrderNum(d.getSort());
-            vo.setRemark(d.getRemark());
-            return vo;
-        }).collect(Collectors.toList());
-    }
-}

+ 36 - 52
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerInfoServiceImpl.java

@@ -96,7 +96,6 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
     private final CustomerInfoTagMapper customerInfoTagMapper;
     private final CustomerContractMapper customerContractMapper;
     private final CustomerDeptMapper customerDeptMapper;
-    private final CustomerDictMapper customerDictMapper;
     private final SupplierBusinessInfoMapper supplierBusinessInfoMapper;
     private final TeamMemberMapper teamMemberMapper;
     private final CrmStaffMapper crmStaffMapper;
@@ -138,10 +137,12 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
 
         // 企业类型名称 (Q0001)
         if (vo.getCustomerTypeId() != null) {
-            CustomerDict dict = customerDictMapper.selectById(vo.getCustomerTypeId());
-            if (dict != null) {
-                vo.setEnterpriseTypeName(dict.getName());
-            }
+            List<RemoteDictDataVo> enterpriseTypeDicts = remoteDictService.selectDictDataByType("Q0001");
+            String typeIdStr = String.valueOf(vo.getCustomerTypeId());
+            CollUtil.emptyIfNull(enterpriseTypeDicts).stream()
+                .filter(d -> typeIdStr.equals(d.getDictValue()))
+                .findFirst()
+                .ifPresent(d -> vo.setEnterpriseTypeName(d.getDictLabel()));
         }
 
         // 客户等级名称 (远程调用)
@@ -150,20 +151,13 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
             vo.setCustomerLevelName(levelMap.get(vo.getCustomerLevelId()));
         }
 
-        // 合作状态名称 (COOPERATION_STATUS)
+        // 合作状态名称 (cooperation_status)
         if (StringUtils.isNotBlank(vo.getStatus())) {
-            List<CustomerDict> cooperationDicts = customerDictMapper.selectList(new LambdaQueryWrapper<CustomerDict>()
-                .eq(CustomerDict::getCode, "COOPERATION_STATUS"));
-            Map<String, String> cooperationMap = cooperationDicts.stream()
-                .collect(Collectors.toMap(
-                    d -> {
-                        String val = d.getValue();
-                        return (val == null || val.isEmpty()) ? (d.getCodeIndex() != null ? String.valueOf(d.getCodeIndex()) : "") : val;
-                    },
-                    CustomerDict::getName,
-                    (k1, k2) -> k1
-                ));
-            vo.setCooperationName(cooperationMap.get(vo.getStatus()));
+            List<RemoteDictDataVo> cooperationDicts = remoteDictService.selectDictDataByType("cooperation_status");
+            CollUtil.emptyIfNull(cooperationDicts).stream()
+                .filter(d -> vo.getStatus().equals(d.getDictValue()))
+                .findFirst()
+                .ifPresent(d -> vo.setCooperationName(d.getDictLabel()));
         }
 
         // 补充省份和城市名称
@@ -218,18 +212,13 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
 
             CustomerSalesInfoVo voObj = MapstructUtils.convert(customerSalesInfo, CustomerSalesInfoVo.class);
 
-            // 补充客户来源名称 (K0001)
+            // 补充客户来源名称 (customer_source)
             if (StringUtils.isNotBlank(customerSalesInfo.getCustomerSource())) {
-                 CustomerDict sourceDict = customerDictMapper.selectOne(new LambdaQueryWrapper<CustomerDict>()
-                     .eq(CustomerDict::getCode, "K0001")
-                     .eq(CustomerDict::getValue, customerSalesInfo.getCustomerSource()));
-                 if (sourceDict == null && StringUtils.isNumeric(customerSalesInfo.getCustomerSource())) {
-                     // 尝试作为 ID 查询
-                     sourceDict = customerDictMapper.selectById(Long.parseLong(customerSalesInfo.getCustomerSource()));
-                 }
-                 if (sourceDict != null) {
-                     vo.setCustomerSourceName(sourceDict.getName());
-                 }
+                List<RemoteDictDataVo> sourceDicts = remoteDictService.selectDictDataByType("customer_source");
+                sourceDicts.stream()
+                    .filter(d -> customerSalesInfo.getCustomerSource().equals(d.getDictValue()))
+                    .findFirst()
+                    .ifPresent(d -> vo.setCustomerSourceName(d.getDictLabel()));
             }
 
             // 补充人员和部门名称
@@ -407,8 +396,9 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
             ? Collections.emptyMap()
             : remoteComCompanyService.selectCompanyNameByIds(companyIds);
         
-        Map<Long, RemoteComStaffVo> staffFullMap = staffIds.isEmpty() ? Collections.emptyMap() : 
-            remoteComStaffService.selectStaffByIds(staffIds).stream().collect(Collectors.toMap(RemoteComStaffVo::getStaffId, Function.identity(), (k1, k2) -> k1));
+        List<RemoteComStaffVo> staffVos = staffIds.isEmpty() ? Collections.emptyList() : remoteComStaffService.selectStaffByIds(staffIds);
+        Map<Long, RemoteComStaffVo> staffFullMap = CollUtil.isEmpty(staffVos) ? Collections.emptyMap() : 
+            staffVos.stream().collect(Collectors.toMap(RemoteComStaffVo::getStaffId, Function.identity(), (k1, k2) -> k1));
 
         // === 6. 回填人员和部门名称到 vo ===
         for (CustomerInfoVo vo : records) {
@@ -610,7 +600,6 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
             Set<Long> staffIds = new HashSet<>();
             Set<Long> creditLevelIds = new HashSet<>();
             Set<Long> companyIds = new HashSet<>();
-            Set<Long> enterpriseTypeIds = new HashSet<>();
             Set<Long> customerLevelIds = new HashSet<>();
             Set<Long> deptIds = new HashSet<>();
 
@@ -622,7 +611,6 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
                     if (vo.getCreditLevelId() != null) creditLevelIds.add(vo.getCreditLevelId());
                 }
                 if (vo.getBelongCompanyId() != null) companyIds.add(vo.getBelongCompanyId());
-                if (vo.getEnterpriseTypeId() != null) enterpriseTypeIds.add(vo.getEnterpriseTypeId());
                 if (vo.getCustomerLevelId() != null) customerLevelIds.add(vo.getCustomerLevelId());
                 
                 // 处理部门ID收集
@@ -640,10 +628,10 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
             // 3. 批量查询公司名称 (远程调用)
             Map<Long, String> companyMap = companyIds.isEmpty() ? Collections.emptyMap() : remoteComCompanyService.selectCompanyNameByIds(companyIds);
 
-            // 4. 批量查询企业类型名称 (从客户字典表查询)
-            Map<Long, String> enterpriseTypeMap = enterpriseTypeIds.isEmpty() ? Collections.emptyMap() :
-                customerDictMapper.selectList(new LambdaQueryWrapper<CustomerDict>().in(CustomerDict::getId, enterpriseTypeIds)).stream()
-                    .collect(Collectors.toMap(d -> Long.valueOf(d.getId()), CustomerDict::getName, (k1, k2) -> k1));
+            // 4. 批量查询企业类型名称 (优先系统字典)
+            List<RemoteDictDataVo> enterpriseTypeDicts = remoteDictService.selectDictDataByType("enterprise_type");
+            Map<String, String> enterpriseTypeMap = enterpriseTypeDicts == null ? Collections.emptyMap() : enterpriseTypeDicts.stream()
+                .collect(Collectors.toMap(RemoteDictDataVo::getDictValue, RemoteDictDataVo::getDictLabel, (k1, k2) -> k1));
 
             // 5. 批量查询客户/合作等级名称 (远程调用)
             Map<Long, String> customerLevelMap = customerLevelIds.isEmpty() ? Collections.emptyMap() : remoteComCustomerLevelService.selectCustomerLevelNameByIds(customerLevelIds);
@@ -651,18 +639,10 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
             // 6. 批量查询部门名称 (系统部门)
             Map<Long, String> deptMap = deptIds.isEmpty() ? Collections.emptyMap() : remoteDeptService.selectDeptNameByIds(deptIds);
 
-            // 7. 批量查询合作状态名称 (从客户字典表查询 code='COOPERATION_STATUS')
-            List<CustomerDict> cooperationDicts = customerDictMapper.selectList(new LambdaQueryWrapper<CustomerDict>()
-                .eq(CustomerDict::getCode, "COOPERATION_STATUS"));
-            Map<String, String> cooperationMap = cooperationDicts.stream()
-                .collect(Collectors.toMap(
-                    d -> {
-                        String val = d.getValue();
-                        return (val == null || val.isEmpty()) ? (d.getCodeIndex() != null ? String.valueOf(d.getCodeIndex()) : "") : val;
-                    },
-                    CustomerDict::getName,
-                    (k1, k2) -> k1
-                ));
+            // 7. 批量查询合作状态名称 (优先系统字典)
+            List<RemoteDictDataVo> cooperationDicts = remoteDictService.selectDictDataByType("cooperation_status");
+            Map<String, String> cooperationMap = cooperationDicts == null ? Collections.emptyMap() : cooperationDicts.stream()
+                .collect(Collectors.toMap(RemoteDictDataVo::getDictValue, RemoteDictDataVo::getDictLabel, (k1, k2) -> k1));
 
             // 8. 填充数据
             records.forEach(vo -> {
@@ -674,11 +654,15 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
                 }
                 vo.setCreditLevelName(creditLevelMap.get(vo.getCreditLevelId()));
                 vo.setCompanyName(companyMap.get(vo.getBelongCompanyId()));
-                vo.setEnterpriseTypeName(enterpriseTypeMap.get(vo.getEnterpriseTypeId()));
+                
+                // 企业类型翻译
+                String typeValue = vo.getEnterpriseTypeId() != null ? String.valueOf(vo.getEnterpriseTypeId()) : null;
+                vo.setEnterpriseTypeName(enterpriseTypeMap.get(typeValue));
+
                 vo.setCustomerLevelName(customerLevelMap.get(vo.getCustomerLevelId()));
-                vo.setCooperationName(cooperationMap.get(vo.getStatus()));
                 
-                // 部门名称已在 Mapper 中通过业务负责人关联查询,此处无需再回填覆盖
+                // 合作状态翻译
+                vo.setCooperationName(cooperationMap.get(vo.getStatus()));
             });
         }
 

+ 2 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/SalesAnnualFinalizationServiceImpl.java

@@ -103,6 +103,7 @@ public class SalesAnnualFinalizationServiceImpl implements ISalesAnnualFinalizat
      * 新增年度入围项目
      */
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public Boolean insertByBo(SalesAnnualFinalizationBo bo) {
         autoFillDept(bo);
         SalesAnnualFinalization add = BeanUtil.toBean(bo, SalesAnnualFinalization.class);
@@ -150,6 +151,7 @@ public class SalesAnnualFinalizationServiceImpl implements ISalesAnnualFinalizat
      * 修改年度入围项目
      */
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public Boolean updateByBo(SalesAnnualFinalizationBo bo) {
         autoFillDept(bo);
         SalesAnnualFinalization oldData = baseMapper.selectById(bo.getId());

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

@@ -86,7 +86,8 @@ public class SalesleadsServiceImpl implements ISalesleadsService {
         }
         boolean success = baseMapper.insert(add) > 0;
         if (success) {
-            if (add.getLeader() != null) {
+            // 确保主键已回填
+            if (add.getId() != null && add.getLeader() != null) {
                 // 新增成功后,将负责人同步到团队成员表
                 syncLeaderToTeamMember(add.getId(), add.getLeader(), add.getLeaderName());
             }

+ 46 - 2
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/TeamMemberServiceImpl.java

@@ -13,6 +13,9 @@ import org.dromara.customer.mapper.SalesleadsMapper;
 import org.dromara.customer.mapper.TeamMemberMapper;
 import org.dromara.customer.service.IOperationLogService;
 import org.dromara.customer.service.ITeamMemberService;
+import org.dromara.system.api.RemoteDictService;
+import org.dromara.system.api.domain.vo.RemoteDictDataVo;
+import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -33,12 +36,19 @@ public class TeamMemberServiceImpl implements ITeamMemberService {
     private final SalesleadsMapper salesleadsMapper;
     private final IOperationLogService operationLogService;
 
+    @DubboReference
+    private RemoteDictService remoteDictService;
+
     /**
      * 查询
      */
     @Override
     public TeamMemberVo queryById(Long id) {
-        return baseMapper.selectVoById(id);
+        TeamMemberVo vo = baseMapper.selectVoById(id);
+        if (vo != null) {
+            translateMember(vo);
+        }
+        return vo;
     }
 
     /**
@@ -46,7 +56,41 @@ public class TeamMemberServiceImpl implements ITeamMemberService {
      */
     @Override
     public List<TeamMemberVo> queryByObjectNo(String objectNo) {
-        return baseMapper.selectByObjectNo(objectNo);
+        List<TeamMemberVo> list = baseMapper.selectByObjectNo(objectNo);
+        if (list != null && !list.isEmpty()) {
+            list.forEach(this::translateMember);
+        }
+        return list;
+    }
+
+    /**
+     * 翻译成员字典字段
+     */
+    private void translateMember(TeamMemberVo vo) {
+        if (vo == null) return;
+        
+        // 翻译角色 (T0001)
+        if (vo.getRoleCode() != null) {
+            List<RemoteDictDataVo> roleDicts = remoteDictService.selectDictDataByType("T0001");
+            if (roleDicts != null) {
+                roleDicts.stream()
+                    .filter(d -> vo.getRoleCode().equals(d.getDictValue()))
+                    .findFirst()
+                    .ifPresent(d -> vo.setRoleName(d.getDictLabel()));
+            }
+        }
+        
+        // 翻译权限 (team_permission)
+        if (vo.getUpdateAccredit() != null) {
+            List<RemoteDictDataVo> permDicts = remoteDictService.selectDictDataByType("team_permission");
+            if (permDicts != null) {
+                String val = String.valueOf(vo.getUpdateAccredit());
+                permDicts.stream()
+                    .filter(d -> val.equals(d.getDictValue()))
+                    .findFirst()
+                    .ifPresent(d -> vo.setPermission(d.getDictLabel()));
+            }
+        }
     }
 
     /**

+ 3 - 27
ruoyi-modules/ruoyi-customer/src/main/resources/mapper/customer/TeamMemberMapper.xml

@@ -4,39 +4,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.dromara.customer.mapper.TeamMemberMapper">
 
-    <!-- 按对象编号查询成员列表(JOIN commondicc 翻译角色名称和权限名称) -->
+    <!-- 按对象编号查询成员列表 -->
     <select id="selectByObjectNo" resultType="org.dromara.customer.domain.vo.TeamMemberVo">
-        SELECT
-            tm.*,
-            cd_role.Name AS roleName,
-            cd_perm.Name AS permission
-        FROM team_member tm
-        LEFT JOIN commondicc cd_role
-            ON cd_role.Code COLLATE utf8mb4_general_ci = 'T0001'
-            AND cd_role.Value COLLATE utf8mb4_general_ci = CONVERT(tm.role_code USING utf8mb4) COLLATE utf8mb4_general_ci
-            AND cd_role.del_flag = '0'
-        LEFT JOIN commondicc cd_perm
-            ON cd_perm.Code COLLATE utf8mb4_general_ci = 'team_permission'
-            AND cd_perm.Value COLLATE utf8mb4_general_ci = CAST(tm.update_accredit AS CHAR) COLLATE utf8mb4_general_ci
-            AND cd_perm.del_flag = '0'
+        SELECT tm.* FROM team_member tm
         WHERE tm.object_no = #{objectNo} AND tm.is_delete = 0
         ORDER BY tm.iz_manager DESC, tm.create_time ASC
     </select>
 
     <select id="selectPageByObjectNo" resultType="org.dromara.customer.domain.vo.TeamMemberVo">
-        SELECT
-            tm.*,
-            cd_role.Name AS roleName,
-            cd_perm.Name AS permission
-        FROM team_member tm
-        LEFT JOIN commondicc cd_role
-            ON cd_role.Code COLLATE utf8mb4_general_ci = 'T0001'
-            AND cd_role.Value COLLATE utf8mb4_general_ci = CONVERT(tm.role_code USING utf8mb4) COLLATE utf8mb4_general_ci
-            AND cd_role.del_flag = '0'
-        LEFT JOIN commondicc cd_perm
-            ON cd_perm.Code COLLATE utf8mb4_general_ci = 'team_permission'
-            AND cd_perm.Value COLLATE utf8mb4_general_ci = CAST(tm.update_accredit AS CHAR) COLLATE utf8mb4_general_ci
-            AND cd_perm.del_flag = '0'
+        SELECT tm.* FROM team_member tm
         WHERE tm.object_no = #{objectNo} AND tm.is_delete = 0
         ORDER BY tm.iz_manager DESC, tm.create_time ASC
     </select>

+ 7 - 3
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDictTypeServiceImpl.java

@@ -22,6 +22,7 @@ import org.dromara.system.domain.vo.SysDictTypeVo;
 import org.dromara.system.mapper.SysDictDataMapper;
 import org.dromara.system.mapper.SysDictTypeMapper;
 import org.dromara.system.service.ISysDictTypeService;
+import org.dromara.common.tenant.helper.TenantHelper;
 import org.springframework.cache.annotation.CachePut;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
@@ -89,11 +90,14 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService {
      * @param dictType 字典类型
      * @return 字典数据集合信息
      */
-    @Cacheable(cacheNames = CacheNames.SYS_DICT, key = "#dictType")
+    // @Cacheable(cacheNames = CacheNames.SYS_DICT, key = "#dictType")
     @Override
     public List<SysDictDataVo> selectDictDataByType(String dictType) {
-        List<SysDictDataVo> dictDatas = dictDataMapper.selectDictDataByType(dictType);
-        return CollUtil.isNotEmpty(dictDatas) ? dictDatas : null;
+        return TenantHelper.ignore(() -> {
+            List<SysDictDataVo> dictDatas = dictDataMapper.selectDictDataByType(dictType);
+            System.out.println("[Debug] dictType: " + dictType + ", count: " + (dictDatas != null ? dictDatas.size() : 0));
+            return CollUtil.isNotEmpty(dictDatas) ? dictDatas : null;
+        });
     }
 
     /**