sap-commerce

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

SAP Commerce Development

SAP Commerce开发

Overview

概述

SAP Commerce Cloud (formerly Hybris) is an enterprise e-commerce platform built on Java and Spring. This skill provides guidance for extension development, type system modeling, service layer implementation, data management, API customization, and accelerator patterns for both Cloud (CCv2) and On-Premise deployments.
SAP Commerce Cloud(原Hybris)是基于Java和Spring构建的企业级电商平台。本技能为Cloud(CCv2)和本地部署场景提供扩展开发、类型系统建模、服务层实现、数据管理、API定制以及加速器模式相关指导。

Core Architecture

核心架构

Type System

类型系统

Data modeling via
items.xml
defines item types, attributes, relations, and enumerations. Types are compiled into Java classes during build. See type-system.md for syntax and patterns.
通过
items.xml
进行数据建模,定义项目类型、属性、关联关系和枚举类型。构建期间,这些类型会被编译为Java类。语法和模式请参考type-system.md

Extensions

扩展

Modular architecture where functionality lives in extensions. Each extension has
extensioninfo.xml
for metadata,
items.xml
for types, and
*-spring.xml
for beans. See extension-development.md.
采用模块化架构,功能以扩展的形式存在。每个扩展包含用于元数据的
extensioninfo.xml
、用于类型定义的
items.xml
以及用于Bean配置的
*-spring.xml
。请参考extension-development.md

Service Layer

服务层

Four-layer architecture: Facade (API for controllers) → Service (business logic) → DAO (data access) → Model (generated from types). See service-layer-architecture.md.
四层架构:Facade(供控制器调用的API)→ Service(业务逻辑)→ DAO(数据访问)→ Model(由类型生成)。请参考service-layer-architecture.md

Data Management

数据管理

ImpEx: Scripting language for data import/export. See impex-guide.md. FlexibleSearch: SQL-like query language for items. See flexiblesearch-reference.md.
ImpEx:用于数据导入/导出的脚本语言。请参考impex-guide.mdFlexibleSearch:用于项目查询类SQL语言。请参考flexiblesearch-reference.md

OCC API

OCC API

RESTful web services exposing commerce functionality. Controllers use
DataMapper
for DTO conversion. See occ-api-development.md.
暴露电商功能的RESTful Web服务。控制器使用
DataMapper
进行DTO转换。请参考occ-api-development.md

Accelerators

加速器

Pre-built storefronts: B2C (retail) and B2B (enterprise with approval workflows). See accelerator-customization.md.
预构建的店面:B2C(零售)和B2B(带审批流程的企业级)。请参考accelerator-customization.md

CronJobs & Task Engine

CronJobs与任务引擎

Scheduled and asynchronous job execution. Define
AbstractJobPerformable
implementations, configure via
ServicelayerJob
+
CronJob
+
Trigger
in ImpEx. See cronjob-task-engine.md.
用于调度和异步任务执行。实现
AbstractJobPerformable
接口,通过ImpEx配置
ServicelayerJob
+
CronJob
+
Trigger
。请参考cronjob-task-engine.md

Business Processes

业务流程

Stateful workflows for order processing, returns, approvals, and custom flows. XML process definitions with action beans (
AbstractSimpleDecisionAction
,
AbstractAction
), wait states, and event triggers. See business-process.md.
用于订单处理、退货、审批和自定义流程的有状态工作流。使用XML定义流程,包含动作Bean(
AbstractSimpleDecisionAction
AbstractAction
)、等待状态和事件触发器。请参考business-process.md

Solr Search

Solr搜索

Product search and faceted navigation powered by Apache Solr. Configure indexed types, properties, value providers, and boost rules. See solr-search-configuration.md.
基于Apache Solr的产品搜索和分面导航。配置索引类型、属性、值提供器和加权规则。请参考solr-search-configuration.md

Promotions & Rule Engine

促销与规则引擎

