From 044df3161f9b23d2a1572484d86da2c243d26cfb Mon Sep 17 00:00:00 2001 From: YuanFeng <770153798@qq.com> Date: Sun, 1 Sep 2024 15:12:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E4=BA=A7=E5=93=81?= =?UTF-8?q?=E4=BF=9D=E5=85=BB=E9=A1=B9=E7=AE=A1=E7=90=86=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=20=E7=A8=BF=E4=BB=B6=E9=A2=84=E8=A7=88=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=20=E5=AE=8C=E5=96=84=20=E4=BA=A7=E5=93=81=E8=B5=84?= =?UTF-8?q?=E6=96=99=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/oms/enums/ErrorCodeConstants.java | 6 + .../ProductCareItemController.java | 95 ++ .../vo/ProductCareItemPageReqVO.java | 46 + .../vo/ProductCareItemRespVO.java | 58 ++ .../vo/ProductCareItemSaveReqVO.java | 40 + .../productinfo/vo/ProductInfoPageReqVO.java | 17 +- .../productinfo/vo/ProductInfoRespVO.java | 25 +- .../productinfo/vo/ProductInfoSaveReqVO.java | 19 +- .../productcareitem/ProductCareItemDO.java | 65 ++ .../dataobject/productinfo/ProductInfoDO.java | 20 +- .../ProductCareItemMapper.java | 34 + .../mysql/productinfo/ProductInfoMapper.java | 5 +- .../ProductCareItemService.java | 55 ++ .../ProductCareItemServiceImpl.java | 74 ++ .../productinfo/ProductInfoService.java | 3 +- .../productinfo/ProductInfoServiceImpl.java | 87 +- .../productcareitem/ProductCareItemMapper.xml | 12 + .../ProductCareItemServiceImplTest.java | 162 ++++ .../convert/oauth2/OAuth2OpenConvertImpl.java | 4 +- .../convert/social/SocialUserConvertImpl.java | 4 +- hangtag-ui/src/App.vue | 4 + hangtag-ui/src/api/infra/file/index.ts | 14 +- .../src/api/oms/productcareitem/index.ts | 47 + .../src/BrandDataListDialog/DataForm.vue | 69 ++ .../src/BrandDataListDialog/config.data.ts | 102 ++ .../Dialog/src/BrandDataListDialog/index.vue | 293 ++++++ .../DraftDesignDataListDialog/DataForm.vue | 74 ++ .../DraftDesignDataListDialog/config.data.ts | 82 ++ .../src/DraftDesignDataListDialog/index.vue | 294 ++++++ .../src/DraftDesignImageLibDialog/index.vue | 248 +++++ .../ProductTypeDataListDialog/DataForm.vue | 70 ++ .../ProductTypeDataListDialog/config.data.ts | 89 ++ .../src/ProductTypeDataListDialog/index.vue | 294 ++++++ .../components/mobile/NoticeBar/config.ts | 2 +- .../components/mobile/TabBar/config.ts | 8 +- .../components/DesignPreviewDialog.vue | 65 ++ .../DraftDesign/components/DesignPropEdit.vue | 476 +++++++++ .../components/DynamicPropConfig.vue | 109 ++- .../components/ImageLibraryManage.vue | 15 +- .../components/layout/LeftPanel.vue | 40 +- .../components/layout/RightPanel.vue | 1 + .../DraftDesign/components/layout/index.vue | 211 ++-- .../components/node/ShapeCellNode.vue | 1 - .../components/node/ShapeCircleNode.vue | 1 - .../components/node/ShapeEllipseNode.vue | 1 - .../components/node/ShapeImageNode.vue | 42 +- .../components/node/ShapeLozengeNode.vue | 1 - .../components/node/ShapeRightArrowNode.vue | 1 - .../node/ShapeRightTriangleNode.vue | 1 - .../components/node/ShapeTriangleNode.vue | 1 - .../components/node/TextCellNode.vue | 22 +- .../components/DraftDesign/config/index.ts | 4 +- .../components/DraftDesign/icons/demo.html | 72 +- .../DraftDesign/icons/fonts/icomoon.eot | Bin 13592 -> 14540 bytes .../DraftDesign/icons/fonts/icomoon.svg | 5 + .../DraftDesign/icons/fonts/icomoon.ttf | Bin 13428 -> 14376 bytes .../DraftDesign/icons/fonts/icomoon.woff | Bin 13504 -> 14452 bytes .../DraftDesign/icons/selection.json | 2 +- .../components/DraftDesign/icons/style.css | 25 +- .../src/components/DraftDesign/index.vue | 900 +++++++++++------- .../src/components/DraftDesign/utils/Dpi.ts | 22 +- .../components/DraftDesign/utils/FuncUtil.ts | 4 +- hangtag-ui/src/components/Form/src/Form.vue | 9 +- hangtag-ui/src/components/Table/src/Table.vue | 3 +- hangtag-ui/src/views/oms/brand/BrandForm.vue | 4 +- .../oms/draftdesigndata/detials/index.vue | 4 +- .../src/views/oms/draftdesigndata/index.vue | 9 +- .../productcareitem/ProductCareItemForm.vue | 147 +++ .../src/views/oms/productcareitem/index.vue | 256 +++++ .../views/oms/productinfo/ProductInfoForm.vue | 140 ++- .../src/views/oms/productinfo/index.vue | 86 +- .../system/codingrules/CodingRulesForm.vue | 6 +- .../codingrules/components/edit-item.vue | 7 +- sql/mysql/20240831/产品保养项.sql | 44 + 74 files changed, 4610 insertions(+), 648 deletions(-) create mode 100644 hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productcareitem/ProductCareItemController.java create mode 100644 hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productcareitem/vo/ProductCareItemPageReqVO.java create mode 100644 hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productcareitem/vo/ProductCareItemRespVO.java create mode 100644 hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productcareitem/vo/ProductCareItemSaveReqVO.java create mode 100644 hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/dal/dataobject/productcareitem/ProductCareItemDO.java create mode 100644 hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/dal/mysql/productcareitem/ProductCareItemMapper.java create mode 100644 hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/productcareitem/ProductCareItemService.java create mode 100644 hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/productcareitem/ProductCareItemServiceImpl.java create mode 100644 hangtag-module-oms/hangtag-module-oms-biz/src/main/resources/mapper/productcareitem/ProductCareItemMapper.xml create mode 100644 hangtag-module-oms/hangtag-module-oms-biz/src/test/java/cn/hangtag/module/oms/service/productcareitem/ProductCareItemServiceImplTest.java create mode 100644 hangtag-ui/src/api/oms/productcareitem/index.ts create mode 100644 hangtag-ui/src/components/Dialog/src/BrandDataListDialog/DataForm.vue create mode 100644 hangtag-ui/src/components/Dialog/src/BrandDataListDialog/config.data.ts create mode 100644 hangtag-ui/src/components/Dialog/src/BrandDataListDialog/index.vue create mode 100644 hangtag-ui/src/components/Dialog/src/DraftDesignDataListDialog/DataForm.vue create mode 100644 hangtag-ui/src/components/Dialog/src/DraftDesignDataListDialog/config.data.ts create mode 100644 hangtag-ui/src/components/Dialog/src/DraftDesignDataListDialog/index.vue create mode 100644 hangtag-ui/src/components/Dialog/src/DraftDesignImageLibDialog/index.vue create mode 100644 hangtag-ui/src/components/Dialog/src/ProductTypeDataListDialog/DataForm.vue create mode 100644 hangtag-ui/src/components/Dialog/src/ProductTypeDataListDialog/config.data.ts create mode 100644 hangtag-ui/src/components/Dialog/src/ProductTypeDataListDialog/index.vue create mode 100644 hangtag-ui/src/components/DraftDesign/components/DesignPreviewDialog.vue create mode 100644 hangtag-ui/src/components/DraftDesign/components/DesignPropEdit.vue create mode 100644 hangtag-ui/src/views/oms/productcareitem/ProductCareItemForm.vue create mode 100644 hangtag-ui/src/views/oms/productcareitem/index.vue create mode 100644 sql/mysql/20240831/产品保养项.sql diff --git a/hangtag-module-oms/hangtag-module-oms-api/src/main/java/cn/hangtag/module/oms/enums/ErrorCodeConstants.java b/hangtag-module-oms/hangtag-module-oms-api/src/main/java/cn/hangtag/module/oms/enums/ErrorCodeConstants.java index 4aa074b..6080cb5 100644 --- a/hangtag-module-oms/hangtag-module-oms-api/src/main/java/cn/hangtag/module/oms/enums/ErrorCodeConstants.java +++ b/hangtag-module-oms/hangtag-module-oms-api/src/main/java/cn/hangtag/module/oms/enums/ErrorCodeConstants.java @@ -9,4 +9,10 @@ public interface ErrorCodeConstants extends cn.hangtag.module.system.enums.Erro ErrorCode CUSTOMER_NOT_EXISTS = new ErrorCode(3300, "客户不存在"); ErrorCode SHAPE_TEMPLATE_NOT_EXISTS = new ErrorCode(3400, "图形模板管理 不存在"); ErrorCode DRAFT_DESIGN_DATA_NOT_EXISTS = new ErrorCode(3500, "稿件模板数据 不存在"); + + + + + + ErrorCode PRODUCT_CARE_ITEM_NOT_EXISTS = new ErrorCode(3800, "产品保养项 不存在"); } diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productcareitem/ProductCareItemController.java b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productcareitem/ProductCareItemController.java new file mode 100644 index 0000000..394eb88 --- /dev/null +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productcareitem/ProductCareItemController.java @@ -0,0 +1,95 @@ +package cn.hangtag.module.oms.controller.admin.productcareitem; + +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; + +import javax.validation.constraints.*; +import javax.validation.*; +import javax.servlet.http.*; +import java.util.*; +import java.io.IOException; + +import cn.hangtag.framework.common.pojo.PageParam; +import cn.hangtag.framework.common.pojo.PageResult; +import cn.hangtag.framework.common.pojo.CommonResult; +import cn.hangtag.framework.common.util.object.BeanUtils; +import static cn.hangtag.framework.common.pojo.CommonResult.success; + +import cn.hangtag.framework.excel.core.util.ExcelUtils; + +import cn.hangtag.framework.apilog.core.annotation.ApiAccessLog; +import static cn.hangtag.framework.apilog.core.enums.OperateTypeEnum.*; + +import cn.hangtag.module.oms.controller.admin.productcareitem.vo.*; +import cn.hangtag.module.oms.dal.dataobject.productcareitem.ProductCareItemDO; +import cn.hangtag.module.oms.service.productcareitem.ProductCareItemService; + +@Tag(name = "管理后台 - 产品保养项 ") +@RestController +@RequestMapping("/oms/product-care-item") +@Validated +public class ProductCareItemController { + + @Resource + private ProductCareItemService productCareItemService; + + @PostMapping("/create") + @Operation(summary = "创建产品保养项 ") + @PreAuthorize("@ss.hasPermission('oms:product-care-item:create')") + public CommonResult createProductCareItem(@Valid @RequestBody ProductCareItemSaveReqVO createReqVO) { + return success(productCareItemService.createProductCareItem(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新产品保养项 ") + @PreAuthorize("@ss.hasPermission('oms:product-care-item:update')") + public CommonResult updateProductCareItem(@Valid @RequestBody ProductCareItemSaveReqVO updateReqVO) { + productCareItemService.updateProductCareItem(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除产品保养项 ") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('oms:product-care-item:delete')") + public CommonResult deleteProductCareItem(@RequestParam("id") Long id) { + productCareItemService.deleteProductCareItem(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得产品保养项 ") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('oms:product-care-item:query')") + public CommonResult getProductCareItem(@RequestParam("id") Long id) { + ProductCareItemDO productCareItem = productCareItemService.getProductCareItem(id); + return success(BeanUtils.toBean(productCareItem, ProductCareItemRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得产品保养项 分页") + @PreAuthorize("@ss.hasPermission('oms:product-care-item:query')") + public CommonResult> getProductCareItemPage(@Valid ProductCareItemPageReqVO pageReqVO) { + PageResult pageResult = productCareItemService.getProductCareItemPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, ProductCareItemRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出产品保养项 Excel") + @PreAuthorize("@ss.hasPermission('oms:product-care-item:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportProductCareItemExcel(@Valid ProductCareItemPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = productCareItemService.getProductCareItemPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "产品保养项 .xls", "数据", ProductCareItemRespVO.class, + BeanUtils.toBean(list, ProductCareItemRespVO.class)); + } + +} \ No newline at end of file diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productcareitem/vo/ProductCareItemPageReqVO.java b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productcareitem/vo/ProductCareItemPageReqVO.java new file mode 100644 index 0000000..59b4ba5 --- /dev/null +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productcareitem/vo/ProductCareItemPageReqVO.java @@ -0,0 +1,46 @@ +package cn.hangtag.module.oms.controller.admin.productcareitem.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.hangtag.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.hangtag.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 产品保养项 分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ProductCareItemPageReqVO extends PageParam { + + @Schema(description = "说明") + private String value; + + @Schema(description = "icon图标", example = "https://www.iocoder.cn") + private String iconUrl; + + @Schema(description = "品牌") + private String brandIds; + + @Schema(description = "只作用于组合") + private Boolean isCombo; + + @Schema(description = "品牌通用") + private Boolean isAll; + + @Schema(description = "语言标识 字典-language_locale") + private String locale; + + @Schema(description = "启用状态") + private Boolean enabled; + + @Schema(description = "备注", example = "你猜") + private String remark; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productcareitem/vo/ProductCareItemRespVO.java b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productcareitem/vo/ProductCareItemRespVO.java new file mode 100644 index 0000000..0acc7dc --- /dev/null +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productcareitem/vo/ProductCareItemRespVO.java @@ -0,0 +1,58 @@ +package cn.hangtag.module.oms.controller.admin.productcareitem.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; +import com.alibaba.excel.annotation.*; +import cn.hangtag.framework.excel.core.annotations.DictFormat; +import cn.hangtag.framework.excel.core.convert.DictConvert; + +@Schema(description = "管理后台 - 产品保养项 Response VO") +@Data +@ExcelIgnoreUnannotated +public class ProductCareItemRespVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3104") + @ExcelProperty("id") + private Long id; + + @Schema(description = "说明", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("说明") + private String value; + + @Schema(description = "icon图标", example = "https://www.iocoder.cn") + @ExcelProperty("icon图标") + private String iconUrl; + + @Schema(description = "品牌") + @ExcelProperty("品牌") + private String brandIds; + + @Schema(description = "只作用于组合") + @ExcelProperty("只作用于组合") + private Boolean isCombo; + + @Schema(description = "品牌通用") + @ExcelProperty("品牌通用") + private Boolean isAll; + + @Schema(description = "语言标识 字典-language_locale") + @ExcelProperty(value = "语言标识 字典-language_locale", converter = DictConvert.class) + @DictFormat("language_locale") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private String locale; + + @Schema(description = "启用状态") + @ExcelProperty("启用状态") + private Boolean enabled; + + @Schema(description = "备注", example = "你猜") + @ExcelProperty("备注") + private String remark; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productcareitem/vo/ProductCareItemSaveReqVO.java b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productcareitem/vo/ProductCareItemSaveReqVO.java new file mode 100644 index 0000000..1265477 --- /dev/null +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productcareitem/vo/ProductCareItemSaveReqVO.java @@ -0,0 +1,40 @@ +package cn.hangtag.module.oms.controller.admin.productcareitem.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 产品保养项 新增/修改 Request VO") +@Data +public class ProductCareItemSaveReqVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3104") + private Long id; + + @Schema(description = "说明", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "说明不能为空") + private String value; + + @Schema(description = "icon图标", example = "https://www.iocoder.cn") + private String iconUrl; + + @Schema(description = "品牌") + private String brandIds; + + @Schema(description = "只作用于组合") + private Boolean isCombo; + + @Schema(description = "品牌通用") + private Boolean isAll; + + @Schema(description = "语言标识 字典-language_locale") + private String locale; + + @Schema(description = "启用状态") + private Boolean enabled; + + @Schema(description = "备注", example = "你猜") + private String remark; + +} \ No newline at end of file diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productinfo/vo/ProductInfoPageReqVO.java b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productinfo/vo/ProductInfoPageReqVO.java index 243c542..3b4d443 100644 --- a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productinfo/vo/ProductInfoPageReqVO.java +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productinfo/vo/ProductInfoPageReqVO.java @@ -18,19 +18,25 @@ public class ProductInfoPageReqVO extends PageParam { @Schema(description = "产品编码") private String code; - @Schema(description = "产品名称", example = "李四") + @Schema(description = "产品名称", example = "张三") private String name; - @Schema(description = "品牌", example = "30672") + @Schema(description = "封面") + private String cover; + + @Schema(description = "品牌", example = "13561") private Long brandId; - @Schema(description = "产品类型id", example = "2389") + @Schema(description = "产品类型id", example = "17099") private Long productTypeId; + @Schema(description = "设计稿id", example = "22184") + private String draftDesignDataId; + @Schema(description = "启用状态") private Boolean enabled; - @Schema(description = "备注", example = "你说的对") + @Schema(description = "备注", example = "你猜") private String remark; @Schema(description = "详情介绍") @@ -40,7 +46,4 @@ public class ProductInfoPageReqVO extends PageParam { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime[] createTime; - @Schema(description = "封面") - private String cover; - } \ No newline at end of file diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productinfo/vo/ProductInfoRespVO.java b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productinfo/vo/ProductInfoRespVO.java index ceea9ad..01b7f31 100644 --- a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productinfo/vo/ProductInfoRespVO.java +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productinfo/vo/ProductInfoRespVO.java @@ -12,7 +12,7 @@ import com.alibaba.excel.annotation.*; @ExcelIgnoreUnannotated public class ProductInfoRespVO { - @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "22864") + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "14473") @ExcelProperty("id") private Long id; @@ -20,23 +20,34 @@ public class ProductInfoRespVO { @ExcelProperty("产品编码") private String code; - @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") + @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") @ExcelProperty("产品名称") private String name; - @Schema(description = "品牌", example = "30672") + @Schema(description = "封面") + @ExcelProperty("封面") + private String cover; + + @Schema(description = "品牌", example = "13561") @ExcelProperty("品牌") private Long brandId; - @Schema(description = "产品类型id", example = "2389") + @ExcelProperty("品牌") + private String brandName; + + @Schema(description = "产品类型id", example = "17099") @ExcelProperty("产品类型id") private Long productTypeId; + @Schema(description = "设计稿id", example = "22184") + @ExcelProperty("设计稿id") + private String draftDesignDataId; + @Schema(description = "启用状态") @ExcelProperty("启用状态") private Boolean enabled; - @Schema(description = "备注", example = "你说的对") + @Schema(description = "备注", example = "你猜") @ExcelProperty("备注") private String remark; @@ -48,8 +59,4 @@ public class ProductInfoRespVO { @ExcelProperty("创建时间") private LocalDateTime createTime; - @Schema(description = "封面") - @ExcelProperty("封面") - private String cover; - } \ No newline at end of file diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productinfo/vo/ProductInfoSaveReqVO.java b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productinfo/vo/ProductInfoSaveReqVO.java index fdc7e6f..1d8df24 100644 --- a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productinfo/vo/ProductInfoSaveReqVO.java +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/controller/admin/productinfo/vo/ProductInfoSaveReqVO.java @@ -9,32 +9,35 @@ import javax.validation.constraints.*; @Data public class ProductInfoSaveReqVO { - @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "22864") + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "14473") private Long id; @Schema(description = "产品编码") private String code; - @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四") + @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") @NotEmpty(message = "产品名称不能为空") private String name; - @Schema(description = "品牌", example = "30672") + @Schema(description = "封面") + private String cover; + + @Schema(description = "品牌", example = "13561") private Long brandId; - @Schema(description = "产品类型id", example = "2389") + @Schema(description = "产品类型id", example = "17099") private Long productTypeId; + @Schema(description = "设计稿id", example = "22184") + private String draftDesignDataId; + @Schema(description = "启用状态") private Boolean enabled; - @Schema(description = "备注", example = "你说的对") + @Schema(description = "备注", example = "你猜") private String remark; @Schema(description = "详情介绍") private String details; - @Schema(description = "封面") - private String cover; - } \ No newline at end of file diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/dal/dataobject/productcareitem/ProductCareItemDO.java b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/dal/dataobject/productcareitem/ProductCareItemDO.java new file mode 100644 index 0000000..9451f44 --- /dev/null +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/dal/dataobject/productcareitem/ProductCareItemDO.java @@ -0,0 +1,65 @@ +package cn.hangtag.module.oms.dal.dataobject.productcareitem; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.hangtag.framework.mybatis.core.dataobject.BaseDO; + +/** + * 产品保养项 DO + * + * @author 芋道源码 + */ +@TableName("oms_product_care_item") +@KeySequence("oms_product_care_item_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class ProductCareItemDO extends BaseDO { + + /** + * id + */ + @TableId + private Long id; + /** + * 说明 + */ + private String value; + /** + * icon图标 + */ + private String iconUrl; + /** + * 品牌 + */ + private String brandIds; + /** + * 只作用于组合 + */ + private Boolean isCombo; + /** + * 品牌通用 + */ + private Boolean isAll; + /** + * 语言标识 字典-language_locale + * + * 枚举 {@link TODO language_locale 对应的类} + */ + private String locale; + /** + * 启用状态 + */ + private Boolean enabled; + /** + * 备注 + */ + private String remark; + +} \ No newline at end of file diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/dal/dataobject/productinfo/ProductInfoDO.java b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/dal/dataobject/productinfo/ProductInfoDO.java index fa3fef0..15d31f7 100644 --- a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/dal/dataobject/productinfo/ProductInfoDO.java +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/dal/dataobject/productinfo/ProductInfoDO.java @@ -10,7 +10,7 @@ import cn.hangtag.framework.mybatis.core.dataobject.BaseDO; /** * 产品资料 DO * - * @author YuanFeng + * @author 芋道源码 */ @TableName("oms_product_info") @KeySequence("oms_product_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 @@ -35,14 +35,28 @@ public class ProductInfoDO extends BaseDO { * 产品名称 */ private String name; + /** + * 封面 + */ + private String cover; /** * 品牌 */ private Long brandId; + + /** + * 品牌名称 + */ + @TableField(exist = false) + private String brandName; /** * 产品类型id */ private Long productTypeId; + /** + * 设计稿id + */ + private String draftDesignDataId; /** * 启用状态 */ @@ -55,9 +69,5 @@ public class ProductInfoDO extends BaseDO { * 详情介绍 */ private String details; - /** - * 封面 - */ - private String cover; } \ No newline at end of file diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/dal/mysql/productcareitem/ProductCareItemMapper.java b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/dal/mysql/productcareitem/ProductCareItemMapper.java new file mode 100644 index 0000000..cc287a0 --- /dev/null +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/dal/mysql/productcareitem/ProductCareItemMapper.java @@ -0,0 +1,34 @@ +package cn.hangtag.module.oms.dal.mysql.productcareitem; + +import java.util.*; + +import cn.hangtag.framework.common.pojo.PageResult; +import cn.hangtag.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.hangtag.framework.mybatis.core.mapper.BaseMapperX; +import cn.hangtag.module.oms.dal.dataobject.productcareitem.ProductCareItemDO; +import org.apache.ibatis.annotations.Mapper; +import cn.hangtag.module.oms.controller.admin.productcareitem.vo.*; + +/** + * 产品保养项 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface ProductCareItemMapper extends BaseMapperX { + + default PageResult selectPage(ProductCareItemPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(ProductCareItemDO::getValue, reqVO.getValue()) + .eqIfPresent(ProductCareItemDO::getIconUrl, reqVO.getIconUrl()) + .eqIfPresent(ProductCareItemDO::getBrandIds, reqVO.getBrandIds()) + .eqIfPresent(ProductCareItemDO::getIsCombo, reqVO.getIsCombo()) + .eqIfPresent(ProductCareItemDO::getIsAll, reqVO.getIsAll()) + .eqIfPresent(ProductCareItemDO::getLocale, reqVO.getLocale()) + .eqIfPresent(ProductCareItemDO::getEnabled, reqVO.getEnabled()) + .eqIfPresent(ProductCareItemDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(ProductCareItemDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(ProductCareItemDO::getId)); + } + +} \ No newline at end of file diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/dal/mysql/productinfo/ProductInfoMapper.java b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/dal/mysql/productinfo/ProductInfoMapper.java index 0c8e20e..1e5d36f 100644 --- a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/dal/mysql/productinfo/ProductInfoMapper.java +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/dal/mysql/productinfo/ProductInfoMapper.java @@ -12,7 +12,7 @@ import cn.hangtag.module.oms.controller.admin.productinfo.vo.*; /** * 产品资料 Mapper * - * @author YuanFeng + * @author 芋道源码 */ @Mapper public interface ProductInfoMapper extends BaseMapperX { @@ -21,13 +21,14 @@ public interface ProductInfoMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(ProductInfoDO::getCode, reqVO.getCode()) .likeIfPresent(ProductInfoDO::getName, reqVO.getName()) + .eqIfPresent(ProductInfoDO::getCover, reqVO.getCover()) .eqIfPresent(ProductInfoDO::getBrandId, reqVO.getBrandId()) .eqIfPresent(ProductInfoDO::getProductTypeId, reqVO.getProductTypeId()) + .eqIfPresent(ProductInfoDO::getDraftDesignDataId, reqVO.getDraftDesignDataId()) .eqIfPresent(ProductInfoDO::getEnabled, reqVO.getEnabled()) .eqIfPresent(ProductInfoDO::getRemark, reqVO.getRemark()) .eqIfPresent(ProductInfoDO::getDetails, reqVO.getDetails()) .betweenIfPresent(ProductInfoDO::getCreateTime, reqVO.getCreateTime()) - .eqIfPresent(ProductInfoDO::getCover, reqVO.getCover()) .orderByDesc(ProductInfoDO::getId)); } diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/productcareitem/ProductCareItemService.java b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/productcareitem/ProductCareItemService.java new file mode 100644 index 0000000..09f785c --- /dev/null +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/productcareitem/ProductCareItemService.java @@ -0,0 +1,55 @@ +package cn.hangtag.module.oms.service.productcareitem; + +import java.util.*; +import javax.validation.*; +import cn.hangtag.module.oms.controller.admin.productcareitem.vo.*; +import cn.hangtag.module.oms.dal.dataobject.productcareitem.ProductCareItemDO; +import cn.hangtag.framework.common.pojo.PageResult; +import cn.hangtag.framework.common.pojo.PageParam; + +/** + * 产品保养项 Service 接口 + * + * @author 芋道源码 + */ +public interface ProductCareItemService { + + /** + * 创建产品保养项 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createProductCareItem(@Valid ProductCareItemSaveReqVO createReqVO); + + /** + * 更新产品保养项 + * + * @param updateReqVO 更新信息 + */ + void updateProductCareItem(@Valid ProductCareItemSaveReqVO updateReqVO); + + /** + * 删除产品保养项 + * + * @param id 编号 + */ + void deleteProductCareItem(Long id); + + /** + * 获得产品保养项 + * + * @param id 编号 + * @return 产品保养项 + */ + ProductCareItemDO getProductCareItem(Long id); + + /** + * 获得产品保养项 分页 + * + * @param pageReqVO 分页查询 + * @return 产品保养项 分页 + */ + PageResult getProductCareItemPage(ProductCareItemPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/productcareitem/ProductCareItemServiceImpl.java b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/productcareitem/ProductCareItemServiceImpl.java new file mode 100644 index 0000000..571447f --- /dev/null +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/productcareitem/ProductCareItemServiceImpl.java @@ -0,0 +1,74 @@ +package cn.hangtag.module.oms.service.productcareitem; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.hangtag.module.oms.controller.admin.productcareitem.vo.*; +import cn.hangtag.module.oms.dal.dataobject.productcareitem.ProductCareItemDO; +import cn.hangtag.framework.common.pojo.PageResult; +import cn.hangtag.framework.common.pojo.PageParam; +import cn.hangtag.framework.common.util.object.BeanUtils; + +import cn.hangtag.module.oms.dal.mysql.productcareitem.ProductCareItemMapper; + +import static cn.hangtag.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.hangtag.module.oms.enums.ErrorCodeConstants.*; + +/** + * 产品保养项 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class ProductCareItemServiceImpl implements ProductCareItemService { + + @Resource + private ProductCareItemMapper productCareItemMapper; + + @Override + public Long createProductCareItem(ProductCareItemSaveReqVO createReqVO) { + // 插入 + ProductCareItemDO productCareItem = BeanUtils.toBean(createReqVO, ProductCareItemDO.class); + productCareItemMapper.insert(productCareItem); + // 返回 + return productCareItem.getId(); + } + + @Override + public void updateProductCareItem(ProductCareItemSaveReqVO updateReqVO) { + // 校验存在 + validateProductCareItemExists(updateReqVO.getId()); + // 更新 + ProductCareItemDO updateObj = BeanUtils.toBean(updateReqVO, ProductCareItemDO.class); + productCareItemMapper.updateById(updateObj); + } + + @Override + public void deleteProductCareItem(Long id) { + // 校验存在 + validateProductCareItemExists(id); + // 删除 + productCareItemMapper.deleteById(id); + } + + private void validateProductCareItemExists(Long id) { + if (productCareItemMapper.selectById(id) == null) { + throw exception(PRODUCT_CARE_ITEM_NOT_EXISTS); + } + } + + @Override + public ProductCareItemDO getProductCareItem(Long id) { + return productCareItemMapper.selectById(id); + } + + @Override + public PageResult getProductCareItemPage(ProductCareItemPageReqVO pageReqVO) { + return productCareItemMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/productinfo/ProductInfoService.java b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/productinfo/ProductInfoService.java index 6394bdb..ae383b7 100644 --- a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/productinfo/ProductInfoService.java +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/productinfo/ProductInfoService.java @@ -10,7 +10,7 @@ import cn.hangtag.framework.common.pojo.PageParam; /** * 产品资料 Service 接口 * - * @author YuanFeng + * @author 芋道源码 */ public interface ProductInfoService { @@ -52,4 +52,5 @@ public interface ProductInfoService { */ PageResult getProductInfoPage(ProductInfoPageReqVO pageReqVO); + String getNewCode(); } \ No newline at end of file diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/productinfo/ProductInfoServiceImpl.java b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/productinfo/ProductInfoServiceImpl.java index f5a7c8e..f3277e0 100644 --- a/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/productinfo/ProductInfoServiceImpl.java +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/java/cn/hangtag/module/oms/service/productinfo/ProductInfoServiceImpl.java @@ -1,5 +1,16 @@ package cn.hangtag.module.oms.service.productinfo; +import cn.hangtag.framework.common.exception.ServiceException; +import cn.hangtag.framework.common.exception.enums.GlobalErrorCodeConstants; +import cn.hangtag.framework.common.util.FuncUtil; +import cn.hangtag.framework.mybatis.core.dataobject.BaseDO; +import cn.hangtag.module.oms.dal.dataobject.brand.BrandDO; +import cn.hangtag.module.oms.dal.dataobject.draftdesigndata.DraftDesignDataDO; +import cn.hangtag.module.oms.dal.mysql.brand.BrandMapper; +import cn.hangtag.module.oms.serialnumber.CodingRulesUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; @@ -20,20 +31,29 @@ import static cn.hangtag.module.oms.enums.ErrorCodeConstants.*; /** * 产品资料 Service 实现类 * - * @author YuanFeng + * @author 芋道源码 */ @Service @Validated +@Slf4j +@AllArgsConstructor public class ProductInfoServiceImpl implements ProductInfoService { + // 系统编码id + private static final long codeId = 4L; - @Resource - private ProductInfoMapper productInfoMapper; + private final ProductInfoMapper productInfoMapper; + private final BrandMapper brandMapper; @Override public Long createProductInfo(ProductInfoSaveReqVO createReqVO) { // 插入 ProductInfoDO productInfo = BeanUtils.toBean(createReqVO, ProductInfoDO.class); - // TODO 逻辑管理 + String code = productInfo.getCode(); + if(FuncUtil.isNotEmpty(code)){ + checkCode(productInfo.getId(),code); + }else { + productInfo.setCode(getNewCode()); + } productInfoMapper.insert(productInfo); // 返回 return productInfo.getId(); @@ -43,6 +63,14 @@ public class ProductInfoServiceImpl implements ProductInfoService { public void updateProductInfo(ProductInfoSaveReqVO updateReqVO) { // 校验存在 validateProductInfoExists(updateReqVO.getId()); + + String code = updateReqVO.getCode(); + if(FuncUtil.isNotEmpty(code)){ + checkCode(updateReqVO.getId(),code); + }else { + updateReqVO.setCode(getNewCode()); + } + // 更新 ProductInfoDO updateObj = BeanUtils.toBean(updateReqVO, ProductInfoDO.class); productInfoMapper.updateById(updateObj); @@ -69,7 +97,56 @@ public class ProductInfoServiceImpl implements ProductInfoService { @Override public PageResult getProductInfoPage(ProductInfoPageReqVO pageReqVO) { - return productInfoMapper.selectPage(pageReqVO); + PageResult productInfoDOPageResult = productInfoMapper.selectPage(pageReqVO); + List list = productInfoDOPageResult.getList(); + list.forEach(productInfoDO -> { + if(FuncUtil.isNotEmpty(productInfoDO.getBrandId())){ + BrandDO brandDO = brandMapper.selectById(productInfoDO.getBrandId()); + if(FuncUtil.isNotEmpty(brandDO)){ + productInfoDO.setBrandName(brandDO.getName()); + } + } + }); + return productInfoDOPageResult; } + private void checkCode(Long id,String code){ + if(FuncUtil.isNotEmpty(code)){ + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + lambdaQueryWrapper.select(ProductInfoDO::getId,ProductInfoDO::getCode, BaseDO::getDeleted); + lambdaQueryWrapper.eq(ProductInfoDO::getCode, code); + lambdaQueryWrapper.eq(ProductInfoDO::getDeleted,false); + List dos = productInfoMapper.selectList(lambdaQueryWrapper); + if(FuncUtil.isEmpty(id) && FuncUtil.isNotEmpty(dos)){ + throw exception(GlobalErrorCodeConstants.DATA_DUPLICATE); + } + if (FuncUtil.isNotEmpty(id) && FuncUtil.isNotEmpty(dos)) { + for (ProductInfoDO aDo : dos) { + // 出现重复并当前id 不一致 + if(!FuncUtil.equals(aDo.getId(), id)){ + throw exception(GlobalErrorCodeConstants.DATA_DUPLICATE); + } + } + } + } + } + @Override + public String getNewCode() { + String s = ""; + int count = 10; + while (true){ + count --; + try { + s = CodingRulesUtils.generateCode(codeId, false); + checkCode(null,s); + return s; + }catch (ServiceException e){ + log.warn("重复或者下一个编码"); + if(count < 0){ + log.error("编码获取失败"); + return ""; + } + } + } + } } \ No newline at end of file diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/main/resources/mapper/productcareitem/ProductCareItemMapper.xml b/hangtag-module-oms/hangtag-module-oms-biz/src/main/resources/mapper/productcareitem/ProductCareItemMapper.xml new file mode 100644 index 0000000..30d2837 --- /dev/null +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/main/resources/mapper/productcareitem/ProductCareItemMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/hangtag-module-oms/hangtag-module-oms-biz/src/test/java/cn/hangtag/module/oms/service/productcareitem/ProductCareItemServiceImplTest.java b/hangtag-module-oms/hangtag-module-oms-biz/src/test/java/cn/hangtag/module/oms/service/productcareitem/ProductCareItemServiceImplTest.java new file mode 100644 index 0000000..488eb31 --- /dev/null +++ b/hangtag-module-oms/hangtag-module-oms-biz/src/test/java/cn/hangtag/module/oms/service/productcareitem/ProductCareItemServiceImplTest.java @@ -0,0 +1,162 @@ +package cn.hangtag.module.oms.service.productcareitem; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.mock.mockito.MockBean; + +import javax.annotation.Resource; + +import cn.hangtag.framework.test.core.ut.BaseDbUnitTest; + +import cn.hangtag.module.oms.controller.admin.productcareitem.vo.*; +import cn.hangtag.module.oms.dal.dataobject.productcareitem.ProductCareItemDO; +import cn.hangtag.module.oms.dal.mysql.productcareitem.ProductCareItemMapper; +import cn.hangtag.framework.common.pojo.PageResult; + +import javax.annotation.Resource; +import org.springframework.context.annotation.Import; +import java.util.*; +import java.time.LocalDateTime; + +import static cn.hutool.core.util.RandomUtil.*; +import static cn.hangtag.module.oms.enums.ErrorCodeConstants.*; +import static cn.hangtag.framework.test.core.util.AssertUtils.*; +import static cn.hangtag.framework.test.core.util.RandomUtils.*; +import static cn.hangtag.framework.common.util.date.LocalDateTimeUtils.*; +import static cn.hangtag.framework.common.util.object.ObjectUtils.*; +import static cn.hangtag.framework.common.util.date.DateUtils.*; +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +/** + * {@link ProductCareItemServiceImpl} 的单元测试类 + * + * @author 芋道源码 + */ +@Import(ProductCareItemServiceImpl.class) +public class ProductCareItemServiceImplTest extends BaseDbUnitTest { + + @Resource + private ProductCareItemServiceImpl productCareItemService; + + @Resource + private ProductCareItemMapper productCareItemMapper; + + @Test + public void testCreateProductCareItem_success() { + // 准备参数 + ProductCareItemSaveReqVO createReqVO = randomPojo(ProductCareItemSaveReqVO.class).setId(null); + + // 调用 + Long productCareItemId = productCareItemService.createProductCareItem(createReqVO); + // 断言 + assertNotNull(productCareItemId); + // 校验记录的属性是否正确 + ProductCareItemDO productCareItem = productCareItemMapper.selectById(productCareItemId); + assertPojoEquals(createReqVO, productCareItem, "id"); + } + + @Test + public void testUpdateProductCareItem_success() { + // mock 数据 + ProductCareItemDO dbProductCareItem = randomPojo(ProductCareItemDO.class); + productCareItemMapper.insert(dbProductCareItem);// @Sql: 先插入出一条存在的数据 + // 准备参数 + ProductCareItemSaveReqVO updateReqVO = randomPojo(ProductCareItemSaveReqVO.class, o -> { + o.setId(dbProductCareItem.getId()); // 设置更新的 ID + }); + + // 调用 + productCareItemService.updateProductCareItem(updateReqVO); + // 校验是否更新正确 + ProductCareItemDO productCareItem = productCareItemMapper.selectById(updateReqVO.getId()); // 获取最新的 + assertPojoEquals(updateReqVO, productCareItem); + } + + @Test + public void testUpdateProductCareItem_notExists() { + // 准备参数 + ProductCareItemSaveReqVO updateReqVO = randomPojo(ProductCareItemSaveReqVO.class); + + // 调用, 并断言异常 + assertServiceException(() -> productCareItemService.updateProductCareItem(updateReqVO), PRODUCT_CARE_ITEM_NOT_EXISTS); + } + + @Test + public void testDeleteProductCareItem_success() { + // mock 数据 + ProductCareItemDO dbProductCareItem = randomPojo(ProductCareItemDO.class); + productCareItemMapper.insert(dbProductCareItem);// @Sql: 先插入出一条存在的数据 + // 准备参数 + Long id = dbProductCareItem.getId(); + + // 调用 + productCareItemService.deleteProductCareItem(id); + // 校验数据不存在了 + assertNull(productCareItemMapper.selectById(id)); + } + + @Test + public void testDeleteProductCareItem_notExists() { + // 准备参数 + Long id = randomLongId(); + + // 调用, 并断言异常 + assertServiceException(() -> productCareItemService.deleteProductCareItem(id), PRODUCT_CARE_ITEM_NOT_EXISTS); + } + + @Test + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 + public void testGetProductCareItemPage() { + // mock 数据 + ProductCareItemDO dbProductCareItem = randomPojo(ProductCareItemDO.class, o -> { // 等会查询到 + o.setValue(null); + o.setIconUrl(null); + o.setBrandIds(null); + o.setIsCombo(null); + o.setIsAll(null); + o.setLocale(null); + o.setEnabled(null); + o.setRemark(null); + o.setCreateTime(null); + }); + productCareItemMapper.insert(dbProductCareItem); + // 测试 value 不匹配 + productCareItemMapper.insert(cloneIgnoreId(dbProductCareItem, o -> o.setValue(null))); + // 测试 iconUrl 不匹配 + productCareItemMapper.insert(cloneIgnoreId(dbProductCareItem, o -> o.setIconUrl(null))); + // 测试 brandIds 不匹配 + productCareItemMapper.insert(cloneIgnoreId(dbProductCareItem, o -> o.setBrandIds(null))); + // 测试 isCombo 不匹配 + productCareItemMapper.insert(cloneIgnoreId(dbProductCareItem, o -> o.setIsCombo(null))); + // 测试 isAll 不匹配 + productCareItemMapper.insert(cloneIgnoreId(dbProductCareItem, o -> o.setIsAll(null))); + // 测试 locale 不匹配 + productCareItemMapper.insert(cloneIgnoreId(dbProductCareItem, o -> o.setLocale(null))); + // 测试 enabled 不匹配 + productCareItemMapper.insert(cloneIgnoreId(dbProductCareItem, o -> o.setEnabled(null))); + // 测试 remark 不匹配 + productCareItemMapper.insert(cloneIgnoreId(dbProductCareItem, o -> o.setRemark(null))); + // 测试 createTime 不匹配 + productCareItemMapper.insert(cloneIgnoreId(dbProductCareItem, o -> o.setCreateTime(null))); + // 准备参数 + ProductCareItemPageReqVO reqVO = new ProductCareItemPageReqVO(); + reqVO.setValue(null); + reqVO.setIconUrl(null); + reqVO.setBrandIds(null); + reqVO.setIsCombo(null); + reqVO.setIsAll(null); + reqVO.setLocale(null); + reqVO.setEnabled(null); + reqVO.setRemark(null); + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); + + // 调用 + PageResult pageResult = productCareItemService.getProductCareItemPage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbProductCareItem, pageResult.getList().get(0)); + } + +} \ No newline at end of file diff --git a/hangtag-module-system/hangtag-module-system-biz/target/generated-sources/annotations/cn/hangtag/module/system/convert/oauth2/OAuth2OpenConvertImpl.java b/hangtag-module-system/hangtag-module-system-biz/target/generated-sources/annotations/cn/hangtag/module/system/convert/oauth2/OAuth2OpenConvertImpl.java index 02d311a..7304892 100644 --- a/hangtag-module-system/hangtag-module-system-biz/target/generated-sources/annotations/cn/hangtag/module/system/convert/oauth2/OAuth2OpenConvertImpl.java +++ b/hangtag-module-system/hangtag-module-system-biz/target/generated-sources/annotations/cn/hangtag/module/system/convert/oauth2/OAuth2OpenConvertImpl.java @@ -4,8 +4,8 @@ import javax.annotation.Generated; @Generated( value = "org.mapstruct.ap.MappingProcessor", - date = "2024-08-10T18:18:46+0800", - comments = "version: 1.5.5.Final, compiler: javac, environment: Java 1.8.0_401 (Oracle Corporation)" + date = "2024-08-13T22:38:55+0800", + comments = "version: 1.5.5.Final, compiler: javac, environment: Java 1.8.0_251 (Oracle Corporation)" ) public class OAuth2OpenConvertImpl implements OAuth2OpenConvert { } diff --git a/hangtag-module-system/hangtag-module-system-biz/target/generated-sources/annotations/cn/hangtag/module/system/convert/social/SocialUserConvertImpl.java b/hangtag-module-system/hangtag-module-system-biz/target/generated-sources/annotations/cn/hangtag/module/system/convert/social/SocialUserConvertImpl.java index 5c030d7..a2780a0 100644 --- a/hangtag-module-system/hangtag-module-system-biz/target/generated-sources/annotations/cn/hangtag/module/system/convert/social/SocialUserConvertImpl.java +++ b/hangtag-module-system/hangtag-module-system-biz/target/generated-sources/annotations/cn/hangtag/module/system/convert/social/SocialUserConvertImpl.java @@ -6,8 +6,8 @@ import javax.annotation.Generated; @Generated( value = "org.mapstruct.ap.MappingProcessor", - date = "2024-08-10T18:18:46+0800", - comments = "version: 1.5.5.Final, compiler: javac, environment: Java 1.8.0_401 (Oracle Corporation)" + date = "2024-08-13T22:38:55+0800", + comments = "version: 1.5.5.Final, compiler: javac, environment: Java 1.8.0_251 (Oracle Corporation)" ) public class SocialUserConvertImpl implements SocialUserConvert { diff --git a/hangtag-ui/src/App.vue b/hangtag-ui/src/App.vue index 7407d97..3eb87f0 100644 --- a/hangtag-ui/src/App.vue +++ b/hangtag-ui/src/App.vue @@ -23,11 +23,15 @@ const setDefaultTheme = () => { appStore.setIsDark(isDarkTheme) } setDefaultTheme() +import { getTeleport } from '@antv/x6-vue-shape'; +// 处理 节点重复渲染 问题 TeleportContainer +const TeleportContainer = defineComponent(getTeleport()); diff --git a/hangtag-ui/src/components/Dialog/src/DraftDesignDataListDialog/DataForm.vue b/hangtag-ui/src/components/Dialog/src/DraftDesignDataListDialog/DataForm.vue new file mode 100644 index 0000000..1539714 --- /dev/null +++ b/hangtag-ui/src/components/Dialog/src/DraftDesignDataListDialog/DataForm.vue @@ -0,0 +1,74 @@ + + diff --git a/hangtag-ui/src/components/Dialog/src/DraftDesignDataListDialog/config.data.ts b/hangtag-ui/src/components/Dialog/src/DraftDesignDataListDialog/config.data.ts new file mode 100644 index 0000000..36cb202 --- /dev/null +++ b/hangtag-ui/src/components/Dialog/src/DraftDesignDataListDialog/config.data.ts @@ -0,0 +1,82 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter } from '@/utils/formatTime' + +// 表单校验 +export const rules = reactive({ + code: [required], + name: [required], +}) + +// CrudSchema https://doc.iocoder.cn/vue3/crud-schema/ +const crudSchemas = reactive([ + { + label: 'id', + field: 'id', + isForm: false, + }, + { + label: '编码', + field: 'code', + isSearch: true, + }, + { + label: '设计搞名称', + field: 'name', + isSearch: true, + }, + { + label: '作者', + field: 'author', + isSearch: true, + }, + { + label: '版本', + field: 'version', + isSearch: false, + form: { + component: 'InputNumber', + componentProps:{ + disabled: true + }, + value: 0 + }, + }, + { + label: '语言标识', + field: 'locale', + dictType: DICT_TYPE.LANGUAGE_LOCALE, + dictClass: 'string', + search: { + show: true, + }, + form: { + component: 'SelectV2' + }, + }, + { + label: '启用状态', + field: 'enabled', + isSearch: false, + }, + { + label: '备注', + field: 'remark', + isSearch: false, + }, + { + label: '创建时间', + field: 'createTime', + formatter: dateFormatter, + isSearch: true, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'daterange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } + }, + isForm: false, + } +]) +export const { allSchemas } = useCrudSchemas(crudSchemas) diff --git a/hangtag-ui/src/components/Dialog/src/DraftDesignDataListDialog/index.vue b/hangtag-ui/src/components/Dialog/src/DraftDesignDataListDialog/index.vue new file mode 100644 index 0000000..c55ca3b --- /dev/null +++ b/hangtag-ui/src/components/Dialog/src/DraftDesignDataListDialog/index.vue @@ -0,0 +1,294 @@ + + + + + diff --git a/hangtag-ui/src/components/Dialog/src/DraftDesignImageLibDialog/index.vue b/hangtag-ui/src/components/Dialog/src/DraftDesignImageLibDialog/index.vue new file mode 100644 index 0000000..d9d1828 --- /dev/null +++ b/hangtag-ui/src/components/Dialog/src/DraftDesignImageLibDialog/index.vue @@ -0,0 +1,248 @@ + + + + + diff --git a/hangtag-ui/src/components/Dialog/src/ProductTypeDataListDialog/DataForm.vue b/hangtag-ui/src/components/Dialog/src/ProductTypeDataListDialog/DataForm.vue new file mode 100644 index 0000000..030f7ab --- /dev/null +++ b/hangtag-ui/src/components/Dialog/src/ProductTypeDataListDialog/DataForm.vue @@ -0,0 +1,70 @@ + + diff --git a/hangtag-ui/src/components/Dialog/src/ProductTypeDataListDialog/config.data.ts b/hangtag-ui/src/components/Dialog/src/ProductTypeDataListDialog/config.data.ts new file mode 100644 index 0000000..ad995f9 --- /dev/null +++ b/hangtag-ui/src/components/Dialog/src/ProductTypeDataListDialog/config.data.ts @@ -0,0 +1,89 @@ +import type { CrudSchema } from '@/hooks/web/useCrudSchemas' +import { dateFormatter } from '@/utils/formatTime' + +// 表单校验 +export const rules = reactive({ + value: [required], + label: [required], +}) + +// CrudSchema https://doc.iocoder.cn/vue3/crud-schema/ +const crudSchemas = reactive([ + { + label: 'id', + field: 'id', + isForm: false, + }, + { + label: '编码', + field: 'value', + isSearch: true, + }, + { + label: '名称', + field: 'label', + isSearch: true, + }, + { + label: '排序号', + field: 'sort', + isSearch: true, + form: { + component: 'InputNumber', + value: 0 + }, + }, + { + label: '语言标识', + field: 'locale', + dictType: DICT_TYPE.LANGUAGE_LOCALE, + dictClass: 'string', + search: { + show: true, + }, + form: { + component: 'SelectV2' + }, + }, + { + label: '扩展项', + field: 'extendInfo', + isTable: false, + form: { + component: 'Input', + componentProps: { + type: 'textarea', + rows: 4 + }, + colProps: { + span: 24 + } + }, + }, + { + label: '备注', + field: 'remark', + isTable: false, + }, + { + label: '创建时间', + field: 'createTime', + formatter: dateFormatter, + isSearch: true, + search: { + component: 'DatePicker', + componentProps: { + valueFormat: 'YYYY-MM-DD HH:mm:ss', + type: 'daterange', + defaultTime: [new Date('1 00:00:00'), new Date('1 23:59:59')] + } + }, + isForm: false, + }, + { + label: '操作', + field: 'action', + isForm: false + } +]) +export const { allSchemas } = useCrudSchemas(crudSchemas) diff --git a/hangtag-ui/src/components/Dialog/src/ProductTypeDataListDialog/index.vue b/hangtag-ui/src/components/Dialog/src/ProductTypeDataListDialog/index.vue new file mode 100644 index 0000000..682f211 --- /dev/null +++ b/hangtag-ui/src/components/Dialog/src/ProductTypeDataListDialog/index.vue @@ -0,0 +1,294 @@ + + + + + diff --git a/hangtag-ui/src/components/DiyEditor/components/mobile/NoticeBar/config.ts b/hangtag-ui/src/components/DiyEditor/components/mobile/NoticeBar/config.ts index b6b0860..505484a 100644 --- a/hangtag-ui/src/components/DiyEditor/components/mobile/NoticeBar/config.ts +++ b/hangtag-ui/src/components/DiyEditor/components/mobile/NoticeBar/config.ts @@ -28,7 +28,7 @@ export const component = { name: '公告栏', icon: 'ep:bell', property: { - iconUrl: 'http://mall.yudao.iocoder.cn/static/images/xinjian.png', + inputVal: 'http://mall.yudao.iocoder.cn/static/images/xinjian.png', contents: [ { text: '', diff --git a/hangtag-ui/src/components/DiyEditor/components/mobile/TabBar/config.ts b/hangtag-ui/src/components/DiyEditor/components/mobile/TabBar/config.ts index 88d706f..083d318 100644 --- a/hangtag-ui/src/components/DiyEditor/components/mobile/TabBar/config.ts +++ b/hangtag-ui/src/components/DiyEditor/components/mobile/TabBar/config.ts @@ -53,25 +53,25 @@ export const component = { { text: '首页', url: '/pages/index/index', - iconUrl: 'http://mall.yudao.iocoder.cn/static/images/1-001.png', + inputVal: 'http://mall.yudao.iocoder.cn/static/images/1-001.png', activeIconUrl: 'http://mall.yudao.iocoder.cn/static/images/1-002.png' }, { text: '分类', url: '/pages/index/category?id=3', - iconUrl: 'http://mall.yudao.iocoder.cn/static/images/2-001.png', + inputVal: 'http://mall.yudao.iocoder.cn/static/images/2-001.png', activeIconUrl: 'http://mall.yudao.iocoder.cn/static/images/2-002.png' }, { text: '购物车', url: '/pages/index/cart', - iconUrl: 'http://mall.yudao.iocoder.cn/static/images/3-001.png', + inputVal: 'http://mall.yudao.iocoder.cn/static/images/3-001.png', activeIconUrl: 'http://mall.yudao.iocoder.cn/static/images/3-002.png' }, { text: '我的', url: '/pages/index/user', - iconUrl: 'http://mall.yudao.iocoder.cn/static/images/4-001.png', + inputVal: 'http://mall.yudao.iocoder.cn/static/images/4-001.png', activeIconUrl: 'http://mall.yudao.iocoder.cn/static/images/4-002.png' } ] diff --git a/hangtag-ui/src/components/DraftDesign/components/DesignPreviewDialog.vue b/hangtag-ui/src/components/DraftDesign/components/DesignPreviewDialog.vue new file mode 100644 index 0000000..56ccc7e --- /dev/null +++ b/hangtag-ui/src/components/DraftDesign/components/DesignPreviewDialog.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/hangtag-ui/src/components/DraftDesign/components/DesignPropEdit.vue b/hangtag-ui/src/components/DraftDesign/components/DesignPropEdit.vue new file mode 100644 index 0000000..c91054a --- /dev/null +++ b/hangtag-ui/src/components/DraftDesign/components/DesignPropEdit.vue @@ -0,0 +1,476 @@ + + + + + + diff --git a/hangtag-ui/src/components/DraftDesign/components/DynamicPropConfig.vue b/hangtag-ui/src/components/DraftDesign/components/DynamicPropConfig.vue index 60a6294..0c085d9 100644 --- a/hangtag-ui/src/components/DraftDesign/components/DynamicPropConfig.vue +++ b/hangtag-ui/src/components/DraftDesign/components/DynamicPropConfig.vue @@ -2,10 +2,11 @@ -
+
- + @@ -28,28 +29,82 @@ + + + +
+ + 允许调整数量 + +
+
+ +
+ + 允许输入值 + +
+
+
+
+ + + + min + + + + max + + + +
-
+
追加 追加10个 删除
+
+ 两个或者以上允许追加更多位置信息 +
-
+
- {{index +1}} + {{ index + 1 }} - X向右 + + {{ index === 0 ? 'text' : 'icon' }} + X向右 - Y向下 + + + {{ index === 0 ? 'text' : 'icon' }} + + Y向下
-
@@ -72,13 +127,18 @@ import {calculateVectorDifference} from "@/components/DraftDesign/utils/FuncUtil import {useMessage} from "@/hooks/web/useMessage"; // 动态属性配置 -const emit = defineEmits(['update:visible','submit']) +const emit = defineEmits(['update:visible', 'submit']) const that = reactive({ allGroupList: [], show: false, - configInfo:{ + configInfo: { groupName: '', // 父节点名称 + isCombo: false, // 是否是组合节点 + minSize: 1, + maxSize: 100, + canChange: false, + canInput: false, cellIds: [], // 节点id groupId: `g_${Math.random().toString(36).substring(2)}`, data: {}, //节点是数据 @@ -93,7 +153,7 @@ const props = defineProps({ } }) const delLast = () => { - if(that.configInfo.pointList.length === 1){ + if (that.configInfo.pointList.length === 1) { useMessage().warning(`至少需要1个位置信息`) return; } @@ -101,11 +161,12 @@ const delLast = () => { useMessage().success(`成功删除1个位置信息`) } const appendNode = () => { - const arr = that.configInfo.pointList - const tmp = calculateVectorDifference(arr[arr.length - 1],arr[arr.length - 2]) + const arr = that.configInfo.pointList + const tmp = calculateVectorDifference(arr[arr.length - 1], arr[arr.length - 2]) - const dx = arr[arr.length - 1].x + tmp.x - const dy = arr[arr.length - 1].y + tmp.y + //@ts-ignore + const dx = arr[arr.length - 1].x + tmp.x, dy = arr[arr.length - 1].y + tmp.y; + //@ts-ignore that.configInfo.pointList.push({ x: dx, y: dy, @@ -113,19 +174,25 @@ const appendNode = () => { size: {...arr[arr.length - 1].size} }) } -const append = (count = 1)=>{ +const append = (count = 1) => { let i = 0; - while (i < count){ - appendNode() - i++; - } + while (i < count) { + appendNode() + i++; + } useMessage().success(`成功添加${count}个位置信息`) } const init = (allGroupList, data) => { that.allGroupList = allGroupList; + that.configInfo = { groupName: '', // 父节点名称 groupId: `g_${Math.random().toString(36).substring(2)}`, + isCombo: false, // 是否是组合节点 + minSize: 1, // 节点组最小数量 + maxSize: 100, // 节点组最大数量 + canChange: false, // 是否允许调整数量 + canInput: false,// 是否允许输入值 cellIds: [], // 节点id data: {}, //节点是数据 shape: '', // 节点类型 diff --git a/hangtag-ui/src/components/DraftDesign/components/ImageLibraryManage.vue b/hangtag-ui/src/components/DraftDesign/components/ImageLibraryManage.vue index 42a193b..be0a280 100644 --- a/hangtag-ui/src/components/DraftDesign/components/ImageLibraryManage.vue +++ b/hangtag-ui/src/components/DraftDesign/components/ImageLibraryManage.vue @@ -88,6 +88,8 @@ const props = defineProps({ tipsText: propTypes.string.def('点击选择图片上传'), }) +const emit = defineEmits( ["close",'update:modelValue']) + const { uploadUrl, httpRequest } = useUpload() const fileList = ref([]) @@ -116,20 +118,14 @@ const beforeUpload: UploadProps['beforeUpload'] = (rawFile) => { return imgType.includes(rawFile.type as FileTypes) && imgSize } -const emit = defineEmits( ["close",'update:modelValue']) -const formData = ref({ - id: undefined, - shapeType: undefined, - name: undefined, - initData: undefined, -}) const uploadSuccess: UploadProps['onSuccess'] = (res: any): void => { message.success('上传成功') - // 删除自身 + //@ts-ignore 删除自身 const index = fileList.value.findIndex((item) => item.response?.data === res.data) fileList.value.splice(index, 1) uploadList.value.push({ + // @ts-ignore filename: res.filename || res.data , name : res.data, url: res.data }) @@ -181,15 +177,18 @@ const addNew = async () => { } }, icon: fileList.value[i].url, + //@ts-ignore label: fileList.value[i].filename || '未命名图片', filterKeyword: function (){ return this.label } }; const data = { id: undefined, shapeType: ShapeType.vueShapeImage, + //@ts-ignore name: fileList.value[i].filename, initData: JSON.stringify(info), } + //@ts-ignore await ShapeTemplateApi.createShapeTemplate(data) } diff --git a/hangtag-ui/src/components/DraftDesign/components/layout/LeftPanel.vue b/hangtag-ui/src/components/DraftDesign/components/layout/LeftPanel.vue index 1d2acc4..075a2e7 100644 --- a/hangtag-ui/src/components/DraftDesign/components/layout/LeftPanel.vue +++ b/hangtag-ui/src/components/DraftDesign/components/layout/LeftPanel.vue @@ -16,8 +16,12 @@ v-loading="that.imgLoading" style="margin: 8px;padding-top: 12px" v-if="`shape_image` === layout.leftActive"> - +
+ + 查询 +
图片上传 +
+ +
+ +
@@ -153,11 +166,12 @@ const hasKey = (obj, path) => { const that = reactive({ effect: 'dark', showImageLib: false, + total:0, queryParams: { pageNo: 1, - pageSize: 80, + pageSize: 20, shapeType: ShapeType.vueShapeImage, - name: undefined, + name: '', }, imgLoading: false, imageKeySet: [], @@ -204,9 +218,12 @@ const uploadSuccess = () => { const queryImage = async () => { that.imgLoading = true + that.queryParams.name = layout.searchKeyword; const data = await ShapeTemplateApi.getShapeTemplatePage(that.queryParams) const domain = await FileApi.getDomain(); - + that.total = data.total; + that.imageUrlList = []; + that.imageKeySet = []; for (let i = 0; i < data.list.length; i++) { let config = JSON.parse(data.list[i].initData) config.filterKeyword = function () { @@ -293,8 +310,8 @@ const layout = reactive({ shape: ShapeType.vueShapeRect, data: { label: '', - width: 80, - height: 80, + width: 10, + height: 10, shape: VueCellShapeType.Rect, style: { fontSize: 12, @@ -314,8 +331,8 @@ const layout = reactive({ shape: ShapeType.vueShapeRect, data: { label: '', - width: 80, - height: 80, + width: 10, + height: 10, shape: VueCellShapeType.Rect, style: { fontSize: 12, @@ -336,8 +353,8 @@ const layout = reactive({ shape: ShapeType.vueShapeRect, data: { label: '', - width: 80, - height: 80, + width: 10, + height: 10, shape: VueCellShapeType.Rect, style: { fontSize: 12, @@ -383,7 +400,7 @@ $height: 600px; $mainPanelWidth: 368px; $mainPanelToggleLeft: 367px; $mainPanelLeft: 67px; -$panelZIndex: 10; +$panelZIndex: 20; .mainPanel { @@ -411,6 +428,7 @@ $panelZIndex: 10; } .mainPanel-mainContent-toggle { + width: 10px; height: 88px; position: absolute; diff --git a/hangtag-ui/src/components/DraftDesign/components/layout/RightPanel.vue b/hangtag-ui/src/components/DraftDesign/components/layout/RightPanel.vue index 2fc5f0d..4796cc9 100644 --- a/hangtag-ui/src/components/DraftDesign/components/layout/RightPanel.vue +++ b/hangtag-ui/src/components/DraftDesign/components/layout/RightPanel.vue @@ -183,6 +183,7 @@ defineExpose({ $height: 600px; $mainPanelWidth: 260px; .mainPanel { + z-index: 20; background-color: #ffffff; width: $mainPanelWidth; height: $height; diff --git a/hangtag-ui/src/components/DraftDesign/components/layout/index.vue b/hangtag-ui/src/components/DraftDesign/components/layout/index.vue index 1383e8d..28241de 100644 --- a/hangtag-ui/src/components/DraftDesign/components/layout/index.vue +++ b/hangtag-ui/src/components/DraftDesign/components/layout/index.vue @@ -4,7 +4,8 @@ - + + + + + + + +
@@ -77,9 +128,13 @@
- Settings + Settings +
+
+ + +
-
@@ -190,6 +246,7 @@
@@ -197,6 +254,7 @@
@@ -204,6 +262,7 @@
@@ -597,7 +656,7 @@
- +
main
@@ -614,7 +673,7 @@
- - + - @@ -1532,10 +1574,11 @@ $panelZIndex: 10; } .center-panel { + overflow: hidden; padding: 0; width: 100%; background-color: #6fa9ba; - height: 600px; + height: calc(86vh - 100px); } @@ -1555,4 +1598,26 @@ $panelZIndex: 10; transform: rotate(133deg); } + +.draggable-ghost { + background: #2ba4f8; + border: 2px solid #2ba4f8; + outline-width: 0; + height: 38px; + box-sizing: border-box; + font-size: 0; + content: ''; + overflow: hidden; + padding: 0; +} +.order-by-item:hover{ + cursor: move; +} +.order-by-item{ + margin: 6px; + border: 1px solid #8e8b8b; + width: 100%; + padding: 10px +} + diff --git a/hangtag-ui/src/components/DraftDesign/components/node/ShapeCellNode.vue b/hangtag-ui/src/components/DraftDesign/components/node/ShapeCellNode.vue index 43d628a..4d1209f 100644 --- a/hangtag-ui/src/components/DraftDesign/components/node/ShapeCellNode.vue +++ b/hangtag-ui/src/components/DraftDesign/components/node/ShapeCellNode.vue @@ -329,7 +329,6 @@ export default defineComponent({ } } } - console.log("text##", info) this.cellInfo = mergeDeepObject({ showInput: false, id: nextId(), diff --git a/hangtag-ui/src/components/DraftDesign/components/node/ShapeCircleNode.vue b/hangtag-ui/src/components/DraftDesign/components/node/ShapeCircleNode.vue index 9d8ee55..c87e2e8 100644 --- a/hangtag-ui/src/components/DraftDesign/components/node/ShapeCircleNode.vue +++ b/hangtag-ui/src/components/DraftDesign/components/node/ShapeCircleNode.vue @@ -209,7 +209,6 @@ export default defineComponent({ } } } - console.log("text##", info) this.cellInfo = mergeDeepObject({ showInput: false, id: nextId(), diff --git a/hangtag-ui/src/components/DraftDesign/components/node/ShapeEllipseNode.vue b/hangtag-ui/src/components/DraftDesign/components/node/ShapeEllipseNode.vue index f877c72..7eb2eac 100644 --- a/hangtag-ui/src/components/DraftDesign/components/node/ShapeEllipseNode.vue +++ b/hangtag-ui/src/components/DraftDesign/components/node/ShapeEllipseNode.vue @@ -217,7 +217,6 @@ export default defineComponent({ } } } - console.log("text##", info) this.cellInfo = mergeDeepObject({ showInput: false, id: nextId(), diff --git a/hangtag-ui/src/components/DraftDesign/components/node/ShapeImageNode.vue b/hangtag-ui/src/components/DraftDesign/components/node/ShapeImageNode.vue index b9a6088..7f91936 100644 --- a/hangtag-ui/src/components/DraftDesign/components/node/ShapeImageNode.vue +++ b/hangtag-ui/src/components/DraftDesign/components/node/ShapeImageNode.vue @@ -3,8 +3,8 @@
{ + // @ts-ignore + this.hrefBase64 = res + }) + } setTimeout(() => { if (this.nodeInfo.store && this.nodeInfo.store.data) { this.nodeInfo.store.data.data = this.cellInfo diff --git a/hangtag-ui/src/components/DraftDesign/components/node/ShapeLozengeNode.vue b/hangtag-ui/src/components/DraftDesign/components/node/ShapeLozengeNode.vue index 1750894..305fe2a 100644 --- a/hangtag-ui/src/components/DraftDesign/components/node/ShapeLozengeNode.vue +++ b/hangtag-ui/src/components/DraftDesign/components/node/ShapeLozengeNode.vue @@ -249,7 +249,6 @@ export default defineComponent({ } } } - console.log("text##", info) this.cellInfo = mergeDeepObject({ showInput: false, id: nextId(), diff --git a/hangtag-ui/src/components/DraftDesign/components/node/ShapeRightArrowNode.vue b/hangtag-ui/src/components/DraftDesign/components/node/ShapeRightArrowNode.vue index 7ba22b1..3b2e933 100644 --- a/hangtag-ui/src/components/DraftDesign/components/node/ShapeRightArrowNode.vue +++ b/hangtag-ui/src/components/DraftDesign/components/node/ShapeRightArrowNode.vue @@ -255,7 +255,6 @@ export default defineComponent({ } } } - console.log("text##", info) this.cellInfo = mergeDeepObject({ showInput: false, id: nextId(), diff --git a/hangtag-ui/src/components/DraftDesign/components/node/ShapeRightTriangleNode.vue b/hangtag-ui/src/components/DraftDesign/components/node/ShapeRightTriangleNode.vue index ed86739..c297821 100644 --- a/hangtag-ui/src/components/DraftDesign/components/node/ShapeRightTriangleNode.vue +++ b/hangtag-ui/src/components/DraftDesign/components/node/ShapeRightTriangleNode.vue @@ -239,7 +239,6 @@ export default defineComponent({ } } } - console.log("text##", info) this.cellInfo = mergeDeepObject({ showInput: false, id: nextId(), diff --git a/hangtag-ui/src/components/DraftDesign/components/node/ShapeTriangleNode.vue b/hangtag-ui/src/components/DraftDesign/components/node/ShapeTriangleNode.vue index 3338a70..3c3a39e 100644 --- a/hangtag-ui/src/components/DraftDesign/components/node/ShapeTriangleNode.vue +++ b/hangtag-ui/src/components/DraftDesign/components/node/ShapeTriangleNode.vue @@ -240,7 +240,6 @@ export default defineComponent({ } } } - console.log("text##", info) this.cellInfo = mergeDeepObject({ showInput: false, id: nextId(), diff --git a/hangtag-ui/src/components/DraftDesign/components/node/TextCellNode.vue b/hangtag-ui/src/components/DraftDesign/components/node/TextCellNode.vue index f32fdb1..3c6f2b6 100644 --- a/hangtag-ui/src/components/DraftDesign/components/node/TextCellNode.vue +++ b/hangtag-ui/src/components/DraftDesign/components/node/TextCellNode.vue @@ -52,8 +52,9 @@ export default defineComponent({ data() { return { textElId: nextId(), + cellInfo: { - id: '', + id: nextId(), label: '新文本', showInput: false, style: { @@ -100,18 +101,15 @@ export default defineComponent({ mounted() { const node = (this as any).getNode() this.nodeInfo = node - - if (node && node.data) { this.setCellInfo(node.data) } node.on('change:data', ({current}) => { - this.setCellInfo(current) }) - }, unmounted() { + }, methods: { safeHtml(val) { @@ -208,7 +206,6 @@ export default defineComponent({ } } } - this.cellInfo = mergeDeepObject({ showInput: false, id: nextId(), @@ -237,15 +234,14 @@ export default defineComponent({ } }, info) - console.log("text##", this.nodeInfo) - setTimeout(() => { - if (this.nodeInfo.store && this.nodeInfo.store.data) { - this.nodeInfo.store.data.data = this.cellInfo - } - }, 300) + // setTimeout(() => { + // if (this.nodeInfo.store && this.nodeInfo.store.data) { + // this.nodeInfo.store.data.data = this.cellInfo + // } + // }, 300) this.fontSize = parseInt(getSafeValue(this.cellInfo.style.text, 'fontSizeVal') || '12') - console.log(" this.fontSize", this.cellInfo) + // this.fontSize = parseInt(getSafeValue(this.cellInfo.style.text, 'fontSize') || '14') this.setInput(this.cellInfo.showInput) this.cellInfo.editMode = getDraftDesignState(); diff --git a/hangtag-ui/src/components/DraftDesign/config/index.ts b/hangtag-ui/src/components/DraftDesign/config/index.ts index b39336b..7a6dea1 100644 --- a/hangtag-ui/src/components/DraftDesign/config/index.ts +++ b/hangtag-ui/src/components/DraftDesign/config/index.ts @@ -73,7 +73,7 @@ export const graphOptions = (elId:string, viewMode = false) => { // 显示网格 grid: { - visible: false, + visible: true, size: 2, // 网格大小 type: 'doubleMesh', // // 'dot' | 'fixedDot' | 'mesh' args: [{ @@ -87,7 +87,7 @@ export const graphOptions = (elId:string, viewMode = false) => { }, // 滚轮缩放 MouseWheel mousewheel: { - enabled: true, zoomAtMousePosition: true, modifiers: ['ctrl', 'meta'], maxScale: 10, minScale: 0.3 + enabled: true, zoomAtMousePosition: true, modifiers: ['ctrl', 'meta'], maxScale: 10, minScale: 0.5 }, panning: { // 画布移动 diff --git a/hangtag-ui/src/components/DraftDesign/icons/demo.html b/hangtag-ui/src/components/DraftDesign/icons/demo.html index b3acf7d..a33d4d7 100644 --- a/hangtag-ui/src/components/DraftDesign/icons/demo.html +++ b/hangtag-ui/src/components/DraftDesign/icons/demo.html @@ -9,10 +9,80 @@
-

Font Name: icomoon (Glyphs: 62)

+

Font Name: icomoon (Glyphs: 67)

Grid Size: Unknown

+
+
+ + icon-lk_order_by +
+
+ + +
+
+ liga: + +
+
+
+
+ + icon-lk_search +
+
+ + +
+
+ liga: + +
+
+
+
+ + icon-lk_reduce +
+
+ + +
+
+ liga: + +
+
+
+
+ + icon-lk_edit +
+
+ + +
+
+ liga: + +
+
+
+
+ + icon-lk_add +
+
+ + +
+
+ liga: + +
+
diff --git a/hangtag-ui/src/components/DraftDesign/icons/fonts/icomoon.eot b/hangtag-ui/src/components/DraftDesign/icons/fonts/icomoon.eot index 3f431576794f26d85c77732ddde8a450b7573f0d..5fa3021f185cc6d5fdd6c813fbb6a758d05d8705 100644 GIT binary patch delta 1212 zcmaJaAj+EEj4Z}Wp}mOC3Peu;~HF$gdP7hBqYK%*lpY> zI4y=AgG;$jI#ph~Hy$?pE9I6rfJc;6ecmk58cbavr9@Du^7mBoSQ@oi-q)0nN? z!Y?qpzKh?+%L2gLO@58vgbzUi9Ws!Ila!xG>S|c?i5-F*mLi7gdC#H#$5VIkgk?}d zQljU7EF25AbI=|PwwLX?Y8ZR(W16gJnj&j^HEyz8cI-7zFz8`7?k6UhWv{Uec5tkj zTN`gyVvKP0p_gdrayQWWFoi}U8pCKrmYgnh3Sx&pgnpl{CDZ6Pqb46hVuC_6AmNNe z(o7*u$^Gm*7zm7-Ryu83BLR9wEHfQDrX2WlV5@ChQWQy=JbZXkl6ra?H#{Sc_N6Uz zlz~Uhax*g+*ta#f<-#1{)rkgvLS>nXLLJj0X-&V@*A#|0fL9WTVxJz?l7=S{k;758 zEk-)q1=|*~3+cudANjhwecS~mYu_K>R^pjVyjF~tN#RR-!!3$#%#!4-E&}`u?i$L( zYQHtb7GNN>O@iXggvY)*3|n=s{O=U#2bxB zPIRFg1s`!-P80VgCKFL~nnblTYWn#TZn0LtMfNTGQmD5##N7?`ic1BtU$hrEo||fE z5uDz(9lnLbtD$sp0h}bKTf`so1Yh7=_?Mc&ODg`)1+o|nWq^7(a`KZC z+m==>VPG&)0SdO|CRP+M_%fUT^49?Q3VDgSsWZJee*^hvfa=={@{3Ctm_hnYLO}8i z%*>4cCZ{mkGulpG!syLtyZHlSslGBJNCnW2H5OOn`E9;3aI=81A&Q~*Lb diff --git a/hangtag-ui/src/components/DraftDesign/icons/fonts/icomoon.svg b/hangtag-ui/src/components/DraftDesign/icons/fonts/icomoon.svg index 343305d..2321bad 100644 --- a/hangtag-ui/src/components/DraftDesign/icons/fonts/icomoon.svg +++ b/hangtag-ui/src/components/DraftDesign/icons/fonts/icomoon.svg @@ -69,4 +69,9 @@ + + + + + \ No newline at end of file diff --git a/hangtag-ui/src/components/DraftDesign/icons/fonts/icomoon.ttf b/hangtag-ui/src/components/DraftDesign/icons/fonts/icomoon.ttf index 27e233e2726580c970ccc5fab10b56b7b5ff5759..a741cf3c80d2dccfb1aea0e331822892292454dd 100644 GIT binary patch delta 1215 zcmaJ>O>7fa5T4mh>|h{U+pK?3YU16Et)|8Hu77q#Q@b`wBc+vXCFG~5Rau3fpeDsA zfPy$U7f{I|J zZ)U!Ep7~~X|C+v5s{;bSc31!rQkBu9A^BV%lIJe%LsPSMEja$mj{w+1_JL#eT#fWg zWV7x%Hgopq{XdL5WX}T_zfK>q55IEd(W?NNNs8yD$dqEvt*; zAd1gFUnyYe3w#?(OYh+6WZebud_`OoSEx<}(olp7yiduQTw0GB0eP28jViIM?%m|j z|L18rM8YzZkd)|sfrVpXp8&pa*jIO2YQxxi9y3(UFf`TJs&R#Lc{_{VaM;Ty;W|sU zoJG#yjbrWH=6L%irbB2oy+BQSdcmS@^O(&vzVXTRTmge-+!P~7ox8h{8j2?yF;N-(<&59Ya~Q##4-zs1KQ4q``0|XfNzR3S}`#`0ZjEKx`T_!SpX8c0WtT-KY3snIx3he>Ac zc{<1k(i>B|7wGK`2d97$HT{u4+|ld z@0Km6WR=SnE?Z@1_28{r^uu0}k?osq*KAR_sdm{tu*qr?8!Pr}f*j zpC;P6@q5a|p`{+Z3mb3hyBeBtVRtAJIulwBzZR~wK2SsO19)1ALc`AZmmU~b@gH9~ B0nPvb delta 292 zcmZ2c@Fk<3fsuiMft#U$ftkU;KUm+0Ux+OgD6$8L6OwZi3&g`N9bsT#lmYTX(i4jd zfV2RR5288Jb1KvLY^BSA{0asJeUFUP#1ze(ZK@0m1_yxhW*I;Mj!>2iOPUnL{A zq~iZvAdA5eXdWX+PJXguV%yTHB@7HkDnQY;+{B6k2498~K>ivaUm-6sH+7~L=WihY z3{XQ`L4I)w(4jzJ5(1KEU}pX|@qj&}?IcETM%&FkjHUX@ApZb?;Tnsp@%%Pl8Ms-% z{73gJu7DUIdUB14Iiu6&EhZd{lP{RI2?2#cx||q}F>ry@FfdIPv=H9hY_^mU09#B% Au>b%7 diff --git a/hangtag-ui/src/components/DraftDesign/icons/fonts/icomoon.woff b/hangtag-ui/src/components/DraftDesign/icons/fonts/icomoon.woff index 482c6c0afa72bc2e168377bcb90d0fa10d6b5c46..3c6c0d8c92848574a40da4e767d04af4d1d201e4 100644 GIT binary patch delta 1256 zcmaJ7fa5T4mh><}Q1W3PWIYT{kThS1pA_0O(oYRg7Rq!ig!LViFXWCe<&CSa7b z1ohxth@gjx$~}|=AS4b|!vV+z2}mQvAywhREwl&30U_nmN>r+ZykW-15(-kEcHX?1 z_s#6gH*a<7P04vKH!uJQw2V2}UekMibnYvEJvmb-0br3_hgjTW&wf8um}TDsvRmFu z`>E;kUy<)IfcApr=_~Di@nqoyKzr*;q`Wu&6=tkThF7K6411OqHWc<%CRiwlHKdI z^GW!XceczWj$pyjMr?Jgk%@=^q1N;QHC^rmgSt&(JQfOLD5%KRHndtKr`v~aS5!-+ z(5;7b(TBtYT~ULCi^mdr5~)k!j_VVTXGAwrDcuA-MRQOO}=ko*Wtz&W^Aj=cI zy%VzB)m1;?v@+6@GV~D!kLcw_q}Q`;y??z8vxHa2>-ce%BLnLj=Gf zTZm#;)UPGt_E=Eyhj>~{I?sZqg?u1gpW;JTXQxZJzOrTo0$sPbC}UY!VgJR4ZtM3JO3Uy_x}HkxJTyl4|$c zxhgK|!y?r_;w|V11!XI?p$#oA;<%h5?sZJWLTJ^AYHLV$i$`rzHIMWBFY}_WyW1z+ z_H|1Od8tn_X9ZE1Y;Lw#9jzN;vw%NHlG*?L=jh6pzQ`x@xJG>lX#OJH=0dxD)jTJ_ z33A#b{3%E9S+QB%XmwbuO-(1tC~^);+`s=4x^rifxnyoD-8}$Z4OSa0JGQomN?eIY z<54LpDdLXm>!GQsA;H7@;jCe1jBM7x6(eh|9l3j#KCItnriK_QT;ux&%FHn02)|V1 z4Ip@3oKYBYKzpTCg&y=FfcG?0Hs1eSUl{~ zk@Uo3kk}p|p96{o(sL@)fMQ1&81y|rn9o+aJR>zRg@M742dKsjgf(-vsb&BLfnqK| zz6uC)gtAP@$StV=iUI9l1e(Xl@qaD@Lr#7&P@SI<&?1I55N=yqwInyO0?0S|0pu%y zu`k1kyu{p81_omZphloN# @@ -1352,7 +1540,6 @@ defineExpose({