From ec695334b5607c76c0cf0fbb547f0a10d7c352f0 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Wed, 01 Jun 2022 16:47:22 +0800
Subject: [PATCH] fix

---
 src/main/java/cc/mrbird/febs/mall/controller/ApiApplyController.java         |   14 +++
 src/main/resources/mapper/modules/MallShopApplyMapper.xml                    |    6 
 src/main/java/cc/mrbird/febs/mall/entity/MallShopApply.java                  |    8 ++
 src/main/java/cc/mrbird/febs/mall/controller/ApiMallMemberController.java    |    7 +
 src/main/java/cc/mrbird/febs/mall/dto/ShopApplyDto.java                      |   16 ++++
 src/main/java/cc/mrbird/febs/mall/dto/ShopListDto.java                       |   20 +++++
 src/main/java/cc/mrbird/febs/mall/conversion/MallShopApplyConversion.java    |   22 +++++
 src/main/java/cc/mrbird/febs/mall/service/IApiMallMemberService.java         |    4 +
 src/main/java/cc/mrbird/febs/mall/dto/ApplyShopDto.java                      |   39 +++++++++
 src/main/java/cc/mrbird/febs/mall/vo/ShopListVo.java                         |   31 +++++++
 src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java |   24 ++++-
 11 files changed, 183 insertions(+), 8 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/controller/ApiApplyController.java b/src/main/java/cc/mrbird/febs/mall/controller/ApiApplyController.java
index 4cb1c4f..1b87b5c 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/ApiApplyController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/ApiApplyController.java
@@ -2,9 +2,13 @@
 
 import cc.mrbird.febs.common.entity.FebsResponse;
 import cc.mrbird.febs.mall.dto.ShopApplyDto;
+import cc.mrbird.febs.mall.dto.ShopListDto;
 import cc.mrbird.febs.mall.service.IApiMallMemberService;
+import cc.mrbird.febs.mall.vo.ShopListVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
@@ -34,4 +38,14 @@
     public FebsResponse findApply() {
         return new FebsResponse().success().data(memberService.findNewestApply());
     }
+
+
+    @ApiOperation(value = "获取商铺列表")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "success", response = ShopListVo.class)
+    })
+    @PostMapping(value = "/findShopList")
+    public FebsResponse findShopList(@RequestBody ShopListDto shopListDto) {
+        return new FebsResponse().success().data(memberService.findShopListVo(shopListDto));
+    }
 }
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 ede4051..ef31935 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/ApiMallMemberController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/ApiMallMemberController.java
@@ -170,4 +170,11 @@
     public FebsResponse myCommission() {
         return new FebsResponse().success().data(memberService.myCommission());
     }
