From 3c5d0550633c0549ac948f4e6a1b015377fa293f Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Tue, 07 Feb 2023 15:10:25 +0800
Subject: [PATCH] 代理人申请,后台审核 测试环境,数据库新建 后台系统名称修改

---
 src/main/resources/templates/index.html                                         |    2 
 src/main/resources/mapper/modules/MallAgentRecordMapper.xml                     |   34 +++
 src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java |   22 +
 src/main/java/cc/mrbird/febs/common/runner/FebsStartedUpRunner.java             |    2 
 src/main/java/cc/mrbird/febs/mall/controller/AdminMallMemberController.java     |   34 +++
 src/main/java/cc/mrbird/febs/mall/service/IApiMallAgentService.java             |   12 +
 src/main/resources/templates/error/404.html                                     |    2 
 src/main/java/cc/mrbird/febs/mall/dto/ApiAgentApplyDto.java                     |   41 ++++
 src/main/java/cc/mrbird/febs/mall/conversion/MallAgentRecordConversion.java     |   15 +
 src/main/java/cc/mrbird/febs/mall/entity/MallAgentRecord.java                   |   40 ++++
 src/main/java/cc/mrbird/febs/mall/mapper/MallAgentRecordMapper.java             |   14 +
 src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java  |   41 ++++
 src/main/resources/templates/error/403.html                                     |    2 
 src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallAgentServiceImpl.java     |   49 ++++
 src/main/resources/templates/febs/views/modules/mallMember/mallAgentRecord.html |  194 +++++++++++++++++++
 src/main/java/cc/mrbird/febs/mall/controller/ViewMallMemberController.java      |    9 
 src/main/java/cc/mrbird/febs/mall/controller/ApiMallMemberController.java       |   17 +
 src/main/resources/application-dev.yml                                          |   22 +-
 src/main/resources/application.yml                                              |    2 
 src/main/resources/templates/error/500.html                                     |    2 
 src/main/java/cc/mrbird/febs/mall/service/IAdminMallMemberService.java          |   11 
 src/main/resources/templates/febs/views/layout.html                             |    2 
 src/main/resources/templates/febs/views/login.html                              |    4 
 23 files changed, 532 insertions(+), 41 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/common/runner/FebsStartedUpRunner.java b/src/main/java/cc/mrbird/febs/common/runner/FebsStartedUpRunner.java
index a7ad8df..d899a86 100644
--- a/src/main/java/cc/mrbird/febs/common/runner/FebsStartedUpRunner.java
+++ b/src/main/java/cc/mrbird/febs/common/runner/FebsStartedUpRunner.java
@@ -63,7 +63,7 @@
             log.info("/ /`  / / \\ | |\\/| | |_) | |   | |_   | |  | |_  ");
             log.info("\\_\\_, \\_\\_/ |_|  | |_|   |_|__ |_|__  |_|  |_|__ ");
             log.info("                                                      ");
-            log.info("壹元蔬菜 权限系统启动完毕,地址:{}", url);
+            log.info("钱阿姨 权限系统启动完毕,地址:{}", url);
 
             boolean auto = febsProperties.isAutoOpenBrowser();
             if (auto && StringUtils.equalsIgnoreCase(active, FebsConstant.DEVELOP)) {
diff --git a/src/main/java/cc/mrbird/febs/mall/controller/AdminMallMemberController.java b/src/main/java/cc/mrbird/febs/mall/controller/AdminMallMemberController.java
index 215b2cd..6be9111 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/AdminMallMemberController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/AdminMallMemberController.java
@@ -5,10 +5,7 @@
 import cc.mrbird.febs.common.entity.FebsResponse;
 import cc.mrbird.febs.common.entity.QueryRequest;
 import cc.mrbird.febs.mall.dto.*;
-import cc.mrbird.febs.mall.entity.AppVersion;
-import cc.mrbird.febs.mall.entity.MallMember;
-import cc.mrbird.febs.mall.entity.MallNewsInfo;
-import cc.mrbird.febs.mall.entity.MallShopApply;
+import cc.mrbird.febs.mall.entity.*;
 import cc.mrbird.febs.mall.service.IAdminMallMemberService;
 import cc.mrbird.febs.mall.service.IApiMallMemberService;
 import cc.mrbird.febs.mall.vo.AdminAgentLevelOptionTreeVo;
@@ -368,4 +365,33 @@
         return new FebsResponse().success();
     }
 
