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)); } } 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; } } src/main/java/cc/mrbird/febs/mall/conversion/MallShopApplyConversion.java
New file @@ -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); } src/main/java/cc/mrbird/febs/mall/dto/ApplyShopDto.java
New file @@ -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; } 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; } src/main/java/cc/mrbird/febs/mall/dto/ShopListDto.java
New file @@ -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; } 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; 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); } 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); } } src/main/java/cc/mrbird/febs/mall/vo/ShopListVo.java
New file @@ -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; } 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>