zxl
2025-06-09 91b7d154e71a4ba5222ecfef6b95ff2ea26b6291
客户管理,客户权限管理(会员分页)
2个文件已修改
1个文件已添加
122 ■■■■■ 已修改文件
buyer-api/src/main/java/cn/lili/controller/lmk/CustomerController.java 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/service/CustomerService.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
framework/src/main/java/cn/lili/modules/lmk/service/impl/CustomerServiceImpl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
buyer-api/src/main/java/cn/lili/controller/lmk/CustomerController.java
New file
@@ -0,0 +1,100 @@
package cn.lili.controller.lmk;
import cn.lili.base.Result;
import cn.lili.group.Add;
import cn.lili.group.Update;
import cn.lili.modules.lmk.domain.form.CustomerTagForm;
import cn.lili.modules.lmk.domain.form.CustomerTagRefForm;
import cn.lili.modules.lmk.domain.query.CustomerQuery;
import cn.lili.modules.lmk.domain.query.CustomerTagQuery;
import cn.lili.modules.lmk.service.CustomerService;
import cn.lili.modules.lmk.service.CustomerTagRefService;
import cn.lili.modules.lmk.service.CustomerTagService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
 * 小程序 客户管理(商户)
 */
@Validated
@RequiredArgsConstructor
@Api(value = "小程序端客户管理", tags = "小程序端客户管理")
@RestController
@RequestMapping("/buyer/lmk/customer")
public class CustomerController {
    private final CustomerService customerService;
    private final CustomerTagService customerTagService;
    private final CustomerTagRefService customerTagRefService;
    @ApiOperation(value = "商铺下拉列表")
    @GetMapping("/store/selectOption")
    public Result getStoreSelectOptions(){
        return customerService.getStoreSelectOptions();
    }
    @ApiOperation(value = "客户分页列表")
    @GetMapping
    public Result getByPage(CustomerQuery customerQuery) {
        return customerService.getMemberPageByWX(customerQuery);
    }
    @PostMapping("/addTag")
    @ApiOperation(value = "添加标签", notes = "添加标签")
    public Result add(@RequestBody @Validated(Add.class) CustomerTagForm form) {
        return customerTagService.add(form);
    }
    @PutMapping("/editTag")
    @ApiOperation(value = "修改标签", notes = "修改标签")
    public Result update(@RequestBody @Validated(Update.class) CustomerTagForm form) {
        return customerTagService.update(form);
    }
    @DeleteMapping("/tag/{id}")
    @ApiOperation(value = "ID删除标签", notes = "ID删除")
    public Result removeById(@PathVariable("id") String id) {
        return customerTagService.removeById(id);
    }
    @GetMapping("/tagList")
    @ApiOperation(value = "标签列表", notes = "标签列表")
    public Result list() {
        return customerTagService.all();
    }
    @GetMapping("/pageTagList")
    @ApiOperation(value = "分页标签列表", notes = "标签列表")
    public Result pageList(CustomerTagQuery query) {
        return customerTagService.page(query);
    }
    @PostMapping("/customerAddTag")
    @ApiOperation(value = "添加客户标签标识", notes = "添加客户标签标识")
    public Result addCustomerTag(@RequestBody @Validated(Add.class) CustomerTagForm form) {
        return customerTagService.addCustomerTag(form);
    }
//    @PostMapping("/customerAddTag")
//    @ApiOperation(value = "添加客户标签标识", notes = "添加客户标签标识")
//    public Result add(@RequestBody @Validated(Add.class) CustomerTagRefForm form) {
//        return customerTagRefService.add(form);
//    }
    @PutMapping("/customerEditTag")
    @ApiOperation(value = "修改客户标签标识", notes = "修改客户标签标识")
    public Result update(@RequestBody @Validated(Update.class) CustomerTagRefForm form) {
        return customerTagRefService.update(form);
    }
    @DeleteMapping("/customerDelTag/{id}")
    @ApiOperation(value = "删除客户标签标识ID删除", notes = "删除客户标签标识ID删除")
    public Result removeCustomerTagById(@PathVariable("id") String id) {
        return customerTagRefService.removeById(id);
    }
}
framework/src/main/java/cn/lili/modules/lmk/service/CustomerService.java
@@ -13,7 +13,13 @@
import com.baomidou.mybatisplus.extension.service.IService;
public interface CustomerService extends IService<Member> {
    /**
     * 获取会员分页 复用于该框架开源api WX端
     *
     * @param customerQuery 会员搜索
     * @return 会员分页
     */
    Result getMemberPageByWX(CustomerQuery customerQuery);
    /**
     * 获取会员分页 复用于该框架开源api
     *
framework/src/main/java/cn/lili/modules/lmk/service/impl/CustomerServiceImpl.java
@@ -2,6 +2,7 @@
import cn.lili.base.Result;
import cn.lili.common.security.context.UserContext;
import cn.lili.modules.lmk.domain.query.CustomerQuery;
import cn.lili.modules.lmk.mapper.CustomerMapper;
import cn.lili.modules.lmk.mapper.LmkStoreMapper;
@@ -20,6 +21,8 @@
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Objects;
@Service
@RequiredArgsConstructor
public class CustomerServiceImpl extends ServiceImpl<MemberMapper, Member> implements CustomerService {
@@ -37,6 +40,17 @@
    }
    @Override
    public Result getMemberPageByWX(CustomerQuery customerQuery) {
        String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
        if ( storeId == null) {
            return Result.error("该账号没有注册店铺");
        }
        return getMemberPage(customerQuery);
    }
    @Override
    public MemberVO getMember(String id) {
        return null;
    }