+    /**
+     * 代理申请列表
+     */
+    @GetMapping("getAgentApplyList")
+    public FebsResponse getAgentApplyList(MallAgentRecord mallAgentRecord, QueryRequest request) {
+        Map<String, Object> data = getDataTable(mallMemberService.getAgentApplyList(mallAgentRecord, request));
+        return new FebsResponse().success().data(data);
+    }
+
+    /**
+     * 代理申请列表
+     *      同意
+     */
+    @GetMapping("agreeAgentApply/{id}")
+    @ControllerEndpoint(operation = "审核代理申请", exceptionMessage = "操作失败")
+    public FebsResponse agreeAgentApply(@NotNull(message = "{required}") @PathVariable Long id) {
+        return mallMemberService.agreeAgentApply(id);
+    }
+
+    /**
+     * 代理申请列表
+     *      拒绝
+     */
+    @GetMapping("disagreeAgentApply/{id}")
+    @ControllerEndpoint(operation = "审核代理申请", exceptionMessage = "操作失败")
+    public FebsResponse disagreeAgentApply(@NotNull(message = "{required}") @PathVariable Long id) {
+        return mallMemberService.disagreeAgentApply(id);
+    }
+
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/controller/ApiMallMemberController.java b/src/main/java/cc/mrbird/febs/mall/controller/ApiMallMemberController.java
index 79d6d3f..d4f191a 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/ApiMallMemberController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/ApiMallMemberController.java
@@ -4,10 +4,7 @@
 import cc.mrbird.febs.mall.dto.*;
 import cc.mrbird.febs.mall.entity.MallMember;
 import cc.mrbird.febs.mall.entity.MallMemberPayment;
-import cc.mrbird.febs.mall.service.IApiMallMemberService;
-import cc.mrbird.febs.mall.service.IApiMallMemberWalletService;
-import cc.mrbird.febs.mall.service.ICommonService;
-import cc.mrbird.febs.mall.service.IMallMemberWithdrawService;
+import cc.mrbird.febs.mall.service.*;
 import cc.mrbird.febs.mall.vo.*;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -34,6 +31,7 @@
     private final IApiMallMemberService memberService;
     private final IMallMemberWithdrawService mallMemberWithdrawService;
     private final IApiMallMemberWalletService walletService;
+    private final IApiMallAgentService iApiMallAgentService;
 
     /**
      * 小程序接收用户数据,更新用户信息
@@ -192,4 +190,15 @@
         return memberService.rechargeWallet(apiRechargeWalletDto);
     }
 
+    /**
+     * 申请代理
+     * @param apiAgentApplyDto
+     * @return
+     */
+    @ApiOperation(value = "申请代理")
+    @PostMapping(value = "/agentApply")
+    public FebsResponse agentApply(@RequestBody @Validated ApiAgentApplyDto apiAgentApplyDto) {
+        return iApiMallAgentService.agentApply(apiAgentApplyDto);
+    }
+
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/controller/ViewMallMemberController.java b/src/main/java/cc/mrbird/febs/mall/controller/ViewMallMemberController.java
index ef7b482..4e58c2d 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/ViewMallMemberController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/ViewMallMemberController.java
@@ -267,6 +267,15 @@
         return FebsUtil.view("modules/mallMember/addMember");
     }
 
+    /**
+     * 代理申请列表
+     */
+    @GetMapping("mallAgentRecord")
+    @RequiresPermissions("mallAgentRecord:view")
+    public String mallAgentRecord() {
+        return FebsUtil.view("modules/mallMember/mallAgentRecord");
+    }
+
 
 
 
