Pārlūkot izejas kodu

客户分ABC类、置顶

Long 1 dienu atpakaļ
vecāks
revīzija
1f22656f28
19 mainītis faili ar 479 papildinājumiem un 31 dzēšanām
  1. 21 14
      fs-admin/src/main/java/com/fs/crm/controller/CrmCustomerController.java
  2. 81 0
      fs-admin/src/main/java/com/fs/crm/controller/CrmCustomerLevelController.java
  3. 7 1
      fs-company/src/main/java/com/fs/crm/controller/CrmCustomerController.java
  4. 37 0
      fs-company/src/main/java/com/fs/crm/controller/CrmCustomerLevelController.java
  5. 10 6
      fs-service-system/src/main/java/com/fs/crm/domain/CrmCustomer.java
  6. 28 0
      fs-service-system/src/main/java/com/fs/crm/domain/CrmCustomerLevel.java
  7. 18 0
      fs-service-system/src/main/java/com/fs/crm/mapper/CrmCustomerLevelMapper.java
  8. 4 4
      fs-service-system/src/main/java/com/fs/crm/mapper/CrmCustomerMapper.java
  9. 26 0
      fs-service-system/src/main/java/com/fs/crm/param/CrmCustomerLevelParm.java
  10. 11 0
      fs-service-system/src/main/java/com/fs/crm/param/CrmCustomerLevelQueryParam.java
  11. 40 0
      fs-service-system/src/main/java/com/fs/crm/service/ICrmCustomerLevelService.java
  12. 9 5
      fs-service-system/src/main/java/com/fs/crm/service/ICrmCustomerService.java
  13. 102 0
      fs-service-system/src/main/java/com/fs/crm/service/impl/CrmCustomerLevelServiceImpl.java
  14. 15 0
      fs-service-system/src/main/java/com/fs/crm/service/impl/CrmCustomerServiceImpl.java
  15. 23 0
      fs-service-system/src/main/java/com/fs/crm/vo/CrmCustomerLevelVO.java
  16. 5 0
      fs-service-system/src/main/java/com/fs/crm/vo/CrmCustomerListVO.java
  17. 14 0
      fs-service-system/src/main/resources/db/upgrade/20250621客户分级.sql
  18. 17 0
      fs-service-system/src/main/resources/mapper/crm/CrmCustomerLevelMapper.xml
  19. 11 1
      fs-service-system/src/main/resources/mapper/crm/CrmCustomerMapper.xml

+ 21 - 14
fs-admin/src/main/java/com/fs/crm/controller/CrmCustomerController.java

@@ -1,35 +1,35 @@
 package com.fs.crm.controller;
 
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.OrderUtils;
 import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.StringUtils;
+import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.company.domain.Company;
 import com.fs.company.service.ICompanyService;
 import com.fs.core.security.LoginUser;
 import com.fs.core.web.service.TokenService;
+import com.fs.crm.domain.CrmCustomer;
 import com.fs.crm.param.*;
-import com.fs.crm.vo.CrmCustomerListVO;
+import com.fs.crm.service.ICrmCustomerService;
 import com.fs.crm.vo.CrmCustomerExportVO;
-import com.fs.store.vo.FsStoreOrderVO;
+import com.fs.crm.vo.CrmCustomerListVO;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.BeanUtils;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
-import com.fs.common.annotation.Log;
-import com.fs.common.core.controller.BaseController;
-import com.fs.common.core.domain.AjaxResult;
-import com.fs.common.enums.BusinessType;
-import com.fs.crm.domain.CrmCustomer;
-import com.fs.crm.service.ICrmCustomerService;
-import com.fs.common.utils.poi.ExcelUtil;
-import com.fs.common.core.page.TableDataInfo;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * 客户Controller
  *
@@ -282,5 +282,12 @@ public class CrmCustomerController extends BaseController
         return R.ok().put("data",customerList);
     }
 
+    @ApiOperation("置顶切换")
+    @PreAuthorize("@ss.hasPermi('crm:customer:switchToTop')")
+    @PostMapping("/switchToTop/{customerId}")
+    public R switchToTop(@PathVariable Long customerId) {
+        crmCustomerService.switchToTop(customerId);
+        return R.ok();
+    }
 
 }

+ 81 - 0
fs-admin/src/main/java/com/fs/crm/controller/CrmCustomerLevelController.java

