update:
1. add store name for application
This commit is contained in:
@@ -40,7 +40,7 @@ public class MarketMerchantController {
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "自营商家认证提交")
|
||||
public R verifyMerchant(@RequestBody @Valid VerifyMerchantRequest request) {
|
||||
return R.status(applicationService.applyMerchant(AuthUtil.getUserId(), request.getType(), request.getCompanyName(), request.getBusinessLicense(), request.getBusinessLicenseUrl(), request.getLegalPerson()));
|
||||
return R.status(applicationService.applyMerchant(AuthUtil.getUserId(), request.getType(),request.getStoreName(), request.getCompanyName(), request.getBusinessLicense(), request.getBusinessLicenseUrl(), request.getLegalPerson()));
|
||||
}
|
||||
|
||||
@GetMapping("/merchant-audit-status")
|
||||
@@ -85,4 +85,12 @@ public class MarketMerchantController {
|
||||
return R.status(inventoryService.increase(AuthUtil.getUserId(), request.getProductId(), request.getNum()));
|
||||
}
|
||||
|
||||
@GetMapping("/is-available")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "查询名称是否可用")
|
||||
public R<Boolean> checkAvailable(String storeName) {
|
||||
return R.data(applicationService.checkAvailable(storeName));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -7,8 +8,10 @@ import java.io.Serializable;
|
||||
@Data
|
||||
public class IncreaseInventoryRequest implements Serializable {
|
||||
|
||||
@NotNull(message = "无效参数")
|
||||
private Long productId;
|
||||
|
||||
@NotNull(message = "无效参数")
|
||||
private Integer num;
|
||||
|
||||
}
|
||||
|
||||
@@ -13,16 +13,16 @@ public class SubmitMerchantProductRequest implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
@NotEmpty
|
||||
@NotEmpty(message = "无效参数")
|
||||
private String productName;
|
||||
|
||||
@NotNull
|
||||
@NotNull(message = "无效参数")
|
||||
private List<String> mainImageUrls;
|
||||
|
||||
@NotNull
|
||||
@NotNull(message = "无效参数")
|
||||
private List<String> detailImageUrls;
|
||||
|
||||
@NotEmpty
|
||||
@NotEmpty(message = "无效参数")
|
||||
private String thumbImageUrl;
|
||||
|
||||
private List<MerchantProductEntity.Spec> specs;
|
||||
|
||||
@@ -12,6 +12,9 @@ public class VerifyMerchantRequest implements Serializable {
|
||||
@NotNull(message = "无效参数")
|
||||
private Integer type;
|
||||
|
||||
@NotEmpty(message = "无效参数")
|
||||
private String storeName;
|
||||
|
||||
private String companyName;
|
||||
|
||||
private String businessLicense;
|
||||
|
||||
@@ -146,7 +146,7 @@ public class MarketMerchantApplicationController extends BladeController {
|
||||
*/
|
||||
@PostMapping("/reject")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "审核拒绝", description = "传入id")
|
||||
@Operation(summary = "审核拒绝", description = "传入id,reason")
|
||||
public R approve(@RequestParam String id, @RequestParam String reason) {
|
||||
return R.status(applicationService.reject(Func.toLong(id), reason));
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="user_account" property="userAccount"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="store_name" property="storeName"/>
|
||||
<result column="company_name" property="companyName"/>
|
||||
<result column="business_license" property="businessLicense"/>
|
||||
<result column="business_license_url" property="businessLicenseUrl"/>
|
||||
@@ -25,6 +26,9 @@
|
||||
|
||||
<select id="selectApplicationPage" resultMap="applicationResultMap">
|
||||
select * from merchant_application where is_deleted = 0
|
||||
<if test="application.storeName !=null">
|
||||
and store_name = #{application.storeName}
|
||||
</if>
|
||||
<if test="application.userAccount !=null">
|
||||
and user_account = #{application.userAccount}
|
||||
</if>
|
||||
|
||||
@@ -116,6 +116,10 @@ public class MarketInfoEntity extends BaseEntity {
|
||||
*/
|
||||
@Schema(description = "自营商家类型 0:未审核 1:个人商家 2:企业商家")
|
||||
private Integer merchantType;
|
||||
|
||||
/**
|
||||
* 店铺名称
|
||||
*/
|
||||
@Schema(description = "店铺名称")
|
||||
private String storeName;
|
||||
|
||||
}
|
||||
|
||||
@@ -63,6 +63,11 @@ public class MarketMerchantApplicationEntity extends BaseEntity {
|
||||
*/
|
||||
@Schema(description = "商家类型: 0-未审核, 1-个人商家, 2-企业商家")
|
||||
private Integer type;
|
||||
/**
|
||||
* 店铺名称
|
||||
*/
|
||||
@Schema(description = "店铺名称")
|
||||
private String storeName;
|
||||
/**
|
||||
* 公司名称(企业商家时必填)
|
||||
*/
|
||||
|
||||
@@ -31,8 +31,6 @@ import org.springblade.modules.market.pojo.vo.MarketMerchantApplicationVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商家入驻申请表 服务类
|
||||
*
|
||||
@@ -55,7 +53,7 @@ public interface IMarketMerchantApplicationService extends BaseService<MarketMer
|
||||
|
||||
boolean reject(Long id, String reason);
|
||||
|
||||
boolean applyMerchant(Long userId, Integer type, String companyName, String businessLicense, String businessLicenseUrl, String legalPerson);
|
||||
boolean applyMerchant(Long userId, Integer type, String storeName, String companyName, String businessLicense, String businessLicenseUrl, String legalPerson);
|
||||
|
||||
int checkMerchantType(Long userId);
|
||||
|
||||
@@ -63,4 +61,5 @@ public interface IMarketMerchantApplicationService extends BaseService<MarketMer
|
||||
|
||||
Integer merchantType(Long userId);
|
||||
|
||||
Boolean checkAvailable(String storeName);
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ public class MarketMerchantApplicationServiceImpl extends BaseServiceImpl<Market
|
||||
throw new ServiceException("商户信息缺失");
|
||||
}
|
||||
marketInfo.setMerchantType(application.getType());
|
||||
marketInfo.setStoreName(application.getStoreName());
|
||||
if (!marketInfoService.updateById(marketInfo)) {
|
||||
throw new ServiceException("商户类型更新失败");
|
||||
}
|
||||
@@ -122,7 +123,7 @@ public class MarketMerchantApplicationServiceImpl extends BaseServiceImpl<Market
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyMerchant(Long userId, Integer type, String companyName, String businessLicense, String businessLicenseUrl, String legalPerson) {
|
||||
public boolean applyMerchant(Long userId, Integer type, String storeName, String companyName, String businessLicense, String businessLicenseUrl, String legalPerson) {
|
||||
if (Objects.isNull(userId) || Objects.isNull(type)) {
|
||||
throw new ServiceException("无效参数");
|
||||
}
|
||||
@@ -132,8 +133,12 @@ public class MarketMerchantApplicationServiceImpl extends BaseServiceImpl<Market
|
||||
if (!MarketInfoCache.hasVerifyBankCard(userId)) {
|
||||
throw new ServiceException("请先绑定银行卡");
|
||||
}
|
||||
if (!checkAvailable(storeName)) {
|
||||
throw new ServiceException("店名不用");
|
||||
}
|
||||
MarketMerchantApplicationEntity application = new MarketMerchantApplicationEntity();
|
||||
MarketMerchantApplicationEntity userApplication = getByUserId(userId);
|
||||
application.setStoreName(storeName);
|
||||
if (userApplication != null) {
|
||||
if (userApplication.getStatus() != MerchantAuditStatus.REJECTED.getCode()) {
|
||||
throw new ServiceException("请勿重复提交申请");
|
||||
@@ -204,4 +209,11 @@ public class MarketMerchantApplicationServiceImpl extends BaseServiceImpl<Market
|
||||
return MarketInfoCache.checkMerchantType(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean checkAvailable(String storeName) {
|
||||
if (StringUtil.isBlank(storeName)) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
return exists(Wrappers.lambdaQuery(MarketMerchantApplicationEntity.class).eq(MarketMerchantApplicationEntity::getStoreName, storeName).eq(MarketMerchantApplicationEntity::getIsDeleted, 0));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user