Drools-based promotion rules with conditions and actions. Supports order/product/customer promotions, coupons, and custom actions. See promotions-rule-engine.md.
基于Drools的促销规则,包含条件和动作。支持订单/产品/客户促销、优惠券和自定义动作。请参考promotions-rule-engine.md

Caching

缓存

Multi-layered caching: platform region caches (entity, query, typesystem), Spring
@Cacheable
, and cluster-aware invalidation. See caching-guide.md.
多层缓存:平台区域缓存(实体、查询、类型系统)、Spring
@Cacheable
以及集群感知失效机制。请参考caching-guide.md

Backoffice

Backoffice

Administration UI customization via cockpitng: widget configuration, custom editors, search/list views, wizards, and deep links. See backoffice-configuration.md.
通过cockpitng定制管理UI:部件配置、自定义编辑器、搜索/列表视图、向导和深度链接。请参考backoffice-configuration.md

Common Workflows

常见工作流

Create a Custom Extension

创建自定义扩展

  1. Generate structure with
    ant extgen
    or use template from
    assets/extension-structure/
  2. Configure
    extensioninfo.xml
    with dependencies
  3. Define types in
    items.xml
  4. Configure beans in
    *-spring.xml
  5. Add to
    localextensions.xml
  6. Build:
    ant clean all
Reference: extension-development.md | Template:
assets/extension-structure/
  1. 使用
    ant extgen
    生成结构,或使用
    assets/extension-structure/
    中的模板
  2. extensioninfo.xml
    中配置依赖
  3. items.xml
    中定义类型
  4. *-spring.xml
    中配置Bean
  5. 添加到
    localextensions.xml
  6. 构建:
    ant clean all
参考:extension-development.md | 模板:
assets/extension-structure/

Define Custom Item Types

定义自定义项目类型

  1. Create or modify
    *-items.xml
    in extension
  2. Define itemtype with attributes, relations
  3. Build to generate model classes
  4. Use in services/DAOs
Reference: type-system.md | Templates:
assets/item-type-definition/
  1. 在扩展中创建或修改
    *-items.xml
  2. 定义包含属性、关联关系的itemtype
  3. 构建以生成模型类
  4. 在服务/DAO中使用
参考:type-system.md | 模板:
assets/item-type-definition/

Implement Service Layer

实现服务层

  1. Create DTO class for data transfer
  2. Create DAO interface and implementation with FlexibleSearch
  3. Create Service interface and implementation with business logic
  4. Create Facade interface and implementation for external API
  5. Configure beans in
    *-spring.xml
Reference: service-layer-architecture.md | Templates:
assets/service-layer/
  1. 创建用于数据传输的DTO类
  2. 创建带FlexibleSearch的DAO接口和实现
  3. 创建包含业务逻辑的Service接口和实现
  4. 创建供外部API调用的Facade接口和实现
  5. *-spring.xml
    中配置Bean
参考:service-layer-architecture.md | 模板:
assets/service-layer/

Import Data with ImpEx

使用ImpEx导入数据

  1. Create
    .impex
    file with header and data rows
  2. Use INSERT_UPDATE for create/modify operations
  3. Define macros for reusable values
  4. Import via HAC or
    ant importImpex
Reference: impex-guide.md | Templates:
assets/impex-scripts/
  1. 创建包含表头和数据行的
    .impex
    文件
  2. 使用INSERT_UPDATE进行创建/修改操作
  3. 定义可复用值的宏
  4. 通过HAC或
    ant importImpex
    导入
参考:impex-guide.md | 模板:
assets/impex-scripts/

Query with FlexibleSearch

使用FlexibleSearch查询

sql
SELECT {pk} FROM {Product} WHERE {code} = ?code
SELECT {p.pk} FROM {Product AS p JOIN Category AS c ON {p.supercategories} = {c.pk}} WHERE {c.code} = ?category
Reference: flexiblesearch-reference.md | Examples:
assets/flexiblesearch-queries/
sql
SELECT {pk} FROM {Product} WHERE {code} = ?code
SELECT {p.pk} FROM {Product AS p JOIN Category AS c ON {p.supercategories} = {c.pk}} WHERE {c.code} = ?category
参考:flexiblesearch-reference.md | 示例:
assets/flexiblesearch-queries/