@@ -0,0 +1,81 @@
+package com.fs.crm.controller;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.crm.domain.CrmCustomerLevel;
+import com.fs.crm.param.CrmCustomerLevelParm;
+import com.fs.crm.param.CrmCustomerLevelQueryParam;
+import com.fs.crm.service.ICrmCustomerLevelService;
+import com.fs.crm.vo.CrmCustomerLevelVO;
+import com.fs.his.vo.OptionsVO;
+import lombok.AllArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@RestController
+@RequestMapping("/crm/customerLevel")
+@AllArgsConstructor
+public class CrmCustomerLevelController extends BaseController {
+
+    private final ICrmCustomerLevelService customerLevelService;
+
+    @PreAuthorize("@ss.hasPermi('crm:customerLevel:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(CrmCustomerLevelQueryParam param) {
+        startPage();
+        List<CrmCustomerLevelVO> list = customerLevelService.selectCrmCustomerLevelVOList(param);
+        return getDataTable(list);
+    }
+
+    @PreAuthorize("@ss.hasPermi('crm:customerLevel:add')")
+    @Log(title = "客户级别", businessType = BusinessType.INSERT)
+    @PostMapping("/add")
+    public AjaxResult add(@Valid @RequestBody CrmCustomerLevelParm param) {
+        return toAjax(customerLevelService.saveCustomerLevel(param));
+    }
+
+    @PreAuthorize("@ss.hasPermi('crm:customerLevel:edit')")
+    @Log(title = "客户级别", businessType = BusinessType.UPDATE)
+    @PutMapping("/edit")
+    public AjaxResult edit(@Valid @RequestBody CrmCustomerLevelParm param) {
+        return toAjax(customerLevelService.editCustomerLevel(param));
+    }
+
+    @PreAuthorize("@ss.hasPermi('crm:customerLevel:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable Long id) {
+        return AjaxResult.success(customerLevelService.selectCrmCustomerLevelVOById(id));
+    }
+
+    @PreAuthorize("@ss.hasPermi('crm:customerLevel:delete')")
+    @Log(title = "客户", businessType = BusinessType.DELETE)
+    @DeleteMapping("/delete/{ids}")
+    public AjaxResult delete(@PathVariable Long[] ids) {
+        customerLevelService.removeByIds(Arrays.asList(ids));
+        return AjaxResult.success();
+    }
+
+    @GetMapping("/getCustomerLevelOption")
+    public R getCustomerLevelOption() {
+        Wrapper<CrmCustomerLevel> wrapper = Wrappers.<CrmCustomerLevel>lambdaQuery()
+                .eq(CrmCustomerLevel::getStatus, 0);
+        List<OptionsVO> options = customerLevelService.list(wrapper).stream().map(l -> {
+            OptionsVO vo = new OptionsVO();
+            vo.setDictLabel(l.getName());
+            vo.setDictValue(l.getId());
+            return vo;
+        }).collect(Collectors.toList());
+        return R.ok().put("data", options);
+    }
+}

+ 7 - 1
fs-company/src/main/java/com/fs/crm/controller/CrmCustomerController.java

@@ -13,7 +13,6 @@ import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.service.ICompanyUserService;
-import com.fs.crm.param.CrmCompanyLineCustomerImportParam;
 import com.fs.core.security.LoginUser;
 import com.fs.core.web.service.TokenService;
 import com.fs.crm.domain.CrmCustomer;
@@ -449,4 +448,11 @@ public class CrmCustomerController extends BaseController
         return R.ok().put("data",list);
     }
 
+    @ApiOperation("置顶切换")
+    @PreAuthorize("@ss.hasPermi('crm:customer:switchToTop')")
+    @PostMapping("/switchToTop/{customerId}")
+    public R switchToTop(@PathVariable Long customerId) {
+        crmCustomerService.switchToTop(customerId);
+        return R.ok();
+    }
 }

+ 37 - 0
fs-company/src/main/java/com/fs/crm/controller/CrmCustomerLevelController.java

