update:
1. add store name for application
This commit is contained in:
@@ -11,12 +11,19 @@ alter table user_market_info
|
|||||||
add merchant_type int4 default 0 not null;
|
add merchant_type int4 default 0 not null;
|
||||||
comment on column user_market_info.merchant_type is '自营商家类型 0:未审核 1:个人商家 2:企业商家';
|
comment on column user_market_info.merchant_type is '自营商家类型 0:未审核 1:个人商家 2:企业商家';
|
||||||
|
|
||||||
|
alter table user_market_info
|
||||||
|
add store_name varchar(255) default '' not null;
|
||||||
|
comment on column user_market_info.store_name is '店铺名称';
|
||||||
|
CREATE INDEX idx_market_info_store_name ON user_market_info (store_name) where is_deleted = 0;
|
||||||
|
|
||||||
|
drop table if exists merchant_application;
|
||||||
create table merchant_application
|
create table merchant_application
|
||||||
(
|
(
|
||||||
id int8 not null primary key,
|
id int8 not null primary key,
|
||||||
user_id int8 not null,
|
user_id int8 not null,
|
||||||
user_account varchar(20) not null,
|
user_account varchar(20) not null,
|
||||||
type int4 not null,
|
type int4 not null,
|
||||||
|
store_name varchar(255) default '' not null,
|
||||||
company_name varchar(100),
|
company_name varchar(100),
|
||||||
business_license varchar(100),
|
business_license varchar(100),
|
||||||
business_license_url TEXT,
|
business_license_url TEXT,
|
||||||
@@ -39,6 +46,7 @@ comment on column merchant_application.id is '主键';
|
|||||||
comment on column merchant_application.user_id is '用户id';
|
comment on column merchant_application.user_id is '用户id';
|
||||||
comment on column merchant_application.user_account is '用户账号';
|
comment on column merchant_application.user_account is '用户账号';
|
||||||
comment on column merchant_application.type is '商家类型: 0-未审核, 1-个人商家, 2-企业商家';
|
comment on column merchant_application.type is '商家类型: 0-未审核, 1-个人商家, 2-企业商家';
|
||||||
|
comment on column merchant_application.store_name is '店铺名称';
|
||||||
comment on column merchant_application.company_name is '公司名称(企业商家时必填)';
|
comment on column merchant_application.company_name is '公司名称(企业商家时必填)';
|
||||||
comment on column merchant_application.business_license is '营业执照注册号';
|
comment on column merchant_application.business_license is '营业执照注册号';
|
||||||
comment on column merchant_application.business_license_url is '营业执照图片URL';
|
comment on column merchant_application.business_license_url is '营业执照图片URL';
|
||||||
@@ -52,14 +60,24 @@ comment on column merchant_application.update_time is '修改时间';
|
|||||||
comment on column merchant_application.status is '状态: 1-待审核 2-已通过 3-已拒绝';
|
comment on column merchant_application.status is '状态: 1-待审核 2-已通过 3-已拒绝';
|
||||||
comment on column merchant_application.is_deleted is '是否已删除';
|
comment on column merchant_application.is_deleted is '是否已删除';
|
||||||
|
|
||||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||||
VALUES ('2046772140345806850', '1123598815738675201', 'application', '商家入驻', 'menu', '/market/marketMerchantApplication', NULL, 1, 1, 0, 1, NULL, 0);
|
is_deleted)
|
||||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
VALUES ('2046772140345806850', '1123598815738675201', 'application', '商家入驻', 'menu',
|
||||||
VALUES ('2046772140345806851', '2046772140345806850', 'application_add', '新增', 'add', '/market/marketMerchantApplication/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
'/market/marketMerchantApplication', NULL, 1, 1, 0, 1, NULL, 0);
|
||||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||||
VALUES ('2046772140345806852', '2046772140345806850', 'application_edit', '修改', 'edit', '/market/marketMerchantApplication/edit', 'form', 2, 2, 2, 1, NULL, 0);
|
is_deleted)
|
||||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
VALUES ('2046772140345806851', '2046772140345806850', 'application_add', '新增', 'add',
|
||||||
VALUES ('2046772140345806853', '2046772140345806850', 'application_delete', '删除', 'delete', '/api/blade-application/marketMerchantApplication/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
'/market/marketMerchantApplication/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||||
VALUES ('2046772140345806854', '2046772140345806850', 'application_view', '查看', 'view', '/market/marketMerchantApplication/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
is_deleted)
|
||||||
|
VALUES ('2046772140345806852', '2046772140345806850', 'application_edit', '修改', 'edit',
|
||||||
|
'/market/marketMerchantApplication/edit', 'form', 2, 2, 2, 1, NULL, 0);
|
||||||
|
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||||
|
is_deleted)
|
||||||
|
VALUES ('2046772140345806853', '2046772140345806850', 'application_delete', '删除', 'delete',
|
||||||
|
'/api/blade-application/marketMerchantApplication/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||||
|
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||||
|
is_deleted)
|
||||||
|
VALUES ('2046772140345806854', '2046772140345806850', 'application_view', '查看', 'view',
|
||||||
|
'/market/marketMerchantApplication/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class MarketMerchantController {
|
|||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 1)
|
||||||
@Operation(summary = "自营商家认证提交")
|
@Operation(summary = "自营商家认证提交")
|
||||||
public R verifyMerchant(@RequestBody @Valid VerifyMerchantRequest request) {
|
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")
|
@GetMapping("/merchant-audit-status")
|
||||||
@@ -85,4 +85,12 @@ public class MarketMerchantController {
|
|||||||
return R.status(inventoryService.increase(AuthUtil.getUserId(), request.getProductId(), request.getNum()));
|
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;
|
package org.springblade.modules.api.request;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -7,8 +8,10 @@ import java.io.Serializable;
|
|||||||
@Data
|
@Data
|
||||||
public class IncreaseInventoryRequest implements Serializable {
|
public class IncreaseInventoryRequest implements Serializable {
|
||||||
|
|
||||||
|
@NotNull(message = "无效参数")
|
||||||
private Long productId;
|
private Long productId;
|
||||||
|
|
||||||
|
@NotNull(message = "无效参数")
|
||||||
private Integer num;
|
private Integer num;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,16 +13,16 @@ public class SubmitMerchantProductRequest implements Serializable {
|
|||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@NotEmpty
|
@NotEmpty(message = "无效参数")
|
||||||
private String productName;
|
private String productName;
|
||||||
|
|
||||||
@NotNull
|
@NotNull(message = "无效参数")
|
||||||
private List<String> mainImageUrls;
|
private List<String> mainImageUrls;
|
||||||
|
|
||||||
@NotNull
|
@NotNull(message = "无效参数")
|
||||||
private List<String> detailImageUrls;
|
private List<String> detailImageUrls;
|
||||||
|
|
||||||
@NotEmpty
|
@NotEmpty(message = "无效参数")
|
||||||
private String thumbImageUrl;
|
private String thumbImageUrl;
|
||||||
|
|
||||||
private List<MerchantProductEntity.Spec> specs;
|
private List<MerchantProductEntity.Spec> specs;
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ public class VerifyMerchantRequest implements Serializable {
|
|||||||
@NotNull(message = "无效参数")
|
@NotNull(message = "无效参数")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
|
@NotEmpty(message = "无效参数")
|
||||||
|
private String storeName;
|
||||||
|
|
||||||
private String companyName;
|
private String companyName;
|
||||||
|
|
||||||
private String businessLicense;
|
private String businessLicense;
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ public class MarketMerchantApplicationController extends BladeController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/reject")
|
@PostMapping("/reject")
|
||||||
@ApiOperationSupport(order = 8)
|
@ApiOperationSupport(order = 8)
|
||||||
@Operation(summary = "审核拒绝", description = "传入id")
|
@Operation(summary = "审核拒绝", description = "传入id,reason")
|
||||||
public R approve(@RequestParam String id, @RequestParam String reason) {
|
public R approve(@RequestParam String id, @RequestParam String reason) {
|
||||||
return R.status(applicationService.reject(Func.toLong(id), reason));
|
return R.status(applicationService.reject(Func.toLong(id), reason));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
<result column="user_id" property="userId"/>
|
<result column="user_id" property="userId"/>
|
||||||
<result column="user_account" property="userAccount"/>
|
<result column="user_account" property="userAccount"/>
|
||||||
<result column="type" property="type"/>
|
<result column="type" property="type"/>
|
||||||
|
<result column="store_name" property="storeName"/>
|
||||||
<result column="company_name" property="companyName"/>
|
<result column="company_name" property="companyName"/>
|
||||||
<result column="business_license" property="businessLicense"/>
|
<result column="business_license" property="businessLicense"/>
|
||||||
<result column="business_license_url" property="businessLicenseUrl"/>
|
<result column="business_license_url" property="businessLicenseUrl"/>
|
||||||
@@ -25,6 +26,9 @@
|
|||||||
|
|
||||||
<select id="selectApplicationPage" resultMap="applicationResultMap">
|
<select id="selectApplicationPage" resultMap="applicationResultMap">
|
||||||
select * from merchant_application where is_deleted = 0
|
select * from merchant_application where is_deleted = 0
|
||||||
|
<if test="application.storeName !=null">
|
||||||
|
and store_name = #{application.storeName}
|
||||||
|
</if>
|
||||||
<if test="application.userAccount !=null">
|
<if test="application.userAccount !=null">
|
||||||
and user_account = #{application.userAccount}
|
and user_account = #{application.userAccount}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -116,6 +116,10 @@ public class MarketInfoEntity extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "自营商家类型 0:未审核 1:个人商家 2:企业商家")
|
@Schema(description = "自营商家类型 0:未审核 1:个人商家 2:企业商家")
|
||||||
private Integer merchantType;
|
private Integer merchantType;
|
||||||
|
/**
|
||||||
|
* 店铺名称
|
||||||
|
*/
|
||||||
|
@Schema(description = "店铺名称")
|
||||||
|
private String storeName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,11 @@ public class MarketMerchantApplicationEntity extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "商家类型: 0-未审核, 1-个人商家, 2-企业商家")
|
@Schema(description = "商家类型: 0-未审核, 1-个人商家, 2-企业商家")
|
||||||
private Integer type;
|
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 com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.springblade.core.mp.base.BaseService;
|
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 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);
|
int checkMerchantType(Long userId);
|
||||||
|
|
||||||
@@ -63,4 +61,5 @@ public interface IMarketMerchantApplicationService extends BaseService<MarketMer
|
|||||||
|
|
||||||
Integer merchantType(Long userId);
|
Integer merchantType(Long userId);
|
||||||
|
|
||||||
|
Boolean checkAvailable(String storeName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ public class MarketMerchantApplicationServiceImpl extends BaseServiceImpl<Market
|
|||||||
throw new ServiceException("商户信息缺失");
|
throw new ServiceException("商户信息缺失");
|
||||||
}
|
}
|
||||||
marketInfo.setMerchantType(application.getType());
|
marketInfo.setMerchantType(application.getType());
|
||||||
|
marketInfo.setStoreName(application.getStoreName());
|
||||||
if (!marketInfoService.updateById(marketInfo)) {
|
if (!marketInfoService.updateById(marketInfo)) {
|
||||||
throw new ServiceException("商户类型更新失败");
|
throw new ServiceException("商户类型更新失败");
|
||||||
}
|
}
|
||||||
@@ -122,7 +123,7 @@ public class MarketMerchantApplicationServiceImpl extends BaseServiceImpl<Market
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)) {
|
if (Objects.isNull(userId) || Objects.isNull(type)) {
|
||||||
throw new ServiceException("无效参数");
|
throw new ServiceException("无效参数");
|
||||||
}
|
}
|
||||||
@@ -132,8 +133,12 @@ public class MarketMerchantApplicationServiceImpl extends BaseServiceImpl<Market
|
|||||||
if (!MarketInfoCache.hasVerifyBankCard(userId)) {
|
if (!MarketInfoCache.hasVerifyBankCard(userId)) {
|
||||||
throw new ServiceException("请先绑定银行卡");
|
throw new ServiceException("请先绑定银行卡");
|
||||||
}
|
}
|
||||||
|
if (!checkAvailable(storeName)) {
|
||||||
|
throw new ServiceException("店名不用");
|
||||||
|
}
|
||||||
MarketMerchantApplicationEntity application = new MarketMerchantApplicationEntity();
|
MarketMerchantApplicationEntity application = new MarketMerchantApplicationEntity();
|
||||||
MarketMerchantApplicationEntity userApplication = getByUserId(userId);
|
MarketMerchantApplicationEntity userApplication = getByUserId(userId);
|
||||||
|
application.setStoreName(storeName);
|
||||||
if (userApplication != null) {
|
if (userApplication != null) {
|
||||||
if (userApplication.getStatus() != MerchantAuditStatus.REJECTED.getCode()) {
|
if (userApplication.getStatus() != MerchantAuditStatus.REJECTED.getCode()) {
|
||||||
throw new ServiceException("请勿重复提交申请");
|
throw new ServiceException("请勿重复提交申请");
|
||||||
@@ -204,4 +209,11 @@ public class MarketMerchantApplicationServiceImpl extends BaseServiceImpl<Market
|
|||||||
return MarketInfoCache.checkMerchantType(userId);
|
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