feat: initialize shoplix platform
This commit is contained in:
commit
de2074a43b
277 files changed
+10407
No files matched your search
@@ -0,0 +1,16 @@
|
||||
package com.shoplix.admin;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/** 中文运营后台应用入口。 */
|
||||
@SpringBootApplication(scanBasePackages = "com.shoplix")
|
||||
@MapperScan("com.shoplix.modules")
|
||||
public class AdminApplication {
|
||||
|
||||
/** 启动运营后台应用。 */
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AdminApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.shoplix.admin.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
/** 运营后台本地开发 Web 配置。 */
|
||||
@Configuration
|
||||
public class AdminWebConfig implements WebMvcConfigurer {
|
||||
/** 本地媒体上传目录。 */ @Value("${shoplix.media.upload-dir:./uploads}") private String uploadDir;
|
||||
/** 允许本地运营前端调用后台接口。 */
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/api/admin/**").allowedOrigins("http://localhost:5173", "http://127.0.0.1:5173")
|
||||
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS").allowCredentials(true);
|
||||
}
|
||||
/** 暴露本地开发媒体资源。 */ @Override public void addResourceHandlers(ResourceHandlerRegistry registry){registry.addResourceHandler("/uploads/**").addResourceLocations(Paths.get(uploadDir).toAbsolutePath().normalize().toUri().toString());}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.shoplix.admin.controller;
|
||||
|
||||
import com.shoplix.admin.facade.AdminContentFacade;
|
||||
import com.shoplix.admin.modules.content.req.ContentListAdminReq;
|
||||
import com.shoplix.admin.modules.content.req.SaveContentAdminReq;
|
||||
import com.shoplix.admin.modules.content.req.SaveContentCategoryAdminReq;
|
||||
import com.shoplix.admin.modules.content.req.ContentCategoryListAdminReq;
|
||||
import com.shoplix.admin.modules.content.req.ContentDetailAdminReq;
|
||||
import com.shoplix.admin.modules.content.req.ContentOperationAdminReq;
|
||||
import com.shoplix.admin.modules.content.req.ContentStatusAdminReq;
|
||||
import com.shoplix.admin.modules.category.res.CategoryListAdminRes;
|
||||
import com.shoplix.admin.modules.common.res.CommonAdminRes;
|
||||
import com.shoplix.admin.modules.content.res.ContentListAdminRes;
|
||||
import com.shoplix.admin.modules.content.res.ContentDetailAdminRes;
|
||||
import com.shoplix.admin.modules.content.res.ContentSaveAdminRes;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/** 运营后台新闻、案例和帮助接口。 */
|
||||
@RestController
|
||||
@RequestMapping("/api/admin/v1/contents")
|
||||
public class AdminContentController {
|
||||
private final AdminContentFacade facade;
|
||||
/** 注入内容 Facade。 */ public AdminContentController(AdminContentFacade facade) { this.facade = facade; }
|
||||
/** 保存新闻、案例或帮助。 */ @PostMapping("/save") public ContentSaveAdminRes save(@Valid @RequestBody SaveContentAdminReq req) { return facade.save(req); }
|
||||
/** 查询新闻、案例或帮助详情。 */ @PostMapping("/detail") public ContentDetailAdminRes detail(@Valid @RequestBody ContentDetailAdminReq req) { return facade.detail(req); }
|
||||
/** 按内容类型查询列表。 */ @PostMapping("/list") public ContentListAdminRes list(@Valid @RequestBody ContentListAdminReq req) { return facade.list(req); }
|
||||
/** 逻辑删除新闻、案例或帮助。 */ @PostMapping("/delete") public CommonAdminRes delete(@Valid @RequestBody ContentOperationAdminReq req) { return facade.delete(req); }
|
||||
/** 上架或下架新闻、案例或帮助。 */ @PostMapping("/status") public CommonAdminRes changeStatus(@Valid @RequestBody ContentStatusAdminReq req) { return facade.changeStatus(req); }
|
||||
/** 保存新闻、案例或帮助分类。 */ @PostMapping("/categories/save") public CommonAdminRes saveCategory(@Valid @RequestBody SaveContentCategoryAdminReq req) { return facade.saveCategory(req); }
|
||||
/** 查询新闻、案例或帮助分类。 */ @PostMapping("/categories/list") public CategoryListAdminRes listCategories(@Valid @RequestBody ContentCategoryListAdminReq req) { return facade.listCategories(req); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.shoplix.admin.controller;
|
||||
import com.shoplix.admin.facade.AdminCustomCodeFacade;
|
||||
import com.shoplix.admin.modules.common.res.CommonAdminRes;
|
||||
import com.shoplix.admin.modules.customcode.req.*;
|
||||
import com.shoplix.admin.modules.customcode.res.*;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
/** 运营后台自定义代码接口。 */
|
||||
@RestController @RequestMapping("/api/admin/v1/custom-codes")
|
||||
public class AdminCustomCodeController {
|
||||
private final AdminCustomCodeFacade facade;
|
||||
/** 注入自定义代码 Facade。 */ public AdminCustomCodeController(AdminCustomCodeFacade facade){this.facade=facade;}
|
||||
/** 查询自定义代码列表。 */ @PostMapping("/list") public CustomCodeListAdminRes list(@Valid @RequestBody CustomCodeListAdminReq req){return facade.list(req);}
|
||||
/** 保存自定义代码。 */ @PostMapping("/save") public CustomCodeAdminRes save(@Valid @RequestBody SaveCustomCodeAdminReq req){return facade.save(req);}
|
||||
/** 删除自定义代码。 */ @PostMapping("/delete") public CommonAdminRes delete(@RequestParam("siteCode") String siteCode,@RequestParam("code") String code){return facade.delete(siteCode,code);}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.shoplix.admin.controller;
|
||||
|
||||
import com.shoplix.admin.facade.AdminDecorationFacade;
|
||||
import com.shoplix.admin.modules.decoration.req.DecorationDetailAdminReq;
|
||||
import com.shoplix.admin.modules.decoration.req.PublishDecorationAdminReq;
|
||||
import com.shoplix.admin.modules.decoration.req.SaveDecorationAdminReq;
|
||||
import com.shoplix.admin.modules.common.res.CommonAdminRes;
|
||||
import com.shoplix.admin.modules.decoration.res.DecorationDetailAdminRes;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/** 运营后台页面装修接口。 */
|
||||
@RestController
|
||||
@RequestMapping("/api/admin/v1/decorations")
|
||||
public class AdminDecorationController {
|
||||
private final AdminDecorationFacade facade;
|
||||
/** 注入页面装修 Facade。 */ public AdminDecorationController(AdminDecorationFacade facade) { this.facade = facade; }
|
||||
/** 查询页面装修草稿。 */ @PostMapping("/detail") public DecorationDetailAdminRes detail(@Valid @RequestBody DecorationDetailAdminReq req) { return facade.detail(req); }
|
||||
/** 保存页面装修草稿。 */ @PostMapping("/save") public CommonAdminRes save(@Valid @RequestBody SaveDecorationAdminReq req) { return facade.save(req); }
|
||||
/** 发布页面装修。 */ @PostMapping("/publish") public CommonAdminRes publish(@Valid @RequestBody PublishDecorationAdminReq req) { return facade.publish(req); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.shoplix.admin.controller;
|
||||
import com.shoplix.admin.facade.AdminInquiryFacade; import com.shoplix.admin.modules.common.res.*; import com.shoplix.admin.modules.inquiry.req.*; import com.shoplix.admin.modules.inquiry.res.*; import com.shoplix.admin.modules.setting.req.*; import com.shoplix.admin.modules.setting.res.*; import jakarta.validation.Valid; import org.springframework.web.bind.annotation.*;
|
||||
/** 运营后台询盘管理接口。 */ @RestController @RequestMapping("/api/admin/v1/inquiries")
|
||||
public class AdminInquiryController {private final AdminInquiryFacade facade; /** 注入询盘Facade。 */ public AdminInquiryController(AdminInquiryFacade facade){this.facade=facade;} /** 查询站点询盘设置。 */ @PostMapping("/settings/detail") public InquirySettingAdminRes setting(@Valid @RequestBody InquirySettingDetailAdminReq r){return facade.setting(r);} /** 保存站点询盘设置。 */ @PostMapping("/settings/save") public CommonAdminRes saveSetting(@Valid @RequestBody SaveInquirySettingAdminReq r){return facade.saveSetting(r);} /** 查询站点询盘表单。 */ @PostMapping("/forms/list") public InquiryFormListAdminRes forms(@Valid @RequestBody InquiryFormListAdminReq r){return facade.forms(r);} /** 保存并发布询盘表单。 */ @PostMapping("/forms/save") public CommonAdminRes saveForm(@Valid @RequestBody SaveInquiryFormAdminReq r){return facade.saveForm(r);} /** 查询询盘列表。 */ @PostMapping("/list") public InquiryListAdminRes list(@Valid @RequestBody InquiryListAdminReq r){return facade.list(r);} /** 查询询盘详情。 */ @PostMapping("/detail") public InquiryDetailAdminRes detail(@Valid @RequestBody InquiryDetailAdminReq r){return facade.detail(r);} /** 分配询盘负责人。 */ @PostMapping("/assign") public CommonAdminRes assign(@Valid @RequestBody AssignInquiryAdminReq r){return facade.assign(r);} /** 变更询盘处理状态。 */ @PostMapping("/change-status") public CommonAdminRes changeStatus(@Valid @RequestBody ChangeInquiryStatusAdminReq r){return facade.changeStatus(r);}}
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.controller; import com.shoplix.admin.facade.AdminMediaFacade; import com.shoplix.admin.modules.media.res.MediaUploadAdminRes; import jakarta.validation.constraints.NotBlank; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile;
|
||||
/** 运营后台媒体接口。 */ @Validated @RestController @RequestMapping("/api/admin/v1/media") public class AdminMediaController {private final AdminMediaFacade facade;/** 注入媒体Facade。 */ public AdminMediaController(AdminMediaFacade facade){this.facade=facade;} /** 上传产品主图。 */ @PostMapping("/upload-image") public MediaUploadAdminRes uploadImage(@RequestParam("siteCode") @NotBlank String siteCode,@RequestParam(value="altText",required=false) String altText,@RequestPart("file") MultipartFile file){return facade.uploadImage(siteCode,altText,file);}}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.shoplix.admin.controller;
|
||||
|
||||
import com.shoplix.admin.facade.AdminPageFacade;
|
||||
import com.shoplix.admin.modules.page.req.PageListAdminReq;
|
||||
import com.shoplix.admin.modules.page.req.SavePageAdminReq;
|
||||
import com.shoplix.admin.modules.page.req.PageDetailAdminReq;
|
||||
import com.shoplix.admin.modules.common.res.CommonAdminRes;
|
||||
import com.shoplix.admin.modules.page.res.PageListAdminRes;
|
||||
import com.shoplix.admin.modules.page.res.PageDetailAdminRes;
|
||||
import com.shoplix.admin.modules.page.res.PageSaveAdminRes;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/** 运营后台页面接口。 */
|
||||
@RestController
|
||||
@RequestMapping("/api/admin/v1/pages")
|
||||
public class AdminPageController {
|
||||
private final AdminPageFacade facade;
|
||||
/** 注入页面 Facade。 */ public AdminPageController(AdminPageFacade facade) { this.facade = facade; }
|
||||
/** 保存固定页面或自定义页面。 */ @PostMapping("/save") public PageSaveAdminRes save(@Valid @RequestBody SavePageAdminReq req) { return facade.save(req); }
|
||||
/** 查询固定页面或自定义页面详情。 */ @PostMapping("/detail") public PageDetailAdminRes detail(@Valid @RequestBody PageDetailAdminReq req) { return facade.detail(req); }
|
||||
/** 查询页面列表。 */ @PostMapping("/list") public PageListAdminRes list(@Valid @RequestBody PageListAdminReq req) { return facade.list(req); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.shoplix.admin.controller;
|
||||
|
||||
import com.shoplix.admin.facade.AdminProductFacade;
|
||||
import com.shoplix.admin.modules.product.req.ProductListAdminReq;
|
||||
import com.shoplix.admin.modules.product.req.SaveProductAdminReq;
|
||||
import com.shoplix.admin.modules.product.req.SaveProductCategoryAdminReq;
|
||||
import com.shoplix.admin.modules.product.req.ProductCategoryListAdminReq;
|
||||
import com.shoplix.admin.modules.product.req.ProductDetailAdminReq;
|
||||
import com.shoplix.admin.modules.product.req.ProductOperationAdminReq;
|
||||
import com.shoplix.admin.modules.product.req.ProductStatusAdminReq;
|
||||
import com.shoplix.admin.modules.category.res.CategoryListAdminRes;
|
||||
import com.shoplix.admin.modules.product.res.ProductDetailAdminRes;
|
||||
import com.shoplix.admin.modules.product.res.ProductSaveAdminRes;
|
||||
import com.shoplix.admin.modules.common.res.CommonAdminRes;
|
||||
import com.shoplix.admin.modules.product.res.ProductListAdminRes;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/** 运营后台 B2B 产品接口。 */
|
||||
@RestController
|
||||
@RequestMapping("/api/admin/v1/products")
|
||||
public class AdminProductController {
|
||||
private final AdminProductFacade facade;
|
||||
/** 注入产品 Facade。 */ public AdminProductController(AdminProductFacade facade) { this.facade = facade; }
|
||||
/** 保存产品、属性及弱规格。 */ @PostMapping("/save") public ProductSaveAdminRes save(@Valid @RequestBody SaveProductAdminReq req) { return facade.save(req); }
|
||||
/** 查询产品完整编辑详情。 */ @PostMapping("/detail") public ProductDetailAdminRes detail(@Valid @RequestBody ProductDetailAdminReq req) { return facade.detail(req); }
|
||||
/** 查询产品列表。 */ @PostMapping("/list") public ProductListAdminRes list(@Valid @RequestBody ProductListAdminReq req) { return facade.list(req); }
|
||||
/** 逻辑删除产品。 */ @PostMapping("/delete") public CommonAdminRes delete(@Valid @RequestBody ProductOperationAdminReq req) { return facade.delete(req); }
|
||||
/** 上架或下架产品。 */ @PostMapping("/status") public CommonAdminRes changeStatus(@Valid @RequestBody ProductStatusAdminReq req) { return facade.changeStatus(req); }
|
||||
/** 保存产品分类。 */ @PostMapping("/categories/save") public CommonAdminRes saveCategory(@Valid @RequestBody SaveProductCategoryAdminReq req) { return facade.saveCategory(req); }
|
||||
/** 查询产品分类。 */ @PostMapping("/categories/list") public CategoryListAdminRes listCategories(@Valid @RequestBody ProductCategoryListAdminReq req) { return facade.listCategories(req); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.shoplix.admin.controller;
|
||||
|
||||
import com.shoplix.admin.facade.AdminSeoFacade;
|
||||
import com.shoplix.admin.modules.seo.req.SaveSeoAdminReq;
|
||||
import com.shoplix.admin.modules.seo.req.SeoDetailAdminReq;
|
||||
import com.shoplix.admin.modules.seo.res.SeoDetailAdminRes;
|
||||
import com.shoplix.admin.modules.common.res.CommonAdminRes;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/** 运营后台 SEO 管理接口。 */
|
||||
@RestController
|
||||
@RequestMapping("/api/admin/v1/seo")
|
||||
public class AdminSeoController {
|
||||
/** 后台 SEO Facade。 */
|
||||
private final AdminSeoFacade facade;
|
||||
|
||||
/** 注入后台 SEO Facade。 */
|
||||
public AdminSeoController(AdminSeoFacade facade) { this.facade = facade; }
|
||||
|
||||
/** 保存页面 SEO 配置。 */
|
||||
@PostMapping("/save")
|
||||
public CommonAdminRes save(@Valid @RequestBody SaveSeoAdminReq request) { return facade.save(request); }
|
||||
|
||||
/** 查询页面 SEO 配置详情。 */
|
||||
@PostMapping("/detail")
|
||||
public SeoDetailAdminRes detail(@Valid @RequestBody SeoDetailAdminReq request) { return facade.detail(request); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.shoplix.admin.exception;
|
||||
|
||||
import com.shoplix.admin.modules.common.res.ErrorAdminRes;
|
||||
import com.shoplix.common.exception.BusinessException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.FieldError;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
/** 将运营后台异常转换为中文对象响应。 */
|
||||
@RestControllerAdvice
|
||||
public class AdminExceptionHandler {
|
||||
|
||||
/** 处理业务异常。 */
|
||||
@ExceptionHandler(BusinessException.class)
|
||||
public ResponseEntity<ErrorAdminRes> handleBusiness(BusinessException exception) {
|
||||
return ResponseEntity.badRequest().body(new ErrorAdminRes(exception.getCode(), exception.getMessage()));
|
||||
}
|
||||
|
||||
/** 处理参数校验异常。 */
|
||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||
public ResponseEntity<ErrorAdminRes> handleValidation(MethodArgumentNotValidException exception) {
|
||||
FieldError fieldError = exception.getBindingResult().getFieldErrors().stream().findFirst().orElse(null);
|
||||
String message = fieldError == null ? "请求参数不正确" : fieldError.getDefaultMessage();
|
||||
return ResponseEntity.badRequest().body(new ErrorAdminRes("VALIDATION_FAILED", message));
|
||||
}
|
||||
|
||||
/** 处理未预期异常并隐藏内部细节。 */
|
||||
@ExceptionHandler(Exception.class)
|
||||
public ResponseEntity<ErrorAdminRes> handleUnexpected(Exception exception) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
.body(new ErrorAdminRes("INTERNAL_ERROR", "服务器内部错误"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.shoplix.admin.facade;
|
||||
|
||||
import com.shoplix.admin.modules.content.req.ContentListAdminReq;
|
||||
import com.shoplix.admin.modules.content.req.SaveContentAdminReq;
|
||||
import com.shoplix.admin.modules.content.req.SaveContentCategoryAdminReq;
|
||||
import com.shoplix.admin.modules.content.req.ContentCategoryListAdminReq;
|
||||
import com.shoplix.admin.modules.content.req.ContentDetailAdminReq;
|
||||
import com.shoplix.admin.modules.content.req.ContentOperationAdminReq;
|
||||
import com.shoplix.admin.modules.content.req.ContentStatusAdminReq;
|
||||
import com.shoplix.admin.modules.category.res.CategoryListAdminRes;
|
||||
import com.shoplix.admin.modules.common.res.CommonAdminRes;
|
||||
import com.shoplix.admin.modules.content.res.ContentListAdminRes;
|
||||
import com.shoplix.admin.modules.content.res.ContentDetailAdminRes;
|
||||
import com.shoplix.admin.modules.content.res.ContentSaveAdminRes;
|
||||
import com.shoplix.admin.service.AdminContentService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/** 运营后台内容中心统一出口。 */
|
||||
@Component
|
||||
public class AdminContentFacade {
|
||||
private final AdminContentService service;
|
||||
/** 注入内容业务。 */ public AdminContentFacade(AdminContentService service) { this.service = service; }
|
||||
/** 保存内容。 */ public ContentSaveAdminRes save(SaveContentAdminReq request) { return new ContentSaveAdminRes(service.save(request)); }
|
||||
/** 查询内容详情。 */ public ContentDetailAdminRes detail(ContentDetailAdminReq request) {
|
||||
return service.detail(request.siteCode(), request.contentCode(), request.contentType().name());
|
||||
}
|
||||
/** 查询内容列表。 */ public ContentListAdminRes list(ContentListAdminReq request) {
|
||||
return new ContentListAdminRes(service.list(request.siteCode(), request.contentType().name()));
|
||||
}
|
||||
/** 删除内容。 */ public CommonAdminRes delete(ContentOperationAdminReq request) { service.delete(request.siteCode(), request.contentCode(), request.contentType().name()); return CommonAdminRes.success(); }
|
||||
/** 变更内容发布状态。 */ public CommonAdminRes changeStatus(ContentStatusAdminReq request) { service.changeStatus(request); return CommonAdminRes.success(); }
|
||||
/** 保存内容分类。 */ public CommonAdminRes saveCategory(SaveContentCategoryAdminReq request) { service.saveCategory(request); return CommonAdminRes.success(); }
|
||||
/** 查询内容分类。 */ public CategoryListAdminRes listCategories(ContentCategoryListAdminReq request) { return new CategoryListAdminRes(service.listCategories(request.siteCode(), request.contentType().name())); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.shoplix.admin.facade;
|
||||
import com.shoplix.admin.modules.common.res.CommonAdminRes;
|
||||
import com.shoplix.admin.modules.customcode.req.*;
|
||||
import com.shoplix.admin.modules.customcode.res.*;
|
||||
import com.shoplix.admin.service.AdminCustomCodeService;
|
||||
import org.springframework.stereotype.Component;
|
||||
/** 运营后台自定义代码统一出口。 */
|
||||
@Component
|
||||
public class AdminCustomCodeFacade {
|
||||
private final AdminCustomCodeService service;
|
||||
/** 注入自定义代码业务。 */ public AdminCustomCodeFacade(AdminCustomCodeService service) { this.service=service; }
|
||||
/** 查询代码列表。 */ public CustomCodeListAdminRes list(CustomCodeListAdminReq req) { return new CustomCodeListAdminRes(service.list(req.siteCode())); }
|
||||
/** 保存代码。 */ public CustomCodeAdminRes save(SaveCustomCodeAdminReq req) { return service.save(req); }
|
||||
/** 删除代码。 */ public CommonAdminRes delete(String siteCode,String code) { service.delete(siteCode,code); return CommonAdminRes.success(); }
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.shoplix.admin.facade;
|
||||
|
||||
import com.shoplix.admin.modules.decoration.req.DecorationDetailAdminReq;
|
||||
import com.shoplix.admin.modules.decoration.req.PublishDecorationAdminReq;
|
||||
import com.shoplix.admin.modules.decoration.req.SaveDecorationAdminReq;
|
||||
import com.shoplix.admin.modules.common.res.CommonAdminRes;
|
||||
import com.shoplix.admin.modules.decoration.res.DecorationDetailAdminRes;
|
||||
import com.shoplix.admin.service.AdminDecorationService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/** 运营后台页面装修统一出口。 */
|
||||
@Component
|
||||
public class AdminDecorationFacade {
|
||||
private final AdminDecorationService service;
|
||||
/** 注入页面装修业务。 */ public AdminDecorationFacade(AdminDecorationService service) { this.service = service; }
|
||||
/** 查询装修草稿。 */ public DecorationDetailAdminRes detail(DecorationDetailAdminReq request) { return service.detail(request.siteCode(), request.pageType()); }
|
||||
/** 保存装修草稿。 */ public CommonAdminRes save(SaveDecorationAdminReq request) { service.save(request); return CommonAdminRes.success(); }
|
||||
/** 发布装修草稿。 */ public CommonAdminRes publish(PublishDecorationAdminReq request) { service.publish(request.siteCode(), request.pageType()); return CommonAdminRes.success(); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.facade;
|
||||
import com.shoplix.admin.modules.common.res.*; import com.shoplix.admin.modules.inquiry.req.*; import com.shoplix.admin.modules.inquiry.res.*; import com.shoplix.admin.modules.setting.req.*; import com.shoplix.admin.modules.setting.res.*; import com.shoplix.admin.service.AdminInquiryService; import org.springframework.stereotype.Component;
|
||||
/** 运营后台询盘统一出口。 */ @Component public class AdminInquiryFacade {private final AdminInquiryService service; /** 注入询盘业务。 */ public AdminInquiryFacade(AdminInquiryService service){this.service=service;} /** 查询设置。 */ public InquirySettingAdminRes setting(InquirySettingDetailAdminReq r){return service.setting(r.siteCode());} /** 保存设置。 */ public CommonAdminRes saveSetting(SaveInquirySettingAdminReq r){service.saveSetting(r);return CommonAdminRes.success();} /** 查询表单。 */ public InquiryFormListAdminRes forms(InquiryFormListAdminReq r){return new InquiryFormListAdminRes(service.listForms(r.siteCode()));} /** 保存表单。 */ public CommonAdminRes saveForm(SaveInquiryFormAdminReq r){service.saveForm(r);return CommonAdminRes.success();} /** 查询询盘。 */ public InquiryListAdminRes list(InquiryListAdminReq r){return new InquiryListAdminRes(service.list(r.siteCode(),r.status()));} /** 查询详情。 */ public InquiryDetailAdminRes detail(InquiryDetailAdminReq r){return service.detail(r.siteCode(),r.inquiryCode());} /** 分配询盘。 */ public CommonAdminRes assign(AssignInquiryAdminReq r){service.assign(r);return CommonAdminRes.success();} /** 变更状态。 */ public CommonAdminRes changeStatus(ChangeInquiryStatusAdminReq r){service.changeStatus(r);return CommonAdminRes.success();}}
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.facade; import com.shoplix.admin.modules.media.res.MediaUploadAdminRes; import com.shoplix.admin.service.AdminMediaService; import org.springframework.stereotype.Component; import org.springframework.web.multipart.MultipartFile;
|
||||
/** 运营后台媒体统一出口。 */ @Component public class AdminMediaFacade {private final AdminMediaService service;/** 注入媒体业务。 */ public AdminMediaFacade(AdminMediaService service){this.service=service;} /** 上传图片。 */ public MediaUploadAdminRes uploadImage(String siteCode,String altText,MultipartFile file){return service.uploadImage(siteCode,altText,file);}}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.shoplix.admin.facade;
|
||||
|
||||
import com.shoplix.admin.modules.page.req.PageListAdminReq;
|
||||
import com.shoplix.admin.modules.page.req.SavePageAdminReq;
|
||||
import com.shoplix.admin.modules.page.req.PageDetailAdminReq;
|
||||
import com.shoplix.admin.modules.common.res.CommonAdminRes;
|
||||
import com.shoplix.admin.modules.page.res.PageListAdminRes;
|
||||
import com.shoplix.admin.modules.page.res.PageDetailAdminRes;
|
||||
import com.shoplix.admin.modules.page.res.PageSaveAdminRes;
|
||||
import com.shoplix.admin.service.AdminPageService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/** 运营后台页面统一出口。 */
|
||||
@Component
|
||||
public class AdminPageFacade {
|
||||
private final AdminPageService service;
|
||||
/** 注入页面业务。 */ public AdminPageFacade(AdminPageService service) { this.service = service; }
|
||||
/** 保存页面。 */ public PageSaveAdminRes save(SavePageAdminReq request) { return new PageSaveAdminRes(service.save(request)); }
|
||||
/** 查询页面详情。 */ public PageDetailAdminRes detail(PageDetailAdminReq request) { return service.detail(request.siteCode(), request.pageCode()); }
|
||||
/** 查询页面列表。 */ public PageListAdminRes list(PageListAdminReq request) { return new PageListAdminRes(service.list(request.siteCode())); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.shoplix.admin.facade;
|
||||
|
||||
import com.shoplix.admin.modules.product.req.ProductListAdminReq;
|
||||
import com.shoplix.admin.modules.product.req.SaveProductAdminReq;
|
||||
import com.shoplix.admin.modules.product.req.SaveProductCategoryAdminReq;
|
||||
import com.shoplix.admin.modules.product.req.ProductCategoryListAdminReq;
|
||||
import com.shoplix.admin.modules.product.req.ProductDetailAdminReq;
|
||||
import com.shoplix.admin.modules.product.req.ProductOperationAdminReq;
|
||||
import com.shoplix.admin.modules.product.req.ProductStatusAdminReq;
|
||||
import com.shoplix.admin.modules.category.res.CategoryListAdminRes;
|
||||
import com.shoplix.admin.modules.common.res.CommonAdminRes;
|
||||
import com.shoplix.admin.modules.product.res.ProductListAdminRes;
|
||||
import com.shoplix.admin.modules.product.res.ProductDetailAdminRes;
|
||||
import com.shoplix.admin.modules.product.res.ProductSaveAdminRes;
|
||||
import com.shoplix.admin.service.AdminProductService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/** 运营后台产品统一出口。 */
|
||||
@Component
|
||||
public class AdminProductFacade {
|
||||
private final AdminProductService service;
|
||||
/** 注入产品业务。 */ public AdminProductFacade(AdminProductService service) { this.service = service; }
|
||||
/** 保存产品。 */ public ProductSaveAdminRes save(SaveProductAdminReq request) { return new ProductSaveAdminRes(service.save(request), "SUCCESS", "操作成功"); }
|
||||
/** 查询产品编辑详情。 */ public ProductDetailAdminRes detail(ProductDetailAdminReq request) { return service.detail(request.siteCode(), request.productCode()); }
|
||||
/** 查询产品列表。 */ public ProductListAdminRes list(ProductListAdminReq request) { return new ProductListAdminRes(service.list(request.siteCode())); }
|
||||
/** 删除产品。 */ public CommonAdminRes delete(ProductOperationAdminReq request) { service.delete(request.siteCode(), request.productCode()); return CommonAdminRes.success(); }
|
||||
/** 变更产品发布状态。 */ public CommonAdminRes changeStatus(ProductStatusAdminReq request) { service.changeStatus(request); return CommonAdminRes.success(); }
|
||||
/** 保存产品分类。 */ public CommonAdminRes saveCategory(SaveProductCategoryAdminReq request) { service.saveCategory(request); return CommonAdminRes.success(); }
|
||||
/** 查询产品分类。 */ public CategoryListAdminRes listCategories(ProductCategoryListAdminReq request) { return new CategoryListAdminRes(service.listCategories(request.siteCode())); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.shoplix.admin.facade;
|
||||
|
||||
import com.shoplix.admin.modules.seo.req.SaveSeoAdminReq;
|
||||
import com.shoplix.admin.modules.seo.req.SeoDetailAdminReq;
|
||||
import com.shoplix.admin.modules.seo.res.SeoDetailAdminRes;
|
||||
import com.shoplix.admin.service.AdminSeoService;
|
||||
import com.shoplix.admin.modules.common.res.CommonAdminRes;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/** 运营后台 SEO 统一出口。 */
|
||||
@Component
|
||||
public class AdminSeoFacade {
|
||||
/** 后台 SEO 业务服务。 */
|
||||
private final AdminSeoService service;
|
||||
|
||||
/** 注入后台 SEO 业务服务。 */
|
||||
public AdminSeoFacade(AdminSeoService service) { this.service = service; }
|
||||
|
||||
/** 保存页面 SEO。 */
|
||||
public CommonAdminRes save(SaveSeoAdminReq request) {
|
||||
service.save(request);
|
||||
return CommonAdminRes.success();
|
||||
}
|
||||
|
||||
/** 查询页面 SEO 详情。 */
|
||||
public SeoDetailAdminRes detail(SeoDetailAdminReq request) { return service.detail(request); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.shoplix.admin.modules.category.res;
|
||||
|
||||
/** 运营后台分类列表项响应。 */
|
||||
public record CategoryItemAdminRes(
|
||||
/** 分类业务编号。 */ String categoryCode,
|
||||
/** 父分类业务编号。 */ String parentCategoryCode,
|
||||
/** 英文分类名称。 */ String categoryName,
|
||||
/** 英文路径标识。 */ String slug,
|
||||
/** 英文分类描述。 */ String description,
|
||||
/** 排序值。 */ Integer sortNo,
|
||||
/** 发布状态。 */ String status) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.shoplix.admin.modules.category.res;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 运营后台分类列表响应。 */
|
||||
public record CategoryListAdminRes(
|
||||
/** 分类列表。 */ List<CategoryItemAdminRes> items) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.shoplix.admin.modules.common.res;
|
||||
|
||||
/** 运营后台通用操作响应。 */
|
||||
public record CommonAdminRes(String code, String message) {
|
||||
/** 创建后台成功响应。 */
|
||||
public static CommonAdminRes success() {
|
||||
return new CommonAdminRes("SUCCESS", "操作成功");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.shoplix.admin.modules.common.res;
|
||||
|
||||
/** 运营后台错误响应。 */
|
||||
public record ErrorAdminRes(String code, String message) {
|
||||
}
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.shoplix.admin.modules.content.req;
|
||||
|
||||
import com.shoplix.modules.content.enums.ContentTypeEnum;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
/** 运营后台内容分类列表请求。 */
|
||||
public record ContentCategoryListAdminReq(
|
||||
/** 所属站点业务编号。 */ @NotBlank @Size(max = 16) String siteCode,
|
||||
/** 内容类型。 */ @NotNull ContentTypeEnum contentType) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.shoplix.admin.modules.content.req;
|
||||
|
||||
import com.shoplix.modules.content.enums.ContentTypeEnum;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
/** 运营后台内容详情请求。 */
|
||||
public record ContentDetailAdminReq(
|
||||
/** 站点业务编号。 */ @NotBlank @Size(max = 16) String siteCode,
|
||||
/** 内容业务编号。 */ @NotBlank @Size(max = 16) String contentCode,
|
||||
/** 内容类型。 */ @NotNull ContentTypeEnum contentType) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.shoplix.admin.modules.content.req;
|
||||
|
||||
import com.shoplix.modules.content.enums.ContentTypeEnum;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/** 运营后台内容列表请求。 */
|
||||
public record ContentListAdminReq(@NotBlank String siteCode, @NotNull ContentTypeEnum contentType) {
|
||||
}
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.shoplix.admin.modules.content.req;
|
||||
|
||||
import com.shoplix.modules.content.enums.ContentTypeEnum;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
/** 运营后台内容操作请求。 */
|
||||
public record ContentOperationAdminReq(
|
||||
/** 站点业务编号。 */ @NotBlank @Size(max = 16) String siteCode,
|
||||
/** 内容业务编号。 */ @NotBlank @Size(max = 16) String contentCode,
|
||||
/** 内容类型。 */ @NotNull ContentTypeEnum contentType) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.shoplix.admin.modules.content.req;
|
||||
|
||||
import com.shoplix.modules.common.enums.PublishStatusEnum;
|
||||
import com.shoplix.modules.content.enums.ContentTypeEnum;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
/** 运营后台内容状态变更请求。 */
|
||||
public record ContentStatusAdminReq(
|
||||
/** 站点业务编号。 */ @NotBlank @Size(max = 16) String siteCode,
|
||||
/** 内容业务编号。 */ @NotBlank @Size(max = 16) String contentCode,
|
||||
/** 内容类型。 */ @NotNull ContentTypeEnum contentType,
|
||||
/** 目标发布状态。 */ @NotNull PublishStatusEnum status) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.shoplix.admin.modules.content.req;
|
||||
|
||||
import com.shoplix.modules.common.enums.PublishStatusEnum;
|
||||
import com.shoplix.modules.content.enums.ContentTypeEnum;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
/** 运营后台保存新闻、案例或帮助请求。 */
|
||||
public record SaveContentAdminReq(
|
||||
@Size(max = 16) String contentCode,
|
||||
@NotBlank @Size(max = 16) String siteCode,
|
||||
@NotNull ContentTypeEnum contentType,
|
||||
@Size(max = 16) String primaryCategoryCode,
|
||||
@NotBlank @Size(max = 200) String title,
|
||||
@NotBlank @Pattern(regexp = "^[a-z0-9]+(?:-[a-z0-9]+)*$") @Size(max = 120) String slug,
|
||||
@Size(max = 500) String summary,
|
||||
@NotBlank String contentBody,
|
||||
@Size(max = 16) String coverMediaCode,
|
||||
@Size(max = 100) String authorName,
|
||||
@Size(max = 100) String sourceName,
|
||||
@NotNull Boolean featured,
|
||||
@NotNull Integer sortNo,
|
||||
@NotNull PublishStatusEnum status) {
|
||||
}
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.shoplix.admin.modules.content.req;
|
||||
|
||||
import com.shoplix.modules.common.enums.PublishStatusEnum;
|
||||
import com.shoplix.modules.content.enums.ContentTypeEnum;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/** 运营后台保存内容分类请求。 */
|
||||
public record SaveContentCategoryAdminReq(
|
||||
/** 分类业务编号,新增时为空。 */ @Size(max = 16) String categoryCode,
|
||||
/** 所属站点业务编号。 */ @NotBlank @Size(max = 16) String siteCode,
|
||||
/** 内容类型。 */ @NotNull ContentTypeEnum contentType,
|
||||
/** 父分类业务编号,顶级为空。 */ @Size(max = 16) String parentCategoryCode,
|
||||
/** 英文分类名称。 */ @NotBlank @Size(max = 100) String categoryName,
|
||||
/** 英文路径标识。 */ @NotBlank @Pattern(regexp = "^[a-z0-9]+(?:-[a-z0-9]+)*$") @Size(max = 100) String slug,
|
||||
/** 英文分类描述。 */ @Size(max = 500) String description,
|
||||
/** 封面媒体业务编号。 */ @Size(max = 16) String coverMediaCode,
|
||||
/** 排序值。 */ @NotNull Integer sortNo,
|
||||
/** 发布状态。 */ @NotNull PublishStatusEnum status) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.shoplix.admin.modules.content.res;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/** 运营后台内容详情响应。 */
|
||||
public record ContentDetailAdminRes(
|
||||
/** 内容业务编号。 */ String contentCode,
|
||||
/** 内容类型。 */ String contentType,
|
||||
/** 主分类业务编号。 */ String primaryCategoryCode,
|
||||
/** 英文标题。 */ String title,
|
||||
/** 英文路径标识。 */ String slug,
|
||||
/** 英文摘要。 */ String summary,
|
||||
/** 英文富文本正文。 */ String contentBody,
|
||||
/** 封面媒体业务编号。 */ String coverMediaCode,
|
||||
/** 封面媒体访问地址。 */ String coverMediaUrl,
|
||||
/** 作者名称。 */ String authorName,
|
||||
/** 内容来源。 */ String sourceName,
|
||||
/** 推荐标识。 */ Boolean featured,
|
||||
/** 排序值。 */ Integer sortNo,
|
||||
/** 发布状态。 */ String status,
|
||||
/** 发布时间。 */ LocalDateTime publishTime) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.shoplix.admin.modules.content.res;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/** 运营后台内容列表项响应。 */
|
||||
public record ContentItemAdminRes(String contentCode, String contentType, String title, String slug,
|
||||
String primaryCategoryCode, String status, Boolean featured,
|
||||
LocalDateTime publishTime) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.shoplix.admin.modules.content.res;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 运营后台内容列表响应。 */
|
||||
public record ContentListAdminRes(List<ContentItemAdminRes> items) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.shoplix.admin.modules.content.res;
|
||||
|
||||
/** 运营后台内容保存响应。 */
|
||||
public record ContentSaveAdminRes(
|
||||
/** 内容业务编号。 */ String contentCode) {
|
||||
}
|
||||
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package com.shoplix.admin.modules.customcode.req;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
/** 查询自定义代码请求。 */
|
||||
public record CustomCodeListAdminReq(/** 站点业务编号。 */ @NotBlank String siteCode) { }
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package com.shoplix.admin.modules.customcode.req;
|
||||
import jakarta.validation.constraints.*;
|
||||
/** 保存自定义代码请求。 */
|
||||
public record SaveCustomCodeAdminReq(/** 业务编号,编辑时必填。 */ @Size(max=16) String code, /** 站点业务编号。 */ @NotBlank String siteCode, /** 标题。 */ @NotBlank @Size(max=120) String title, /** HTML或JavaScript代码。 */ @NotBlank String content, /** 语言站点。 */ @NotBlank @Size(max=20) String locale, /** 终端类型。 */ @NotBlank @Pattern(regexp="ALL|DESKTOP|MOBILE") String device, /** 注入位置。 */ @NotBlank @Pattern(regexp="HEAD|BODY_START|BODY_END") String position, /** 是否启用。 */ @NotNull Boolean enabled, /** 排序号。 */ @NotNull @Min(0) @Max(9999) Integer sortNo) { }
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.customcode.res;
|
||||
/** 自定义代码响应。 */
|
||||
public record CustomCodeAdminRes(String code,String siteCode,String title,String content,String locale,String device,String position,Boolean enabled,Integer sortNo) { }
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package com.shoplix.admin.modules.customcode.res;
|
||||
import java.util.List;
|
||||
/** 自定义代码列表响应。 */
|
||||
public record CustomCodeListAdminRes(List<CustomCodeAdminRes> items) { }
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.shoplix.admin.modules.decoration.req;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
/** 查询页面装修详情请求。 */
|
||||
public record DecorationDetailAdminReq(
|
||||
/** 站点业务编号。 */ @NotBlank String siteCode,
|
||||
/** 页面类型,当前支持 HOME。 */ @NotBlank String pageType) {
|
||||
}
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.shoplix.admin.modules.decoration.req;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
/** 发布页面装修请求。 */
|
||||
public record PublishDecorationAdminReq(
|
||||
/** 站点业务编号。 */ @NotBlank String siteCode,
|
||||
/** 页面类型,当前支持 HOME。 */ @NotBlank String pageType) {
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.shoplix.admin.modules.decoration.req;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
/** 保存页面装修草稿请求。 */
|
||||
public record SaveDecorationAdminReq(
|
||||
/** 站点业务编号。 */ @NotBlank String siteCode,
|
||||
/** 页面类型,当前支持 HOME。 */ @NotBlank String pageType,
|
||||
/** 完整装修草稿 JSON。 */ @NotBlank String schema) {
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.shoplix.admin.modules.decoration.res;
|
||||
|
||||
/** 页面装修编辑详情响应。 */
|
||||
public record DecorationDetailAdminRes(
|
||||
/** 装修配置业务编号。 */ String decorationCode,
|
||||
/** 页面类型。 */ String pageType,
|
||||
/** 草稿装修 JSON。 */ String schema,
|
||||
/** 装修状态。 */ String status,
|
||||
/** 已发布版本号。 */ Integer publishedVersion) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.inquiry.req; import jakarta.validation.constraints.*;
|
||||
/** 后台分配询盘请求。 */ public record AssignInquiryAdminReq(/** 站点业务编号。 */ @NotBlank @Size(max=16) String siteCode, /** 询盘业务编号。 */ @NotBlank @Size(max=16) String inquiryCode, /** 负责人用户编号。 */ @NotBlank @Size(max=16) String ownerUserCode, /** 操作用户编号。 */ @NotBlank @Size(max=16) String operatorUserCode) {}
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.inquiry.req; import com.shoplix.modules.inquiry.enums.InquiryStatusEnum; import jakarta.validation.constraints.*; import java.time.LocalDateTime;
|
||||
/** 后台变更询盘状态请求。 */ public record ChangeInquiryStatusAdminReq(/** 站点业务编号。 */ @NotBlank @Size(max=16) String siteCode, /** 询盘业务编号。 */ @NotBlank @Size(max=16) String inquiryCode, /** 目标状态。 */ @NotNull InquiryStatusEnum status, /** 操作用户编号。 */ @NotBlank @Size(max=16) String operatorUserCode, /** 操作备注。 */ @Size(max=1000) String remark, /** 下次跟进时间。 */ LocalDateTime nextFollowTime) {}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.inquiry.req; import jakarta.validation.constraints.*;
|
||||
/** 后台询盘详情请求。 */ public record InquiryDetailAdminReq(/** 站点业务编号。 */ @NotBlank @Size(max=16) String siteCode, /** 询盘业务编号。 */ @NotBlank @Size(max=16) String inquiryCode) {}
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.inquiry.req; import com.shoplix.modules.inquiry.enums.InquiryFieldTypeEnum; import jakarta.validation.constraints.*;
|
||||
/** 后台询盘表单字段请求。 */ public record InquiryFormFieldAdminReq(/** 字段业务编号。 */ @Size(max=16) String fieldCode, /** 稳定字段键。 */ @NotBlank @Pattern(regexp="^[a-z][a-z0-9_]{1,59}$") String fieldKey, /** 英文字段标签。 */ @NotBlank @Size(max=100) String label, /** 字段类型。 */ @NotNull InquiryFieldTypeEnum fieldType, /** 英文占位提示。 */ @Size(max=200) String placeholder, /** 英文帮助文字。 */ @Size(max=300) String helpText, /** 是否必填。 */ @NotNull Boolean required, /** 是否系统字段。 */ @NotNull Boolean systemField, /** 选项JSON。 */ String optionsJson, /** 展示宽度。 */ @NotBlank @Pattern(regexp="FULL|HALF") String widthType, /** 排序值。 */ @NotNull Integer sortNo) {}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.inquiry.req; import jakarta.validation.constraints.*;
|
||||
/** 后台询盘表单列表请求。 */ public record InquiryFormListAdminReq(/** 站点业务编号。 */ @NotBlank @Size(max=16) String siteCode) {}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.inquiry.req; import com.shoplix.modules.inquiry.enums.InquiryStatusEnum; import jakarta.validation.constraints.*;
|
||||
/** 后台询盘列表请求。 */ public record InquiryListAdminReq(/** 站点业务编号。 */ @NotBlank @Size(max=16) String siteCode, /** 可选状态。 */ InquiryStatusEnum status) {}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.inquiry.req; import com.shoplix.modules.common.enums.PublishStatusEnum; import com.shoplix.modules.inquiry.enums.InquirySceneEnum; import jakarta.validation.Valid; import jakarta.validation.constraints.*; import java.util.List;
|
||||
/** 后台保存询盘表单请求。 */ public record SaveInquiryFormAdminReq(/** 表单业务编号,新增为空。 */ @Size(max=16) String formCode, /** 站点业务编号。 */ @NotBlank @Size(max=16) String siteCode, /** 后台表单名称。 */ @NotBlank @Size(max=100) String formName, /** 表单场景。 */ @NotNull InquirySceneEnum scene, /** 英文提交按钮。 */ @NotBlank @Size(max=100) String submitButtonText, /** 英文成功提示。 */ @NotBlank @Size(max=500) String successMessage, /** 隐私页面编号。 */ @Size(max=16) String privacyPageCode, /** 发布状态。 */ @NotNull PublishStatusEnum status, /** 排序值。 */ @NotNull Integer sortNo, /** 表单字段。 */ @NotEmpty @Valid List<InquiryFormFieldAdminReq> fields) {}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.inquiry.res; import java.time.LocalDateTime; import java.util.*;
|
||||
/** 后台询盘详情响应。 */ public record InquiryDetailAdminRes(String inquiryCode,String formCode,Integer formVersion,String sourceType,String sourceCode,String sourceUrl,String productCode,String productName,String customerName,String customerEmail,String customerPhone,String companyName,String countryCode,String message,String status,String statusLabel,Set<String> allowedOperations,String priority,String ownerUserCode,String crmLeadCode,String utmSource,String utmMedium,String utmCampaign,String referrerUrl,String landingUrl,String deviceType,Boolean privacyConsent,LocalDateTime privacyConsentTime,Boolean duplicate,Boolean spam,String spamReason,LocalDateTime nextFollowTime,LocalDateTime createTime,List<InquiryFieldValueAdminRes> fieldValues) {}
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.inquiry.res;
|
||||
/** 后台询盘动态字段值响应。 */ public record InquiryFieldValueAdminRes(String fieldCode,String fieldKey,String label,String fieldType,String value,Integer sortNo) {}
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.inquiry.res;
|
||||
/** 后台询盘表单字段响应。 */ public record InquiryFormFieldAdminRes(String fieldCode,String fieldKey,String label,String fieldType,String placeholder,String helpText,Boolean required,Boolean systemField,String optionsJson,String widthType,Integer sortNo) {}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.inquiry.res; import java.util.List;
|
||||
/** 后台询盘表单响应。 */ public record InquiryFormItemAdminRes(String formCode,String formName,String scene,String submitButtonText,String successMessage,String privacyPageCode,String status,Integer publishedVersion,Integer sortNo,List<InquiryFormFieldAdminRes> fields) {}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.inquiry.res; import java.util.List;
|
||||
/** 后台询盘表单列表响应。 */ public record InquiryFormListAdminRes(List<InquiryFormItemAdminRes> items) {}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.inquiry.res; import java.time.LocalDateTime; import java.util.Set;
|
||||
/** 后台询盘列表项响应。 */ public record InquiryItemAdminRes(String inquiryCode,String sourceType,String sourceCode,String productName,String customerName,String customerEmail,String customerPhone,String companyName,String countryCode,String message,String status,String statusLabel,Set<String> allowedOperations,String priority,String ownerUserCode,Boolean duplicate,Boolean spam,LocalDateTime createTime) {}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.inquiry.res; import java.util.List;
|
||||
/** 后台询盘列表响应。 */ public record InquiryListAdminRes(List<InquiryItemAdminRes> items) {}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.media.res;
|
||||
/** 后台媒体上传响应。 */ public record MediaUploadAdminRes(String mediaCode,String url,String originalFileName,Long fileSize) {}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.shoplix.admin.modules.page.req;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
/** 运营后台页面详情请求。 */
|
||||
public record PageDetailAdminReq(
|
||||
/** 站点业务编号。 */ @NotBlank @Size(max = 16) String siteCode,
|
||||
/** 页面业务编号。 */ @NotBlank @Size(max = 16) String pageCode) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.shoplix.admin.modules.page.req;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
/** 运营后台页面列表请求。 */
|
||||
public record PageListAdminReq(@NotBlank String siteCode) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.shoplix.admin.modules.page.req;
|
||||
|
||||
import com.shoplix.modules.common.enums.PublishStatusEnum;
|
||||
import com.shoplix.modules.page.enums.SystemPageTypeEnum;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
/** 运营后台保存页面请求。 */
|
||||
public record SavePageAdminReq(
|
||||
@Size(max = 16) String pageCode,
|
||||
@NotBlank @Size(max = 16) String siteCode,
|
||||
@NotBlank @Pattern(regexp = "SYSTEM_PAGE|CUSTOM_PAGE") String pageType,
|
||||
SystemPageTypeEnum systemPageType,
|
||||
@NotBlank @Size(max = 100) String pageName,
|
||||
@NotBlank @Pattern(regexp = "^[a-z0-9]+(?:-[a-z0-9]+)*$") @Size(max = 100) String slug,
|
||||
@NotBlank String pageContent,
|
||||
@Size(max = 500) String summary,
|
||||
@Size(max = 16) String coverMediaCode,
|
||||
@NotNull Integer sortNo,
|
||||
@NotNull PublishStatusEnum status) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.shoplix.admin.modules.page.res;
|
||||
|
||||
/** 运营后台页面详情响应。 */
|
||||
public record PageDetailAdminRes(
|
||||
/** 页面业务编号。 */ String pageCode,
|
||||
/** 页面类型。 */ String pageType,
|
||||
/** 固定页面类型。 */ String systemPageType,
|
||||
/** 后台页面名称。 */ String pageName,
|
||||
/** 英文路径标识。 */ String slug,
|
||||
/** 英文富文本内容。 */ String pageContent,
|
||||
/** 英文摘要。 */ String summary,
|
||||
/** 封面媒体业务编号。 */ String coverMediaCode,
|
||||
/** 封面媒体访问地址。 */ String coverMediaUrl,
|
||||
/** 排序值。 */ Integer sortNo,
|
||||
/** 发布状态。 */ String status) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.shoplix.admin.modules.page.res;
|
||||
|
||||
/** 运营后台页面列表项响应。 */
|
||||
public record PageItemAdminRes(String pageCode, String pageType, String systemPageType,
|
||||
String pageName, String slug, String status, Integer sortNo) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.shoplix.admin.modules.page.res;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 运营后台页面列表响应。 */
|
||||
public record PageListAdminRes(List<PageItemAdminRes> items) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.shoplix.admin.modules.page.res;
|
||||
|
||||
/** 运营后台页面保存响应。 */
|
||||
public record PageSaveAdminRes(
|
||||
/** 页面业务编号。 */ String pageCode) {
|
||||
}
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.product.req; import jakarta.validation.constraints.*;
|
||||
/** 后台产品属性值请求。 */ public record ProductAttributeValueAdminReq(/** 属性业务编号,新自定义属性可为空。 */ @Size(max=16) String attributeCode, /** 新自定义属性英文名称。 */ @Size(max=100) String attributeName, /** 属性展示值。 */ @NotBlank @Size(max=500) String value, /** 单位。 */ @Size(max=30) String unit, /** 排序值。 */ @NotNull Integer sortNo) {}
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.shoplix.admin.modules.product.req;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
/** 运营后台产品分类列表请求。 */
|
||||
public record ProductCategoryListAdminReq(
|
||||
/** 所属站点业务编号。 */ @NotBlank @Size(max = 16) String siteCode) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.product.req; import jakarta.validation.constraints.*;
|
||||
/** 后台产品详情请求。 */ public record ProductDetailAdminReq(/** 站点业务编号。 */ @NotBlank @Size(max=16) String siteCode, /** 产品业务编号。 */ @NotBlank @Size(max=16) String productCode) {}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.shoplix.admin.modules.product.req;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
/** 运营后台产品列表请求。 */
|
||||
public record ProductListAdminReq(@NotBlank String siteCode) {
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.shoplix.admin.modules.product.req;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
/** 运营后台产品操作请求。 */
|
||||
public record ProductOperationAdminReq(
|
||||
/** 站点业务编号。 */ @NotBlank @Size(max = 16) String siteCode,
|
||||
/** 产品业务编号。 */ @NotBlank @Size(max = 16) String productCode) {
|
||||
}
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.shoplix.admin.modules.product.req;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
/** 运营后台产品弱规格请求。 */
|
||||
public record ProductSpecificationAdminReq(
|
||||
@Size(max = 100) String groupName,
|
||||
@NotBlank @Size(max = 100) String name,
|
||||
@NotBlank @Size(max = 500) String value,
|
||||
@Size(max = 30) String unit,
|
||||
@NotNull Integer sortNo) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.shoplix.admin.modules.product.req;
|
||||
|
||||
import com.shoplix.modules.common.enums.PublishStatusEnum;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
/** 运营后台产品状态变更请求。 */
|
||||
public record ProductStatusAdminReq(
|
||||
/** 站点业务编号。 */ @NotBlank @Size(max = 16) String siteCode,
|
||||
/** 产品业务编号。 */ @NotBlank @Size(max = 16) String productCode,
|
||||
/** 目标发布状态。 */ @NotNull PublishStatusEnum status) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.shoplix.admin.modules.product.req;
|
||||
|
||||
import com.shoplix.modules.common.enums.PublishStatusEnum;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 运营后台保存 B2B 产品请求。 */
|
||||
public record SaveProductAdminReq(
|
||||
@Size(max = 16) String productCode,
|
||||
@NotBlank @Size(max = 16) String siteCode,
|
||||
@Size(max = 16) String primaryCategoryCode,
|
||||
@NotBlank @Size(max = 200) String productName,
|
||||
@NotBlank @Pattern(regexp = "^[a-z0-9]+(?:-[a-z0-9]+)*$") @Size(max = 120) String slug,
|
||||
@Size(max = 100) String model,
|
||||
@Size(max = 500) String summary,
|
||||
@NotBlank String productContent,
|
||||
@Size(max = 16) String coverMediaCode,
|
||||
@NotNull Boolean featured,
|
||||
@NotNull Boolean inquiryEnabled,
|
||||
@NotNull Integer sortNo,
|
||||
@NotNull PublishStatusEnum status,
|
||||
@Valid List<ProductSpecificationAdminReq> specifications,
|
||||
@Valid List<ProductAttributeValueAdminReq> attributes) {
|
||||
}
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.shoplix.admin.modules.product.req;
|
||||
|
||||
import com.shoplix.modules.common.enums.PublishStatusEnum;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/** 运营后台保存产品分类请求。 */
|
||||
public record SaveProductCategoryAdminReq(
|
||||
/** 分类业务编号,新增时为空。 */ @Size(max = 16) String categoryCode,
|
||||
/** 所属站点业务编号。 */ @NotBlank @Size(max = 16) String siteCode,
|
||||
/** 父分类业务编号,顶级为空。 */ @Size(max = 16) String parentCategoryCode,
|
||||
/** 英文分类名称。 */ @NotBlank @Size(max = 100) String categoryName,
|
||||
/** 英文路径标识。 */ @NotBlank @Pattern(regexp = "^[a-z0-9]+(?:-[a-z0-9]+)*$") @Size(max = 100) String slug,
|
||||
/** 英文分类描述。 */ @Size(max = 500) String description,
|
||||
/** 封面媒体业务编号。 */ @Size(max = 16) String coverMediaCode,
|
||||
/** 排序值。 */ @NotNull Integer sortNo,
|
||||
/** 发布状态。 */ @NotNull PublishStatusEnum status) {
|
||||
}
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.product.res;
|
||||
/** 后台产品属性值响应。 */ public record ProductAttributeValueAdminRes(String attributeCode,String attributeName,String value,String unit,Integer sortNo) {}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.product.res; import java.util.List;
|
||||
/** 后台产品详情响应。 */ public record ProductDetailAdminRes(String productCode,String primaryCategoryCode,String productName,String slug,String model,String summary,String productContent,String coverMediaCode,String coverMediaUrl,Boolean featured,Boolean inquiryEnabled,Integer sortNo,String status,List<ProductAttributeValueAdminRes> attributes,List<ProductSpecificationAdminRes> specifications) {}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.shoplix.admin.modules.product.res;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/** 运营后台产品列表项响应。 */
|
||||
public record ProductItemAdminRes(String productCode, String productName, String slug, String model,
|
||||
String primaryCategoryCode, String status, Boolean featured,
|
||||
Boolean inquiryEnabled, LocalDateTime publishTime) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.shoplix.admin.modules.product.res;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 运营后台产品列表响应。 */
|
||||
public record ProductListAdminRes(List<ProductItemAdminRes> items) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.product.res;
|
||||
/** 后台产品保存响应。 */ public record ProductSaveAdminRes(/** 产品业务编号。 */ String productCode, /** 操作结果编码。 */ String code, /** 操作结果文案。 */ String message) {}
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.product.res;
|
||||
/** 后台产品弱规格响应。 */ public record ProductSpecificationAdminRes(String groupName,String name,String value,String unit,Integer sortNo) {}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.shoplix.admin.modules.seo.req;
|
||||
|
||||
import com.shoplix.modules.seo.enums.SeoPageTypeEnum;
|
||||
import com.shoplix.modules.seo.enums.SeoPublishStatusEnum;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 运营后台保存页面 SEO 请求。 */
|
||||
public record SaveSeoAdminReq(
|
||||
@NotBlank @Size(max = 16) String siteCode,
|
||||
@NotNull SeoPageTypeEnum pageType,
|
||||
@Size(max = 16) String targetCode,
|
||||
@NotBlank @Size(max = 70) String title,
|
||||
@NotBlank @Size(max = 160) String description,
|
||||
@Size(max = 255) String keywords,
|
||||
@NotBlank @Size(max = 120) String h1,
|
||||
@Size(max = 500) String canonicalUrl,
|
||||
@NotBlank @Size(max = 100) String robots,
|
||||
@Size(max = 100) String ogTitle,
|
||||
@Size(max = 200) String ogDescription,
|
||||
@Size(max = 500) String ogImageUrl,
|
||||
String structuredData,
|
||||
@NotNull SeoPublishStatusEnum status,
|
||||
@Valid List<SeoHeadingAdminReq> headings) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.shoplix.admin.modules.seo.req;
|
||||
|
||||
import com.shoplix.modules.seo.enums.SeoPageTypeEnum;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/** 运营后台查询 SEO 详情请求。 */
|
||||
public record SeoDetailAdminReq(@NotBlank String siteCode, @NotNull SeoPageTypeEnum pageType, String targetCode) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.shoplix.admin.modules.seo.req;
|
||||
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/** 运营后台 SEO 标题请求。 */
|
||||
public record SeoHeadingAdminReq(
|
||||
@NotNull @Min(2) @Max(3) Integer level,
|
||||
@NotBlank String text,
|
||||
@NotNull @Min(0) Integer sortNo) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.shoplix.admin.modules.seo.res;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 运营后台 SEO 详情响应。 */
|
||||
public record SeoDetailAdminRes(String seoCode, String siteCode, String pageType, String targetCode,
|
||||
String title, String description, String keywords, String h1,
|
||||
String canonicalUrl, String robots, String ogTitle,
|
||||
String ogDescription, String ogImageUrl, String structuredData,
|
||||
String status, List<SeoHeadingAdminRes> headings) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.shoplix.admin.modules.seo.res;
|
||||
|
||||
/** 运营后台 SEO 标题响应。 */
|
||||
public record SeoHeadingAdminRes(Integer level, String text, Integer sortNo) {
|
||||
}
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.setting.req; import jakarta.validation.constraints.*;
|
||||
/** 后台询盘设置详情请求。 */ public record InquirySettingDetailAdminReq(/** 站点业务编号。 */ @NotBlank @Size(max=16) String siteCode) {}
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.setting.req; import jakarta.validation.constraints.*;
|
||||
/** 后台保存询盘设置请求。 */ public record SaveInquirySettingAdminReq(/** 站点业务编号。 */ @NotBlank @Size(max=16) String siteCode, /** 询盘是否启用。 */ @NotNull Boolean inquiryEnabled, /** 验证码是否启用。 */ @NotNull Boolean captchaEnabled, /** 隐私授权是否必填。 */ @NotNull Boolean privacyConsentRequired, /** 重复窗口分钟。 */ @NotNull @Min(1) @Max(10080) Integer duplicateWindowMinutes, /** IP每小时限制。 */ @NotNull @Min(1) @Max(1000) Integer ipHourLimit, /** 邮箱每日限制。 */ @NotNull @Min(1) @Max(1000) Integer emailDayLimit, /** 成功动作。 */ @NotBlank @Pattern(regexp="MESSAGE|PAGE|URL") String successAction, /** 成功页面编号。 */ @Size(max=16) String successPageCode, /** 成功跳转地址。 */ @Size(max=500) String successRedirectUrl, /** 通知是否启用。 */ @NotNull Boolean notificationEnabled, /** 自动回复是否启用。 */ @NotNull Boolean autoReplyEnabled, /** 自动回复英文主题。 */ @Size(max=200) String autoReplySubject, /** 自动回复英文正文。 */ String autoReplyContent, /** 数据保留天数。 */ @NotNull @Min(30) Integer dataRetentionDays) {}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.shoplix.admin.modules.setting.res;
|
||||
/** 后台询盘设置响应。 */ public record InquirySettingAdminRes(String settingCode,String siteCode,Boolean inquiryEnabled,Boolean captchaEnabled,Boolean privacyConsentRequired,Integer duplicateWindowMinutes,Integer ipHourLimit,Integer emailDayLimit,String successAction,String successPageCode,String successRedirectUrl,Boolean notificationEnabled,Boolean autoReplyEnabled,String autoReplySubject,String autoReplyContent,Integer dataRetentionDays) {}
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
package com.shoplix.admin.service;
|
||||
|
||||
import com.shoplix.admin.modules.content.req.SaveContentAdminReq;
|
||||
import com.shoplix.admin.modules.content.req.SaveContentCategoryAdminReq;
|
||||
import com.shoplix.admin.modules.content.req.ContentStatusAdminReq;
|
||||
import com.shoplix.admin.modules.category.res.CategoryItemAdminRes;
|
||||
import com.shoplix.admin.modules.content.res.ContentItemAdminRes;
|
||||
import com.shoplix.admin.modules.content.res.ContentDetailAdminRes;
|
||||
import com.shoplix.common.code.enums.BusinessCodePrefixEnum;
|
||||
import com.shoplix.common.exception.BusinessException;
|
||||
import com.shoplix.common.utils.BusinessCodeUtils;
|
||||
import com.shoplix.modules.content.repository.entity.ContentEntity;
|
||||
import com.shoplix.modules.content.repository.entity.ContentCategoryEntity;
|
||||
import com.shoplix.modules.content.repository.service.ContentRepositoryService;
|
||||
import com.shoplix.modules.content.repository.service.ContentCategoryRepositoryService;
|
||||
import com.shoplix.modules.media.repository.service.MediaAssetRepositoryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/** 运营后台新闻、案例和帮助业务。 */
|
||||
@Service
|
||||
public class AdminContentService {
|
||||
private final ContentRepositoryService repository;
|
||||
private final ContentCategoryRepositoryService categoryRepository;
|
||||
private final MediaAssetRepositoryService mediaRepository;
|
||||
private final BusinessCodeUtils codeUtils;
|
||||
/** 注入内容业务依赖。 */ public AdminContentService(ContentRepositoryService repository,
|
||||
ContentCategoryRepositoryService categoryRepository,
|
||||
MediaAssetRepositoryService mediaRepository,
|
||||
BusinessCodeUtils codeUtils) {
|
||||
this.repository = repository; this.categoryRepository = categoryRepository;
|
||||
this.mediaRepository = mediaRepository; this.codeUtils = codeUtils;
|
||||
}
|
||||
/** 保存新闻、案例或帮助内容。 */
|
||||
@Transactional
|
||||
public String save(SaveContentAdminReq request) {
|
||||
boolean creating = request.contentCode() == null || request.contentCode().isBlank();
|
||||
ContentEntity entity = creating ? new ContentEntity() : repository.findByCode(request.siteCode(), request.contentCode())
|
||||
.orElseThrow(() -> new BusinessException("CONTENT_NOT_FOUND", "内容不存在"));
|
||||
if (!creating && !entity.getContentType().equals(request.contentType().name()))
|
||||
throw new BusinessException("CONTENT_TYPE_IMMUTABLE", "内容类型不允许修改");
|
||||
if (creating) { entity.setContentCode(codeUtils.generate(BusinessCodePrefixEnum.CONTENT)); entity.setSiteCode(request.siteCode()); }
|
||||
entity.setContentType(request.contentType().name()); entity.setPrimaryCategoryCode(orEmpty(request.primaryCategoryCode()));
|
||||
entity.setTitle(request.title()); entity.setSlug(request.slug()); entity.setSummary(request.summary());
|
||||
entity.setContentBody(request.contentBody()); entity.setCoverMediaCode(request.coverMediaCode());
|
||||
entity.setAuthorName(request.authorName()); entity.setSourceName(request.sourceName());
|
||||
entity.setFeaturedFlag(Boolean.TRUE.equals(request.featured()) ? 1 : 0); entity.setSortNo(request.sortNo());
|
||||
entity.setStatus(request.status().name());
|
||||
if (request.status().name().equals("PUBLISHED") && entity.getPublishTime() == null) entity.setPublishTime(LocalDateTime.now());
|
||||
int affected = creating ? repository.insert(entity) : repository.updateByCode(entity);
|
||||
if (affected != 1) throw new BusinessException("CONTENT_SAVE_FAILED", "内容保存失败");
|
||||
return entity.getContentCode();
|
||||
}
|
||||
/** 查询新闻、案例或帮助内容详情。 */
|
||||
public ContentDetailAdminRes detail(String siteCode, String contentCode, String contentType) {
|
||||
ContentEntity entity = repository.findByCode(siteCode, contentCode)
|
||||
.orElseThrow(() -> new BusinessException("CONTENT_NOT_FOUND", "内容不存在"));
|
||||
if (!entity.getContentType().equals(contentType))
|
||||
throw new BusinessException("CONTENT_TYPE_MISMATCH", "内容类型不匹配");
|
||||
String coverMediaUrl = entity.getCoverMediaCode() == null ? null : mediaRepository
|
||||
.find(siteCode, entity.getCoverMediaCode()).map(media -> media.getRelativeUrl()).orElse(null);
|
||||
return new ContentDetailAdminRes(entity.getContentCode(), entity.getContentType(),
|
||||
entity.getPrimaryCategoryCode(), entity.getTitle(), entity.getSlug(), entity.getSummary(),
|
||||
entity.getContentBody(), entity.getCoverMediaCode(), coverMediaUrl, entity.getAuthorName(),
|
||||
entity.getSourceName(), entity.getFeaturedFlag() != null && entity.getFeaturedFlag() == 1,
|
||||
entity.getSortNo(), entity.getStatus(), entity.getPublishTime());
|
||||
}
|
||||
/** 查询指定类型内容。 */
|
||||
public List<ContentItemAdminRes> list(String siteCode, String type) {
|
||||
return repository.list(siteCode, type).stream().map(item -> new ContentItemAdminRes(item.getContentCode(),
|
||||
item.getContentType(), item.getTitle(), item.getSlug(), item.getPrimaryCategoryCode(), item.getStatus(),
|
||||
item.getFeaturedFlag() != null && item.getFeaturedFlag() == 1, item.getPublishTime())).toList();
|
||||
}
|
||||
/** 逻辑删除指定类型内容。 */
|
||||
@Transactional
|
||||
public void delete(String siteCode, String contentCode, String contentType) {
|
||||
ContentEntity entity = repository.findByCode(siteCode, contentCode)
|
||||
.orElseThrow(() -> new BusinessException("CONTENT_NOT_FOUND", "内容不存在"));
|
||||
if (!entity.getContentType().equals(contentType))
|
||||
throw new BusinessException("CONTENT_TYPE_MISMATCH", "内容类型不匹配");
|
||||
if (repository.deleteByCode(siteCode, contentCode) != 1)
|
||||
throw new BusinessException("CONTENT_DELETE_FAILED", "内容删除失败");
|
||||
}
|
||||
/** 上架或下架指定类型内容。 */
|
||||
@Transactional
|
||||
public void changeStatus(ContentStatusAdminReq request) {
|
||||
ContentEntity entity = repository.findByCode(request.siteCode(), request.contentCode())
|
||||
.orElseThrow(() -> new BusinessException("CONTENT_NOT_FOUND", "内容不存在"));
|
||||
if (!entity.getContentType().equals(request.contentType().name()))
|
||||
throw new BusinessException("CONTENT_TYPE_MISMATCH", "内容类型不匹配");
|
||||
LocalDateTime publishTime = entity.getPublishTime();
|
||||
LocalDateTime offlineTime = entity.getOfflineTime();
|
||||
if (request.status().name().equals("PUBLISHED")) {
|
||||
if (publishTime == null) publishTime = LocalDateTime.now();
|
||||
offlineTime = null;
|
||||
} else if (request.status().name().equals("OFFLINE")) {
|
||||
offlineTime = LocalDateTime.now();
|
||||
}
|
||||
if (repository.updateStatus(request.siteCode(), request.contentCode(), request.status().name(), publishTime, offlineTime) != 1)
|
||||
throw new BusinessException("CONTENT_STATUS_UPDATE_FAILED", "内容状态更新失败");
|
||||
}
|
||||
/** 保存新闻、案例或帮助分类。 */
|
||||
@Transactional
|
||||
public void saveCategory(SaveContentCategoryAdminReq request) {
|
||||
boolean creating = request.categoryCode() == null || request.categoryCode().isBlank();
|
||||
ContentCategoryEntity entity = creating ? new ContentCategoryEntity()
|
||||
: categoryRepository.findByCode(request.siteCode(), request.categoryCode())
|
||||
.orElseThrow(() -> new BusinessException("CONTENT_CATEGORY_NOT_FOUND", "内容分类不存在"));
|
||||
if (creating) {
|
||||
entity.setCategoryCode(codeUtils.generate(BusinessCodePrefixEnum.CONTENT_CATEGORY));
|
||||
entity.setSiteCode(request.siteCode());
|
||||
}
|
||||
entity.setContentType(request.contentType().name());
|
||||
String parentCategoryCode = orEmpty(request.parentCategoryCode());
|
||||
validateContentCategoryHierarchy(request.siteCode(), entity.getCategoryCode(), request.contentType().name(), parentCategoryCode);
|
||||
entity.setParentCategoryCode(parentCategoryCode);
|
||||
entity.setCategoryName(request.categoryName()); entity.setSlug(request.slug());
|
||||
entity.setDescription(request.description()); entity.setCoverMediaCode(request.coverMediaCode());
|
||||
entity.setSortNo(request.sortNo()); entity.setStatus(request.status().name());
|
||||
int affected = creating ? categoryRepository.insert(entity) : categoryRepository.updateByCode(entity);
|
||||
if (affected != 1) throw new BusinessException("CONTENT_CATEGORY_SAVE_FAILED", "内容分类保存失败");
|
||||
}
|
||||
/** 查询指定内容类型的后台分类。 */
|
||||
public List<CategoryItemAdminRes> listCategories(String siteCode, String type) {
|
||||
return categoryRepository.list(siteCode, type, false).stream().map(item -> new CategoryItemAdminRes(
|
||||
item.getCategoryCode(), item.getParentCategoryCode(), item.getCategoryName(), item.getSlug(),
|
||||
item.getDescription(), item.getSortNo(), item.getStatus())).toList();
|
||||
}
|
||||
/** 校验内容分类最多两级、类型一致且不存在循环父子关系。 */
|
||||
private void validateContentCategoryHierarchy(String siteCode, String categoryCode, String contentType,
|
||||
String parentCategoryCode) {
|
||||
if (parentCategoryCode == null || parentCategoryCode.isBlank()) return;
|
||||
if (parentCategoryCode.equals(categoryCode))
|
||||
throw new BusinessException("CONTENT_CATEGORY_CYCLE", "内容分类不能形成循环层级");
|
||||
ContentCategoryEntity parent = categoryRepository.findByCode(siteCode, parentCategoryCode)
|
||||
.orElseThrow(() -> new BusinessException("CONTENT_CATEGORY_PARENT_NOT_FOUND", "父内容分类不存在"));
|
||||
if (!contentType.equals(parent.getContentType()))
|
||||
throw new BusinessException("CONTENT_CATEGORY_TYPE_MISMATCH", "父内容分类类型不匹配");
|
||||
if (parent.getParentCategoryCode() != null && !parent.getParentCategoryCode().isBlank())
|
||||
throw new BusinessException("CONTENT_CATEGORY_DEPTH_EXCEEDED", "内容分类最多支持两级");
|
||||
}
|
||||
private String orEmpty(String value) { return value == null ? "" : value; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.shoplix.admin.service;
|
||||
import com.shoplix.admin.modules.customcode.req.SaveCustomCodeAdminReq;
|
||||
import com.shoplix.admin.modules.customcode.res.CustomCodeAdminRes;
|
||||
import com.shoplix.common.code.enums.BusinessCodePrefixEnum;
|
||||
import com.shoplix.common.exception.BusinessException;
|
||||
import com.shoplix.common.utils.BusinessCodeUtils;
|
||||
import com.shoplix.modules.customcode.repository.entity.SiteCustomCodeEntity;
|
||||
import com.shoplix.modules.customcode.repository.service.SiteCustomCodeRepositoryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
/** 运营后台自定义代码业务。 */
|
||||
@Service
|
||||
public class AdminCustomCodeService {
|
||||
private final SiteCustomCodeRepositoryService repository; private final BusinessCodeUtils codeUtils;
|
||||
/** 注入自定义代码依赖。 */ public AdminCustomCodeService(SiteCustomCodeRepositoryService repository,BusinessCodeUtils codeUtils){this.repository=repository;this.codeUtils=codeUtils;}
|
||||
/** 查询代码列表。 */ public List<CustomCodeAdminRes> list(String siteCode){return repository.list(siteCode).stream().map(this::toRes).toList();}
|
||||
/** 新增或编辑代码。 */ public CustomCodeAdminRes save(SaveCustomCodeAdminReq req){SiteCustomCodeEntity e=repository.list(req.siteCode()).stream().filter(x->req.code()!=null&&!req.code().isBlank()&&req.code().equals(x.getCode())).findFirst().orElse(null);if(e==null){e=new SiteCustomCodeEntity();e.setCode(codeUtils.generate(BusinessCodePrefixEnum.CUSTOM_CODE));e.setSiteCode(req.siteCode());}e.setTitle(req.title());e.setContent(req.content());e.setLocale(req.locale());e.setDevice(req.device());e.setPosition(req.position());e.setEnabled(Boolean.TRUE.equals(req.enabled())?1:0);e.setSortNo(req.sortNo());int n=e.getId()==null?repository.insert(e):repository.update(e);if(n!=1)throw new BusinessException("CUSTOM_CODE_SAVE_FAILED","自定义代码保存失败");return toRes(e);}
|
||||
/** 删除代码。 */ public void delete(String siteCode,String code){if(repository.delete(siteCode,code)!=1)throw new BusinessException("CUSTOM_CODE_NOT_FOUND","自定义代码不存在");}
|
||||
private CustomCodeAdminRes toRes(SiteCustomCodeEntity e){return new CustomCodeAdminRes(e.getCode(),e.getSiteCode(),e.getTitle(),e.getContent(),e.getLocale(),e.getDevice(),e.getPosition(),e.getEnabled()!=null&&e.getEnabled()==1,e.getSortNo());}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.shoplix.admin.service;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.shoplix.admin.modules.decoration.req.SaveDecorationAdminReq;
|
||||
import com.shoplix.admin.modules.decoration.res.DecorationDetailAdminRes;
|
||||
import com.shoplix.common.code.enums.BusinessCodePrefixEnum;
|
||||
import com.shoplix.common.exception.BusinessException;
|
||||
import com.shoplix.common.utils.BusinessCodeUtils;
|
||||
import com.shoplix.modules.decoration.repository.entity.SiteDecorationEntity;
|
||||
import com.shoplix.modules.decoration.repository.service.SiteDecorationRepositoryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/** 运营后台页面装修业务。 */
|
||||
@Service
|
||||
public class AdminDecorationService {
|
||||
private static final String DEFAULT_SCHEMA = "{\"global\":{\"primaryColor\":\"#176b5d\",\"backgroundColor\":\"#ffffff\",\"textColor\":\"#17211f\",\"fontFamily\":\"Inter\",\"contentWidth\":1200},\"sections\":[]}";
|
||||
private final SiteDecorationRepositoryService repository;
|
||||
private final BusinessCodeUtils codeUtils;
|
||||
private final ObjectMapper objectMapper;
|
||||
/** 注入装修业务依赖。 */
|
||||
public AdminDecorationService(SiteDecorationRepositoryService repository, BusinessCodeUtils codeUtils, ObjectMapper objectMapper) {
|
||||
this.repository = repository; this.codeUtils = codeUtils; this.objectMapper = objectMapper;
|
||||
}
|
||||
/** 查询装修草稿,未配置时返回默认结构。 */
|
||||
public DecorationDetailAdminRes detail(String siteCode, String pageType) {
|
||||
return repository.find(siteCode, pageType)
|
||||
.map(item -> new DecorationDetailAdminRes(item.getDecorationCode(), item.getPageType(), item.getDraftSchema(), item.getStatus(), item.getPublishedVersion()))
|
||||
.orElseGet(() -> new DecorationDetailAdminRes(null, pageType, DEFAULT_SCHEMA, "DRAFT", 0));
|
||||
}
|
||||
/** 保存装修草稿,不影响线上已发布版本。 */
|
||||
@Transactional
|
||||
public void save(SaveDecorationAdminReq request) {
|
||||
validateSchema(request.schema());
|
||||
SiteDecorationEntity entity = repository.find(request.siteCode(), request.pageType()).orElse(null);
|
||||
boolean creating = entity == null;
|
||||
if (creating) {
|
||||
entity = new SiteDecorationEntity(); entity.setDecorationCode(codeUtils.generate(BusinessCodePrefixEnum.DECORATION));
|
||||
entity.setSiteCode(request.siteCode()); entity.setPageType(request.pageType()); entity.setPublishedVersion(0);
|
||||
}
|
||||
entity.setDraftSchema(request.schema());
|
||||
entity.setStatus(entity.getPublishedVersion() != null && entity.getPublishedVersion() > 0 ? "PUBLISHED" : "DRAFT");
|
||||
int affected = creating ? repository.insert(entity) : repository.updateByCode(entity);
|
||||
if (affected != 1) throw new BusinessException("DECORATION_SAVE_FAILED", "页面装修保存失败");
|
||||
}
|
||||
/** 将当前草稿发布为前台可见版本。 */
|
||||
@Transactional
|
||||
public void publish(String siteCode, String pageType) {
|
||||
SiteDecorationEntity entity = repository.find(siteCode, pageType)
|
||||
.orElseThrow(() -> new BusinessException("DECORATION_NOT_FOUND", "请先保存页面装修草稿"));
|
||||
validateSchema(entity.getDraftSchema());
|
||||
entity.setPublishedSchema(entity.getDraftSchema()); entity.setStatus("PUBLISHED");
|
||||
entity.setPublishedVersion((entity.getPublishedVersion() == null ? 0 : entity.getPublishedVersion()) + 1);
|
||||
entity.setPublishTime(LocalDateTime.now());
|
||||
if (repository.updateByCode(entity) != 1) throw new BusinessException("DECORATION_PUBLISH_FAILED", "页面装修发布失败");
|
||||
}
|
||||
/** 校验装修 JSON 的根结构和区块集合。 */
|
||||
private void validateSchema(String schema) {
|
||||
try {
|
||||
JsonNode root = objectMapper.readTree(schema);
|
||||
if (!root.isObject() || !root.path("global").isObject() || !root.path("sections").isArray()) {
|
||||
throw new BusinessException("DECORATION_SCHEMA_INVALID", "页面装修结构不完整");
|
||||
}
|
||||
} catch (BusinessException exception) { throw exception; }
|
||||
catch (Exception exception) { throw new BusinessException("DECORATION_SCHEMA_INVALID", "页面装修配置不是有效 JSON"); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.shoplix.admin.service;
|
||||
import com.shoplix.admin.modules.inquiry.req.*; import com.shoplix.admin.modules.inquiry.res.*; import com.shoplix.admin.modules.setting.req.*; import com.shoplix.admin.modules.setting.res.*; import com.shoplix.common.code.enums.BusinessCodePrefixEnum; import com.shoplix.common.exception.BusinessException; import com.shoplix.common.utils.BusinessCodeUtils;
|
||||
import com.shoplix.modules.inquiry.enums.InquiryStatusEnum; import com.shoplix.modules.inquiry.repository.entity.*; import com.shoplix.modules.inquiry.repository.service.*; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional;
|
||||
import java.time.LocalDateTime; import java.util.*;
|
||||
/** 运营后台询盘设置、表单与处理业务。 */ @Service
|
||||
public class AdminInquiryService {
|
||||
private final InquirySettingRepositoryService settings; private final InquiryFormRepositoryService forms; private final InquiryFormFieldRepositoryService fields; private final InquiryRecordRepositoryService records; private final InquiryFieldValueRepositoryService values; private final InquiryOperationLogRepositoryService logs; private final BusinessCodeUtils codes;
|
||||
/** 注入后台询盘业务依赖。 */ public AdminInquiryService(InquirySettingRepositoryService settings,InquiryFormRepositoryService forms,InquiryFormFieldRepositoryService fields,InquiryRecordRepositoryService records,InquiryFieldValueRepositoryService values,InquiryOperationLogRepositoryService logs,BusinessCodeUtils codes){this.settings=settings;this.forms=forms;this.fields=fields;this.records=records;this.values=values;this.logs=logs;this.codes=codes;}
|
||||
/** 查询站点询盘设置,不存在时返回合理默认值。 */ public InquirySettingAdminRes setting(String site){return settings.find(site).map(this::toSetting).orElse(new InquirySettingAdminRes(null,site,true,false,true,30,10,20,"MESSAGE","",null,true,false,null,null,730));}
|
||||
/** 保存站点询盘设置。 */ @Transactional public void saveSetting(SaveInquirySettingAdminReq r){boolean create=settings.find(r.siteCode()).isEmpty();InquirySettingEntity e=create?new InquirySettingEntity():settings.find(r.siteCode()).orElseThrow();if(create){e.setSettingCode(codes.generate(BusinessCodePrefixEnum.INQUIRY_SETTING));e.setSiteCode(r.siteCode());}e.setInquiryEnabled(flag(r.inquiryEnabled()));e.setCaptchaEnabled(flag(r.captchaEnabled()));e.setPrivacyConsentRequired(flag(r.privacyConsentRequired()));e.setDuplicateWindowMinutes(r.duplicateWindowMinutes());e.setIpHourLimit(r.ipHourLimit());e.setEmailDayLimit(r.emailDayLimit());e.setAttachmentEnabled(0);e.setMaxAttachmentCount(3);e.setMaxAttachmentSize(10485760L);e.setAllowedAttachmentTypes("pdf,jpg,jpeg,png,doc,docx");e.setSuccessAction(r.successAction());e.setSuccessPageCode(orEmpty(r.successPageCode()));e.setSuccessRedirectUrl(r.successRedirectUrl());e.setNotificationEnabled(flag(r.notificationEnabled()));e.setAutoReplyEnabled(flag(r.autoReplyEnabled()));e.setAutoReplySubject(r.autoReplySubject());e.setAutoReplyContent(r.autoReplyContent());e.setDataRetentionDays(r.dataRetentionDays());e.setStatus("ENABLED");int n=create?settings.insert(e):settings.update(e);if(n!=1)throw new BusinessException("INQUIRY_SETTING_SAVE_FAILED","询盘设置保存失败");}
|
||||
/** 查询站点表单。 */ public List<InquiryFormItemAdminRes> listForms(String site){return forms.list(site).stream().map(this::toForm).toList();}
|
||||
/** 保存表单并替换字段定义。 */ @Transactional public void saveForm(SaveInquiryFormAdminReq r){if(r.fields().stream().map(InquiryFormFieldAdminReq::fieldKey).distinct().count()!=r.fields().size())throw new BusinessException("INQUIRY_FIELD_KEY_DUPLICATED","表单字段键不能重复");boolean create=r.formCode()==null||r.formCode().isBlank();InquiryFormEntity e=create?new InquiryFormEntity():forms.find(r.siteCode(),r.formCode()).orElseThrow(()->new BusinessException("INQUIRY_FORM_NOT_FOUND","询盘表单不存在"));if(create){e.setFormCode(codes.generate(BusinessCodePrefixEnum.FORM));e.setSiteCode(r.siteCode());e.setPublishedVersion(0);}e.setFormName(r.formName());e.setFormScene(r.scene().name());e.setSubmitButtonText(r.submitButtonText());e.setSuccessMessage(r.successMessage());e.setPrivacyPageCode(orEmpty(r.privacyPageCode()));e.setStatus(r.status().name());e.setSortNo(r.sortNo());if("PUBLISHED".equals(e.getStatus()))e.setPublishedVersion(e.getPublishedVersion()+1);int n=create?forms.insert(e):forms.update(e);if(n!=1)throw new BusinessException("INQUIRY_FORM_SAVE_FAILED","询盘表单保存失败");fields.deleteByForm(e.getSiteCode(),e.getFormCode());for(InquiryFormFieldAdminReq f:r.fields()){InquiryFormFieldEntity x=new InquiryFormFieldEntity();x.setFieldCode(f.fieldCode()==null||f.fieldCode().isBlank()?codes.generate(BusinessCodePrefixEnum.FORM_FIELD):f.fieldCode());x.setSiteCode(e.getSiteCode());x.setFormCode(e.getFormCode());x.setFieldKey(f.fieldKey());x.setFieldLabel(f.label());x.setFieldType(f.fieldType().name());x.setPlaceholder(f.placeholder());x.setHelpText(f.helpText());x.setRequiredFlag(flag(f.required()));x.setSystemFieldFlag(flag(f.systemField()));x.setOptionsJson(f.optionsJson());x.setWidthType(f.widthType());x.setSortNo(f.sortNo());x.setStatus("ENABLED");if(fields.insert(x)!=1)throw new BusinessException("INQUIRY_FIELD_SAVE_FAILED","询盘字段保存失败");}}
|
||||
/** 查询后台询盘列表。 */ public List<InquiryItemAdminRes> list(String site,InquiryStatusEnum status){return records.list(site,status==null?null:status.name()).stream().map(this::toItem).toList();}
|
||||
/** 查询后台询盘详情。 */ public InquiryDetailAdminRes detail(String site,String code){InquiryRecordEntity e=records.find(site,code).orElseThrow(()->new BusinessException("INQUIRY_NOT_FOUND","询盘不存在"));InquiryStatusEnum s=InquiryStatusEnum.valueOf(e.getStatus());return new InquiryDetailAdminRes(e.getInquiryCode(),e.getFormCode(),e.getFormVersion(),e.getSourceType(),e.getSourceCode(),e.getSourceUrl(),e.getProductCode(),e.getProductNameSnapshot(),e.getCustomerName(),e.getCustomerEmail(),e.getCustomerPhone(),e.getCompanyName(),e.getCountryCode(),e.getMessage(),s.name(),s.getLabel(),s.getOperations(),e.getPriority(),e.getOwnerUserCode(),e.getCrmLeadCode(),e.getUtmSource(),e.getUtmMedium(),e.getUtmCampaign(),e.getReferrerUrl(),e.getLandingUrl(),e.getDeviceType(),e.getPrivacyConsentFlag()==1,e.getPrivacyConsentTime(),e.getDuplicateFlag()==1,e.getSpamFlag()==1,e.getSpamReason(),e.getNextFollowTime(),e.getCreateTime(),values.list(site,code).stream().map(v->new InquiryFieldValueAdminRes(v.getFieldCode(),v.getFieldKey(),v.getFieldLabelSnapshot(),v.getFieldTypeSnapshot(),v.getFieldValue(),v.getSortNo())).toList());}
|
||||
/** 分配询盘负责人。 */ @Transactional public void assign(AssignInquiryAdminReq r){InquiryRecordEntity e=records.find(r.siteCode(),r.inquiryCode()).orElseThrow(()->new BusinessException("INQUIRY_NOT_FOUND","询盘不存在"));e.setOwnerUserCode(r.ownerUserCode());if(records.update(e)!=1)throw new BusinessException("INQUIRY_ASSIGN_FAILED","询盘分配失败");log(e,r.operatorUserCode(),"ASSIGN",e.getStatus(),e.getStatus(),"负责人:"+r.ownerUserCode());}
|
||||
/** 按合法状态机变更询盘状态。 */ @Transactional public void changeStatus(ChangeInquiryStatusAdminReq r){InquiryRecordEntity e=records.find(r.siteCode(),r.inquiryCode()).orElseThrow(()->new BusinessException("INQUIRY_NOT_FOUND","询盘不存在"));InquiryStatusEnum before=InquiryStatusEnum.valueOf(e.getStatus());if(!canTransition(before,r.status()))throw new BusinessException("INQUIRY_STATUS_INVALID","当前状态不允许执行此操作");e.setStatus(r.status().name());e.setSpamFlag(r.status()==InquiryStatusEnum.SPAM?1:0);if(r.status()==InquiryStatusEnum.SPAM)e.setSpamReason(r.remark());if(r.status()==InquiryStatusEnum.FOLLOWING||r.status()==InquiryStatusEnum.QUOTED){if(e.getFirstFollowTime()==null)e.setFirstFollowTime(LocalDateTime.now());e.setLastFollowTime(LocalDateTime.now());e.setNextFollowTime(r.nextFollowTime());}if(r.status()==InquiryStatusEnum.CLOSED)e.setCloseTime(LocalDateTime.now());if(records.update(e)!=1)throw new BusinessException("INQUIRY_STATUS_SAVE_FAILED","询盘状态更新失败");log(e,r.operatorUserCode(),r.status()==InquiryStatusEnum.SPAM?"MARK_SPAM":"STATUS_CHANGE",before.name(),r.status().name(),r.remark());}
|
||||
/** 判断状态流转是否合法。 */ private boolean canTransition(InquiryStatusEnum from,InquiryStatusEnum to){if(from==to)return false;return switch(from){case NEW->Set.of(InquiryStatusEnum.VALID,InquiryStatusEnum.SPAM,InquiryStatusEnum.CLOSED).contains(to);case VALID->Set.of(InquiryStatusEnum.FOLLOWING,InquiryStatusEnum.SPAM,InquiryStatusEnum.CLOSED).contains(to);case FOLLOWING->Set.of(InquiryStatusEnum.QUOTED,InquiryStatusEnum.WON,InquiryStatusEnum.LOST,InquiryStatusEnum.CLOSED).contains(to);case QUOTED->Set.of(InquiryStatusEnum.FOLLOWING,InquiryStatusEnum.WON,InquiryStatusEnum.LOST,InquiryStatusEnum.CLOSED).contains(to);case WON,LOST->to==InquiryStatusEnum.CLOSED||to==InquiryStatusEnum.FOLLOWING;case SPAM,CLOSED->to==InquiryStatusEnum.NEW;};}
|
||||
/** 写入询盘操作日志。 */ private void log(InquiryRecordEntity e,String user,String type,String before,String after,String content){InquiryOperationLogEntity l=new InquiryOperationLogEntity();l.setLogCode(codes.generate(BusinessCodePrefixEnum.INQUIRY_LOG));l.setSiteCode(e.getSiteCode());l.setInquiryCode(e.getInquiryCode());l.setOperatorUserCode(user);l.setOperationType(type);l.setBeforeStatus(before);l.setAfterStatus(after);l.setOperationContent(content);logs.insert(l);}
|
||||
/** 转换设置响应。 */ private InquirySettingAdminRes toSetting(InquirySettingEntity e){return new InquirySettingAdminRes(e.getSettingCode(),e.getSiteCode(),e.getInquiryEnabled()==1,e.getCaptchaEnabled()==1,e.getPrivacyConsentRequired()==1,e.getDuplicateWindowMinutes(),e.getIpHourLimit(),e.getEmailDayLimit(),e.getSuccessAction(),e.getSuccessPageCode(),e.getSuccessRedirectUrl(),e.getNotificationEnabled()==1,e.getAutoReplyEnabled()==1,e.getAutoReplySubject(),e.getAutoReplyContent(),e.getDataRetentionDays());}
|
||||
/** 转换表单响应。 */ private InquiryFormItemAdminRes toForm(InquiryFormEntity e){return new InquiryFormItemAdminRes(e.getFormCode(),e.getFormName(),e.getFormScene(),e.getSubmitButtonText(),e.getSuccessMessage(),e.getPrivacyPageCode(),e.getStatus(),e.getPublishedVersion(),e.getSortNo(),fields.list(e.getSiteCode(),e.getFormCode(),false).stream().map(f->new InquiryFormFieldAdminRes(f.getFieldCode(),f.getFieldKey(),f.getFieldLabel(),f.getFieldType(),f.getPlaceholder(),f.getHelpText(),f.getRequiredFlag()==1,f.getSystemFieldFlag()==1,f.getOptionsJson(),f.getWidthType(),f.getSortNo())).toList());}
|
||||
/** 转换列表项响应。 */ private InquiryItemAdminRes toItem(InquiryRecordEntity e){InquiryStatusEnum s=InquiryStatusEnum.valueOf(e.getStatus());return new InquiryItemAdminRes(e.getInquiryCode(),e.getSourceType(),e.getSourceCode(),e.getProductNameSnapshot(),e.getCustomerName(),e.getCustomerEmail(),e.getCustomerPhone(),e.getCompanyName(),e.getCountryCode(),e.getMessage(),s.name(),s.getLabel(),s.getOperations(),e.getPriority(),e.getOwnerUserCode(),e.getDuplicateFlag()==1,e.getSpamFlag()==1,e.getCreateTime());}
|
||||
/** 布尔值转数据库标识。 */ private int flag(Boolean b){return Boolean.TRUE.equals(b)?1:0;} /** 空值转空字符串。 */ private String orEmpty(String s){return s==null?"":s;}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.shoplix.admin.service;
|
||||
import com.shoplix.admin.modules.media.res.MediaUploadAdminRes; import com.shoplix.common.code.enums.BusinessCodePrefixEnum; import com.shoplix.common.exception.BusinessException; import com.shoplix.common.utils.BusinessCodeUtils; import com.shoplix.modules.media.repository.entity.MediaAssetEntity; import com.shoplix.modules.media.repository.service.MediaAssetRepositoryService; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile;
|
||||
import java.io.IOException; import java.nio.file.*; import java.util.*;
|
||||
/** 运营后台媒体上传业务。 */ @Service public class AdminMediaService {private static final long MAX_IMAGE_SIZE=10*1024*1024;private final MediaAssetRepositoryService repository;private final BusinessCodeUtils codes;private final Path uploadRoot;/** 注入媒体依赖。 */ public AdminMediaService(MediaAssetRepositoryService repository,BusinessCodeUtils codes,@Value("${shoplix.media.upload-dir:./uploads}") String uploadDir){this.repository=repository;this.codes=codes;this.uploadRoot=Paths.get(uploadDir).toAbsolutePath().normalize();} /** 校验并保存产品图片。 */ public MediaUploadAdminRes uploadImage(String siteCode,String altText,MultipartFile file){if(file.isEmpty()||file.getSize()>MAX_IMAGE_SIZE)throw new BusinessException("MEDIA_SIZE_INVALID","图片不能为空且不能超过10MB");String original=Objects.requireNonNullElse(file.getOriginalFilename(),"image");String extension=extension(original);String detectedType=detectType(file);String storage=UUID.randomUUID().toString().replace("-","")+"."+extension;try{Files.createDirectories(uploadRoot);Path target=uploadRoot.resolve(storage).normalize();if(!target.startsWith(uploadRoot))throw new BusinessException("MEDIA_PATH_INVALID","文件路径不合法");file.transferTo(target);}catch(IOException e){throw new BusinessException("MEDIA_UPLOAD_FAILED","图片上传失败");}MediaAssetEntity entity=new MediaAssetEntity();entity.setMediaCode(codes.generate(BusinessCodePrefixEnum.MEDIA));entity.setSiteCode(siteCode);entity.setMediaType("IMAGE");entity.setOriginalFileName(original);entity.setStorageFileName(storage);entity.setRelativeUrl("/uploads/"+storage);entity.setMimeType(detectedType);entity.setFileExtension(extension);entity.setFileSize(file.getSize());entity.setAltText(altText);entity.setStatus("ENABLED");if(repository.insert(entity)!=1)throw new BusinessException("MEDIA_SAVE_FAILED","媒体记录保存失败");return new MediaUploadAdminRes(entity.getMediaCode(),entity.getRelativeUrl(),original,file.getSize());} /** 根据文件签名识别真实图片类型。 */ private String detectType(MultipartFile file){try{byte[] bytes=file.getBytes();if(bytes.length>=8&&bytes[0]==(byte)0x89&&bytes[1]==0x50&&bytes[2]==0x4E&&bytes[3]==0x47)return "image/png";if(bytes.length>=3&&bytes[0]==(byte)0xFF&&bytes[1]==(byte)0xD8&&bytes[2]==(byte)0xFF)return "image/jpeg";if(bytes.length>=6&&bytes[0]=='G'&&bytes[1]=='I'&&bytes[2]=='F')return "image/gif";if(bytes.length>=12&&bytes[0]=='R'&&bytes[1]=='I'&&bytes[2]=='F'&&bytes[8]=='W'&&bytes[9]=='E'&&bytes[10]=='B'&&bytes[11]=='P')return "image/webp";}catch(IOException e){throw new BusinessException("MEDIA_READ_FAILED","图片读取失败");}throw new BusinessException("MEDIA_TYPE_INVALID","文件内容不是支持的图片格式");} /** 提取并校验文件扩展名。 */ private String extension(String name){int index=name.lastIndexOf('.');if(index<0)return "jpg";String value=name.substring(index+1).toLowerCase(Locale.ROOT);if(!Set.of("jpg","jpeg","png","webp","gif").contains(value))throw new BusinessException("MEDIA_EXTENSION_INVALID","图片扩展名不支持");return value;}}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.shoplix.admin.service;
|
||||
|
||||
import com.shoplix.admin.modules.page.req.SavePageAdminReq;
|
||||
import com.shoplix.admin.modules.page.res.PageItemAdminRes;
|
||||
import com.shoplix.admin.modules.page.res.PageDetailAdminRes;
|
||||
import com.shoplix.common.code.enums.BusinessCodePrefixEnum;
|
||||
import com.shoplix.common.exception.BusinessException;
|
||||
import com.shoplix.common.utils.BusinessCodeUtils;
|
||||
import com.shoplix.modules.page.repository.entity.PageEntity;
|
||||
import com.shoplix.modules.page.repository.service.PageRepositoryService;
|
||||
import com.shoplix.modules.media.repository.service.MediaAssetRepositoryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/** 运营后台页面业务。 */
|
||||
@Service
|
||||
public class AdminPageService {
|
||||
private final PageRepositoryService repository;
|
||||
private final BusinessCodeUtils codeUtils;
|
||||
private final MediaAssetRepositoryService mediaRepository;
|
||||
/** 注入页面业务依赖。 */
|
||||
public AdminPageService(PageRepositoryService repository, BusinessCodeUtils codeUtils,
|
||||
MediaAssetRepositoryService mediaRepository) {
|
||||
this.repository = repository; this.codeUtils = codeUtils; this.mediaRepository = mediaRepository;
|
||||
}
|
||||
/** 保存固定页面或自定义页面。 */
|
||||
@Transactional
|
||||
public String save(SavePageAdminReq request) {
|
||||
if ("SYSTEM_PAGE".equals(request.pageType()) && request.systemPageType() == null) {
|
||||
throw new BusinessException("SYSTEM_PAGE_TYPE_REQUIRED", "固定页面类型不能为空");
|
||||
}
|
||||
boolean creating = request.pageCode() == null || request.pageCode().isBlank();
|
||||
PageEntity entity = creating ? new PageEntity() : repository.findByCode(request.siteCode(), request.pageCode())
|
||||
.orElseThrow(() -> new BusinessException("PAGE_NOT_FOUND", "页面不存在"));
|
||||
if (creating) { entity.setPageCode(codeUtils.generate(BusinessCodePrefixEnum.PAGE)); entity.setSiteCode(request.siteCode()); }
|
||||
entity.setPageType(request.pageType());
|
||||
entity.setSystemPageType(request.systemPageType() == null ? null : request.systemPageType().name());
|
||||
entity.setPageName(request.pageName()); entity.setSlug(request.slug()); entity.setPageContent(request.pageContent());
|
||||
entity.setSummary(request.summary()); entity.setCoverMediaCode(request.coverMediaCode()); entity.setSortNo(request.sortNo());
|
||||
entity.setStatus(request.status().name());
|
||||
if (request.status().name().equals("PUBLISHED") && entity.getPublishTime() == null) entity.setPublishTime(LocalDateTime.now());
|
||||
int affected = creating ? repository.insert(entity) : repository.updateByCode(entity);
|
||||
if (affected != 1) throw new BusinessException("PAGE_SAVE_FAILED", "页面保存失败");
|
||||
return entity.getPageCode();
|
||||
}
|
||||
/** 查询页面完整编辑详情。 */
|
||||
public PageDetailAdminRes detail(String siteCode, String pageCode) {
|
||||
PageEntity entity = repository.findByCode(siteCode, pageCode)
|
||||
.orElseThrow(() -> new BusinessException("PAGE_NOT_FOUND", "页面不存在"));
|
||||
String coverUrl = entity.getCoverMediaCode() == null ? null : mediaRepository
|
||||
.find(siteCode, entity.getCoverMediaCode()).map(media -> media.getRelativeUrl()).orElse(null);
|
||||
return new PageDetailAdminRes(entity.getPageCode(), entity.getPageType(), entity.getSystemPageType(),
|
||||
entity.getPageName(), entity.getSlug(), entity.getPageContent(), entity.getSummary(),
|
||||
entity.getCoverMediaCode(), coverUrl, entity.getSortNo(), entity.getStatus());
|
||||
}
|
||||
/** 查询站点全部页面。 */
|
||||
public List<PageItemAdminRes> list(String siteCode) {
|
||||
return repository.list(siteCode).stream().map(item -> new PageItemAdminRes(item.getPageCode(), item.getPageType(),
|
||||
item.getSystemPageType(), item.getPageName(), item.getSlug(), item.getStatus(), item.getSortNo())).toList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
package com.shoplix.admin.service;
|
||||
|
||||
import com.shoplix.admin.modules.product.req.ProductSpecificationAdminReq;
|
||||
import com.shoplix.admin.modules.product.req.ProductAttributeValueAdminReq;
|
||||
import com.shoplix.admin.modules.product.req.SaveProductAdminReq;
|
||||
import com.shoplix.admin.modules.product.req.SaveProductCategoryAdminReq;
|
||||
import com.shoplix.admin.modules.product.req.ProductStatusAdminReq;
|
||||
import com.shoplix.admin.modules.category.res.CategoryItemAdminRes;
|
||||
import com.shoplix.admin.modules.product.res.ProductItemAdminRes;
|
||||
import com.shoplix.admin.modules.product.res.*;
|
||||
import com.shoplix.common.code.enums.BusinessCodePrefixEnum;
|
||||
import com.shoplix.common.exception.BusinessException;
|
||||
import com.shoplix.common.utils.BusinessCodeUtils;
|
||||
import com.shoplix.modules.product.repository.entity.ProductEntity;
|
||||
import com.shoplix.modules.product.repository.entity.ProductCategoryEntity;
|
||||
import com.shoplix.modules.product.repository.entity.ProductSpecificationEntity;
|
||||
import com.shoplix.modules.product.repository.entity.ProductAttributeEntity;
|
||||
import com.shoplix.modules.product.repository.entity.ProductAttributeValueEntity;
|
||||
import com.shoplix.modules.media.repository.service.MediaAssetRepositoryService;
|
||||
import com.shoplix.modules.product.repository.service.ProductRepositoryService;
|
||||
import com.shoplix.modules.product.repository.service.ProductCategoryRepositoryService;
|
||||
import com.shoplix.modules.product.repository.service.ProductSpecificationRepositoryService;
|
||||
import com.shoplix.modules.product.repository.service.ProductAttributeRepositoryService;
|
||||
import com.shoplix.modules.product.repository.service.ProductAttributeValueRepositoryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/** 运营后台 B2B 产品业务。 */
|
||||
@Service
|
||||
public class AdminProductService {
|
||||
private final ProductRepositoryService repository;
|
||||
private final ProductSpecificationRepositoryService specificationRepository;
|
||||
private final ProductCategoryRepositoryService categoryRepository;
|
||||
private final ProductAttributeRepositoryService attributeRepository;
|
||||
private final ProductAttributeValueRepositoryService attributeValueRepository;
|
||||
private final MediaAssetRepositoryService mediaRepository;
|
||||
private final BusinessCodeUtils codeUtils;
|
||||
/** 注入产品业务依赖。 */
|
||||
public AdminProductService(ProductRepositoryService repository,
|
||||
ProductSpecificationRepositoryService specificationRepository,
|
||||
ProductCategoryRepositoryService categoryRepository,
|
||||
ProductAttributeRepositoryService attributeRepository,
|
||||
ProductAttributeValueRepositoryService attributeValueRepository,
|
||||
MediaAssetRepositoryService mediaRepository,
|
||||
BusinessCodeUtils codeUtils) {
|
||||
this.repository = repository; this.specificationRepository = specificationRepository;
|
||||
this.categoryRepository = categoryRepository; this.attributeRepository = attributeRepository;
|
||||
this.attributeValueRepository = attributeValueRepository; this.mediaRepository = mediaRepository; this.codeUtils = codeUtils;
|
||||
}
|
||||
/** 保存产品并原子替换弱规格。 */
|
||||
@Transactional
|
||||
public String save(SaveProductAdminReq request) {
|
||||
boolean creating = request.productCode() == null || request.productCode().isBlank();
|
||||
ProductEntity entity = creating ? new ProductEntity() : repository.findByCode(request.siteCode(), request.productCode())
|
||||
.orElseThrow(() -> new BusinessException("PRODUCT_NOT_FOUND", "产品不存在"));
|
||||
if (creating) { entity.setProductCode(codeUtils.generate(BusinessCodePrefixEnum.PRODUCT)); entity.setSiteCode(request.siteCode()); }
|
||||
entity.setPrimaryCategoryCode(request.primaryCategoryCode() == null ? "" : request.primaryCategoryCode());
|
||||
entity.setProductName(request.productName()); entity.setSlug(request.slug()); entity.setModel(request.model());
|
||||
entity.setSummary(request.summary()); entity.setProductContent(request.productContent());
|
||||
entity.setCoverMediaCode(request.coverMediaCode()); entity.setFeaturedFlag(request.featured() ? 1 : 0);
|
||||
entity.setInquiryEnabled(request.inquiryEnabled() ? 1 : 0); entity.setSortNo(request.sortNo()); entity.setStatus(request.status().name());
|
||||
if (request.status().name().equals("PUBLISHED") && entity.getPublishTime() == null) entity.setPublishTime(LocalDateTime.now());
|
||||
int affected = creating ? repository.insert(entity) : repository.updateByCode(entity);
|
||||
if (affected != 1) throw new BusinessException("PRODUCT_SAVE_FAILED", "产品保存失败");
|
||||
specificationRepository.delete(entity.getSiteCode(), entity.getProductCode());
|
||||
for (ProductSpecificationAdminReq item : request.specifications() == null ? List.<ProductSpecificationAdminReq>of() : request.specifications()) {
|
||||
ProductSpecificationEntity specification = new ProductSpecificationEntity();
|
||||
specification.setSpecificationCode(codeUtils.generate(BusinessCodePrefixEnum.PRODUCT_SPECIFICATION));
|
||||
specification.setSiteCode(entity.getSiteCode()); specification.setProductCode(entity.getProductCode());
|
||||
specification.setGroupName(item.groupName()); specification.setSpecificationName(item.name());
|
||||
specification.setSpecificationValue(item.value()); specification.setUnit(item.unit()); specification.setSortNo(item.sortNo());
|
||||
if (specificationRepository.insert(specification) != 1) throw new BusinessException("PRODUCT_SPECIFICATION_SAVE_FAILED", "产品规格保存失败");
|
||||
}
|
||||
attributeValueRepository.delete(entity.getSiteCode(), entity.getProductCode());
|
||||
for (ProductAttributeValueAdminReq item : request.attributes() == null ? List.<ProductAttributeValueAdminReq>of() : request.attributes()) {
|
||||
String attributeCode = item.attributeCode();
|
||||
if (attributeCode == null || attributeCode.isBlank()) {
|
||||
if (item.attributeName() == null || item.attributeName().isBlank()) throw new BusinessException("PRODUCT_ATTRIBUTE_NAME_REQUIRED", "自定义属性名称不能为空");
|
||||
ProductAttributeEntity attribute = new ProductAttributeEntity(); attributeCode = codeUtils.generate(BusinessCodePrefixEnum.PRODUCT_ATTRIBUTE);
|
||||
attribute.setAttributeCode(attributeCode); attribute.setSiteCode(entity.getSiteCode()); attribute.setAttributeName(item.attributeName());
|
||||
attribute.setInputType("TEXT"); attribute.setUnit(item.unit()); attribute.setFilterableFlag(0); attribute.setRequiredFlag(0); attribute.setSortNo(item.sortNo()); attribute.setStatus("ENABLED");
|
||||
if (attributeRepository.insert(attribute) != 1) throw new BusinessException("PRODUCT_ATTRIBUTE_SAVE_FAILED", "产品属性保存失败");
|
||||
} else attributeRepository.find(entity.getSiteCode(), attributeCode).orElseThrow(() -> new BusinessException("PRODUCT_ATTRIBUTE_NOT_FOUND", "产品属性不存在"));
|
||||
ProductAttributeValueEntity value = new ProductAttributeValueEntity(); value.setValueCode(codeUtils.generate(BusinessCodePrefixEnum.PRODUCT_ATTRIBUTE_VALUE));
|
||||
value.setSiteCode(entity.getSiteCode()); value.setProductCode(entity.getProductCode()); value.setAttributeCode(attributeCode); value.setOptionCode(""); value.setTextValue(item.value()); value.setSortNo(item.sortNo());
|
||||
if (attributeValueRepository.insert(value) != 1) throw new BusinessException("PRODUCT_ATTRIBUTE_VALUE_SAVE_FAILED", "产品属性值保存失败");
|
||||
}
|
||||
return entity.getProductCode();
|
||||
}
|
||||
/** 查询后台产品完整编辑详情。 */
|
||||
public ProductDetailAdminRes detail(String siteCode, String productCode) {
|
||||
ProductEntity item = repository.findByCode(siteCode, productCode).orElseThrow(() -> new BusinessException("PRODUCT_NOT_FOUND", "产品不存在"));
|
||||
String mediaUrl = item.getCoverMediaCode() == null ? null : mediaRepository.find(siteCode, item.getCoverMediaCode()).map(x -> x.getRelativeUrl()).orElse(null);
|
||||
List<ProductAttributeValueAdminRes> attributes = attributeValueRepository.list(siteCode, productCode).stream().map(value -> {
|
||||
ProductAttributeEntity definition = attributeRepository.find(siteCode, value.getAttributeCode()).orElse(null);
|
||||
return new ProductAttributeValueAdminRes(value.getAttributeCode(), definition == null ? value.getAttributeCode() : definition.getAttributeName(), value.getTextValue(), definition == null ? null : definition.getUnit(), value.getSortNo());
|
||||
}).toList();
|
||||
List<ProductSpecificationAdminRes> specifications = specificationRepository.list(siteCode, productCode).stream().map(x -> new ProductSpecificationAdminRes(x.getGroupName(), x.getSpecificationName(), x.getSpecificationValue(), x.getUnit(), x.getSortNo())).toList();
|
||||
return new ProductDetailAdminRes(item.getProductCode(), item.getPrimaryCategoryCode(), item.getProductName(), item.getSlug(), item.getModel(), item.getSummary(), item.getProductContent(), item.getCoverMediaCode(), mediaUrl, item.getFeaturedFlag() == 1, item.getInquiryEnabled() == 1, item.getSortNo(), item.getStatus(), attributes, specifications);
|
||||
}
|
||||
/** 查询后台产品列表。 */
|
||||
public List<ProductItemAdminRes> list(String siteCode) {
|
||||
return repository.list(siteCode).stream().map(item -> new ProductItemAdminRes(item.getProductCode(), item.getProductName(),
|
||||
item.getSlug(), item.getModel(), item.getPrimaryCategoryCode(), item.getStatus(), item.getFeaturedFlag() == 1,
|
||||
item.getInquiryEnabled() == 1, item.getPublishTime())).toList();
|
||||
}
|
||||
/** 逻辑删除产品。 */
|
||||
@Transactional
|
||||
public void delete(String siteCode, String productCode) {
|
||||
repository.findByCode(siteCode, productCode)
|
||||
.orElseThrow(() -> new BusinessException("PRODUCT_NOT_FOUND", "产品不存在"));
|
||||
if (repository.deleteByCode(siteCode, productCode) != 1)
|
||||
throw new BusinessException("PRODUCT_DELETE_FAILED", "产品删除失败");
|
||||
}
|
||||
/** 上架或下架产品。 */
|
||||
@Transactional
|
||||
public void changeStatus(ProductStatusAdminReq request) {
|
||||
ProductEntity entity = repository.findByCode(request.siteCode(), request.productCode())
|
||||
.orElseThrow(() -> new BusinessException("PRODUCT_NOT_FOUND", "产品不存在"));
|
||||
LocalDateTime publishTime = entity.getPublishTime();
|
||||
LocalDateTime offlineTime = entity.getOfflineTime();
|
||||
if (request.status().name().equals("PUBLISHED")) {
|
||||
if (publishTime == null) publishTime = LocalDateTime.now();
|
||||
offlineTime = null;
|
||||
} else if (request.status().name().equals("OFFLINE")) {
|
||||
offlineTime = LocalDateTime.now();
|
||||
}
|
||||
if (repository.updateStatus(request.siteCode(), request.productCode(), request.status().name(), publishTime, offlineTime) != 1)
|
||||
throw new BusinessException("PRODUCT_STATUS_UPDATE_FAILED", "产品状态更新失败");
|
||||
}
|
||||
/** 保存产品分类。 */
|
||||
@Transactional
|
||||
public void saveCategory(SaveProductCategoryAdminReq request) {
|
||||
boolean creating = request.categoryCode() == null || request.categoryCode().isBlank();
|
||||
ProductCategoryEntity entity = creating ? new ProductCategoryEntity()
|
||||
: categoryRepository.findByCode(request.siteCode(), request.categoryCode())
|
||||
.orElseThrow(() -> new BusinessException("PRODUCT_CATEGORY_NOT_FOUND", "产品分类不存在"));
|
||||
if (creating) {
|
||||
entity.setCategoryCode(codeUtils.generate(BusinessCodePrefixEnum.PRODUCT_CATEGORY));
|
||||
entity.setSiteCode(request.siteCode());
|
||||
}
|
||||
String parentCategoryCode = request.parentCategoryCode() == null ? "" : request.parentCategoryCode();
|
||||
validateProductCategoryHierarchy(request.siteCode(), entity.getCategoryCode(), parentCategoryCode);
|
||||
entity.setParentCategoryCode(parentCategoryCode);
|
||||
entity.setCategoryName(request.categoryName()); entity.setSlug(request.slug());
|
||||
entity.setDescription(request.description()); entity.setCoverMediaCode(request.coverMediaCode());
|
||||
entity.setSortNo(request.sortNo()); entity.setStatus(request.status().name());
|
||||
int affected = creating ? categoryRepository.insert(entity) : categoryRepository.updateByCode(entity);
|
||||
if (affected != 1) throw new BusinessException("PRODUCT_CATEGORY_SAVE_FAILED", "产品分类保存失败");
|
||||
}
|
||||
/** 查询后台产品分类。 */
|
||||
public List<CategoryItemAdminRes> listCategories(String siteCode) {
|
||||
return categoryRepository.list(siteCode, false).stream().map(item -> new CategoryItemAdminRes(
|
||||
item.getCategoryCode(), item.getParentCategoryCode(), item.getCategoryName(), item.getSlug(),
|
||||
item.getDescription(), item.getSortNo(), item.getStatus())).toList();
|
||||
}
|
||||
/** 校验产品分类最多三级且不存在循环父子关系。 */
|
||||
private void validateProductCategoryHierarchy(String siteCode, String categoryCode, String parentCategoryCode) {
|
||||
String currentCode = parentCategoryCode;
|
||||
int parentDepth = 0;
|
||||
while (currentCode != null && !currentCode.isBlank()) {
|
||||
if (currentCode.equals(categoryCode))
|
||||
throw new BusinessException("PRODUCT_CATEGORY_CYCLE", "产品分类不能形成循环层级");
|
||||
ProductCategoryEntity parent = categoryRepository.findByCode(siteCode, currentCode)
|
||||
.orElseThrow(() -> new BusinessException("PRODUCT_CATEGORY_PARENT_NOT_FOUND", "父产品分类不存在"));
|
||||
parentDepth++;
|
||||
if (parentDepth >= 3)
|
||||
throw new BusinessException("PRODUCT_CATEGORY_DEPTH_EXCEEDED", "产品分类最多支持三级");
|
||||
currentCode = parent.getParentCategoryCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.shoplix.admin.service;
|
||||
|
||||
import com.shoplix.admin.modules.seo.req.SaveSeoAdminReq;
|
||||
import com.shoplix.admin.modules.seo.req.SeoDetailAdminReq;
|
||||
import com.shoplix.admin.modules.seo.res.SeoDetailAdminRes;
|
||||
import com.shoplix.admin.modules.seo.res.SeoHeadingAdminRes;
|
||||
import com.shoplix.common.code.enums.BusinessCodePrefixEnum;
|
||||
import com.shoplix.common.exception.BusinessException;
|
||||
import com.shoplix.common.utils.BusinessCodeUtils;
|
||||
import com.shoplix.modules.seo.dto.SeoHeadingDto;
|
||||
import com.shoplix.modules.seo.repository.entity.SeoHeadingEntity;
|
||||
import com.shoplix.modules.seo.repository.entity.SeoMetadataEntity;
|
||||
import com.shoplix.modules.seo.repository.service.SeoHeadingRepositoryService;
|
||||
import com.shoplix.modules.seo.repository.service.SeoMetadataRepositoryService;
|
||||
import com.shoplix.modules.seo.service.SeoHeadingValidator;
|
||||
import com.shoplix.modules.seo.service.SeoTargetValidator;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/** 运营后台 SEO 编辑与查询业务。 */
|
||||
@Service
|
||||
public class AdminSeoService {
|
||||
/** SEO 元数据仓储服务。 */
|
||||
private final SeoMetadataRepositoryService metadataRepository;
|
||||
/** SEO 标题仓储服务。 */
|
||||
private final SeoHeadingRepositoryService headingRepository;
|
||||
/** SEO 标题规则校验器。 */
|
||||
private final SeoHeadingValidator headingValidator;
|
||||
/** SEO 页面目标校验器。 */
|
||||
private final SeoTargetValidator targetValidator;
|
||||
/** 业务编号生成工具。 */
|
||||
private final BusinessCodeUtils codeUtils;
|
||||
|
||||
/** 注入后台 SEO 业务依赖。 */
|
||||
public AdminSeoService(SeoMetadataRepositoryService metadataRepository,
|
||||
SeoHeadingRepositoryService headingRepository,
|
||||
SeoHeadingValidator headingValidator, SeoTargetValidator targetValidator,
|
||||
BusinessCodeUtils codeUtils) {
|
||||
this.metadataRepository = metadataRepository;
|
||||
this.headingRepository = headingRepository;
|
||||
this.headingValidator = headingValidator;
|
||||
this.targetValidator = targetValidator;
|
||||
this.codeUtils = codeUtils;
|
||||
}
|
||||
|
||||
/** 新增或更新页面 SEO,并原子替换标题层级。 */
|
||||
@Transactional
|
||||
public void save(SaveSeoAdminReq request) {
|
||||
targetValidator.validate(request.pageType(), request.targetCode());
|
||||
List<SeoHeadingDto> headingDtos = request.headings() == null ? List.of()
|
||||
: request.headings().stream()
|
||||
.map(item -> new SeoHeadingDto(item.level(), item.text(), item.sortNo())).toList();
|
||||
headingValidator.validate(request.h1(), headingDtos);
|
||||
String targetCode = normalizeTargetCode(request.targetCode());
|
||||
SeoMetadataEntity entity = metadataRepository
|
||||
.find(request.siteCode(), request.pageType().name(), targetCode)
|
||||
.orElseGet(SeoMetadataEntity::new);
|
||||
boolean creating = entity.getSeoCode() == null;
|
||||
if (creating) {
|
||||
entity.setSeoCode(codeUtils.generate(BusinessCodePrefixEnum.SEO));
|
||||
entity.setSiteCode(request.siteCode());
|
||||
entity.setPageType(request.pageType().name());
|
||||
entity.setTargetCode(targetCode);
|
||||
}
|
||||
copyRequest(request, entity);
|
||||
int affected = creating ? metadataRepository.insert(entity) : metadataRepository.updateByCode(entity);
|
||||
if (affected != 1) {
|
||||
throw new BusinessException("SEO_SAVE_FAILED", "SEO配置保存失败");
|
||||
}
|
||||
headingRepository.deleteBySeoCode(entity.getSeoCode());
|
||||
for (SeoHeadingDto heading : headingDtos) {
|
||||
SeoHeadingEntity headingEntity = new SeoHeadingEntity();
|
||||
headingEntity.setHeadingCode(codeUtils.generate(BusinessCodePrefixEnum.SEO_HEADING));
|
||||
headingEntity.setSeoCode(entity.getSeoCode());
|
||||
headingEntity.setHeadingLevel(heading.level());
|
||||
headingEntity.setHeadingText(heading.text());
|
||||
headingEntity.setSortNo(heading.sortNo());
|
||||
if (headingRepository.insert(headingEntity) != 1) {
|
||||
throw new BusinessException("SEO_HEADING_SAVE_FAILED", "SEO标题保存失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询后台 SEO 详情。 */
|
||||
public SeoDetailAdminRes detail(SeoDetailAdminReq request) {
|
||||
SeoMetadataEntity entity = metadataRepository
|
||||
.find(request.siteCode(), request.pageType().name(), normalizeTargetCode(request.targetCode()))
|
||||
.orElseThrow(() -> new BusinessException("SEO_NOT_FOUND", "SEO配置不存在"));
|
||||
List<SeoHeadingAdminRes> headings = headingRepository.listBySeoCode(entity.getSeoCode()).stream()
|
||||
.map(item -> new SeoHeadingAdminRes(item.getHeadingLevel(), item.getHeadingText(), item.getSortNo()))
|
||||
.toList();
|
||||
return new SeoDetailAdminRes(entity.getSeoCode(), entity.getSiteCode(), entity.getPageType(),
|
||||
entity.getTargetCode(), entity.getTitle(), entity.getDescription(), entity.getKeywords(),
|
||||
entity.getH1(), entity.getCanonicalUrl(), entity.getRobots(), entity.getOgTitle(),
|
||||
entity.getOgDescription(), entity.getOgImageUrl(), entity.getStructuredData(),
|
||||
entity.getStatus(), headings);
|
||||
}
|
||||
|
||||
/** 将请求允许编辑的字段复制到实体。 */
|
||||
private void copyRequest(SaveSeoAdminReq request, SeoMetadataEntity entity) {
|
||||
entity.setTitle(request.title());
|
||||
entity.setDescription(request.description());
|
||||
entity.setKeywords(request.keywords());
|
||||
entity.setH1(request.h1());
|
||||
entity.setCanonicalUrl(request.canonicalUrl());
|
||||
entity.setRobots(request.robots());
|
||||
entity.setOgTitle(request.ogTitle());
|
||||
entity.setOgDescription(request.ogDescription());
|
||||
entity.setOgImageUrl(request.ogImageUrl());
|
||||
entity.setStructuredData(request.structuredData());
|
||||
entity.setStatus(request.status().name());
|
||||
}
|
||||
|
||||
/** 将首页等无目标页面的编号统一为空字符串。 */
|
||||
private String normalizeTargetCode(String targetCode) {
|
||||
return targetCode == null ? "" : targetCode.trim();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
server:
|
||||
port: 8081
|
||||
spring:
|
||||
application:
|
||||
name: shoplix-admin
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 10MB
|
||||
max-request-size: 12MB
|
||||
datasource:
|
||||
url: jdbc:mysql://127.0.0.1:3306/shoplix?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&allowPublicKeyRetrieval=true&useSSL=false
|
||||
username: shoplix
|
||||
password: Shoplix_Local_2026!
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
flyway:
|
||||
enabled: true
|
||||
locations: classpath:db/migration
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
global-config:
|
||||
db-config:
|
||||
logic-delete-field: deleted
|
||||
logic-delete-value: 1
|
||||
logic-not-delete-value: 0
|
||||
shoplix:
|
||||
code:
|
||||
worker-id: 1
|
||||
@@ -0,0 +1,125 @@
|
||||
CREATE TABLE sys_site (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '站点业务编号',
|
||||
site_name VARCHAR(100) NOT NULL COMMENT '站点名称',
|
||||
timezone VARCHAR(50) NOT NULL DEFAULT 'UTC' COMMENT '站点展示时区',
|
||||
status VARCHAR(20) NOT NULL COMMENT '站点状态:ENABLED启用,DISABLED停用',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_site_code (site_code)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='前台站点';
|
||||
|
||||
CREATE TABLE sys_site_domain (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
domain_code VARCHAR(16) NOT NULL COMMENT '域名业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '关联站点业务编号',
|
||||
domain VARCHAR(255) NOT NULL COMMENT '小写规范化域名,不含协议和端口',
|
||||
primary_flag TINYINT NOT NULL DEFAULT 0 COMMENT '主域名标识:0否,1是',
|
||||
force_https TINYINT NOT NULL DEFAULT 1 COMMENT '强制HTTPS标识:0否,1是',
|
||||
status VARCHAR(20) NOT NULL COMMENT '域名状态:PENDING待验证,ENABLED启用,DISABLED停用',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_site_domain_code (domain_code),
|
||||
UNIQUE KEY uk_site_domain_domain (domain),
|
||||
KEY idx_site_domain_site_status (site_code, status)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='站点域名绑定';
|
||||
|
||||
CREATE TABLE page (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
page_code VARCHAR(16) NOT NULL COMMENT '页面业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
page_type VARCHAR(20) NOT NULL COMMENT '页面类型:SYSTEM_PAGE固定系统页面,CUSTOM_PAGE运营自定义页面',
|
||||
system_page_type VARCHAR(30) NULL COMMENT '固定页面类型:ABOUT_US关于我们,CONTACT_US联系我们,TERMS_OF_SERVICE服务协议,PRIVACY_POLICY隐私协议,COOKIE_POLICY Cookie协议,INQUIRY_SUCCESS询盘成功页;自定义页面为空',
|
||||
page_name VARCHAR(100) NOT NULL COMMENT '运营后台页面名称',
|
||||
slug VARCHAR(100) NOT NULL COMMENT '页面英文路径标识',
|
||||
status VARCHAR(20) NOT NULL COMMENT '发布状态:DRAFT草稿,PUBLISHED已发布,OFFLINE已下线',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_page_code (page_code),
|
||||
UNIQUE KEY uk_page_site_slug (site_code, slug),
|
||||
UNIQUE KEY uk_page_site_system_type (site_code, system_page_type),
|
||||
KEY idx_page_site_status (site_code, status)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='固定页面和自定义页面';
|
||||
|
||||
CREATE TABLE seo_metadata (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
seo_code VARCHAR(16) NOT NULL COMMENT 'SEO配置业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
page_type VARCHAR(30) NOT NULL COMMENT 'SEO页面类型:HOME首页,列表页,分类页,详情页,SYSTEM_PAGE固定页面,CUSTOM_PAGE自定义页面',
|
||||
target_code VARCHAR(16) NOT NULL DEFAULT '' COMMENT '关联页面、分类或内容业务编号,首页和公共列表为空字符串',
|
||||
title VARCHAR(70) NOT NULL COMMENT 'SEO标题,建议不超过70个字符',
|
||||
description VARCHAR(160) NOT NULL COMMENT 'SEO描述,建议不超过160个字符',
|
||||
keywords VARCHAR(255) NULL COMMENT 'SEO关键词,英文逗号分隔',
|
||||
h1 VARCHAR(120) NOT NULL COMMENT '页面唯一H1一级标题',
|
||||
canonical_url VARCHAR(500) NULL COMMENT '规范页面完整地址',
|
||||
robots VARCHAR(100) NOT NULL DEFAULT 'index,follow' COMMENT '搜索引擎索引指令',
|
||||
og_title VARCHAR(100) NULL COMMENT 'Open Graph标题',
|
||||
og_description VARCHAR(200) NULL COMMENT 'Open Graph描述',
|
||||
og_image_url VARCHAR(500) NULL COMMENT 'Open Graph图片地址',
|
||||
structured_data JSON NULL COMMENT 'JSON-LD结构化数据',
|
||||
status VARCHAR(20) NOT NULL COMMENT '发布状态:DRAFT草稿,PUBLISHED已发布,OFFLINE已下线',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_seo_metadata_code (seo_code),
|
||||
UNIQUE KEY uk_seo_metadata_page (site_code, page_type, target_code),
|
||||
KEY idx_seo_metadata_site_status (site_code, status)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='页面SEO元数据';
|
||||
|
||||
CREATE TABLE seo_heading (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
heading_code VARCHAR(16) NOT NULL COMMENT 'SEO标题业务编号',
|
||||
seo_code VARCHAR(16) NOT NULL COMMENT '关联SEO配置业务编号',
|
||||
heading_level TINYINT NOT NULL COMMENT '标题层级:2表示H2,3表示H3',
|
||||
heading_text VARCHAR(200) NOT NULL COMMENT '标题文本',
|
||||
sort_no INT NOT NULL DEFAULT 0 COMMENT '页面出现顺序',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_seo_heading_code (heading_code),
|
||||
KEY idx_seo_heading_seo_sort (seo_code, sort_no)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='页面H2和H3标题';
|
||||
|
||||
CREATE TABLE navigation (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
navigation_code VARCHAR(16) NOT NULL COMMENT '导航业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
navigation_name VARCHAR(100) NOT NULL COMMENT '运营后台导航名称',
|
||||
position VARCHAR(20) NOT NULL COMMENT '导航位置:HEADER页头,FOOTER页脚,MOBILE移动端,SIDEBAR侧边栏',
|
||||
status VARCHAR(20) NOT NULL COMMENT '发布状态:DRAFT草稿,PUBLISHED已发布,OFFLINE已下线',
|
||||
published_version INT NOT NULL DEFAULT 0 COMMENT '当前发布版本号',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_navigation_code (navigation_code),
|
||||
UNIQUE KEY uk_navigation_site_position (site_code, position)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='站点导航';
|
||||
|
||||
CREATE TABLE navigation_item (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
item_code VARCHAR(16) NOT NULL COMMENT '导航项业务编号',
|
||||
navigation_code VARCHAR(16) NOT NULL COMMENT '关联导航业务编号',
|
||||
parent_item_code VARCHAR(16) NOT NULL DEFAULT '' COMMENT '父导航项业务编号,顶级为空字符串',
|
||||
item_type VARCHAR(30) NOT NULL COMMENT '导航目标类型:HOME首页,PRODUCT_CATEGORY产品分类,PRODUCT产品,CASE_CATEGORY案例分类,CASE案例,NEWS_CATEGORY新闻分类,NEWS新闻,CUSTOM_PAGE自定义页面,EXTERNAL_LINK外部链接',
|
||||
title VARCHAR(100) NOT NULL COMMENT '英文导航标题',
|
||||
target_code VARCHAR(16) NOT NULL DEFAULT '' COMMENT '内部页面目标业务编号',
|
||||
custom_url VARCHAR(500) NULL COMMENT '自定义或外部链接地址',
|
||||
open_type VARCHAR(20) NOT NULL DEFAULT 'CURRENT' COMMENT '打开方式:CURRENT当前窗口,NEW新窗口',
|
||||
visible TINYINT NOT NULL DEFAULT 1 COMMENT '显示状态:0隐藏,1显示',
|
||||
sort_no INT NOT NULL DEFAULT 0 COMMENT '同级排序值',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_navigation_item_code (item_code),
|
||||
KEY idx_navigation_item_tree (navigation_code, parent_item_code, sort_no)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='站点导航项';
|
||||
@@ -0,0 +1,238 @@
|
||||
ALTER TABLE page
|
||||
ADD COLUMN page_content LONGTEXT NULL COMMENT '页面英文富文本内容' AFTER slug,
|
||||
ADD COLUMN summary VARCHAR(500) NULL COMMENT '页面英文摘要' AFTER page_content,
|
||||
ADD COLUMN cover_media_code VARCHAR(16) NULL COMMENT '页面封面媒体业务编号' AFTER summary,
|
||||
ADD COLUMN sort_no INT NOT NULL DEFAULT 0 COMMENT '页面排序值' AFTER cover_media_code,
|
||||
ADD COLUMN publish_time DATETIME(3) NULL COMMENT '发布时间' AFTER status,
|
||||
ADD COLUMN offline_time DATETIME(3) NULL COMMENT '下线时间' AFTER publish_time,
|
||||
ADD COLUMN published_version INT NOT NULL DEFAULT 0 COMMENT '已发布版本号' AFTER offline_time;
|
||||
|
||||
CREATE TABLE content_category (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
category_code VARCHAR(16) NOT NULL COMMENT '内容分类业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
content_type VARCHAR(20) NOT NULL COMMENT '内容类型:NEWS新闻,CASE案例,HELP帮助',
|
||||
parent_category_code VARCHAR(16) NOT NULL DEFAULT '' COMMENT '父分类业务编号,顶级为空字符串',
|
||||
category_name VARCHAR(100) NOT NULL COMMENT '英文分类名称',
|
||||
slug VARCHAR(100) NOT NULL COMMENT '英文路径标识',
|
||||
description VARCHAR(500) NULL COMMENT '英文分类描述',
|
||||
cover_media_code VARCHAR(16) NULL COMMENT '分类封面媒体业务编号',
|
||||
sort_no INT NOT NULL DEFAULT 0 COMMENT '同级排序值',
|
||||
status VARCHAR(20) NOT NULL COMMENT '状态:DRAFT草稿,PUBLISHED已发布,OFFLINE已下线',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_content_category_code (category_code),
|
||||
UNIQUE KEY uk_content_category_site_type_slug (site_code, content_type, slug),
|
||||
KEY idx_content_category_tree (site_code, content_type, parent_category_code, sort_no)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='新闻案例帮助统一分类';
|
||||
|
||||
CREATE TABLE content (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
content_code VARCHAR(16) NOT NULL COMMENT '内容业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
content_type VARCHAR(20) NOT NULL COMMENT '内容类型:NEWS新闻,CASE案例,HELP帮助',
|
||||
primary_category_code VARCHAR(16) NOT NULL DEFAULT '' COMMENT '主分类业务编号,用于面包屑和Canonical',
|
||||
title VARCHAR(200) NOT NULL COMMENT '英文标题',
|
||||
slug VARCHAR(120) NOT NULL COMMENT '英文路径标识',
|
||||
summary VARCHAR(500) NULL COMMENT '英文摘要',
|
||||
content_body LONGTEXT NOT NULL COMMENT '英文富文本正文',
|
||||
cover_media_code VARCHAR(16) NULL COMMENT '封面媒体业务编号',
|
||||
author_name VARCHAR(100) NULL COMMENT '作者名称',
|
||||
source_name VARCHAR(100) NULL COMMENT '内容来源名称',
|
||||
featured_flag TINYINT NOT NULL DEFAULT 0 COMMENT '推荐标识:0否,1是',
|
||||
sort_no INT NOT NULL DEFAULT 0 COMMENT '排序值',
|
||||
status VARCHAR(20) NOT NULL COMMENT '状态:DRAFT草稿,PUBLISHED已发布,OFFLINE已下线',
|
||||
publish_time DATETIME(3) NULL COMMENT '发布时间',
|
||||
offline_time DATETIME(3) NULL COMMENT '下线时间',
|
||||
view_count BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '页面浏览次数',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_content_code (content_code),
|
||||
UNIQUE KEY uk_content_site_type_slug (site_code, content_type, slug),
|
||||
KEY idx_content_site_type_status_publish (site_code, content_type, status, publish_time),
|
||||
KEY idx_content_primary_category (site_code, content_type, primary_category_code, status)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='新闻案例帮助统一内容';
|
||||
|
||||
CREATE TABLE content_category_relation (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
relation_code VARCHAR(16) NOT NULL COMMENT '内容分类关系业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
content_code VARCHAR(16) NOT NULL COMMENT '内容业务编号',
|
||||
category_code VARCHAR(16) NOT NULL COMMENT '内容分类业务编号',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_content_category_relation_code (relation_code),
|
||||
UNIQUE KEY uk_content_category_relation (site_code, content_code, category_code),
|
||||
KEY idx_content_category_relation_category (site_code, category_code, content_code)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='内容与分类关系';
|
||||
|
||||
CREATE TABLE content_product_relation (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
relation_code VARCHAR(16) NOT NULL COMMENT '内容产品关系业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
content_code VARCHAR(16) NOT NULL COMMENT '案例等内容业务编号',
|
||||
product_code VARCHAR(16) NOT NULL COMMENT '关联产品业务编号',
|
||||
sort_no INT NOT NULL DEFAULT 0 COMMENT '关联产品排序值',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_content_product_relation_code (relation_code),
|
||||
UNIQUE KEY uk_content_product_relation (site_code, content_code, product_code)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='案例等内容关联产品';
|
||||
|
||||
CREATE TABLE product_category (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
category_code VARCHAR(16) NOT NULL COMMENT '产品分类业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
parent_category_code VARCHAR(16) NOT NULL DEFAULT '' COMMENT '父分类业务编号,顶级为空字符串',
|
||||
category_name VARCHAR(100) NOT NULL COMMENT '英文分类名称',
|
||||
slug VARCHAR(100) NOT NULL COMMENT '英文路径标识',
|
||||
description VARCHAR(500) NULL COMMENT '英文分类描述',
|
||||
cover_media_code VARCHAR(16) NULL COMMENT '分类封面媒体业务编号',
|
||||
sort_no INT NOT NULL DEFAULT 0 COMMENT '同级排序值',
|
||||
status VARCHAR(20) NOT NULL COMMENT '状态:DRAFT草稿,PUBLISHED已发布,OFFLINE已下线',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_product_category_code (category_code),
|
||||
UNIQUE KEY uk_product_category_site_slug (site_code, slug),
|
||||
KEY idx_product_category_tree (site_code, parent_category_code, sort_no)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='产品分类';
|
||||
|
||||
CREATE TABLE product (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
product_code VARCHAR(16) NOT NULL COMMENT '产品业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
primary_category_code VARCHAR(16) NOT NULL DEFAULT '' COMMENT '主分类业务编号',
|
||||
product_name VARCHAR(200) NOT NULL COMMENT '英文产品名称',
|
||||
slug VARCHAR(120) NOT NULL COMMENT '英文路径标识',
|
||||
model VARCHAR(100) NULL COMMENT '产品型号',
|
||||
summary VARCHAR(500) NULL COMMENT '英文产品摘要',
|
||||
product_content LONGTEXT NOT NULL COMMENT '英文产品详情',
|
||||
cover_media_code VARCHAR(16) NULL COMMENT '封面媒体业务编号',
|
||||
featured_flag TINYINT NOT NULL DEFAULT 0 COMMENT '推荐标识:0否,1是',
|
||||
inquiry_enabled TINYINT NOT NULL DEFAULT 1 COMMENT '询盘启用标识:0关闭,1启用',
|
||||
sort_no INT NOT NULL DEFAULT 0 COMMENT '排序值',
|
||||
status VARCHAR(20) NOT NULL COMMENT '状态:DRAFT草稿,PUBLISHED已发布,OFFLINE已下线',
|
||||
publish_time DATETIME(3) NULL COMMENT '发布时间',
|
||||
offline_time DATETIME(3) NULL COMMENT '下线时间',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_product_code (product_code),
|
||||
UNIQUE KEY uk_product_site_slug (site_code, slug),
|
||||
KEY idx_product_site_status_sort (site_code, status, sort_no),
|
||||
KEY idx_product_primary_category (site_code, primary_category_code, status)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='B2B产品';
|
||||
|
||||
CREATE TABLE product_category_relation (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
relation_code VARCHAR(16) NOT NULL COMMENT '产品分类关系业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
product_code VARCHAR(16) NOT NULL COMMENT '产品业务编号',
|
||||
category_code VARCHAR(16) NOT NULL COMMENT '产品分类业务编号',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_product_category_relation_code (relation_code),
|
||||
UNIQUE KEY uk_product_category_relation (site_code, product_code, category_code)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='产品与分类关系';
|
||||
|
||||
CREATE TABLE product_attribute (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
attribute_code VARCHAR(16) NOT NULL COMMENT '产品属性业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
attribute_name VARCHAR(100) NOT NULL COMMENT '英文属性名称',
|
||||
input_type VARCHAR(20) NOT NULL COMMENT '输入类型:TEXT文本,NUMBER数字,SINGLE_SELECT单选,MULTI_SELECT多选,BOOLEAN布尔',
|
||||
unit VARCHAR(30) NULL COMMENT '属性单位',
|
||||
filterable_flag TINYINT NOT NULL DEFAULT 0 COMMENT '前台筛选标识:0否,1是',
|
||||
required_flag TINYINT NOT NULL DEFAULT 0 COMMENT '必填标识:0否,1是',
|
||||
sort_no INT NOT NULL DEFAULT 0 COMMENT '属性排序值',
|
||||
status VARCHAR(20) NOT NULL COMMENT '状态:ENABLED启用,DISABLED停用',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_product_attribute_code (attribute_code),
|
||||
UNIQUE KEY uk_product_attribute_site_name (site_code, attribute_name),
|
||||
KEY idx_product_attribute_site_status (site_code, status, sort_no)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='产品属性定义';
|
||||
|
||||
CREATE TABLE product_attribute_option (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
option_code VARCHAR(16) NOT NULL COMMENT '属性选项业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
attribute_code VARCHAR(16) NOT NULL COMMENT '产品属性业务编号',
|
||||
option_name VARCHAR(100) NOT NULL COMMENT '英文选项名称',
|
||||
sort_no INT NOT NULL DEFAULT 0 COMMENT '选项排序值',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_product_attribute_option_code (option_code),
|
||||
UNIQUE KEY uk_product_attribute_option_name (site_code, attribute_code, option_name)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='产品属性选项';
|
||||
|
||||
CREATE TABLE product_attribute_value (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
value_code VARCHAR(16) NOT NULL COMMENT '产品属性值业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
product_code VARCHAR(16) NOT NULL COMMENT '产品业务编号',
|
||||
attribute_code VARCHAR(16) NOT NULL COMMENT '产品属性业务编号',
|
||||
option_code VARCHAR(16) NOT NULL DEFAULT '' COMMENT '选择型属性选项业务编号',
|
||||
text_value VARCHAR(500) NULL COMMENT '文本属性值',
|
||||
number_value DECIMAL(20,6) NULL COMMENT '数字属性值',
|
||||
boolean_value TINYINT NULL COMMENT '布尔属性值:0否,1是',
|
||||
sort_no INT NOT NULL DEFAULT 0 COMMENT '多值属性排序值',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_product_attribute_value_code (value_code),
|
||||
KEY idx_product_attribute_value_product (site_code, product_code, attribute_code),
|
||||
KEY idx_product_attribute_value_filter (site_code, attribute_code, option_code, number_value)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='产品属性值';
|
||||
|
||||
CREATE TABLE product_specification (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
specification_code VARCHAR(16) NOT NULL COMMENT '产品规格业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
product_code VARCHAR(16) NOT NULL COMMENT '产品业务编号',
|
||||
group_name VARCHAR(100) NULL COMMENT '英文规格分组名称',
|
||||
specification_name VARCHAR(100) NOT NULL COMMENT '英文规格名称',
|
||||
specification_value VARCHAR(500) NOT NULL COMMENT '英文规格展示值',
|
||||
unit VARCHAR(30) NULL COMMENT '规格单位',
|
||||
sort_no INT NOT NULL DEFAULT 0 COMMENT '规格排序值',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_product_specification_code (specification_code),
|
||||
KEY idx_product_specification_product (site_code, product_code, sort_no)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='产品弱规格展示参数';
|
||||
|
||||
CREATE TABLE product_relation (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
relation_code VARCHAR(16) NOT NULL COMMENT '关联产品关系业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
product_code VARCHAR(16) NOT NULL COMMENT '产品业务编号',
|
||||
related_product_code VARCHAR(16) NOT NULL COMMENT '关联产品业务编号',
|
||||
relation_type VARCHAR(20) NOT NULL COMMENT '关系类型:RELATED相关产品,RECOMMENDED推荐产品',
|
||||
sort_no INT NOT NULL DEFAULT 0 COMMENT '关联排序值',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_product_relation_code (relation_code),
|
||||
UNIQUE KEY uk_product_relation_pair (site_code, product_code, related_product_code, relation_type)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='相关及推荐产品关系';
|
||||
@@ -0,0 +1,174 @@
|
||||
CREATE TABLE inquiry_setting (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
setting_code VARCHAR(16) NOT NULL COMMENT '询盘设置业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
inquiry_enabled TINYINT NOT NULL DEFAULT 1 COMMENT '询盘启用状态:0关闭,1启用',
|
||||
captcha_enabled TINYINT NOT NULL DEFAULT 0 COMMENT '验证码启用状态:0关闭,1启用',
|
||||
privacy_consent_required TINYINT NOT NULL DEFAULT 1 COMMENT '隐私授权必填状态:0否,1是',
|
||||
duplicate_window_minutes INT NOT NULL DEFAULT 30 COMMENT '重复提交识别时间窗口,单位分钟',
|
||||
ip_hour_limit INT NOT NULL DEFAULT 10 COMMENT '同一IP哈希每小时允许提交次数',
|
||||
email_day_limit INT NOT NULL DEFAULT 20 COMMENT '同一邮箱每天允许提交次数',
|
||||
attachment_enabled TINYINT NOT NULL DEFAULT 0 COMMENT '附件启用状态:0关闭,1启用',
|
||||
max_attachment_count INT NOT NULL DEFAULT 3 COMMENT '单次提交最大附件数量',
|
||||
max_attachment_size BIGINT NOT NULL DEFAULT 10485760 COMMENT '单个附件最大字节数',
|
||||
allowed_attachment_types VARCHAR(500) NULL COMMENT '允许附件扩展名,英文逗号分隔',
|
||||
success_action VARCHAR(20) NOT NULL DEFAULT 'MESSAGE' COMMENT '成功动作:MESSAGE提示,PAGE页面,URL地址',
|
||||
success_page_code VARCHAR(16) NOT NULL DEFAULT '' COMMENT '询盘成功页面业务编号',
|
||||
success_redirect_url VARCHAR(500) NULL COMMENT '成功后外部跳转地址',
|
||||
notification_enabled TINYINT NOT NULL DEFAULT 1 COMMENT '负责人通知启用状态:0关闭,1启用',
|
||||
auto_reply_enabled TINYINT NOT NULL DEFAULT 0 COMMENT '客户自动回复启用状态:0关闭,1启用',
|
||||
auto_reply_subject VARCHAR(200) NULL COMMENT '客户自动回复英文主题',
|
||||
auto_reply_content LONGTEXT NULL COMMENT '客户自动回复英文内容',
|
||||
data_retention_days INT NOT NULL DEFAULT 730 COMMENT '询盘数据保留天数',
|
||||
status VARCHAR(20) NOT NULL COMMENT '配置状态:ENABLED启用,DISABLED停用',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id), UNIQUE KEY uk_inquiry_setting_code (setting_code),
|
||||
UNIQUE KEY uk_inquiry_setting_site (site_code)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='站点询盘设置';
|
||||
|
||||
CREATE TABLE inquiry_notification_receiver (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
receiver_code VARCHAR(16) NOT NULL COMMENT '通知接收人业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
receiver_name VARCHAR(100) NOT NULL COMMENT '接收人名称',
|
||||
receiver_email VARCHAR(200) NOT NULL COMMENT '接收邮箱',
|
||||
status VARCHAR(20) NOT NULL COMMENT '状态:ENABLED启用,DISABLED停用',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id), UNIQUE KEY uk_inquiry_receiver_code (receiver_code),
|
||||
UNIQUE KEY uk_inquiry_receiver_email (site_code, receiver_email)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='询盘通知接收人';
|
||||
|
||||
CREATE TABLE inquiry_form (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
form_code VARCHAR(16) NOT NULL COMMENT '询盘表单业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
form_name VARCHAR(100) NOT NULL COMMENT '运营后台表单名称',
|
||||
form_scene VARCHAR(20) NOT NULL COMMENT '表单场景:GENERAL通用,PRODUCT产品,CONTENT内容,PAGE页面,CONTACT联系',
|
||||
submit_button_text VARCHAR(100) NOT NULL DEFAULT 'Submit Inquiry' COMMENT '英文提交按钮文字',
|
||||
success_message VARCHAR(500) NOT NULL COMMENT '英文提交成功提示',
|
||||
privacy_page_code VARCHAR(16) NOT NULL DEFAULT '' COMMENT '隐私政策页面业务编号',
|
||||
status VARCHAR(20) NOT NULL COMMENT '发布状态:DRAFT草稿,PUBLISHED已发布,OFFLINE已下线',
|
||||
published_version INT NOT NULL DEFAULT 0 COMMENT '已发布版本号',
|
||||
sort_no INT NOT NULL DEFAULT 0 COMMENT '排序值',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id), UNIQUE KEY uk_inquiry_form_code (form_code),
|
||||
KEY idx_inquiry_form_scene (site_code, form_scene, status, sort_no)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='站点询盘表单';
|
||||
|
||||
CREATE TABLE inquiry_form_field (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
field_code VARCHAR(16) NOT NULL COMMENT '表单字段业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
form_code VARCHAR(16) NOT NULL COMMENT '所属表单业务编号',
|
||||
field_key VARCHAR(60) NOT NULL COMMENT '稳定字段键',
|
||||
field_label VARCHAR(100) NOT NULL COMMENT '英文字段标签',
|
||||
field_type VARCHAR(30) NOT NULL COMMENT '字段类型:TEXT文本,TEXTAREA多行,EMAIL邮箱,PHONE电话,NUMBER数字,SINGLE_SELECT单选,MULTI_SELECT多选,RADIO单选框,CHECKBOX复选框,FILE文件,COUNTRY国家',
|
||||
placeholder VARCHAR(200) NULL COMMENT '英文占位提示',
|
||||
help_text VARCHAR(300) NULL COMMENT '英文帮助提示',
|
||||
required_flag TINYINT NOT NULL DEFAULT 0 COMMENT '必填状态:0否,1是',
|
||||
system_field_flag TINYINT NOT NULL DEFAULT 0 COMMENT '系统字段状态:0自定义,1系统字段',
|
||||
validation_rule VARCHAR(500) NULL COMMENT '字段校验规则JSON',
|
||||
options_json JSON NULL COMMENT '选择项JSON数组',
|
||||
default_value VARCHAR(500) NULL COMMENT '默认值',
|
||||
width_type VARCHAR(20) NOT NULL DEFAULT 'FULL' COMMENT '展示宽度:FULL整行,HALF半行',
|
||||
sort_no INT NOT NULL DEFAULT 0 COMMENT '排序值',
|
||||
status VARCHAR(20) NOT NULL COMMENT '状态:ENABLED启用,DISABLED停用',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id), UNIQUE KEY uk_inquiry_field_code (field_code),
|
||||
UNIQUE KEY uk_inquiry_field_key (site_code, form_code, field_key),
|
||||
KEY idx_inquiry_field_form (site_code, form_code, status, sort_no)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='询盘表单字段';
|
||||
|
||||
CREATE TABLE inquiry_record (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
inquiry_code VARCHAR(16) NOT NULL COMMENT '询盘业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
form_code VARCHAR(16) NOT NULL COMMENT '提交表单业务编号',
|
||||
form_version INT NOT NULL COMMENT '提交时表单版本号',
|
||||
source_type VARCHAR(20) NOT NULL COMMENT '来源类型:GENERAL通用,PRODUCT产品,CONTENT内容,PAGE页面,CONTACT联系',
|
||||
source_code VARCHAR(16) NOT NULL DEFAULT '' COMMENT '来源业务编号',
|
||||
source_url VARCHAR(1000) NULL COMMENT '提交页面地址',
|
||||
product_code VARCHAR(16) NOT NULL DEFAULT '' COMMENT '关联产品业务编号',
|
||||
product_name_snapshot VARCHAR(200) NULL COMMENT '提交时产品英文名称快照',
|
||||
customer_name VARCHAR(100) NOT NULL COMMENT '客户姓名',
|
||||
customer_email VARCHAR(200) NOT NULL COMMENT '客户邮箱',
|
||||
email_hash CHAR(64) NOT NULL COMMENT '规范化邮箱SHA-256摘要',
|
||||
customer_phone VARCHAR(60) NULL COMMENT '客户电话',
|
||||
company_name VARCHAR(200) NULL COMMENT '公司名称',
|
||||
country_code VARCHAR(10) NULL COMMENT '国家或地区代码',
|
||||
message TEXT NOT NULL COMMENT '客户询盘正文',
|
||||
status VARCHAR(20) NOT NULL COMMENT '状态:NEW新询盘,VALID有效,FOLLOWING跟进中,QUOTED已报价,WON成交,LOST丢单,SPAM垃圾,CLOSED关闭',
|
||||
priority VARCHAR(20) NOT NULL DEFAULT 'NORMAL' COMMENT '优先级:LOW低,NORMAL普通,HIGH高,URGENT紧急',
|
||||
owner_user_code VARCHAR(16) NOT NULL DEFAULT '' COMMENT '负责人用户业务编号',
|
||||
crm_lead_code VARCHAR(16) NOT NULL DEFAULT '' COMMENT '转化CRM线索业务编号',
|
||||
utm_source VARCHAR(200) NULL COMMENT 'UTM来源', utm_medium VARCHAR(200) NULL COMMENT 'UTM媒介',
|
||||
utm_campaign VARCHAR(200) NULL COMMENT 'UTM活动', utm_content VARCHAR(200) NULL COMMENT 'UTM内容',
|
||||
utm_term VARCHAR(200) NULL COMMENT 'UTM关键词', referrer_url VARCHAR(1000) NULL COMMENT '来源页面地址',
|
||||
landing_url VARCHAR(1000) NULL COMMENT '首次落地页面地址', ip_hash CHAR(64) NOT NULL COMMENT '访问IP加盐SHA-256摘要',
|
||||
user_agent VARCHAR(1000) NULL COMMENT '浏览器User-Agent', device_type VARCHAR(20) NULL COMMENT '设备类型',
|
||||
privacy_consent_flag TINYINT NOT NULL COMMENT '隐私授权状态:0未授权,1已授权',
|
||||
privacy_consent_time DATETIME(3) NULL COMMENT '隐私授权时间',
|
||||
duplicate_flag TINYINT NOT NULL DEFAULT 0 COMMENT '重复询盘标识:0否,1是',
|
||||
spam_flag TINYINT NOT NULL DEFAULT 0 COMMENT '垃圾询盘标识:0否,1是',
|
||||
spam_reason VARCHAR(500) NULL COMMENT '垃圾询盘识别原因',
|
||||
first_follow_time DATETIME(3) NULL COMMENT '首次跟进时间', last_follow_time DATETIME(3) NULL COMMENT '最近跟进时间',
|
||||
next_follow_time DATETIME(3) NULL COMMENT '下次跟进时间', close_time DATETIME(3) NULL COMMENT '关闭时间',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id), UNIQUE KEY uk_inquiry_record_code (inquiry_code),
|
||||
KEY idx_inquiry_record_site_status (site_code, status, create_time),
|
||||
KEY idx_inquiry_record_email (site_code, email_hash, create_time),
|
||||
KEY idx_inquiry_record_ip (site_code, ip_hash, create_time),
|
||||
KEY idx_inquiry_record_owner (site_code, owner_user_code, status, create_time)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='客户原始询盘记录';
|
||||
|
||||
CREATE TABLE inquiry_field_value (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键', value_code VARCHAR(16) NOT NULL COMMENT '字段值业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号', inquiry_code VARCHAR(16) NOT NULL COMMENT '询盘业务编号',
|
||||
field_code VARCHAR(16) NOT NULL COMMENT '表单字段业务编号', field_key VARCHAR(60) NOT NULL COMMENT '提交时字段键快照',
|
||||
field_label_snapshot VARCHAR(100) NOT NULL COMMENT '提交时英文标签快照', field_type_snapshot VARCHAR(30) NOT NULL COMMENT '提交时字段类型快照',
|
||||
field_value TEXT NULL COMMENT '规范化字段值', sort_no INT NOT NULL DEFAULT 0 COMMENT '排序值',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间', update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id), UNIQUE KEY uk_inquiry_value_code (value_code), KEY idx_inquiry_value_inquiry (site_code, inquiry_code, sort_no)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='询盘动态字段提交值';
|
||||
|
||||
CREATE TABLE inquiry_attachment (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键', attachment_code VARCHAR(16) NOT NULL COMMENT '询盘附件业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号', inquiry_code VARCHAR(16) NOT NULL DEFAULT '' COMMENT '询盘业务编号,上传后提交前可为空',
|
||||
field_code VARCHAR(16) NOT NULL DEFAULT '' COMMENT '文件字段业务编号', media_code VARCHAR(16) NOT NULL COMMENT '媒体业务编号',
|
||||
original_file_name VARCHAR(255) NOT NULL COMMENT '原始文件名', file_extension VARCHAR(20) NOT NULL COMMENT '小写扩展名',
|
||||
file_size BIGINT NOT NULL COMMENT '文件字节数', mime_type VARCHAR(100) NOT NULL COMMENT 'MIME类型',
|
||||
scan_status VARCHAR(20) NOT NULL COMMENT '扫描状态:PENDING待扫描,PASSED通过,REJECTED拒绝', status VARCHAR(20) NOT NULL COMMENT '状态:TEMP临时,BOUND已绑定,EXPIRED已过期',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除', create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间', update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id), UNIQUE KEY uk_inquiry_attachment_code (attachment_code), KEY idx_inquiry_attachment_inquiry (site_code, inquiry_code)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='询盘附件';
|
||||
|
||||
CREATE TABLE inquiry_operation_log (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键', log_code VARCHAR(16) NOT NULL COMMENT '询盘操作日志业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号', inquiry_code VARCHAR(16) NOT NULL COMMENT '询盘业务编号',
|
||||
operator_user_code VARCHAR(16) NOT NULL DEFAULT '' COMMENT '操作用户业务编号,系统操作为空', operation_type VARCHAR(30) NOT NULL COMMENT '操作类型:CREATE创建,ASSIGN分配,STATUS_CHANGE状态变化,MARK_SPAM标记垃圾,RESTORE恢复,EXPORT导出,DELETE删除,CONVERT_LEAD转线索',
|
||||
before_status VARCHAR(20) NULL COMMENT '操作前状态', after_status VARCHAR(20) NULL COMMENT '操作后状态', operation_content VARCHAR(1000) NULL COMMENT '操作说明',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
PRIMARY KEY (id), UNIQUE KEY uk_inquiry_log_code (log_code), KEY idx_inquiry_log_inquiry (site_code, inquiry_code, create_time)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='询盘操作轨迹';
|
||||
|
||||
CREATE TABLE mail_task (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键', task_code VARCHAR(16) NOT NULL COMMENT '邮件任务业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号', business_type VARCHAR(30) NOT NULL COMMENT '业务类型:INQUIRY询盘', business_code VARCHAR(16) NOT NULL COMMENT '业务编号',
|
||||
mail_type VARCHAR(30) NOT NULL COMMENT '邮件类型:INQUIRY_NOTIFICATION负责人通知,CUSTOMER_CONFIRMATION客户确认,OWNER_REMINDER负责人提醒',
|
||||
recipient VARCHAR(200) NOT NULL COMMENT '收件邮箱', subject VARCHAR(300) NOT NULL COMMENT '邮件主题', content LONGTEXT NOT NULL COMMENT '邮件正文',
|
||||
status VARCHAR(20) NOT NULL COMMENT '任务状态:PENDING待发送,SENDING发送中,SUCCESS成功,FAILED失败,CANCELLED取消', retry_count INT NOT NULL DEFAULT 0 COMMENT '已重试次数',
|
||||
next_retry_time DATETIME(3) NULL COMMENT '下次重试时间', last_error VARCHAR(1000) NULL COMMENT '最近失败原因', send_time DATETIME(3) NULL COMMENT '发送成功时间',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除', create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间', update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id), UNIQUE KEY uk_mail_task_code (task_code), KEY idx_mail_task_schedule (status, next_retry_time, create_time)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='MySQL异步邮件任务';
|
||||
@@ -0,0 +1,21 @@
|
||||
CREATE TABLE media_asset (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '数据库内部主键',
|
||||
media_code VARCHAR(16) NOT NULL COMMENT '媒体业务编号',
|
||||
site_code VARCHAR(16) NOT NULL COMMENT '所属站点业务编号',
|
||||
media_type VARCHAR(20) NOT NULL COMMENT '媒体类型:IMAGE图片,DOCUMENT文档,VIDEO视频',
|
||||
original_file_name VARCHAR(255) NOT NULL COMMENT '原始文件名',
|
||||
storage_file_name VARCHAR(255) NOT NULL COMMENT '存储文件名',
|
||||
relative_url VARCHAR(500) NOT NULL COMMENT '站内访问相对地址',
|
||||
mime_type VARCHAR(100) NOT NULL COMMENT 'MIME类型',
|
||||
file_extension VARCHAR(20) NOT NULL COMMENT '小写文件扩展名',
|
||||
file_size BIGINT NOT NULL COMMENT '文件字节数',
|
||||
alt_text VARCHAR(255) NULL COMMENT '图片英文替代文本',
|
||||
status VARCHAR(20) NOT NULL COMMENT '状态:ENABLED启用,DISABLED停用',
|
||||
deleted TINYINT NOT NULL DEFAULT 0 COMMENT '逻辑删除状态:0未删除,1已删除',
|
||||
create_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
|
||||
update_time DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY uk_media_asset_code (media_code),
|
||||
UNIQUE KEY uk_media_asset_storage_name (storage_file_name),
|
||||
KEY idx_media_asset_site_type (site_code, media_type, status, create_time)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='站点媒体资源';
|
||||
Loaded 100 of 277 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user