POST
/goods/updateGoods管理后台商品-更新
商品与履约 / 商品(主表)
基本信息
- 接口状态前端在用
- 接口URLPOST
https://dscp-dev.hn12301.net/manage-api/goods/updateGoods - 请求方式
POST - Content-Type
application/json - 暴露渠道管理后台 前缀
/manage-api - 名称来源源码注释
- 调用方已确认在用 · 管理后台(1 个前端)
- 需求上下文
- 维护人 / 最后改动AsiQue 2023-11-24
- 读写数据表
goods、card_resource_rule、goods_info、sku、goods_channel_snapshot、goods_channel_extend_snapshot、goods_relation、checker_relation、system_user_relation反查该表全部接口 → - 控制器
com.jxxx.dscp.api.controller.goods.GoodsController#updateGoods - 源码位置
jxxx-dscp/dscp-service-business/src/main/java/com/jxxx/dscp/api/controller/goods/GoodsController.java:352 - 判定依据
请求参数
Header 请求参数
| 参数名 | 参数值 | 是否必填 | 参数类型 | 描述说明 |
|---|---|---|---|---|
| 无(渠道统一鉴权头见《认证方式》) | ||||
Query 请求参数
| 参数名 | 参数值 | 是否必填 | 参数类型 | 描述说明 |
|---|---|---|---|---|
| 无 | ||||
路径参数及说明
| 参数名 | 参数值 | 是否必填 | 参数类型 | 描述说明 |
|---|---|---|---|---|
| 无 | ||||
Body 请求参数
| 参数名 | 参数值 | 是否必填 | 参数类型 | 描述说明 |
|---|---|---|---|---|
| id | … | 是 | Long | 商品id,主键 → card_resource_rule.id |
| shopId | … | 否 | Long | 所属商铺id,关联shop表id → card_resource_rule.shop_id |
| name | … | 是 | String | 商品名称 → goods.name |
| mainPic | … | 否 | String | 商品主图 → goods.main_pic |
| typeId | … | 是 | String | 商品大类id → goods.type_id |
| subTypeId | … | 否 | String | 商品小类id → goods.sub_type_id |
| cardModelId | … | 否 | Long | 卡种id → card_resource_rule.card_model_id |
| grade | … | 否 | String | 商品等级 → goods.grade |
| shortName | … | 否 | String | 商品简称 → goods_info.short_name |
| weight | … | 否 | Integer | 商品权重 → goods_info.weight |
| tags | … | 否 | String | 商品标签 → goods_info.tags |
| recommendReason | … | 否 | String | → goods_info.recommend_reason |
| introduction | … | 否 | String | 简介 → goods_channel_snapshot.introduction |
| propagatePic | … | 否 | String | 宣传图片url地址 → goods_info.propagate_pic |
| video | … | 否 | String | 宣传视频url地址 → goods_info.video |
| notice | … | 否 | String | 购买须知 → card_resource_rule.notice |
| tips | … | 否 | String | 温馨提示 → goods_info.tips |
| businessTime | … | 否 | String | 营业时间 → goods_info.business_time |
| expireDate | … | 否 | Date | → goods_info.expire_date |
| isRefund | … | 否 | Boolean | → goods_info.is_refund |
| skuList | … | 是 | List<SkuUpdateRequest> | sku列表 |
| goodsId | … | 是 | Long | 商品ID,关联商品表id → card_resource_rule.goods_id |
| goodsChannelId | … | 否 | Long | 关联商品渠道id → goods_channel_extend_snapshot.goods_channel_id |
| shopId | … | 否 | Long | 所属商铺id,关联shop表id → card_resource_rule.shop_id |
| id | … | 否 | Long | 商品id,主键 → card_resource_rule.id |
| skuName | … | 是 | String | sku名称 → sku.sku_name |
| showPrice | … | 否 | Integer | 商品挂牌价 → sku.show_price |
| buyPrice | … | 否 | Integer | 商品实际售价 → sku.buy_price |
| costPrice | … | 否 | Integer | 商品成本价 → sku.cost_price |
| buyCount | … | 否 | Integer | 单次可购买数量 → sku.buy_count |
| stock | … | 否 | Integer | 库存数量 → goods_channel_snapshot.stock |
| isLogistic | … | 否 | Boolean | 是否需要物流 → sku.is_logistic |
| carriageId | … | 否 | Long | 物流模版ID,关联carriage表id → sku.carriage_id |
| mold | … | 是 | GoodsMold | 商品状态,1实物商品,2虚拟商品,3电子卡券 → sku.mold 1=实物商品 2=虚拟商品 3=电子卡券 |
| isDistributes | … | 否 | Boolean | 是否可分销 → sku.is_distributes |
| commission | … | 否 | Integer | 分销佣金 → sku.commission |
| isPreferential | … | 否 | Boolean | 是否可使用优惠券 → sku.is_preferential |
| isUseScore | … | 否 | Boolean | 是否可使用积分抵扣 → sku.is_use_score |
| isAddScore | … | 否 | Boolean | 购买后是否产生积分 → sku.is_add_score |
| useScoreRate | … | 否 | BigDecimal | 抵扣积分倍率 → sku.use_score_rate |
| addScoreRate | … | 否 | BigDecimal | 产生积分倍率 → sku.add_score_rate |
| skuEntranceList | … | 否 | List<SkuEntrance> | 景区入口 |
| id | … | 否 | Long | ID,主键 → card_resource_rule.id |
| skuId | … | 否 | Long | 所属关联sku表id → card_resource_rule.sku_id |
| entranceName | … | 否 | String | 景区入口名称 |
| merchantId | … | 否 | Long | 所属商户id → checker_relation.merchant_id |
| shopId | … | 否 | Long | 所属商铺id → card_resource_rule.shop_id |
| goodsId | … | 否 | Long | 商品ID,关联商品表id → card_resource_rule.goods_id |
| createdBy | … | 否 | String | 创建人id → card_resource_rule.created_by |
| createdTime | … | 否 | Date | 创建时间 → card_resource_rule.created_time |
| cardNum | … | 否 | Integer | 发卡数量,仅旅游卡商品 → sku.card_num |
| thirdId | … | 否 | String | 第三方id → checker_relation.third_id |
| thirdName | … | 否 | String | 第三方名称 → goods.third_name |
| relationList | … | 否 | List<GoodsRelationUpdateRequest> | |
| id | … | 否 | Long | id → card_resource_rule.id |
| thirdName | … | 否 | String | 第三方名称 → goods.third_name |
| thirdId | … | 否 | String | 第三方id → checker_relation.third_id |
| channelType | … | 否 | ChannelType | → checker_relation.channel_type |
认证方式
响应参数
| 参数名 | 参数值 | 是否必填 | 参数类型 | 描述说明 |
|---|---|---|---|---|
| void —— 不返回业务数据(外层包装见全局公共参数) | ||||
响应示例
成功响应示例
{"errcode":0,"errmsg":""}失败响应示例
{
"data": null,
"可能返回": [
{
"errcode": "99999",
"errmsg": "服务内部错误"
}
]
}附录 · 实现细节
调用链 / 数据表 / 调用点证据 / 源码注释 / 逻辑摘要
涉及数据表:goods、card_resource_rule、goods_info、sku、goods_channel_snapshot、goods_channel_extend_snapshot、goods_relation、checker_relation、system_user_relation 反查全部引用接口 →
- GoodsController#updateGoods
- GoodsService#mustGet(GoodsServiceImpl)
- GoodsMapper#mustGet
- SessionUserService#isMerchant
- SessionUserService#getSessionUser
- GoodsService#update(GoodsServiceImpl)
- GoodsMapper#update
- CardResourceRuleService#queryList(CardResourceRuleServiceImpl)
- CardResourceRuleMapper#queryList
- CardResourceRuleService#updateList(CardResourceRuleServiceImpl)
- CardResourceRuleMapper#updateList
- GoodsInfoService#update(GoodsInfoServiceImpl)
- GoodsInfoMapper#update
- SkuService#queryList(SkuServiceImpl)
- SkuMapper#queryList
- SkuService#delete(SkuServiceImpl)
- SkuMapper#delete
- ChannelSnapshotService#delete(ChannelSnapshotServiceImpl)
- ChannelSnapshotMapper#delete
- ChannelExtendSnapshotService#delete(ChannelExtendSnapshotServiceImpl)
- ChannelExtendSnapshotMapper#delete
- GoodsRelationService#queryList(GoodsRelationServiceImpl)
- GoodsRelationMapper#queryList
- GoodsRelationService#delete(GoodsRelationServiceImpl)
- GoodsRelationMapper#delete
- CheckerRelationService#queryList(CheckerRelationServiceImpl)
- CheckerRelationMapper#queryList
- CheckerRelationService#updateList(CheckerRelationServiceImpl)
- CheckerRelationMapper#updateList
- UserRelationService#queryList(UserRelationServiceImpl)
- UserRelationMapper#queryList
- UserRelationService#updateList(UserRelationServiceImpl)
- BeanUtils.map → Goods ⇒ 表 goods
- BeanUtils.map → GoodsInfo ⇒ 表 goods_info
- BeanUtils.mapList → SkuAddRequest
- BeanUtils.mapList → GoodsRelationAddRequest
其它依赖:ChaosTransactionTemplate.execute
逻辑摘要:调用 execute(newTransactionTemplate.execute);调用 mustGet(goodsService.mustGet);更新(goodsService.update);入参与返回值经 BeanUtils 做对象/分页映射
源码内联注释(旧站解析结果)
- 查询商品
- 更新商品信息
- 处理商品sku
- 查询现有数据
- 处理删除数据
- 删除sku
- 删除skuEntrance
- skuEntranceService.delete(SkuEntranceQuery.builder().skuId(e).build());
旧站环境备注:pro:(仓库 .env.pro 指向 uat;生产域名未确认,此处沿用 uat 主机示意)
调用点证据
dscp-html-manage/src/api/goods/index.ts:27管理后台 · request
可能抛出的业务码:99999 服务内部错误 错误码字典 →