Customize OCC API

定制OCC API

  1. Create controller with
    @Controller
    and
    @RequestMapping
  2. Create WsDTO for response data
  3. Create populator for model-to-DTO conversion
  4. Register in
    *-web-spring.xml
Reference: occ-api-development.md | Templates:
assets/occ-customization/
  1. 创建带
    @Controller
    @RequestMapping
    的控制器
  2. 创建用于响应数据的WsDTO
  3. 创建用于模型到DTO转换的populator
  4. *-web-spring.xml
    中注册
参考:occ-api-development.md | 模板:
assets/occ-customization/

Extend Accelerator Checkout

扩展加速器结账流程

  1. Create custom checkout step implementing
    CheckoutStep
  2. Configure in checkout flow XML
  3. Create JSP for step UI
  4. Register beans in
    *-spring.xml
Reference: accelerator-customization.md | Templates:
assets/checkout-customization/
  1. 创建实现
    CheckoutStep
    的自定义结账步骤
  2. 在结账流程XML中配置
  3. 为步骤UI创建JSP
  4. *-spring.xml
    中注册Bean
参考:accelerator-customization.md | 模板:
assets/checkout-customization/

Create a Scheduled Job (CronJob)

创建调度任务(CronJob)

  1. Implement
    AbstractJobPerformable<CronJobModel>
    with
    perform()
    method
  2. Register Spring bean with
    parent="abstractJobPerformable"
  3. Create
    ServicelayerJob
    ,
    CronJob
    , and
    Trigger
    via ImpEx
  4. Test via HAC > Platform > CronJobs
Reference: cronjob-task-engine.md | Templates:
assets/cronjob/
  1. 实现
    AbstractJobPerformable<CronJobModel>
    并编写
    perform()
    方法
  2. 注册Spring Bean,设置
    parent="abstractJobPerformable"
  3. 通过ImpEx创建
    ServicelayerJob
    CronJob
    Trigger
  4. 通过HAC > Platform > CronJobs进行测试
参考:cronjob-task-engine.md | 模板:
assets/cronjob/

Define a Business Process

定义业务流程

  1. Create process definition XML in
    resources/processes/
  2. Implement action beans extending
    AbstractSimpleDecisionAction
  3. Register action beans in Spring with
    parent="abstractAction"
  4. Register process definition via
    ProcessDefinitionResource
    Spring bean
  5. Start process via
    BusinessProcessService.createProcess()
    and
    startProcess()
Reference: business-process.md | Templates:
assets/business-process/
  1. resources/processes/
    中创建流程定义XML
  2. 实现继承
    AbstractSimpleDecisionAction
    的动作Bean
  3. 在Spring中注册动作Bean,设置
    parent="abstractAction"
  4. 通过
    ProcessDefinitionResource
    Spring Bean注册流程定义
  5. 通过
    BusinessProcessService.createProcess()
    startProcess()
    启动流程
参考:business-process.md | 模板:
assets/business-process/

Configure Solr Product Search

配置Solr产品搜索

  1. Set up
    SolrFacetSearchConfig
    with server, languages, currencies, catalog versions
  2. Define
    SolrIndexedType
    for Product
  3. Configure
    SolrIndexedProperty
    entries (searchable, facet, sortable)
  4. Set up indexer CronJobs (full nightly, incremental every 5 min)
  5. Test search via HAC > Platform > Solr
Reference: solr-search-configuration.md | Templates:
assets/solr-configuration/
  1. 设置
    SolrFacetSearchConfig
    ,包含服务器、语言、货币、目录版本
  2. 为Product定义
    SolrIndexedType
  3. 配置
    SolrIndexedProperty
    项(可搜索、分面、可排序)
  4. 设置索引器CronJob(每晚全量,每5分钟增量)
  5. 通过HAC > Platform > Solr测试搜索