+
+    @ApiOperation(value = "商铺申请是否存在")
+    @PostMapping(value = "/shopApplyIsExist")
+    public FebsResponse shopApplyIsExist() {
+        return null;
+    }
+
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/conversion/MallShopApplyConversion.java b/src/main/java/cc/mrbird/febs/mall/conversion/MallShopApplyConversion.java
new file mode 100644
index 0000000..a966940
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/conversion/MallShopApplyConversion.java
@@ -0,0 +1,22 @@
+package cc.mrbird.febs.mall.conversion;
+
+import cc.mrbird.febs.mall.dto.ShopApplyDto;
+import cc.mrbird.febs.mall.entity.MallShopApply;
+import cc.mrbird.febs.mall.vo.ShopListVo;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+import java.util.List;
+
+/**
+ * @author wzy
+ * @date 2022-06-01
+ **/
+@Mapper
+public abstract class MallShopApplyConversion {
+    public static MallShopApplyConversion INSTANCE = Mappers.getMapper(MallShopApplyConversion.class);
+
+    public abstract ShopApplyDto entityToDto(MallShopApply shopApply);
+
+    public abstract List<ShopListVo> entitiesToVOs(List<MallShopApply> list);
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/ApplyShopDto.java b/src/main/java/cc/mrbird/febs/mall/dto/ApplyShopDto.java
new file mode 100644
index 0000000..7db94fe
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/dto/ApplyShopDto.java
@@ -0,0 +1,39 @@
+package cc.mrbird.febs.mall.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author wzy
+ * @date 2022-06-01
+ **/
+@Data
+@ApiModel(value = "ApplyShopDto", description = "申请商铺入驻")
+public class ApplyShopDto {
+
+    @ApiModelProperty(value = "商店名称")
+    private String shopName;
+
+    @ApiModelProperty(value = "经度")
+    private String longitude;
+
+    @ApiModelProperty(value = "纬度")
+    private String latitude;
+
+    @ApiModelProperty(value = "法人姓名")
+    private String name;
+
+    @ApiModelProperty(value = "电话")
+    private String phone;
+
+    @ApiModelProperty(value = "身份证")
+    private String idCard;
+
+    @ApiModelProperty(value = "营业执照")
+    private String shopLicense;
+
+    @ApiModelProperty(value = "经营场地")
+    private String shopBase;
+
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/ShopApplyDto.java b/src/main/java/cc/mrbird/febs/mall/dto/ShopApplyDto.java
index 2abb7d1..8fc1932 100644
--- a/src/main/java/cc/mrbird/febs/mall/dto/ShopApplyDto.java
+++ b/src/main/java/cc/mrbird/febs/mall/dto/ShopApplyDto.java
@@ -15,6 +15,18 @@
 public class ShopApplyDto {
 
     @NotBlank(message = "参数错误")
+    @ApiModelProperty(value = "商店名称")
+    private String shopName;
+
+    @NotBlank(message = "参数错误")
+    @ApiModelProperty(value = "经度")
+    private String longitude;
+
+    @NotBlank(message = "参数错误")
+    @ApiModelProperty(value = "纬度")
+    private String latitude;
+
+    @NotBlank(message = "参数错误")
     @ApiModelProperty(value = "姓名", example = "123")
     private String name;
 
@@ -33,4 +45,8 @@
     @NotBlank(message = "参数错误")
     @ApiModelProperty(value = "经营场地")
     private String saleArea;
+
+    @NotBlank(message = "参数错误")
+    @ApiModelProperty(value = "地址")
+    private String address;
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/dto/ShopListDto.java b/src/main/java/cc/mrbird/febs/mall/dto/ShopListDto.java
new file mode 100644
index 0000000..65bc49b
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/dto/ShopListDto.java
@@ -0,0 +1,20 @@
+package cc.mrbird.febs.mall.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @author wzy
+ * @date 2022-06-01
+ **/
+@Data
+@ApiModel(value = "ShopListDto", description = "商铺列表接口请求参数类")
+public class ShopListDto {
+
+    @ApiModelProperty(value = "页码", example = "1")
+    private Integer pageNow;
+
+    @ApiModelProperty(value = "每页数量", example = "10")
+    private Integer pageSize;
+}
diff --git a/src/main/java/cc/mrbird/febs/mall/entity/MallShopApply.java b/src/main/java/cc/mrbird/febs/mall/entity/MallShopApply.java
index 1d70dd3..bbf8d7d 100644
--- a/src/main/java/cc/mrbird/febs/mall/entity/MallShopApply.java
+++ b/src/main/java/cc/mrbird/febs/mall/entity/MallShopApply.java
@@ -49,6 +49,14 @@
      */
     private Integer status;
 
+    private String longitude;
+
+    private String latitude;
+
+    private String shopName;
+
+    private String address;
+
     @TableField(exist = false)
     private String vipName;
 
diff --git a/src/main/java/cc/mrbird/febs/mall/service/IApiMallMemberService.java b/src/main/java/cc/mrbird/febs/mall/service/IApiMallMemberService.java
index fe1c8c1..027b9e1 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/IApiMallMemberService.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/IApiMallMemberService.java
@@ -4,10 +4,12 @@
 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.entity.MallMemberShopApplyEntity;
 import cc.mrbird.febs.mall.entity.MallShopApply;
 import cc.mrbird.febs.mall.vo.CashOutSettingVo;
 import cc.mrbird.febs.mall.vo.MyCommissionVo;
 import cc.mrbird.febs.mall.vo.MyTeamVo;
+import cc.mrbird.febs.mall.vo.ShopListVo;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 import java.math.BigDecimal;
@@ -61,4 +63,6 @@
     void addRegisterAppeal(RegisterAppealDto registerAppeal);
 
     CashOutSettingVo cashOutSetting();
+
+    List<ShopListVo> findShopListVo(ShopListDto shopListDto);
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java
index 7d9bedb..4f4f7c0 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallMemberServiceImpl.java
@@ -8,6 +8,7 @@
 import cc.mrbird.febs.common.exception.FebsException;
 import cc.mrbird.febs.common.utils.*;
 import cc.mrbird.febs.mall.conversion.MallMemberConversion;
+import cc.mrbird.febs.mall.conversion.MallShopApplyConversion;
 import cc.mrbird.febs.mall.dto.*;
 import cc.mrbird.febs.mall.entity.*;
 import cc.mrbird.febs.mall.mapper.*;
@@ -35,10 +36,7 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @author wzy
@@ -60,6 +58,7 @@
     private final DataDictionaryCustomMapper dataDictionaryCustomMapper;
     private final MallShopApplyMapper mallShopApplyMapper;
     private final MallRegisterAppealMapper mallRegisterAppealMapper;
+    private final MallMemberShopApplyMapper mallMemberShopApplyMapper;
 
 
     @Value("${spring.profiles.active}")
@@ -495,7 +494,7 @@
         MallShopApply hasApply = mallShopApplyMapper.selectNewestApplyByMemberId(member.getId());
         if (hasApply != null) {
             if (!hasApply.getStatus().equals(MallShopApply.APPLY_DISAGREE)) {
-                throw new FebsException("审核中或审核已通过");
+                throw new FebsException("请勿重复提交申请");
             }
         }
 
@@ -538,4 +537,19 @@
         }
         return cashOutSettingVo;
     }
+
+    @Override
+    public List<ShopListVo> findShopListVo(ShopListDto shopListDto) {
+        Page<MallShopApply> page = new Page<>(shopListDto.getPageNow(), shopListDto.getPageSize());
+
+        MallShopApply shopApply = new MallShopApply();
+        shopApply.setStatus(MallShopApply.APPLY_AGREE);
+        IPage<MallShopApply> pageResult = mallShopApplyMapper.selectShopApplyInPage(shopApply, page);
+
+        List<MallShopApply> list = pageResult.getRecords();
+        if (CollUtil.isEmpty(list)) {
+            list = new ArrayList<>();
+        }
+        return MallShopApplyConversion.INSTANCE.entitiesToVOs(list);
+    }
 }
