本次开发在 alien-store-platform 服务中新增了商户店铺入住申请接口,将原 alien-store 服务中的 /store/info/saveStoreInfo 接口迁移到 web 端商户平台,实现相同的业务逻辑。
接口路径: POST /storeManage/applyStore
原接口路径: POST /alienStore/store/info/saveStoreInfo
接口说明: 商户提交店铺入住申请,创建店铺信息并进入审批流程
Content-Type: application/json
| 参数名 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
| storeName | String | 是 | 店铺名称 | "张三烧烤店" |
| storeContact | String | 是 | 联系人 | "张三" |
| storePhone | String | 是 | 联系电话 | "13800138000" |
| storeAddress | String | 是 | 店铺地址 | "北京市朝阳区xxx街道" |
| storePositionLongitude | String | 是 | 经度 | "116.4074" |
| storePositionLatitude | String | 是 | 纬度 | "39.9042" |
| businessSection | Integer | 是 | 经营板块ID | 1 |
| businessTypes | List<String> | 是 | 经营种类ID列表 | ["101", "102"] |
| administrativeRegionProvinceAdcode | String | 是 | 省份行政区划代码 | "110000" |
| administrativeRegionCityAdcode | String | 是 | 城市行政区划代码 | "110100" |
| administrativeRegionDistrictAdcode | String | 是 | 区县行政区划代码 | "110105" |
| businessLicenseAddress | List<String> | 是 | 营业执照图片URL列表 | ["https://xxx/license.jpg"] |
| contractImageList | List<String> | 否 | 合同图片URL列表 | ["https://xxx/contract.jpg"] |
| foodLicenceUrl | String | 否 | 经营许可证图片URL | "https://xxx/licence.jpg" |
| storePass | String | 否 | 店铺密码(默认123456) | "123456" |
| storeStatus | Integer | 是 | 店铺状态 | 1 |
| userAccount | String | 是 | 商户用户ID | "1001" |
| idCard | String | 否 | 身份证号 | "110101199001011234" |
| commissionRate | String | 否 | 抽成比例(默认3%) | "3" |
POST /storeManage/applyStore
Content-Type: application/json
{
"storeName": "张三烧烤店",
"storeContact": "张三",
"storePhone": "13800138000",
"storeAddress": "北京市朝阳区xxx街道100号",
"storePositionLongitude": "116.4074",
"storePositionLatitude": "39.9042",
"businessSection": 1,
"businessTypes": ["101", "102"],
"administrativeRegionProvinceAdcode": "110000",
"administrativeRegionCityAdcode": "110100",
"administrativeRegionDistrictAdcode": "110105",
"businessLicenseAddress": ["https://example.com/license.jpg"],
"contractImageList": ["https://example.com/contract1.jpg"],
"foodLicenceUrl": "https://example.com/food-licence.jpg",
"storePass": "888888",
"storeStatus": 1,
"userAccount": "1001",
"idCard": "110101199001011234",
"commissionRate": "3"
}
成功响应:
{
"code": 200,
"success": true,
"msg": "店铺入住申请已提交",
"data": {
"id": 12345
}
}
失败响应:
{
"code": 500,
"success": false,
"msg": "经营板块不存在:99",
"data": null
}
1. 接收店铺入住申请数据
↓
2. 查询经营板块信息
↓
3. 查询经营种类信息
↓
4. 构建店铺信息对象
├─ 设置店铺基本信息
├─ 设置经纬度
├─ 设置店铺密码(默认123456)
├─ 设置经营板块和类型
├─ 设置审批状态为"待审批"
└─ 设置行政区域信息
↓
5. 插入店铺信息到数据库
↓
6. 添加地理位置到Redis(用于附近商家搜索)
↓
7. 更新商户用户绑定关系
↓
8. 保存店铺相关图片
├─ 营业执照图片(imgType=14)
├─ 合同图片(imgType=15)
└─ 经营许可证图片(imgType=25)
↓
9. 初始化店铺标签
↓
10. 发送入住申请通知给商户
↓
11. 返回店铺ID
123456passType=0:初始密码,passType=1:已修改密码storeApplicationStatus=0(待审批)0:待审批1:审批通过2:审批失败3%essential_city_code 表获取区域名称geo:store:primaryimgType=14:营业执照imgType=15:合同图片imgType=25:经营许可证storeId(绑定店铺)Key: geo:store:primary
操作:
GEOADD geo:store:primary 经度 纬度 店铺ID
示例:
GEOADD geo:store:primary 116.4074 39.9042 "12345"
用途:
接收人: store_{商户手机号}
消息内容:
您在2025-01-15 14:30:00提交的入驻店铺申请,平台已受理,1-3个工作日将审核结果发送至应用内的消息-通知中,请注意查收。
通知类型: noticeType=1(系统通知)
发送人: system
alien-store-platform/
├── controller/
│ └── StoreManageController.java # 店铺管理控制器
├── service/
│ ├── StoreManageService.java # 店铺管理服务接口
│ └── impl/
│ └── StoreManageServiceImpl.java # 店铺管理服务实现
└── util/
└── NearMeUtil.java # 附近商家地理位置工具类
StoreManageServiceImpl 依赖:
StoreInfoMapper:店铺信息MapperStoreDictionaryMapper:字典MapperEssentialCityCodeMapper:城市编码MapperStoreUserMapper:商户用户MapperStoreImgMapper:店铺图片MapperTagStoreRelationMapper:标签关系MapperLifeNoticeMapper:通知消息MapperNearMeUtil:地理位置工具类NearMeUtil 依赖:
StringRedisTemplate:Redis操作模板| 类型值 | 类型名称 | 说明 | 是否必填 |
|---|---|---|---|
| 14 | 营业执照 | 店铺营业执照图片 | ✅ 必填 |
| 15 | 合同图片 | 店铺与平台的合同图片 | ❌ 可选 |
| 25 | 经营许可证 | 食品经营许可证等 | ❌ 可选 |
curl -X POST "http://localhost:8080/storeManage/applyStore" \
-H "Content-Type: application/json" \
-d '{
"storeName": "测试烧烤店",
"storeContact": "测试联系人",
"storePhone": "13800138000",
"storeAddress": "北京市朝阳区测试街道100号",
"storePositionLongitude": "116.4074",
"storePositionLatitude": "39.9042",
"businessSection": 1,
"businessTypes": ["101", "102"],
"administrativeRegionProvinceAdcode": "110000",
"administrativeRegionCityAdcode": "110100",
"administrativeRegionDistrictAdcode": "110105",
"businessLicenseAddress": ["https://example.com/license.jpg"],
"storeStatus": 1,
"userAccount": "1001"
}'
curl -X POST "http://localhost:8080/storeManage/applyStore" \
-H "Content-Type: application/json" \
-d '{
"storeName": "测试餐厅",
"storeContact": "张经理",
"storePhone": "13900139000",
"storeAddress": "上海市浦东新区测试路200号",
"storePositionLongitude": "121.4737",
"storePositionLatitude": "31.2304",
"businessSection": 1,
"businessTypes": ["101"],
"administrativeRegionProvinceAdcode": "310000",
"administrativeRegionCityAdcode": "310100",
"administrativeRegionDistrictAdcode": "310115",
"businessLicenseAddress": ["https://example.com/license.jpg"],
"contractImageList": ["https://example.com/contract.jpg"],
"foodLicenceUrl": "https://example.com/food.jpg",
"storePass": "888888",
"storeStatus": 1,
"userAccount": "1002",
"idCard": "310101199001011234",
"commissionRate": "5"
}'
| 异常情况 | 错误信息 | 处理建议 |
|---|---|---|
| 经营板块不存在 | "经营板块不存在:{id}" | 检查businessSection参数 |
| 商户用户不存在 | "未找到商户用户" | 检查userAccount参数 |
| 行政区划代码错误 | 查询结果为空 | 检查adCode参数 |
| Redis连接失败 | 地理位置添加失败(仅警告) | 不影响主流程 |
| 数据库操作失败 | 事务回滚 | 检查数据完整性 |
@Transactional 注解store_infostore_imgstore_userstore_dictionaryessential_city_codetag_store_relationlife_notice| 对比项 | 原接口 | 新接口 |
|---|---|---|
| 服务 | alien-store | alien-store-platform |
| 路径 | /store/info/saveStoreInfo |
/storeManage/applyStore |
| 方法 | POST | POST |
| 参数 | StoreInfoDto | StoreInfoDto |
| 返回 | StoreInfoVo | StoreInfoVo |
| 业务逻辑 | ✅ 完全一致 | ✅ 完全一致 |
开发完成时间: 2025-01-xx
开发人员: AI Assistant
版本号: v1.0.0