@@ -0,0 +1,37 @@
+package com.fs.crm.controller;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.R;
+import com.fs.crm.domain.CrmCustomerLevel;
+import com.fs.crm.service.ICrmCustomerLevelService;
+import com.fs.his.vo.OptionsVO;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+@RestController
+@RequestMapping("/crm/customerLevel")
+@AllArgsConstructor
+public class CrmCustomerLevelController extends BaseController {
+
+    private final ICrmCustomerLevelService customerLevelService;
+
+    @GetMapping("/getCustomerLevelOption")
+    public R getCustomerLevelOption() {
+        Wrapper<CrmCustomerLevel> wrapper = Wrappers.<CrmCustomerLevel>lambdaQuery()
+                .eq(CrmCustomerLevel::getStatus, 0);
+        List<OptionsVO> options = customerLevelService.list(wrapper).stream().map(l -> {
+            OptionsVO vo = new OptionsVO();
+            vo.setDictLabel(l.getName());
+            vo.setDictValue(l.getId());
+            return vo;
+        }).collect(Collectors.toList());
+        return R.ok().put("data", options);
+    }
+}

+ 10 - 6
fs-service-system/src/main/java/com/fs/crm/domain/CrmCustomer.java

@@ -1,16 +1,13 @@
 package com.fs.crm.domain;
 
-import java.math.BigDecimal;
-import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.annotation.Excel;
 import com.fs.common.core.domain.BaseEntity;
 import lombok.Data;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 
 import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.Pattern;
+import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  * 客户对象 crm_customer
@@ -177,5 +174,12 @@ public class CrmCustomer extends BaseEntity
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date visitTime;
 
-
+    /**
+     * 客户级别
+     */
+    private Long customerLevel;
+    /**
+     * 是否置顶
+     */
+    private Integer isTop;
 }

+ 28 - 0
fs-service-system/src/main/java/com/fs/crm/domain/CrmCustomerLevel.java

@@ -0,0 +1,28 @@
+package com.fs.crm.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+@TableName("crm_customer_level")
+@Data
+public class CrmCustomerLevel {
+    /**
+     * 主键ID
+     */
+    @TableId(type = IdType.AUTO)
+    private Long id;
+    /**
+     * 级别名称
+     */
+    private String name;
+    /**
+     * 状态 0显示 1停用
+     */
+    private Integer status;
+    /**
+     * 序号
+     */
+    private Integer sort;
+}

+ 18 - 0
fs-service-system/src/main/java/com/fs/crm/mapper/CrmCustomerLevelMapper.java

@@ -0,0 +1,18 @@
+package com.fs.crm.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.crm.domain.CrmCustomerLevel;
+import com.fs.crm.param.CrmCustomerLevelQueryParam;
+import com.fs.crm.vo.CrmCustomerLevelVO;
+
+import java.util.List;
+
+public interface CrmCustomerLevelMapper extends BaseMapper<CrmCustomerLevel> {
+
+    /**
+     * 查询客户级别列表
+     * @param param 参数
+     * @return  list
+     */
+    List<CrmCustomerLevelVO> selectCrmCustomerLevelVOList(CrmCustomerLevelQueryParam param);
+}

+ 4 - 4
fs-service-system/src/main/java/com/fs/crm/mapper/CrmCustomerMapper.java

@@ -1,8 +1,5 @@
 package com.fs.crm.mapper;
 
-import java.util.List;
-import java.util.Map;
-
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.crm.domain.CrmCustomer;
@@ -13,6 +10,9 @@ import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * 客户Mapper接口
 
@@ -199,7 +199,7 @@ public interface CrmCustomerMapper extends BaseMapper<CrmCustomer>
             "<if test = 'maps.endTime != null and maps.endTime != \"\" '> " +
             "and date_format(c.create_time,'%y%m%d') &lt;= date_format(#{maps.endTime},'%y%m%d') " +
             "</if>" +
-            " order by c.customer_id desc "+
+            " order by c.is_top desc,c.customer_id desc "+
             "</script>"})
     List<CrmCustomerListVO> selectCrmCustomerListVO(@Param("maps")CrmCustomer crmCustomer);
 

+ 26 - 0
fs-service-system/src/main/java/com/fs/crm/param/CrmCustomerLevelParm.java

@@ -0,0 +1,26 @@
+package com.fs.crm.param;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+@Data
+public class CrmCustomerLevelParm {
+    /**
+     * 主键ID
+     */
+    private Long id;
+    /**
+     * 级别名称
+     */
+    @NotBlank(message = "级别名称不能为空")
+    private String name;
+    /**
+     * 状态 0显示 1停用
+     */
+    private Integer status;
+    /**
+     * 序号
+     */
+    private Integer sort;
+}

+ 11 - 0
fs-service-system/src/main/java/com/fs/crm/param/CrmCustomerLevelQueryParam.java