diff --git a/src/main/java/cc/mrbird/febs/mall/vo/ShopListVo.java b/src/main/java/cc/mrbird/febs/mall/vo/ShopListVo.java
new file mode 100644
index 0000000..d00ee38
--- /dev/null
+++ b/src/main/java/cc/mrbird/febs/mall/vo/ShopListVo.java
@@ -0,0 +1,31 @@
+package cc.mrbird.febs.mall.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @author wzy
+ * @date 2022-06-01
+ **/
+@Data
+@ApiModel(value = "ShopListVo", description = "商铺列表返回参数类")
+public class ShopListVo {
+
+    @ApiModelProperty(value = "经营场地")
+    private String saleArea;
+
+    @ApiModelProperty(value = "商铺名称")
+    private String shopName;
+
+    @ApiModelProperty(value = "地址")
+    private String address;
+
+    @ApiModelProperty(value = "经度")
+    private String longitude;
+
+    @ApiModelProperty(value = "纬度")
+    private String latitude;
+}
diff --git a/src/main/resources/mapper/modules/MallShopApplyMapper.xml b/src/main/resources/mapper/modules/MallShopApplyMapper.xml
index f01c0a3..260e47d 100644
--- a/src/main/resources/mapper/modules/MallShopApplyMapper.xml
+++ b/src/main/resources/mapper/modules/MallShopApplyMapper.xml
@@ -3,7 +3,6 @@
 <mapper namespace="cc.mrbird.febs.mall.mapper.MallShopApplyMapper">
 
     <select id="selectShopApplyInPage" resultType="cc.mrbird.febs.mall.entity.MallShopApply">
-
         select a.*,b.name vipName, b.invite_id inviteId
         from mall_shop_apply a
         inner join mall_member b on a.member_id=b.ID
@@ -18,8 +17,9 @@
     </select>
 
     <select id="selectNewestApplyByMemberId" resultType="cc.mrbird.febs.mall.entity.MallShopApply">
-        select *, max(created_time) from mall_shop_apply
+        select * from mall_shop_apply
         where member_id=#{memberId}
-        group by member_id
+        order by id desc
+        limit 1
     </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.1