参考:solr-search-configuration.md | 模板:
assets/solr-configuration/

Set Up Promotions

设置促销活动

  1. Create
    PromotionGroup
    for your store
  2. Define
    PromotionSourceRule
    with conditions and actions
  3. Configure coupons (
    SingleCodeCoupon
    /
    MultiCodeCoupon
    ) if needed
  4. Publish rules to activate them
  5. Test in Backoffice > Marketing > Promotion Rules
Reference: promotions-rule-engine.md | Templates:
assets/promotions/
  1. 为店铺创建
    PromotionGroup
  2. 定义包含条件和动作的
    PromotionSourceRule
  3. 如有需要,配置优惠券(
    SingleCodeCoupon
    /
    MultiCodeCoupon
  4. 发布规则以激活
  5. 在Backoffice > Marketing > Promotion Rules中测试
参考:promotions-rule-engine.md | 模板:
assets/promotions/

Quick Reference

快速参考

TaskReferenceAssetsScript
Extension setupextension-development.md
assets/extension-structure/
scripts/generate-extension.sh
Type definitionstype-system.md
assets/item-type-definition/
-
Service layerservice-layer-architecture.md
assets/service-layer/
-
Data importimpex-guide.md
assets/impex-scripts/
scripts/validate-impex.sh
Queriesflexiblesearch-reference.md
assets/flexiblesearch-queries/
scripts/query-items.sh
API customizationocc-api-development.md
assets/occ-customization/
-
Checkout/Storefrontaccelerator-customization.md
assets/checkout-customization/
-
Spring configspring-configuration.md--
Data patternsdata-modeling-patterns.md--
Troubleshootingtroubleshooting-guide.md--
CronJobscronjob-task-engine.md
assets/cronjob/
-
Business processesbusiness-process.md
assets/business-process/
-
Solr searchsolr-search-configuration.md
assets/solr-configuration/
-
Promotionspromotions-rule-engine.md
assets/promotions/
-
Cachingcaching-guide.md--
Backofficebackoffice-configuration.md--
任务参考文档资源脚本
扩展设置extension-development.md
assets/extension-structure/
scripts/generate-extension.sh
类型定义type-system.md
assets/item-type-definition/
-
服务层service-layer-architecture.md
assets/service-layer/
-
数据导入impex-guide.md
assets/impex-scripts/
scripts/validate-impex.sh
查询flexiblesearch-reference.md
assets/flexiblesearch-queries/
scripts/query-items.sh
API定制occ-api-development.md
assets/occ-customization/
-
结账/店面accelerator-customization.md
assets/checkout-customization/
-
Spring配置spring-configuration.md--
数据模式data-modeling-patterns.md--
故障排除troubleshooting-guide.md--
CronJobscronjob-task-engine.md
assets/cronjob/
-
业务流程business-process.md
assets/business-process/
-
Solr搜索solr-search-configuration.md
assets/solr-configuration/
-
促销活动promotions-rule-engine.md
assets/promotions/
-
缓存caching-guide.md--
Backofficebackoffice-configuration.md--

Resources

资源

scripts/

scripts/

Utility scripts for common tasks:
  • generate-extension.sh
    - Scaffold new extension structure
  • validate-impex.sh
    - Validate ImpEx syntax before import
  • query-items.sh
    - Execute FlexibleSearch queries via HAC
用于常见任务的实用脚本:
  • generate-extension.sh
    - 快速搭建新扩展结构
  • validate-impex.sh
    - 导入前验证ImpEx语法
  • query-items.sh
    - 通过HAC执行FlexibleSearch查询

references/

references/

Detailed guides for each topic area. Load as needed for in-depth information.
各主题领域的详细指南。可按需加载以获取深入信息。

assets/

assets/

Production-quality code templates ready to copy and customize. Organized by domain (service-layer, impex-scripts, etc.).
可直接复制和定制的生产级代码模板。按领域组织(服务层、ImpEx脚本等)。