From b94cd087729596a0a7cf0cd4c21fa48808d2b51e Mon Sep 17 00:00:00 2001 From: zhanhong <283456800@qq.com> Date: Wed, 28 Feb 2024 00:07:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9ACRM=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=95=86=E6=9C=BA=E4=BA=A7=E5=93=81=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=20CrmProductStatusEnum.ENABLE(1,=20"=E4=B8=8A?= =?UTF-8?q?=E6=9E=B6")=20CommonStatusEnum.DISABLE(1,=20"=E5=85=B3=E9=97=AD?= =?UTF-8?q?");?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/crm/enums/product/CrmProductStatusEnum.java | 9 +++++++++ .../controller/admin/product/CrmProductController.java | 4 ++-- .../crm/service/product/CrmProductServiceImpl.java | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/product/CrmProductStatusEnum.java b/yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/product/CrmProductStatusEnum.java index e82d5b5b8..9516c35c6 100644 --- a/yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/product/CrmProductStatusEnum.java +++ b/yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/product/CrmProductStatusEnum.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.crm.enums.product; +import cn.hutool.core.util.ObjUtil; import cn.iocoder.yudao.framework.common.core.IntArrayValuable; import lombok.AllArgsConstructor; import lombok.Getter; @@ -35,4 +36,12 @@ public enum CrmProductStatusEnum implements IntArrayValuable { return ARRAYS; } + public static boolean isEnable(Integer status) { + return ObjUtil.equal(ENABLE.status, status); + } + + public static boolean isDisable(Integer status) { + return ObjUtil.equal(DISABLE.status, status); + } + } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/CrmProductController.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/CrmProductController.java index 91d31de7a..1d04e7759 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/CrmProductController.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/product/CrmProductController.java @@ -1,7 +1,6 @@ package cn.iocoder.yudao.module.crm.controller.admin.product; import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -14,6 +13,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.product.vo.product.CrmProduc import cn.iocoder.yudao.module.crm.controller.admin.product.vo.product.CrmProductSaveReqVO; import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductCategoryDO; import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductDO; +import cn.iocoder.yudao.module.crm.enums.product.CrmProductStatusEnum; import cn.iocoder.yudao.module.crm.service.product.CrmProductCategoryService; import cn.iocoder.yudao.module.crm.service.product.CrmProductService; import cn.iocoder.yudao.module.system.api.user.AdminUserApi; @@ -96,7 +96,7 @@ public class CrmProductController { @GetMapping("/simple-list") @Operation(summary = "获得产品精简列表", description = "只包含被开启的产品,主要用于前端的下拉选项") public CommonResult> getProductSimpleList() { - List list = productService.getProductListByStatus(CommonStatusEnum.ENABLE.getStatus()); + List list = productService.getProductListByStatus(CrmProductStatusEnum.ENABLE.getStatus()); return success(convertList(list, product -> new CrmProductRespVO().setId(product.getId()).setName(product.getName()) .setUnit(product.getUnit()).setNo(product.getNo()).setPrice(product.getPrice()))); } diff --git a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductServiceImpl.java b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductServiceImpl.java index c44bc6b9e..0598e6253 100644 --- a/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductServiceImpl.java +++ b/yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/product/CrmProductServiceImpl.java @@ -1,7 +1,6 @@ package cn.iocoder.yudao.module.crm.service.product; import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.module.crm.controller.admin.product.vo.product.CrmProductPageReqVO; @@ -11,6 +10,7 @@ import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductDO; import cn.iocoder.yudao.module.crm.dal.mysql.product.CrmProductMapper; import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; +import cn.iocoder.yudao.module.crm.enums.product.CrmProductStatusEnum; import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPermission; import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; @@ -165,7 +165,7 @@ public class CrmProductServiceImpl implements CrmProductService { if (productMap.get(id) == null) { throw exception(PRODUCT_NOT_EXISTS); } - if (CommonStatusEnum.isDisable(product.getStatus())) { + if (CrmProductStatusEnum.isDisable(product.getStatus())) { throw exception(PRODUCT_NOT_ENABLE, product.getName()); } }