diff --git a/src/main/java/cc/mrbird/febs/mall/conversion/MallAgentRecordConversion.java b/src/main/java/cc/mrbird/febs/mall/conversion/MallAgentRecordConversion.java
new file mode 100644
index 0000000..a91ac62
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/conversion/MallAgentRecordConversion.java
@@ -0,0 +1,15 @@
+package cc.mrbird.febs.mall.conversion;
+
+import cc.mrbird.febs.mall.dto.ApiAgentApplyDto;
+import cc.mrbird.febs.mall.entity.MallAgentRecord;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+@Mapper
+public abstract class MallAgentRecordConversion {
+
+    public static final MallAgentRecordConversion INSTANCE = Mappers.getMapper(MallAgentRecordConversion.class);
+
+    public abstract MallAgentRecord dtoToEntity(ApiAgentApplyDto apiAgentApplyDto);
+
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/ApiAgentApplyDto.java b/src/main/java/cc/mrbird/febs/mall/dto/ApiAgentApplyDto.java
new file mode 100644
index 0000000..45596ae
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/dto/ApiAgentApplyDto.java
@@ -0,0 +1,41 @@
+package cc.mrbird.febs.mall.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+@Data
+@ApiModel(value = "ApiAgentApplyDto", description = "申请代理")
+public class ApiAgentApplyDto {
+
+    //申请人姓名
+    @NotBlank(message = "姓名不能为空")
+    @ApiModelProperty(value = "姓名")
+    private String name;
+    //电话
+    @NotBlank(message = "电话不能为空")
+    @ApiModelProperty(value = "电话")
+    private String phone;
+    //店铺名称(非必填)
+    @ApiModelProperty(value = "店铺名称(非必填)")
+    private String storeName;
+    //省
+    @NotBlank(message = "省不能为空")
+    @ApiModelProperty(value = "省")
+    private String province;
+    //市
+    @NotBlank(message = "市不能为空")
+    @ApiModelProperty(value = "市")
+    private String city;
+    //区、县
+    @NotBlank(message = "区、县不能为空")
+    @ApiModelProperty(value = "区、县")
+    private String area;
+    //详细地址
+    @NotBlank(message = "详细地址不能为空")
+    @ApiModelProperty(value = "详细地址")
+    private String storeAddress;
+
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/entity/MallAgentRecord.java b/src/main/java/cc/mrbird/febs/mall/entity/MallAgentRecord.java
new file mode 100644
index 0000000..5556174
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/entity/MallAgentRecord.java
@@ -0,0 +1,40 @@
+package cc.mrbird.febs.mall.entity;
+
+import cc.mrbird.febs.common.entity.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+@TableName("mall_agent_record")
+public class MallAgentRecord extends BaseEntity {
+
+    private Long memberId;
+
+    //申请人姓名
+    private String name;
+    //电话
+    private String phone;
+    //店铺名称(非必填)
+    private String storeName;
+    //省
+    private String province;
+    //市
+    private String city;
+    //区、县
+    private String area;
+    //详细地址
+    private String storeAddress;
+
+    //状态 1::申请中 2:同意 3:拒绝
+    private Integer state;
+    public static final Integer APPLY_ING = 1;
+    public static final Integer APPLY_AGREE = 2;
+    public static final Integer APPLY_DISAGREE = 3;
+
+    @TableField(exist = false)
+    private String memberName;
+
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/mapper/MallAgentRecordMapper.java b/src/main/java/cc/mrbird/febs/mall/mapper/MallAgentRecordMapper.java
new file mode 100644
index 0000000..5e3b8cf
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/mapper/MallAgentRecordMapper.java
@@ -0,0 +1,14 @@
+package cc.mrbird.febs.mall.mapper;
+
+import cc.mrbird.febs.mall.entity.MallAgentRecord;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
+
+public interface MallAgentRecordMapper extends BaseMapper<MallAgentRecord> {
+
+    MallAgentRecord selectByMemberIdAndState(@Param("memberId")Long memberId, @Param("state")Integer applyIng);
+
+    IPage<MallAgentRecord> selectMallAgentRecordListInPage(Page<MallAgentRecord> page, @Param("record")MallAgentRecord mallAgentRecord);
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/service/IAdminMallMemberService.java b/src/main/java/cc/mrbird/febs/mall/service/IAdminMallMemberService.java
index bb75da6..200a1c6 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/IAdminMallMemberService.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/IAdminMallMemberService.java
@@ -3,10 +3,7 @@
 import cc.mrbird.febs.common.entity.FebsResponse;
 import cc.mrbird.febs.common.entity.QueryRequest;
 import cc.mrbird.febs.mall.dto.*;
-import cc.mrbird.febs.mall.entity.AppVersion;
-import cc.mrbird.febs.mall.entity.MallMember;
-import cc.mrbird.febs.mall.entity.MallNewsInfo;
-import cc.mrbird.febs.mall.entity.MallShopApply;
+import cc.mrbird.febs.mall.entity.*;
 import cc.mrbird.febs.mall.vo.*;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -93,4 +90,10 @@
     MallMember findByInviteId(String inviteId);
 
     void modifyReferer(MallMember member);
+
+    IPage<MallAgentRecord> getAgentApplyList(MallAgentRecord mallAgentRecord, QueryRequest request);
+
+    FebsResponse agreeAgentApply(Long id);
+
+    FebsResponse disagreeAgentApply(Long id);
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/service/IApiMallAgentService.java b/src/main/java/cc/mrbird/febs/mall/service/IApiMallAgentService.java
new file mode 100644
index 0000000..2f4f89b
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/service/IApiMallAgentService.java
@@ -0,0 +1,12 @@
+package cc.mrbird.febs.mall.service;
+
+import cc.mrbird.febs.common.entity.FebsResponse;
+import cc.mrbird.febs.mall.dto.ApiAgentApplyDto;
+import cc.mrbird.febs.mall.entity.MallAgentRecord;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+public interface IApiMallAgentService extends IService<MallAgentRecord> {
+
+    FebsResponse agentApply(ApiAgentApplyDto apiAgentApplyDto);
+
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
index 7a91557..e57eb82 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallMemberServiceImpl.java
@@ -68,6 +68,8 @@
     private final IMallMoneyFlowService mallMoneyFlowService;
     private final MallTeamLeaderMapper mallTeamLeaderMapper;
 
+    private final MallAgentRecordMapper mallAgentRecordMapper;
+
     @Override
     public IPage<MallMember> getMallMemberList(MallMember mallMember, QueryRequest request) {
         Page<MallMember> page = new Page<>(request.getPageNum(), request.getPageSize());
@@ -600,6 +602,45 @@
         }
     }
 
+    @Override
+    public IPage<MallAgentRecord> getAgentApplyList(MallAgentRecord mallAgentRecord, QueryRequest request) {
+        Page<MallAgentRecord> page = new Page<>(request.getPageNum(), request.getPageSize());
+        IPage<MallAgentRecord> mallAgentRecords = mallAgentRecordMapper.selectMallAgentRecordListInPage(page, mallAgentRecord);
+        return mallAgentRecords;
+    }
+
+    @Override
+    @Transactional
+    public FebsResponse agreeAgentApply(Long id) {
+        MallAgentRecord mallAgentRecord = mallAgentRecordMapper.selectById(id);
+        if(ObjectUtil.isEmpty(mallAgentRecord)){
+            return new FebsResponse().fail().message("申请记录不存在");
+        }
+        mallAgentRecord.setState(MallAgentRecord.APPLY_AGREE);
+        mallAgentRecordMapper.updateById(mallAgentRecord);
+
+        //更新用户表中的LEVEL
+        MallMember mallMember = this.baseMapper.selectById(mallAgentRecord.getMemberId());
+        if(ObjectUtil.isEmpty(mallMember)){
+            return new FebsResponse().fail().message("用户不存在");
+        }
+        mallMember.setLevel(AgentLevelEnum.FIRST_LEVEL.name());
+        this.baseMapper.updateById(mallMember);
+        return new FebsResponse().success();
+    }
+
+    @Override
+    @Transactional
+    public FebsResponse disagreeAgentApply(Long id) {
+        MallAgentRecord mallAgentRecord = mallAgentRecordMapper.selectById(id);
+        if(ObjectUtil.isEmpty(mallAgentRecord)){
+            return new FebsResponse().fail().message("申请记录不存在");
+        }
+        mallAgentRecord.setState(MallAgentRecord.APPLY_DISAGREE);
+        mallAgentRecordMapper.updateById(mallAgentRecord);
+        return new FebsResponse().success();
+    }
+
     private String refererIds(String parentId) {
         boolean flag = false;
         if (StrUtil.isBlank(parentId)) {
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallAgentServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallAgentServiceImpl.java
new file mode 100644
index 0000000..94ab94b
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallAgentServiceImpl.java
@@ -0,0 +1,49 @@
+package cc.mrbird.febs.mall.service.impl;
+
+import cc.mrbird.febs.common.entity.FebsResponse;
+import cc.mrbird.febs.common.enumerates.AgentLevelEnum;
+import cc.mrbird.febs.common.utils.LoginUserUtil;
+import cc.mrbird.febs.mall.conversion.MallAgentRecordConversion;
+import cc.mrbird.febs.mall.conversion.MallGoodsConversion;
+import cc.mrbird.febs.mall.dto.ApiAgentApplyDto;
+import cc.mrbird.febs.mall.entity.MallAgentRecord;
+import cc.mrbird.febs.mall.entity.MallMember;
+import cc.mrbird.febs.mall.mapper.MallAgentRecordMapper;
+import cc.mrbird.febs.mall.mapper.MallMemberMapper;
+import cc.mrbird.febs.mall.service.IApiMallAgentService;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class ApiMallAgentServiceImpl extends ServiceImpl<MallAgentRecordMapper, MallAgentRecord> implements IApiMallAgentService {
+
+    private final MallAgentRecordMapper mallAgentRecordMapper;
+    private final MallMemberMapper mallMemberMapper;
+
+    @Override
+    public FebsResponse agentApply(ApiAgentApplyDto apiAgentApplyDto) {
+        Long memberId = LoginUserUtil.getLoginUser().getId();
+        //判断用户当前的级别
+        MallMember mallMember = mallMemberMapper.selectById(memberId);
+        if(!AgentLevelEnum.ZERO_LEVEL.name().equals(mallMember.getLevel())){
+            return new FebsResponse().fail().message("用户已无法申请");
+        }
+        //判断用户是否正在申请
+        MallAgentRecord mallAgentRecord = mallAgentRecordMapper.selectByMemberIdAndState(memberId,MallAgentRecord.APPLY_ING);
+        if(ObjectUtil.isNotEmpty(mallAgentRecord)){
+            return new FebsResponse().fail().message("用户已申请");
+        }
+
+        MallAgentRecord mallAgentRecordNew = MallAgentRecordConversion.INSTANCE.dtoToEntity(apiAgentApplyDto);
+        mallAgentRecordNew.setMemberId(memberId);
+        mallAgentRecordNew.setState(MallAgentRecord.APPLY_ING);
+        mallAgentRecordMapper.insert(mallAgentRecordNew);
+
+        return new FebsResponse().success().message("申请成功");
+    }
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java
index 4516640..1d08982 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java
@@ -88,20 +88,24 @@
     public Long createOrder(AddOrderDto addOrderDto) {
 //        synchronized(this){
         MallMember member = LoginUserUtil.getLoginUser();
-        String takeUniqueCode = addOrderDto.getTakeUniqueCode();
-        if(StrUtil.isEmpty(takeUniqueCode)){
-            throw new FebsException("请选择自提点");
+        //验证用户的等级
+        if(AgentLevelEnum.ZERO_LEVEL.name().equals(member.getLevel())){
+            throw new FebsException("请先申请成为代理人");
         }
+//        String takeUniqueCode = addOrderDto.getTakeUniqueCode();
+//        if(StrUtil.isEmpty(takeUniqueCode)){
+//            throw new FebsException("请选择自提点");
+//        }
 
-        MallTeamLeader mallTeamLeader = mallTeamLeaderMapper.selectLeaderByUniqueCode(takeUniqueCode);
-        if(ObjectUtil.isEmpty(mallTeamLeader)){
-            throw new FebsException("请重新选择团长");
-        }
+//        MallTeamLeader mallTeamLeader = mallTeamLeaderMapper.selectLeaderByUniqueCode(takeUniqueCode);
+//        if(ObjectUtil.isEmpty(mallTeamLeader)){
+//            throw new FebsException("请重新选择团长");
+//        }
 
         //订单范围内才允许下单
         MallAddressInfo address = mallAddressInfoMapper.selectAddressInfoByMemberIdAndId(member.getId(), addOrderDto.getAddressId());
         if(ObjectUtil.isEmpty(address)){
-            throw new FebsException("请重新选择提货人信息");
+            throw new FebsException("请重新选择收货地址信息");
         }
 //        MallElectronicFence mallElectronicFence = mallElectronicFenceMapper.selectByTeamLeaderCode(mallTeamLeader.getUniqueCode());
 //        if(ObjectUtil.isNotEmpty(mallElectronicFence)){
@@ -121,7 +125,7 @@
         orderInfo.setRemark(addOrderDto.getRemark());
         orderInfo.setOrderType(addOrderDto.getOrderType());
 
-        orderInfo.setTakeUniqueCode(addOrderDto.getTakeUniqueCode());
+//        orderInfo.setTakeUniqueCode(addOrderDto.getTakeUniqueCode());
         orderInfo.setDeliveryType(1);
 
         if (CollUtil.isEmpty(addOrderDto.getItems())) {
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index 6da9eb5..093efa7 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -19,10 +19,10 @@
 #          password: 123456
 #          driver-class-name: com.mysql.cj.jdbc.Driver
 #          url: jdbc:mysql://120.27.238.55:3306/db_pingtuan?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8
-          username: db_yyg
-          password: yyg123!@#
+          username: db_mall_qianayi
+          password: db_mall_qianayi123!@#123
           driver-class-name: com.mysql.cj.jdbc.Driver
-          url: jdbc:mysql://121.37.162.173:3306/db_yyg?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8
+          url: jdbc:mysql://121.37.162.173:3306/db_mall_qianayi?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8
 #          username: db_mall
 #          password: mall!@#123
 #          driver-class-name: com.mysql.cj.jdbc.Driver
@@ -30,13 +30,13 @@
 
   redis:
     # Redis数据库索引(默认为 0)
-    database: 3
+    database: 8
     # Redis服务器地址
-    host: 120.27.238.55
+    host: 121.37.162.173
     # Redis服务器连接端口
     port: 6379
     # Redis 密码
-    password: xcong123
+    password: d32ncxe@i3#!dV
     lettuce:
       pool:
         # 连接池中的最小空闲连接
@@ -50,10 +50,10 @@
     # 连接超时时间(毫秒)
     timeout: 5000
   rabbitmq:
-    host: 120.27.238.55
+    host: 121.37.162.173
     port: 5672
-    username: ct_rabbit
-    password: 123456
+    username: hibit
+    password: hibit123
     publisher-confirm-type: correlated
 
 pay:
@@ -69,8 +69,8 @@
 
 xcx:
   wechar_login_url: https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code
-  xcx_appid: wx0b515f652282158e
-  xcx_secret: 8d3d3c14221f7dc37650b861dc0fc570
+  xcx_appid: wxfb1acf504eb9d058
+  xcx_secret: 7ee226a964b1be7cfb96f5e0dc739c44
   debug: false
   wecharPaynotifyUrl: http://groupbuy.csxuncong.com/api/xcxPay/wxpayCallback
   wecharRechargePaynotifyUrl: http://groupbuy.csxuncong.com/api/xcxPay/rechargeCallBack
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index fa54718..ebfeb13 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -5,7 +5,7 @@
 
 spring:
   profiles:
-    active: test
+    active: dev
 
   servlet:
     multipart:
diff --git a/src/main/resources/mapper/modules/MallAgentRecordMapper.xml b/src/main/resources/mapper/modules/MallAgentRecordMapper.xml
new file mode 100644
index 0000000..a9fb76e
--- /dev/null
+++ b/src/main/resources/mapper/modules/MallAgentRecordMapper.xml
@@ -0,0 +1,34 @@
+<?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="cc.mrbird.febs.mall.mapper.MallAgentRecordMapper">
+
+    <select id="selectByMemberIdAndState" resultType="cc.mrbird.febs.mall.entity.MallAgentRecord">
+        select a.* from mall_agent_record a
+        where a.member_id = #{memberId}
+            and a.state = #{state}
+        limit 1
+    </select>
+
+    <select id="selectMallAgentRecordListInPage" resultType="cc.mrbird.febs.mall.entity.MallAgentRecord">
+        SELECT
+            a.*,
+            b.name memberName
+        FROM mall_agent_record a
+        LEFT JOIN mall_member b on a.member_id = b.id
+        <where>
+            <if test="record != null" >
+                <if test="record.name!=null and record.name!=''">
+                    and a.name like concat('%',  #{record.name},'%')
+                </if>
+                <if test="record.memberName!=null and record.memberName!=''">
+                    and b.name like concat('%',  #{record.memberName},'%')
+                </if>
+                <if test="record.state!=null">
+                    and a.state = #{record.state}
+                </if>
+            </if>
+        </where>
+        GROUP BY a.id order by a.CREATED_TIME desc
+    </select>
+
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/templates/error/403.html b/src/main/resources/templates/error/403.html
index 0d696ad..0972b5d 100644
--- a/src/main/resources/templates/error/403.html
+++ b/src/main/resources/templates/error/403.html
@@ -2,7 +2,7 @@
 <html xmlns:th="http://www.thymeleaf.org">
 <head>
     <meta charset="utf-8">
-    <title>壹元蔬菜 权限系统</title>
+    <title>钱阿姨 权限系统</title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
     <meta name="renderer" content="webkit">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
diff --git a/src/main/resources/templates/error/404.html b/src/main/resources/templates/error/404.html
index 2fb8836..16775c7 100644
--- a/src/main/resources/templates/error/404.html
+++ b/src/main/resources/templates/error/404.html
@@ -2,7 +2,7 @@
 <html xmlns:th="http://www.thymeleaf.org">
 <head>
     <meta charset="utf-8">
-    <title>壹元蔬菜 权限系统</title>
+    <title>钱阿姨 权限系统</title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
     <meta name="renderer" content="webkit">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
diff --git a/src/main/resources/templates/error/500.html b/src/main/resources/templates/error/500.html
index d0e9ecb..4222f6e 100644
--- a/src/main/resources/templates/error/500.html
+++ b/src/main/resources/templates/error/500.html
@@ -2,7 +2,7 @@
 <html xmlns:th="http://www.thymeleaf.org">
 <head>
     <meta charset="utf-8">
-    <title>壹元蔬菜 权限系统</title>
+    <title>钱阿姨 权限系统</title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
     <meta name="renderer" content="webkit">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
diff --git a/src/main/resources/templates/febs/views/layout.html b/src/main/resources/templates/febs/views/layout.html
index 6e93a47..fb91414 100644
--- a/src/main/resources/templates/febs/views/layout.html
+++ b/src/main/resources/templates/febs/views/layout.html
@@ -64,7 +64,7 @@
         <div class="layui-side-scroll">
             <div class="layui-logo" style="cursor: pointer">
                 <img data-th-src="@{febs/images/logo.png}">
-                <span>壹元蔬菜 权限系统</span>
+                <span>钱阿姨 权限系统</span>
             </div>
             <script
                     type="text/html"
diff --git a/src/main/resources/templates/febs/views/login.html b/src/main/resources/templates/febs/views/login.html
index 2e7d8a2..d4cd2a8 100644
--- a/src/main/resources/templates/febs/views/login.html
+++ b/src/main/resources/templates/febs/views/login.html
@@ -2,7 +2,7 @@
 <html xmlns:th="http://www.thymeleaf.org">
 <head>
     <meta charset="utf-8">
-    <title>壹元蔬菜 权限系统</title>
+    <title>钱阿姨 权限系统</title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
     <meta name="renderer" content="webkit">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@@ -19,7 +19,7 @@
         <div class="layui-container">
             <div class="layui-row">
                 <div class="layui-col-xs12 layui-col-lg4 layui-col-lg-offset4 febs-tc">
-                    <div class="layui-logo"><span><b>壹元蔬菜</b> 权限系统</span></div>
+                    <div class="layui-logo"><span><b>钱阿姨</b> 权限系统</span></div>
                 </div>
                 <div class="layui-col-xs12 layui-col-lg4 layui-col-lg-offset4" id="login-div">
                     <div class="layui-form" lay-filter="login-form">
diff --git a/src/main/resources/templates/febs/views/modules/mallMember/mallAgentRecord.html b/src/main/resources/templates/febs/views/modules/mallMember/mallAgentRecord.html
new file mode 100644
index 0000000..ed1b52f
--- /dev/null
+++ b/src/main/resources/templates/febs/views/modules/mallMember/mallAgentRecord.html
@@ -0,0 +1,194 @@
+<div class="layui-fluid layui-anim febs-anim" id="febs-agent-apply-list" lay-title="代理申请列表">
+    <div class="layui-row febs-container">
+        <div class="layui-col-md12">
+            <div class="layui-card">
+                <div class="layui-card-body febs-table-full">
+                    <form class="layui-form layui-table-form" lay-filter="user-table-form">
+                        <div class="layui-row">
+                            <div class="layui-col-md10">
+                                <div class="layui-form-item">
+                                    <div class="layui-inline">
+                                        <div class="layui-input-inline">
+                                            <input type="text" placeholder="微信昵称" name="memberName" autocomplete="off" class="layui-input">
+                                        </div>
+                                    </div>
+                                    <div class="layui-inline">
+                                        <div class="layui-input-inline">
+                                            <input type="text" placeholder="姓名" name="name" autocomplete="off" class="layui-input">
+                                        </div>
+                                    </div>
+                                    <div class="layui-inline">
+                                        <div class="layui-input-inline">
+                                            <input type="text" placeholder="电话" name="phone" autocomplete="off" class="layui-input">
+                                        </div>
+                                    </div>
+                                    <div class="layui-inline">
+                                        <label class="layui-form-label layui-form-label-sm">申请状态</label>
+                                        <div class="layui-input-inline">
+                                            <select name="state">
+                                                <option value="">请选择</option>
+                                                <option value="1">申请中</option>
+                                                <option value="2">通过</option>
+                                                <option value="3">拒绝</option>
+                                            </select>
+                                        </div>
+                                    </div>
+<!--                                    <div class="layui-inline">-->
+<!--                                        <label class="layui-form-label layui-form-label-sm">会员类型</label>-->
+<!--                                        <div class="layui-input-inline">-->
+<!--                                            <select name="level">-->
+<!--                                                <option value="">请选择</option>-->
+<!--                                                <option value="FIRST_LEVEL">普通会员</option>-->
+<!--                                                <option value="SECOND_LEVEL">一星</option>-->
+<!--                                                <option value="THIRD_LEVEL">二星</option>-->
+<!--                                                <option value="FOUR_LEVEL">三星</option>-->
+<!--                                                <option value="FIFTH_LEVEL">四星</option>-->
+<!--                                            </select>-->
+<!--                                        </div>-->
+<!--                                    </div>-->
+                                </div>
+                            </div>
+                            <div class="layui-col-md2 layui-col-sm12 layui-col-xs12 table-action-area">
+                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-blue-plain table-action" id="query">
+                                    <i class="layui-icon">&#xe848;</i>
+                                </div>
+                                <div class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain table-action" id="reset">
+                                    <i class="layui-icon">&#xe79b;</i>
+                                </div>
+                            </div>
+                        </div>
+                    </form>
+                    <table lay-filter="agentApplyTable" lay-data="{id: 'agentApplyTable'}"></table>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<!-- 表格操作栏 start -->
+<script type="text/html" id="user-option">
+    <span shiro:lacksPermission="user:view,user:update,user:delete">
+        <span class="layui-badge-dot febs-bg-orange"></span> 无权限
+    </span>
+    <a lay-event="edit" shiro:hasPermission="user:update"><i
+            class="layui-icon febs-edit-area febs-blue">&#xe7a5;</i></a>
+</script>
+<style>
+    .layui-form-onswitch {
+        background-color: #5FB878 !important;
+    }
+</style>
+<script data-th-inline="none" type="text/javascript">
+    // 引入组件并初始化
+    layui.use([ 'jquery', 'form', 'table', 'febs'], function () {
+        var $ = layui.jquery,
+            febs = layui.febs,
+            form = layui.form,
+            table = layui.table,
+            $view = $('#febs-agent-apply-list'),
+            $query = $view.find('#query'),
+            $reset = $view.find('#reset'),
+            $searchForm = $view.find('form'),
+            sortObject = {field: 'phone', type: null},
+            tableIns;
+
+        form.render();
+
+        // 表格初始化
+        initTable();
+
+        // 初始化表格操作栏各个按钮功能
+        table.on('tool(agentApplyTable)', function (obj) {
+            var data = obj.data,
+                layEvent = obj.event;
+
+            if (layEvent === 'agree') {
+                febs.modal.confirm('通过', '通过用户的代理申请?', function () {
+                    agree(data.id);
+                });
+            }
+            if (layEvent === 'disagree') {
+                febs.modal.confirm('拒绝', '拒绝用户的代理申请?', function () {
+                    disagree(data.id);
+                });
+            }
+        });
+        function agree(id) {
+            febs.get(ctx + 'admin/mallMember/agreeAgentApply/' + id, null, function () {
+                febs.alert.success('已同意');
+                $query.click();
+            });
+        }
+        function disagree(id) {
+            febs.get(ctx + 'admin/mallMember/disagreeAgentApply/' + id, null, function () {
+                febs.alert.success('已拒绝');
+                $query.click();
+            });
+        }
+
+        // 查询按钮
+        $query.on('click', function () {
+            var params = $.extend(getQueryParams(), {field: sortObject.field, order: sortObject.type});
+            tableIns.reload({where: params, page: {curr: 1}});
+        });
+
+        // 刷新按钮
+        $reset.on('click', function () {
+            $searchForm[0].reset();
+            sortObject.type = 'null';
+            tableIns.reload({where: getQueryParams(), page: {curr: 1}, initSort: sortObject});
+        });
+
+        function initTable() {
+            tableIns = febs.table.init({
+                elem: $view.find('table'),
+                id: 'agentApplyTable',
+                url: ctx + 'admin/mallMember/getAgentApplyList',
+                defaultToolbar:[],
+                cols: [[
+                    {field: 'memberName', title: '微信昵称', minWidth: 150,align:'left'},
+                    {field: 'name', title: '姓名', minWidth: 100,align:'left'},
+                    {field: 'phone', title: '电话', minWidth: 100,align:'left'},
+                    {field: 'province', title: '省', minWidth: 100,align:'left'},
+                    {field: 'city', title: '市', minWidth: 100,align:'left'},
+                    {field: 'area', title: '区、县', minWidth: 100,align:'left'},
+                    {field: 'storeAddress', title: '详细地址', minWidth: 100,align:'left'},
+                    {field: 'storeName', title: '店铺名称', minWidth: 100,align:'left'},
+                    {field: 'state', title: '申请状态',
+                        templet: function (d) {
+                            if (d.state === 1) {
+                                return '<span style="color:green;">申请中</span>'
+                            }else if (d.state === 2) {
+                                return '<span style="color:blue;">通过</span>'
+                            }else if (d.state === 3) {
+                                return '<span style="color:red;">拒绝</span>'
+                            }else{
+                                return ''
+                            }
+                        }, minWidth: 100,align:'center'},
+                    {field: 'createdTime', title: '申请时间', minWidth: 180,align:'center'},
+                    {title: '操作',
+                        templet: function (d) {
+                            if(d.state === 1 ){
+                                return '<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="agree" shiro:hasPermission="user:update">同意</button>'
+                                +'<button class="layui-btn layui-btn-normal layui-btn-xs" lay-event="disagree" shiro:hasPermission="user:update">拒绝</button>'
+                            }else{
+                                return ''
+                            }
+                        },minWidth: 200,align:'center', fixed:"right"
+                    }
+                ]]
+            });
+        }
+
+        // 获取查询参数
+        function getQueryParams() {
+            return {
+                memberName: $searchForm.find('input[name="memberName"]').val().trim(),
+                name: $searchForm.find('input[name="name"]').val().trim(),
+                phone: $searchForm.find('input[name="phone"]').val().trim(),
+                state: $searchForm.find("select[name='state']").val()
+            };
+        }
+
+    })
+</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html
index a110623..3870aaf 100644
--- a/src/main/resources/templates/index.html
+++ b/src/main/resources/templates/index.html
@@ -3,7 +3,7 @@
       xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
 <head>
     <meta charset="utf-8">
-    <title>壹元蔬菜 权限系统</title>
+    <title>钱阿姨 权限系统</title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
     <meta name="renderer" content="webkit">
     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

--
Gitblit v1.9.1