@@ -0,0 +1,11 @@
+package com.fs.crm.param;
+
+import lombok.Data;
+
+@Data
+public class CrmCustomerLevelQueryParam {
+    /**
+     * 级别名称
+     */
+    private String name;
+}

+ 40 - 0
fs-service-system/src/main/java/com/fs/crm/service/ICrmCustomerLevelService.java

@@ -0,0 +1,40 @@
+package com.fs.crm.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fs.crm.domain.CrmCustomerLevel;
+import com.fs.crm.param.CrmCustomerLevelParm;
+import com.fs.crm.param.CrmCustomerLevelQueryParam;
+import com.fs.crm.vo.CrmCustomerLevelVO;
+
+import java.util.List;
+
+public interface ICrmCustomerLevelService extends IService<CrmCustomerLevel> {
+
+    /**
+     * 查询客户级别列表
+     * @param param 参数
+     * @return  list
+     */
+    List<CrmCustomerLevelVO> selectCrmCustomerLevelVOList(CrmCustomerLevelQueryParam param);
+
+    /**
+     * 新增客户级别
+     * @param param 参数
+     * @return 受影响行数
+     */
+    int saveCustomerLevel(CrmCustomerLevelParm param);
+
+    /**
+     * 修改客户级别
+     * @param param 参数
+     * @return 受影响行数
+     */
+    int editCustomerLevel(CrmCustomerLevelParm param);
+
+    /**
+     * 根据ID查询
+     * @param id id
+     * @return CrmCustomerLevelVO
+     */
+    CrmCustomerLevelVO selectCrmCustomerLevelVOById(Long id);
+}

+ 9 - 5
fs-service-system/src/main/java/com/fs/crm/service/ICrmCustomerService.java

@@ -1,16 +1,14 @@
 package com.fs.crm.service;
 
-import java.util.List;
-import java.util.Map;
-
 import com.alibaba.fastjson.JSONObject;
 import com.fs.common.core.domain.R;
 import com.fs.crm.domain.CrmCustomer;
 import com.fs.crm.param.*;
 import com.fs.crm.vo.*;
 import com.fs.qwApi.param.QwCustomerDetailParam;
-import com.fs.store.dto.StoreOrderExpressExportDTO;
-import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * 客户Service接口
@@ -141,4 +139,10 @@ public interface ICrmCustomerService
     public List<CrmCustomerListVO> selectCrmCustomer1();
 
     List<CrmMyCustomerListQueryVO> selectCrmMyAssistListQuery(CrmMyCustomerListQueryParam param);
+
+    /**
+     * 置顶切换
+     * @param customerId 客户ID
+     */
+    void switchToTop(Long customerId);
 }

+ 102 - 0
fs-service-system/src/main/java/com/fs/crm/service/impl/CrmCustomerLevelServiceImpl.java

@@ -0,0 +1,102 @@
+package com.fs.crm.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fs.common.exception.CustomException;
+import com.fs.common.utils.bean.BeanUtils;
+import com.fs.crm.domain.CrmCustomerLevel;
+import com.fs.crm.mapper.CrmCustomerLevelMapper;
+import com.fs.crm.param.CrmCustomerLevelParm;
+import com.fs.crm.param.CrmCustomerLevelQueryParam;
+import com.fs.crm.service.ICrmCustomerLevelService;
+import com.fs.crm.vo.CrmCustomerLevelVO;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Objects;
+
+@Service
+public class CrmCustomerLevelServiceImpl extends ServiceImpl<CrmCustomerLevelMapper, CrmCustomerLevel> implements ICrmCustomerLevelService {
+
+    /**
+     * 查询客户级别列表
+     * @param param 参数
+     * @return  list
+     */
+    @Override
+    public List<CrmCustomerLevelVO> selectCrmCustomerLevelVOList(CrmCustomerLevelQueryParam param) {
+        return baseMapper.selectCrmCustomerLevelVOList(param);
+    }
+
+    /**
+     * 新增客户级别
+     * @param param 参数
+     * @return 受影响行数
+     */
+    @Override
+    public int saveCustomerLevel(CrmCustomerLevelParm param) {
+        CrmCustomerLevel crmCustomerLevel = getCustomerLevelByName(param.getName());
+        if (Objects.nonNull(crmCustomerLevel)) {
+            throw new CustomException("级别名称已存在");
+        }
+
+        crmCustomerLevel = new CrmCustomerLevel();
+        BeanUtils.copyProperties(param, crmCustomerLevel, "id");
+        return baseMapper.insert(crmCustomerLevel);
+    }
+
+    /**
+     * 根据名称查询客户级别
+     * @param name 名称
+     * @return CrmCustomerLevel
+     */
+    private CrmCustomerLevel getCustomerLevelByName(String name) {
+        Wrapper<CrmCustomerLevel> queryWrapper = Wrappers.<CrmCustomerLevel>lambdaQuery()
+                .eq(CrmCustomerLevel::getName, name)
+                .last("limit 1");
+        return getOne(queryWrapper);
+    }
+
+    /**
+     * 修改客户级别
+     * @param param 参数
+     * @return 受影响行数
+     */
+    @Override
+    public int editCustomerLevel(CrmCustomerLevelParm param) {
+        if (Objects.isNull(param.getId())) {
+            throw new CustomException("ID不能为空");
+        }
+
+        CrmCustomerLevel customerLevel = getById(param.getId());
+        if (Objects.isNull(customerLevel)) {
+            throw new CustomException("记录不存在");
+        }
+
+        CrmCustomerLevel levelByName = getCustomerLevelByName(param.getName());
+        if (Objects.nonNull(levelByName) && !levelByName.getId().equals(customerLevel.getId())) {
+            throw new CustomException("级别名称已存在");
+        }
+
+        BeanUtils.copyProperties(param, customerLevel, "id");
+        return baseMapper.updateById(customerLevel);
+    }
+
+    /**
+     * 根据ID查询
+     * @param id id
+     * @return CrmCustomerLevelVO
+     */
+    @Override
+    public CrmCustomerLevelVO selectCrmCustomerLevelVOById(Long id) {
+        CrmCustomerLevel customerLevel = getById(id);
+        if (Objects.isNull(customerLevel)) {
+            throw new CustomException("记录不存在");
+        }
+
+        CrmCustomerLevelVO crmCustomerLevelVO = new CrmCustomerLevelVO();
+        BeanUtils.copyProperties(customerLevel, crmCustomerLevelVO);
+        return crmCustomerLevelVO;
+    }
+}

+ 15 - 0
fs-service-system/src/main/java/com/fs/crm/service/impl/CrmCustomerServiceImpl.java

@@ -962,4 +962,19 @@ public class CrmCustomerServiceImpl extends ServiceImpl<CrmCustomerMapper, CrmCu
 
         return vos;
     }
+
+    /**
+     * 置顶切换
+     * @param customerId 客户ID
+     */
+    @Override
+    public void switchToTop(Long customerId) {
+        CrmCustomer crmCustomer = crmCustomerMapper.selectCrmCustomerById(customerId);
+        if (Objects.isNull(crmCustomer)){
+            throw new CustomException("客户不存在");
+        }
+
+        crmCustomer.setIsTop(crmCustomer.getIsTop() == 0 ? 1 : 0);
+        crmCustomerMapper.updateCrmCustomer(crmCustomer);
+    }
 }

+ 23 - 0
fs-service-system/src/main/java/com/fs/crm/vo/CrmCustomerLevelVO.java

@@ -0,0 +1,23 @@
+package com.fs.crm.vo;
+
+import lombok.Data;
+
+@Data
+public class CrmCustomerLevelVO {
+    /**
+     * 主键ID
+     */
+    private Long id;
+    /**
+     * 级别名称
+     */
+    private String name;
+    /**
+     * 状态 0显示 1停用
+     */
+    private Integer status;
+    /**
+     * 序号
+     */
+    private Integer sort;
+}

+ 5 - 0
fs-service-system/src/main/java/com/fs/crm/vo/CrmCustomerListVO.java

@@ -127,4 +127,9 @@ public class CrmCustomerListVO implements Serializable
     @Excel(name = "进线客户提交日期" )
     private String registerSubmitTime;
 
+    /** 客户级别 */
+    private Long customerLevel;
+    /** 置顶状态 0未置顶 1置顶 */
+    private Integer isTop;
+
 }

+ 14 - 0
fs-service-system/src/main/resources/db/upgrade/20250621客户分级.sql

@@ -0,0 +1,14 @@
+-- 客户级别表
+drop table if exists crm_customer_level;
+create table crm_customer_level (
+    `id`        bigint          not null auto_increment comment '主键ID',
+    `name`      varchar(255)    not null                comment '级别名称',
+    `status`    tinyint         default 0               comment '状态 0显示 1停用',
+    `sort`      int             default 0               comment '序号',
+    primary key (`id`) using btree
+) engine = InnoDB comment = '客户级别表';
+
+-- 客户表新增级别字段、置顶字段
+alter table crm_customer
+    add column `customer_level` bigint comment '客户级别' after `customer_type`,
+    add column `is_top` tinyint default 0 comment '是否置顶 0未置顶 1置顶';

+ 17 - 0
fs-service-system/src/main/resources/mapper/crm/CrmCustomerLevelMapper.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fs.crm.mapper.CrmCustomerLevelMapper">
+
+    <select id="selectCrmCustomerLevelVOList" resultType="com.fs.crm.vo.CrmCustomerLevelVO">
+        select
+            ccl.*
+        from crm_customer_level ccl
+        <where>
+            <if test="name != null and name != ''">
+                and ccl.name like concat('%', #{name}, '%')
+            </if>
+        </where>
+    </select>
+</mapper>

+ 11 - 1
fs-service-system/src/main/resources/mapper/crm/CrmCustomerMapper.xml

@@ -53,10 +53,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="importType"    column="import_type"    />
         <result property="thirdAccount"    column="third_account"    />
         <result property="clueId"    column="clue_id"    />
+        <result property="customerLevel"    column="customer_level"    />
+        <result property="isTop"    column="is_top"    />
     </resultMap>
 
     <sql id="selectCrmCustomerVo">
-        select customer_id, customer_code, customer_name, mobile, sex, weixin, remark, user_id, create_user_id, receive_user_id, customer_user_id, address,city_ids, location, detail_address, lng, lat, create_time, update_time, status, is_receive, dept_id, is_del, customer_type, receive_time, pool_time, company_id, is_line, source, tags,ext_json,visit_status,register_date,register_link_url,register_desc,register_submit_time,is_pool,register_type,pay_money,buy_count,source_code,push_time,push_code,visit_time,traffic_source,import_type,third_account,clue_id from crm_customer
+        select customer_id, customer_code, customer_name, mobile, sex, weixin, remark, user_id, create_user_id, receive_user_id, customer_user_id, address,city_ids, location, detail_address, lng, lat, create_time, update_time, status, is_receive, dept_id, is_del, customer_type, receive_time, pool_time, company_id, is_line, source, tags,ext_json,visit_status,register_date,register_link_url,register_desc,register_submit_time,is_pool,register_type,pay_money,buy_count,source_code,push_time,push_code,visit_time,traffic_source,import_type,third_account,clue_id,customer_level,is_top from crm_customer
     </sql>
 
     <select id="selectCrmCustomerList" parameterType="CrmCustomer" resultMap="CrmCustomerResult">
@@ -92,6 +94,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="importType != null "> and import_type = #{importType}</if>
             <if test="thirdAccount != null "> and third_account = #{thirdAccount}</if>
             <if test="clueId != null "> and clue_id = #{clueId}</if>
+            <if test="customerLevel != null "> and customer_level = #{customerLevel}</if>
+            <if test="isTop != null "> and is_top = #{isTop}</if>
         </where>
         order by customer_id desc
     </select>
@@ -156,6 +160,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="importType != null">import_type,</if>
             <if test="thirdAccount != null">third_account,</if>
             <if test="clueId != null">clue_id,</if>
+            <if test="customerLevel != null">customer_level,</if>
+            <if test="isTop != null">is_top,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="customerCode != null">#{customerCode},</if>
@@ -205,6 +211,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="importType != null">#{importType},</if>
             <if test="thirdAccount != null">#{thirdAccount},</if>
             <if test="clueId != null">#{clueId},</if>
+            <if test="customerLevel != null">#{customerLevel},</if>
+            <if test="isTop != null">#{isTop},</if>
          </trim>
     </insert>
 
@@ -258,6 +266,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="importType != null">import_type = #{importType},</if>
             <if test="thirdAccount != null">third_account = #{thirdAccount},</if>
             <if test="clueId != null">clue_id = #{clueId},</if>
+            <if test="customerLevel != null">customer_level = #{customerLevel},</if>
+            <if test="isTop != null">is_top = #{isTop},</if>
         </trim>
         where customer_id = #{customerId}
     </update>