From a347d2a1d39ae5c591b45f6f439d1674b3db0f0b Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 5 Sep 2022 21:08:45 +0800 Subject: [PATCH 01/29] =?UTF-8?q?=E6=B8=85=E7=90=86=E5=B7=B2=E8=BF=81?= =?UTF-8?q?=E7=A7=BB=E7=9A=84=20product=20=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 归档/management-web-app/pom.xml | 128 ----------- .../product/ProductAttrController.http | 21 -- .../product/ProductAttrController.java | 100 -------- .../product/ProductBrandController.http | 20 -- .../product/ProductBrandController.java | 82 ------- .../product/ProductCategoryController.http | 15 -- .../product/ProductCategoryController.java | 64 ------ .../product/ProductSpuController.http | 65 ------ .../product/ProductSpuController.java | 27 --- .../vo/attr/ProductAttrKeyCreateReqVO.java | 24 -- .../vo/attr/ProductAttrKeyPageReqVO.java | 22 -- .../product/vo/attr/ProductAttrKeyRespVO.java | 20 -- .../vo/attr/ProductAttrKeyUpdateReqVO.java | 27 --- .../vo/attr/ProductAttrValueCreateReqVO.java | 28 --- .../vo/attr/ProductAttrValueListQueryReqVO.java | 21 -- .../product/vo/attr/ProductAttrValueRespVO.java | 22 -- .../vo/attr/ProductAttrValueUpdateReqVO.java | 28 --- .../vo/brand/ProductBrandCreateReqVO.java | 20 -- .../product/vo/brand/ProductBrandPageReqVO.java | 19 -- .../product/vo/brand/ProductBrandRespVO.java | 24 -- .../vo/brand/ProductBrandUpdateReqVO.java | 22 -- .../vo/category/ProductCategoryCreateReqVO.java | 34 --- .../vo/category/ProductCategoryRespVO.java | 30 --- .../category/ProductCategoryTreeNodeRespVO.java | 36 --- .../vo/category/ProductCategoryUpdateReqVO.java | 37 --- .../product/vo/spu/ProductSpuCreateReqVO.java | 73 ------ .../product/vo/spu/ProductSpuRespVO.java | 34 --- .../product/vo/spu/ProductSpuUpdateReqVO.java | 77 ------- .../convert/product/ProductAttrConvert.java | 39 ---- .../convert/product/ProductBrandConvert.java | 34 --- .../convert/product/ProductCategoryConvert.java | 26 --- .../convert/product/ProductSpuConvert.java | 34 --- .../managementweb/convert/user/UserConvert.java | 35 --- .../manager/product/ProductBrandManager.java | 93 -------- .../manager/product/ProductCategoryManager.java | 106 --------- .../manager/product/ProductSpuManager.java | 63 ----- .../moved/product/product-service-impl/pom.xml | 106 --------- .../product/convert/ProductAttrConvert.java | 58 ----- .../mall/product/dao/ProductAttrMapper.java | 31 --- .../product/dao/ProductAttrValueMapper.java | 29 --- .../mall/product/dao/ProductSkuMapper.java | 26 --- .../dao/UserProductSpuCollectionsMapper.java | 51 ----- .../mall/product/dataobject/ProductStockDO.java | 44 ---- .../dataobject/UserProductSpuCollectionsDO.java | 79 ------- .../ProductSpuCollectionServiceImpl.java | 64 ------ .../src/main/resources/config/application.yaml | 91 -------- .../main/resources/mapper/ProductAttrMapper.xml | 87 ------- .../resources/mapper/ProductAttrValueMapper.xml | 130 ----------- .../main/resources/mapper/ProductSkuMapper.xml | 87 ------- 归档/product-service-project/pom.xml | 39 ---- .../product-service-api/pom.xml | 36 --- .../enums/ProductErrorCodeConstants.java | 37 --- .../enums/category/ProductCategoryIdEnum.java | 23 -- .../rpc/brand/ProductBrandFeign.java | 69 ------ .../rpc/brand/dto/ProductBrandCreateReqDTO.java | 36 --- .../rpc/brand/dto/ProductBrandPageReqDTO.java | 25 -- .../rpc/brand/dto/ProductBrandRespDTO.java | 41 ---- .../rpc/brand/dto/ProductBrandUpdateReqDTO.java | 41 ---- .../rpc/category/ProductCategoryFeign.java | 68 ------ .../dto/ProductCategoryCreateReqDTO.java | 49 ---- .../dto/ProductCategoryListQueryReqDTO.java | 27 --- .../category/dto/ProductCategoryRespDTO.java | 49 ---- .../dto/ProductCategoryUpdateReqDTO.java | 54 ----- .../productservice/rpc/spu/ProductSpuFeign.java | 57 ----- .../rpc/spu/dto/ProductSpuPageReqDTO.java | 33 --- .../rpc/spu/dto/ProductSpuRespDTO.java | 62 ----- .../product-service-app/pom.xml | 123 ---------- .../ProductServiceApplication.java | 17 -- .../productservice/config/AopConfiguration.java | 12 - .../config/DatabaseConfiguration.java | 28 --- .../controller/ProductBrandController.java | 98 -------- .../controller/ProductCategoryController.java | 107 --------- .../convert/attr/ProductAttrConvert.java | 61 ----- .../convert/brand/ProductBrandConvert.java | 48 ---- .../category/ProductCategoryConvert.java | 40 ---- .../mysql/dataobject/attr/ProductAttrKeyDO.java | 34 --- .../dataobject/attr/ProductAttrValueDO.java | 40 ---- .../mysql/dataobject/brand/ProductBrandDO.java | 41 ---- .../dataobject/category/ProductCategoryDO.java | 52 ----- .../mysql/mapper/attr/ProductAttrKeyMapper.java | 25 -- .../mapper/attr/ProductAttrValueMapper.java | 24 -- .../mysql/mapper/brand/ProductBrandMapper.java | 25 -- .../mapper/category/ProductCategoryMapper.java | 24 -- .../manager/brand/ProductBrandManager.java | 86 ------- .../category/ProductCategoryManager.java | 87 ------- .../manager/spu/ProductSpuManager.java | 34 --- .../service/brand/ProductBrandService.java | 119 ---------- .../service/brand/bo/ProductBrandBO.java | 40 ---- .../service/brand/bo/ProductBrandCreateBO.java | 38 --- .../service/brand/bo/ProductBrandPageBO.java | 27 --- .../service/brand/bo/ProductBrandUpdateBO.java | 43 ---- .../category/ProductCategoryService.java | 135 ----------- .../service/category/bo/ProductCategoryBO.java | 48 ---- .../category/bo/ProductCategoryCreateBO.java | 48 ---- .../category/bo/ProductCategoryListQueryBO.java | 25 -- .../category/bo/ProductCategoryUpdateBO.java | 53 ----- .../service/spu/ProductSpuService.java | 110 --------- .../src/main/resources/application-dev.yaml | 21 -- .../src/main/resources/application-local.yaml | 24 -- .../src/main/resources/application.yaml | 60 ----- .../main/resources/mapper/ProductSkuMapper.xml | 17 -- .../main/resources/sql/mall_product_data.sql | 216 ------------------ .../main/resources/sql/mall_product_schema.sql | 103 --------- .../manager/spu/ProductSkuManagerTest.java | 34 --- .../mall/productservice/package-info.java | 1 - 105 files changed, 5347 deletions(-) delete mode 100644 归档/management-web-app/pom.xml delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductAttrController.http delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductAttrController.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductBrandController.http delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductBrandController.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductCategoryController.http delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductCategoryController.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.http delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrKeyCreateReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrKeyPageReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrKeyRespVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrKeyUpdateReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueCreateReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueListQueryReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueRespVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueUpdateReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandCreateReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandPageReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandRespVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandUpdateReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryCreateReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryRespVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryTreeNodeRespVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryUpdateReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuCreateReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuRespVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuUpdateReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductAttrConvert.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductBrandConvert.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductCategoryConvert.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductSpuConvert.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/user/UserConvert.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductBrandManager.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductCategoryManager.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductSpuManager.java delete mode 100644 归档/moved/product/product-service-impl/pom.xml delete mode 100644 归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductAttrConvert.java delete mode 100644 归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductAttrMapper.java delete mode 100644 归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductAttrValueMapper.java delete mode 100644 归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductSkuMapper.java delete mode 100644 归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/UserProductSpuCollectionsMapper.java delete mode 100644 归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductStockDO.java delete mode 100644 归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/UserProductSpuCollectionsDO.java delete mode 100644 归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuCollectionServiceImpl.java delete mode 100644 归档/moved/product/product-service-impl/src/main/resources/config/application.yaml delete mode 100644 归档/moved/product/product-service-impl/src/main/resources/mapper/ProductAttrMapper.xml delete mode 100644 归档/moved/product/product-service-impl/src/main/resources/mapper/ProductAttrValueMapper.xml delete mode 100644 归档/moved/product/product-service-impl/src/main/resources/mapper/ProductSkuMapper.xml delete mode 100644 归档/product-service-project/pom.xml delete mode 100644 归档/product-service-project/product-service-api/pom.xml delete mode 100644 归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/enums/ProductErrorCodeConstants.java delete mode 100644 归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/enums/category/ProductCategoryIdEnum.java delete mode 100644 归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/ProductBrandFeign.java delete mode 100644 归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandCreateReqDTO.java delete mode 100644 归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandPageReqDTO.java delete mode 100644 归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandRespDTO.java delete mode 100644 归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandUpdateReqDTO.java delete mode 100644 归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/ProductCategoryFeign.java delete mode 100644 归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryCreateReqDTO.java delete mode 100644 归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryListQueryReqDTO.java delete mode 100644 归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryRespDTO.java delete mode 100644 归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryUpdateReqDTO.java delete mode 100644 归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/ProductSpuFeign.java delete mode 100644 归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuPageReqDTO.java delete mode 100644 归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuRespDTO.java delete mode 100644 归档/product-service-project/product-service-app/pom.xml delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/ProductServiceApplication.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/config/AopConfiguration.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/config/DatabaseConfiguration.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/controller/ProductBrandController.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/controller/ProductCategoryController.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/attr/ProductAttrConvert.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/brand/ProductBrandConvert.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/category/ProductCategoryConvert.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/attr/ProductAttrKeyDO.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/attr/ProductAttrValueDO.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/brand/ProductBrandDO.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/category/ProductCategoryDO.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/attr/ProductAttrKeyMapper.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/attr/ProductAttrValueMapper.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/brand/ProductBrandMapper.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/category/ProductCategoryMapper.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/brand/ProductBrandManager.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/category/ProductCategoryManager.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/ProductBrandService.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandBO.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandCreateBO.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandPageBO.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandUpdateBO.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/ProductCategoryService.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryBO.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryCreateBO.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryListQueryBO.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryUpdateBO.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/ProductSpuService.java delete mode 100644 归档/product-service-project/product-service-app/src/main/resources/application-dev.yaml delete mode 100644 归档/product-service-project/product-service-app/src/main/resources/application-local.yaml delete mode 100644 归档/product-service-project/product-service-app/src/main/resources/application.yaml delete mode 100644 归档/product-service-project/product-service-app/src/main/resources/mapper/ProductSkuMapper.xml delete mode 100644 归档/product-service-project/product-service-app/src/main/resources/sql/mall_product_data.sql delete mode 100644 归档/product-service-project/product-service-app/src/main/resources/sql/mall_product_schema.sql delete mode 100644 归档/product-service-project/product-service-app/src/test/java/cn/iocoder/mall/productservice/manager/spu/ProductSkuManagerTest.java delete mode 100644 归档/product-service-project/product-service-app/src/test/java/cn/iocoder/mall/productservice/package-info.java diff --git a/归档/management-web-app/pom.xml b/归档/management-web-app/pom.xml deleted file mode 100644 index bed43c5dd..000000000 --- a/归档/management-web-app/pom.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - - onemall - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - management-web-app - 管理后台,提供管理员管理的所有功能 - - - - - - cn.iocoder.mall - mall-dependencies - 1.0-SNAPSHOT - pom - import - - - - - - - - cn.iocoder.mall - mall-spring-boot-starter-web - - - - cn.iocoder.mall - mall-spring-boot-starter-swagger - - - - cn.iocoder.mall - mall-spring-boot-starter-security-admin - - - - - cn.iocoder.mall - mall-spring-boot-starter-dubbo - - - - - cn.iocoder.mall - user-service-api - 1.0-SNAPSHOT - - - - cn.iocoder.mall - system-service-api - 1.0-SNAPSHOT - - - - cn.iocoder.mall - product-service-api - 1.0-SNAPSHOT - - - - cn.iocoder.mall - promotion-service-api - 1.0-SNAPSHOT - - - - cn.iocoder.mall - pay-service-api - 1.0-SNAPSHOT - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - - - org.springframework.boot - spring-boot-starter-actuator - - - - - org.projectlombok - lombok - - - - org.mapstruct - mapstruct - - - org.mapstruct - mapstruct-jdk8 - - - - - org.springframework.cloud - spring-cloud-starter-openfeign - - - - - - ${project.artifactId} - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductAttrController.http b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductAttrController.http deleted file mode 100644 index e946ab23d..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductAttrController.http +++ /dev/null @@ -1,21 +0,0 @@ -### /product-attr/page 成功(全部) -GET http://127.0.0.1:18083/management-api/product-attr/key/page?pageNo=1&pageSize=10 -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### - -POST http://127.0.0.1:18083/management-api/product-attr/key/create -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -name=桶&status=1 - -### -POST http://127.0.0.1:18083/management-api/product-attr/value/create -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -attrKeyId=12&name=大桶&status=1 - -### \ No newline at end of file diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductAttrController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductAttrController.java deleted file mode 100644 index ad77f1a2c..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductAttrController.java +++ /dev/null @@ -1,100 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.product.vo.attr.*; -import cn.iocoder.mall.managementweb.manager.product.ProductAttrKeyManager; -import cn.iocoder.security.annotations.RequiresPermissions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.List; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** - * 商品规格键 Controller - */ -@RestController -@RequestMapping("/product-attr/") -@Api(tags = "商品规格") -@Validated -public class ProductAttrController { - - @Autowired - private ProductAttrKeyManager productAttrKeyManager; - - @PostMapping("/key/create") - @ApiOperation("创建商品规格键") - @RequiresPermissions("product:attr-key:create") - public CommonResult createProductAttrKey(@Valid ProductAttrKeyCreateReqVO createVO) { - return success(productAttrKeyManager.createProductAttrKey(createVO)); - } - - @PostMapping("/key/update") - @ApiOperation("更新商品规格键") - @RequiresPermissions("product:attr-key:update") - public CommonResult updateProductAttrKey(@Valid ProductAttrKeyUpdateReqVO updateVO) { - productAttrKeyManager.updateProductAttrKey(updateVO); - return success(true); - } - - @GetMapping("/key/get") - @ApiOperation("获得商品规格键") - @ApiImplicitParam(name = "productAttrKeyId", value = "商品规格键编号", required = true, example = "1") - @RequiresPermissions("product:attr-key:page") - public CommonResult getProductAttrKey(@RequestParam("productAttrKeyId") Integer productAttrKeyId) { - return success(productAttrKeyManager.getProductAttrKey(productAttrKeyId)); - } - - @GetMapping("/key/list") - @ApiOperation("获得商品规格键列表") - @ApiImplicitParam(name = "productAttrKeyIds", value = "商品规格键编号列表", required = true, example = "1,3") - @RequiresPermissions("product:attr-key:page") - public CommonResult> listProductAttrKeys(@RequestParam("productAttrKeyIds") List productAttrKeyIds) { - return success(productAttrKeyManager.listProductAttrKeys(productAttrKeyIds)); - } - - @GetMapping("/key/page") - @ApiOperation("获得商品规格键分页") - @RequiresPermissions("product:attr-key:page") - public CommonResult> pageProductAttrKey(ProductAttrKeyPageReqVO pageVO) { - return success(productAttrKeyManager.pageProductAttrKey(pageVO)); - } - - @PostMapping("/value/create") - @ApiOperation("创建商品规格值") - @RequiresPermissions("product:attr-value:create") - public CommonResult createProductAttrValue(@Valid ProductAttrValueCreateReqVO createVO) { - return success(productAttrKeyManager.createProductAttrValue(createVO)); - } - - @PostMapping("/value/update") - @ApiOperation("更新商品规格值") - @RequiresPermissions("product:attr-value:update") - public CommonResult updateProductAttrValue(@Valid ProductAttrValueUpdateReqVO updateVO) { - productAttrKeyManager.updateProductAttrValue(updateVO); - return success(true); - } - - @GetMapping("/value/get") - @ApiOperation("获得商品规格值") - @ApiImplicitParam(name = "productAttrValueId", value = "商品规格值编号", required = true) - @RequiresPermissions("product:attr-value:list") - public CommonResult getProductAttrValue(@RequestParam("productAttrValueId") Integer productAttrValueId) { - return success(productAttrKeyManager.getProductAttrValue(productAttrValueId)); - } - - @GetMapping("/value/list") - @ApiOperation("获得商品规格值列表") - @RequiresPermissions("product:attr-value:list") - public CommonResult> listProductAttrValues(@Valid ProductAttrValueListQueryReqVO queryReqVO) { - return success(productAttrKeyManager.listProductAttrValues(queryReqVO)); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductBrandController.http b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductBrandController.http deleted file mode 100644 index 1d862b54c..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductBrandController.http +++ /dev/null @@ -1,20 +0,0 @@ -### /product-attr/page 成功(全部) -GET http://127.0.0.1:18083/management-api/product-attr/key/page?pageNo=1&pageSize=10 -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### - -POST http://127.0.0.1:18083/management-api/product-brand/create -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -name=光明牌&description=光明牌电灯泡&status=1 - -### -GET http://127.0.0.1:18083/management-api/product-brand/get?productBrandId=3 -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - - -### \ No newline at end of file diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductBrandController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductBrandController.java deleted file mode 100644 index f99a3ece9..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductBrandController.java +++ /dev/null @@ -1,82 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandCreateReqVO; -import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandPageReqVO; -import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandRespVO; -import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandUpdateReqVO; -import cn.iocoder.mall.managementweb.manager.product.ProductBrandManager; -import cn.iocoder.security.annotations.RequiresPermissions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.List; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** -* 商品品牌 Controller -*/ -@RestController -@RequestMapping("/product-brand") -@Api(tags = "商品品牌") -@Validated -public class ProductBrandController { - - @Autowired - private ProductBrandManager productBrandManager; - - @PostMapping("/create") - @ApiOperation("创建商品品牌") - @RequiresPermissions("product:brand:create") - public CommonResult createProductBrand(@Valid ProductBrandCreateReqVO createVO) { - return success(productBrandManager.createProductBrand(createVO)); - } - - @PostMapping("/update") - @ApiOperation("更新商品品牌") - @RequiresPermissions("product:brand:update") - public CommonResult updateProductBrand(@Valid ProductBrandUpdateReqVO updateVO) { - productBrandManager.updateProductBrand(updateVO); - return success(true); - } - - @PostMapping("/delete") - @ApiOperation("删除商品品牌") - @ApiImplicitParam(name = "productBrandId", value = "商品品牌编号", required = true) - @RequiresPermissions("product:brand:delete") - public CommonResult deleteProductBrand(@RequestParam("productBrandId") Integer productBrandId) { - productBrandManager.deleteProductBrand(productBrandId); - return success(true); - } - - @GetMapping("/get") - @ApiOperation("获得商品品牌") - @ApiImplicitParam(name = "productBrandId", value = "商品品牌编号", required = true) - @RequiresPermissions("product:brand:page") - public CommonResult getProductBrand(@RequestParam("productBrandId") Integer productBrandId) { - return success(productBrandManager.getProductBrand(productBrandId)); - } - - @GetMapping("/list") - @ApiOperation("获得商品品牌列表") - @ApiImplicitParam(name = "productBrandIds", value = "商品品牌编号列表", required = true) - @RequiresPermissions("product:brand:page") - public CommonResult> listProductBrands(@RequestParam("productBrandIds") List productBrandIds) { - return success(productBrandManager.listProductBrands(productBrandIds)); - } - - @GetMapping("/page") - @ApiOperation("获得商品品牌分页") - @RequiresPermissions("product:brand:page") - public CommonResult> pageProductBrand(ProductBrandPageReqVO pageVO) { - return success(productBrandManager.pageProductBrand(pageVO)); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductCategoryController.http b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductCategoryController.http deleted file mode 100644 index e6acf7396..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductCategoryController.http +++ /dev/null @@ -1,15 +0,0 @@ -### /product-category/tree 成功 -GET http://127.0.0.1:18083/management-api/product-category/tree -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### - -POST http://127.0.0.1:18083/management-api/product-category/create -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -pid=0&name=美食&description=吃喝拉撒&sort=7&status=1 - - -### \ No newline at end of file diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductCategoryController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductCategoryController.java deleted file mode 100644 index 97b9d6175..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductCategoryController.java +++ /dev/null @@ -1,64 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryCreateReqVO; -import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryTreeNodeRespVO; -import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryUpdateReqVO; -import cn.iocoder.mall.managementweb.manager.product.ProductCategoryManager; -import cn.iocoder.security.annotations.RequiresPermissions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.List; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** -* 商品分类 Controller -*/ -@RestController -@RequestMapping("/product-category") -@Api(tags = "商品分类") -@Validated -public class ProductCategoryController { - - @Autowired - private ProductCategoryManager productCategoryManager; - - @PostMapping("/create") - @ApiOperation("创建商品分类") - @RequiresPermissions("product:category:create") - public CommonResult createProductCategory(@Valid ProductCategoryCreateReqVO createVO) { - return success(productCategoryManager.createProductCategory(createVO)); - } - - @PostMapping("/update") - @ApiOperation("更新商品分类") - @RequiresPermissions("product:category:update") - public CommonResult updateProductCategory(@Valid ProductCategoryUpdateReqVO updateVO) { - productCategoryManager.updateProductCategory(updateVO); - return success(true); - } - - @PostMapping("/delete") - @ApiOperation("删除商品分类") - @RequiresPermissions("product:category:delete") - @ApiImplicitParam(name = "productCategoryId", value = "商品分类编号", required = true) - public CommonResult deleteProductCategory(@RequestParam("productCategoryId") Integer productCategoryId) { - productCategoryManager.deleteProductCategory(productCategoryId); - return success(true); - } - - @GetMapping("/tree") - @ApiOperation("获得资源树") - @RequiresPermissions("product:category:tree") - public CommonResult> treeProductCategory() { - return success(productCategoryManager.treeProductCategory()); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.http b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.http deleted file mode 100644 index 9b1ba1498..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.http +++ /dev/null @@ -1,65 +0,0 @@ -### /product-spu/page 成功(全部) -GET http://127.0.0.1:18083/management-api/product-spu/page?pageNo=1&pageSize=100 -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### /product-spu/page 成功(有库存 + 上架) -GET http://127.0.0.1:18083/management-api/product-spu/page?pageNo=1&pageSize=10&hasQuantity=true&visible=true -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### /product-spu/page 成功(无库存 + 下架) -GET http://127.0.0.1:18083/management-api/product-spu/page?pageNo=1&pageSize=10&hasQuantity=false&visible=false -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -### /product-spu/create 成功 -POST http://127.0.0.1:18083/management-api/product-spu/create -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -name=新商品&description=新商品描述&cid=637&sellPoint=丑&picUrls=1,2,3&visible=true -&skus[0].price=1&skus[0].quantity=100&skus[0].attrValueIds=1,3 -&skus[1].price=2&skus[1].quantity=50&skus[1].attrValueIds=2,4 - -### /product-spu/create 失败(规格不存在) -POST http://127.0.0.1:18083/management-api/product-spu/create -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -name=测试商品标题&description=测试商品描述&cid=637&sellPoint=丑&picUrls=1,2,3&visible=true -&skus[0].price=1&skus[0].quantity=100&skus[0].attrValueIds=1,0 - -### /product-spu/create 失败(规格数量不匹配) -POST http://127.0.0.1:18083/management-api/product-spu/create -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -name=测试商品标题&description=测试商品描述&cid=637&sellPoint=丑&picUrls=1,2,3&visible=true -&skus[0].price=1&skus[0].quantity=100&skus[0].attrValueIds=1,3 -&skus[1].price=2&skus[1].quantity=50&skus[1].attrValueIds=1,2,4 - -### /product-spu/update 成功 -POST http://127.0.0.1:18083/management-api/product-spu/update -Content-Type: application/x-www-form-urlencoded -Authorization: Bearer yudaoyuanma - -id=64&name=新商品测试&description=新商品测试&cid=637&sellPoint=丑&picUrls=1,2,3&visible=true -&skus[0].price=1&skus[0].quantity=100&skus[0].attrValueIds=1,3 -&skus[1].price=2&skus[1].quantity=50&skus[1].attrValueIds=2,4 - -### - -### /product-spu/get -GET http://127.0.0.1:18083/management-api/product-spu/get?productSpuId=32 -Content-Type: application/x-www-form-urlencoded -Authorization:Bearer yudaoyuanma - -### - -### /product-spu/get -GET http://127.0.0.1:18083/management-api/product-spu/list?productSpuIds=32,33,34 -Content-Type: application/x-www-form-urlencoded -Authorization:Bearer yudaoyuanma - -### diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.java index a306591e8..d38e36ed1 100644 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.java +++ b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/ProductSpuController.java @@ -31,33 +31,6 @@ public class ProductSpuController { @Autowired private ProductSpuManager productSpuManager; - @PostMapping("/create") - @ApiOperation("创建商品 SPU") - public CommonResult createProductSpu(@Valid ProductSpuCreateReqVO createVO) { - return success(productSpuManager.createProductSpu(createVO)); - } - - @PostMapping("/update") - @ApiOperation("更新商品 SPU") - public CommonResult updateProductSpu(@Valid ProductSpuUpdateReqVO updateVO) { - productSpuManager.updateProductSpu(updateVO); - return success(true); - } - - @GetMapping("/get") - @ApiOperation("获得商品 SPU") - @ApiImplicitParam(name = "productSpuId", value = "商品 SPU 编号", required = true) - public CommonResult getProductSpu(@RequestParam("productSpuId") Integer productSpuId) { - return success(productSpuManager.getProductSpu(productSpuId)); - } - - @GetMapping("/list") - @ApiOperation("获得商品 SPU 列表") - @ApiImplicitParam(name = "productSpuIds", value = "商品 SPU 编号列表", required = true) - public CommonResult> listProductSpus(@RequestParam("productSpuIds") List productSpuIds) { - return success(productSpuManager.listProductSpus(productSpuIds)); - } - @GetMapping("/page") @ApiOperation("获得商品 SPU 分页") public CommonResult> pageProductSpu(ProductSpuPageReqVO pageVO) { diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrKeyCreateReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrKeyCreateReqVO.java deleted file mode 100644 index 8c34ad510..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrKeyCreateReqVO.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.attr; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("商品规格键创建 Request VO") -@Data -public class ProductAttrKeyCreateReqVO { - - @ApiModelProperty(value = "规格键名称", required = true, example = "尺寸") - @NotEmpty(message = "规格键名称不能为空") - private String name; - @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举") - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrKeyPageReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrKeyPageReqVO.java deleted file mode 100644 index 2ef4b106d..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrKeyPageReqVO.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.attr; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.common.framework.vo.PageParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@ApiModel("商品规格键分页 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -public class ProductAttrKeyPageReqVO extends PageParam { - - @ApiModelProperty(value = "规格键名称", required = true, example = "尺寸", notes = "模糊匹配") - private String name; - @ApiModelProperty(value = "状态", example = "1", notes = "见 CommonStatusEnum 枚举") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrKeyRespVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrKeyRespVO.java deleted file mode 100644 index 9b88b6861..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrKeyRespVO.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.attr; - -import lombok.*; -import io.swagger.annotations.*; -import java.util.*; - -@ApiModel("商品规格键 Response VO") -@Data -public class ProductAttrKeyRespVO { - - @ApiModelProperty(value = "规格键编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "规格键名称", required = true, example = "尺寸") - private String name; - @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举") - private Integer status; - @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrKeyUpdateReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrKeyUpdateReqVO.java deleted file mode 100644 index c7d3f2454..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrKeyUpdateReqVO.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.attr; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("商品规格键更新 Request VO") -@Data -public class ProductAttrKeyUpdateReqVO { - - @ApiModelProperty(value = "规格键编号", required = true, example = "1") - @NotNull(message = "规格键编号不能为空") - private Integer id; - @ApiModelProperty(value = "规格键名称", required = true, example = "尺寸") - @NotEmpty(message = "规格键名称不能为空") - private String name; - @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举") - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueCreateReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueCreateReqVO.java deleted file mode 100644 index b1c2e6ea9..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueCreateReqVO.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.attr; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("商品规格值创建 Request VO") -@Data -public class ProductAttrValueCreateReqVO { - - @ApiModelProperty(value = "规格键编号", required = true, example = "2") - @NotNull(message = "规格键编号不能为空") - private Integer attrKeyId; - @ApiModelProperty(value = "规格值名字", required = true, example = "XXL") - @NotEmpty(message = "规格值名字不能为空") - private String name; - @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举") - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - -} - diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueListQueryReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueListQueryReqVO.java deleted file mode 100644 index b77815791..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueListQueryReqVO.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.attr; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.List; - -@ApiModel("商品规格值的列表查询条件 Request VO") -@Data -@Accessors(chain = true) -public class ProductAttrValueListQueryReqVO { - - @ApiModelProperty(value = "商品规格值编号列表", example = "1, 3") - private List productAttrValueIds; - - @ApiModelProperty(value = "规格键编号", required = true, example = "2") - private Integer productAttrKeyId; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueRespVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueRespVO.java deleted file mode 100644 index 77b3ba654..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueRespVO.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.attr; - -import lombok.*; -import io.swagger.annotations.*; -import java.util.*; - -@ApiModel("商品规格值 Response VO") -@Data -public class ProductAttrValueRespVO { - - @ApiModelProperty(value = "规格值编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "规格键编号", required = true, example = "2") - private Integer attrKeyId; - @ApiModelProperty(value = "规格值名字", required = true, example = "XXL") - private String name; - @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举") - private Integer status; - @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueUpdateReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueUpdateReqVO.java deleted file mode 100644 index 3a77de78a..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/attr/ProductAttrValueUpdateReqVO.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.attr; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("商品规格值更新 Request VO") -@Data -public class ProductAttrValueUpdateReqVO { - - @ApiModelProperty(value = "规格值编号", required = true, example = "1") - @NotNull(message = "规格值编号不能为空") - private Integer id; - @ApiModelProperty(value = "规格值名字", required = true, example = "XXL") - @NotEmpty(message = "规格值名字不能为空") - private String name; - @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举") - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - -} - diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandCreateReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandCreateReqVO.java deleted file mode 100644 index 0c4d8a42e..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandCreateReqVO.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.brand; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@ApiModel("商品品牌创建 Request VO") -@Data -public class ProductBrandCreateReqVO { - - @ApiModelProperty(value = "品牌名称", required = true, example = "这个商品品牌很吊") - private String name; - @ApiModelProperty(value = "品牌描述", example = "这个商品描述很吊") - private String description; - @ApiModelProperty(value = "品牌名图片", example = "http://www.iocoder.cn/xx.jpg") - private String picUrl; - @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举") - private Integer status; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandPageReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandPageReqVO.java deleted file mode 100644 index 9bc34ed58..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandPageReqVO.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.brand; - -import cn.iocoder.common.framework.vo.PageParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@ApiModel("商品品牌分页 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -public class ProductBrandPageReqVO extends PageParam { - - @ApiModelProperty(value = "品牌名称", required = true, notes = "模糊匹配", example = "这个商品品牌很吊") - private String name; - @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举") - private Integer status; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandRespVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandRespVO.java deleted file mode 100644 index 276a23651..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandRespVO.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.brand; - -import lombok.*; -import io.swagger.annotations.*; -import java.util.*; - -@ApiModel("商品品牌 Response VO") -@Data -public class ProductBrandRespVO { - - @ApiModelProperty(value = "品牌编号", required = true, example = "1024") - private Integer id; - @ApiModelProperty(value = "品牌名称", required = true, example = "这个商品品牌很吊") - private String name; - @ApiModelProperty(value = "品牌描述", example = "这个商品描述很吊") - private String description; - @ApiModelProperty(value = "品牌名图片", example = "http://www.iocoder.cn/xx.jpg") - private String picUrl; - @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举") - private Integer status; - @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandUpdateReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandUpdateReqVO.java deleted file mode 100644 index eb9352ff5..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/brand/ProductBrandUpdateReqVO.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.brand; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@ApiModel("商品品牌更新 Request VO") -@Data -public class ProductBrandUpdateReqVO { - - @ApiModelProperty(value = "品牌编号", required = true, example = "1024") - private Integer id; - @ApiModelProperty(value = "品牌名称", required = true, example = "这个商品品牌很吊") - private String name; - @ApiModelProperty(value = "品牌描述", example = "这个商品描述很吊") - private String description; - @ApiModelProperty(value = "品牌名图片", example = "http://www.iocoder.cn/xx.jpg") - private String picUrl; - @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举") - private Integer status; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryCreateReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryCreateReqVO.java deleted file mode 100644 index bb5535e2b..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryCreateReqVO.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.category; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("商品分类创建 Request VO") -@Data -public class ProductCategoryCreateReqVO { - - @ApiModelProperty(value = "父分类编号", required = true, example = "0") - @NotNull(message = "父分类编号不能为空") - private Integer pid; - @ApiModelProperty(value = "分类名称", required = true, example = "手机") - @NotEmpty(message = "分类名称不能为空") - private String name; - @ApiModelProperty(value = "分类描述", required = true, example = "这个商品很吊") - private String description; - @ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg") - private String picUrl; - @ApiModelProperty(value = "分类排序", required = true, example = "10") - @NotNull(message = "分类排序不能为空") - private Integer sort; - @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举") - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryRespVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryRespVO.java deleted file mode 100644 index 4b9c287c1..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryRespVO.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.category; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.Date; - -@ApiModel("商品分类 Response VO") -@Data -public class ProductCategoryRespVO { - - @ApiModelProperty(value = "分类编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "父分类编号", required = true, example = "0") - private Integer pid; - @ApiModelProperty(value = "分类名称", required = true, example = "手机") - private String name; - @ApiModelProperty(value = "分类描述", required = true, example = "这个商品分类很吊") - private String description; - @ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg") - private String picUrl; - @ApiModelProperty(value = "分类排序", required = true, example = "10") - private Integer sort; - @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举") - private Integer status; - @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryTreeNodeRespVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryTreeNodeRespVO.java deleted file mode 100644 index 4f06f3ca8..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryTreeNodeRespVO.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.category; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.Date; -import java.util.List; - -@ApiModel("商品分类 Response VO") -@Data -public class ProductCategoryTreeNodeRespVO { - - @ApiModelProperty(value = "分类编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "父分类编号", required = true, example = "0") - private Integer pid; - @ApiModelProperty(value = "分类名称", required = true, example = "手机") - private String name; - @ApiModelProperty(value = "分类描述", required = true, example = "这个商品很吊") - private String description; - @ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg") - private String picUrl; - @ApiModelProperty(value = "分类排序", required = true, example = "10") - private Integer sort; - @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举") - private Integer status; - @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; - - /** - * 子节点 - */ - private List children; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryUpdateReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryUpdateReqVO.java deleted file mode 100644 index dd358ef00..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/category/ProductCategoryUpdateReqVO.java +++ /dev/null @@ -1,37 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.category; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("商品分类更新 Request VO") -@Data -public class ProductCategoryUpdateReqVO { - - @ApiModelProperty(value = "分类编号", required = true, example = "1") - @NotNull(message = "分类编号不能为空") - private Integer id; - @ApiModelProperty(value = "父分类编号", required = true, example = "0") - @NotNull(message = "父分类编号不能为空") - private Integer pid; - @ApiModelProperty(value = "分类名称", required = true, example = "手机") - @NotEmpty(message = "分类名称不能为空") - private String name; - @ApiModelProperty(value = "分类描述", required = true, example = "这个商品很吊") - private String description; - @ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg") - private String picUrl; - @ApiModelProperty(value = "分类排序", required = true, example = "10") - @NotNull(message = "分类排序不能为空") - private Integer sort; - @ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举") - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuCreateReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuCreateReqVO.java deleted file mode 100644 index a194eb3ef..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuCreateReqVO.java +++ /dev/null @@ -1,73 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.spu; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.Valid; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.List; - -@ApiModel("商品 SPU 创建 Request VO") -@Data -public class ProductSpuCreateReqVO { - - /** - * SKU 信息 - */ - @Data - @Accessors(chain = true) - public static class Sku { - - /** - * 规格值数组 - */ - @NotNull(message = "规格值数组不能为空") - private List attrValueIds; - /** - * 价格,单位:分 - */ - @NotNull(message = "价格不能为空") - @Min(value = 1L, message = "最小价格为 1") - private Integer price; - /** - * 库存数量 - */ - @NotNull(message = "库存数量不能为空") - @Min(value = 1L, message = "最小库存为 1") - private Integer quantity; - - } - - @ApiModelProperty(value = "SPU 名字", required = true, example = "芋艿") - @NotEmpty(message = "SPU 名字不能为空") - private String name; - @ApiModelProperty(value = "卖点", required = true, example = "好吃好玩") - @NotEmpty(message = "卖点不能为空") - private String sellPoint; - @ApiModelProperty(value = "描述", required = true, example = "我是哈哈哈") - @NotEmpty(message = "描述不能为空") - private String description; - @ApiModelProperty(value = "分类编号", required = true, example = "1") - @NotNull(message = "分类编号不能为空") - private Integer cid; - @ApiModelProperty(value = "商品主图地址", required = true, example = "http://www.iocoder.cn/xxx.jpg", notes = "多个之间,使用逗号分隔") - @NotEmpty(message = "商品主图地址不能为空") - private List picUrls; - @ApiModelProperty(value = "是否上架商品", required = true, example = "true") - @NotNull(message = "是否上架商品不能为空") - private Boolean visible; - - // ========== SKU ========= - - /** - * SKU 数组 - */ - @NotNull(message = "SKU 不能为空") - @Valid - private List skus; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuRespVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuRespVO.java deleted file mode 100644 index a7e1a0e28..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuRespVO.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.spu; - -import lombok.*; -import io.swagger.annotations.*; -import java.util.*; - -@ApiModel("商品 SPU Response VO") -@Data -public class ProductSpuRespVO { - - @ApiModelProperty(value = "SPU 编号", required = true) - private Integer id; - @ApiModelProperty(value = "SPU 名字", required = true, example = "芋艿") - private String name; - @ApiModelProperty(value = "卖点", required = true, example = "好吃好玩") - private String sellPoint; - @ApiModelProperty(value = "描述", required = true, example = "我是哈哈哈") - private String description; - @ApiModelProperty(value = "分类编号", required = true, example = "1") - private Integer cid; - @ApiModelProperty(value = "商品主图地址", required = true, example = "http://www.iocoder.cn/xxx.jpg", notes = "多个之间,使用逗号分隔") - private List picUrls; - @ApiModelProperty(value = "是否上架商品", required = true, example = "true") - private Boolean visible; - @ApiModelProperty(value = "排序字段", required = true, example = "1024") - private Integer sort; - @ApiModelProperty(value = "价格", required = true, example = "233", notes = "单位:分") - private Integer price; - @ApiModelProperty(value = "库存数量", required = true, example = "1024") - private Integer quantity; - @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuUpdateReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuUpdateReqVO.java deleted file mode 100644 index 7f3f8be48..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/product/vo/spu/ProductSpuUpdateReqVO.java +++ /dev/null @@ -1,77 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.product.vo.spu; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.Valid; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.List; - -@ApiModel("商品 SPU 更新 Request VO") -@Data -public class ProductSpuUpdateReqVO { - - /** - * SKU 信息 - */ - @Data - @Accessors(chain = true) - public static class Sku { - - /** - * 规格值数组 - */ - @NotNull(message = "规格值数组不能为空") - private List attrValueIds; - /** - * 价格,单位:分 - */ - @NotNull(message = "价格不能为空") - @Min(value = 1L, message = "最小价格为 1") - private Integer price; - /** - * 库存数量 - */ - @NotNull(message = "库存数量不能为空") - @Min(value = 1L, message = "最小库存为 1") - private Integer quantity; - - } - - @ApiModelProperty(value = "SPU 编号", required = true) - @NotNull(message = "SPU 编号不能为空") - private Integer id; - - @ApiModelProperty(value = "SPU 名字", required = true, example = "芋艿") - @NotEmpty(message = "SPU 名字不能为空") - private String name; - @ApiModelProperty(value = "卖点", required = true, example = "好吃好玩") - @NotEmpty(message = "卖点不能为空") - private String sellPoint; - @ApiModelProperty(value = "描述", required = true, example = "我是哈哈哈") - @NotEmpty(message = "描述不能为空") - private String description; - @ApiModelProperty(value = "分类编号", required = true, example = "1") - @NotNull(message = "分类编号不能为空") - private Integer cid; - @ApiModelProperty(value = "商品主图地址", required = true, example = "http://www.iocoder.cn/xxx.jpg", notes = "多个之间,使用逗号分隔") - @NotEmpty(message = "商品主图地址不能为空") - private List picUrls; - @ApiModelProperty(value = "是否上架商品", required = true, example = "true") - @NotNull(message = "是否上架商品不能为空") - private Boolean visible; - - // ========== SKU ========= - - /** - * SKU 数组 - */ - @NotNull(message = "SKU 不能为空") - @Valid - private List skus; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductAttrConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductAttrConvert.java deleted file mode 100644 index 5ea731780..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductAttrConvert.java +++ /dev/null @@ -1,39 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.product; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.product.vo.attr.*; -import cn.iocoder.mall.productservice.rpc.attr.dto.*; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface ProductAttrConvert { - - ProductAttrConvert INSTANCE = Mappers.getMapper(ProductAttrConvert.class); - - ProductAttrKeyCreateReqDTO convert(ProductAttrKeyCreateReqVO bean); - - ProductAttrKeyUpdateReqDTO convert(ProductAttrKeyUpdateReqVO bean); - - ProductAttrKeyRespVO convert(ProductAttrKeyRespDTO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - ProductAttrKeyPageReqDTO convert(ProductAttrKeyPageReqVO bean); - - - ProductAttrValueCreateReqDTO convert(ProductAttrValueCreateReqVO bean); - - ProductAttrValueUpdateReqDTO convert(ProductAttrValueUpdateReqVO bean); - - ProductAttrValueRespVO convert(ProductAttrValueRespDTO bean); - - List convertList02(List list); - - ProductAttrValueListQueryReqDTO convert(ProductAttrValueListQueryReqVO bean); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductBrandConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductBrandConvert.java deleted file mode 100644 index 476898156..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductBrandConvert.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.product; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandCreateReqVO; -import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandPageReqVO; -import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandRespVO; -import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandUpdateReqVO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface ProductBrandConvert { - - ProductBrandConvert INSTANCE = Mappers.getMapper(ProductBrandConvert.class); - - ProductBrandCreateReqDTO convert(ProductBrandCreateReqVO bean); - - ProductBrandUpdateReqDTO convert(ProductBrandUpdateReqVO bean); - - ProductBrandRespVO convert(ProductBrandRespDTO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - ProductBrandPageReqDTO convert(ProductBrandPageReqVO bean); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductCategoryConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductCategoryConvert.java deleted file mode 100644 index 570c86567..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductCategoryConvert.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.product; - -import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryCreateReqVO; -import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryRespVO; -import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryTreeNodeRespVO; -import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryUpdateReqVO; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryCreateReqDTO; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryUpdateReqDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface ProductCategoryConvert { - - ProductCategoryConvert INSTANCE = Mappers.getMapper(ProductCategoryConvert.class); - - ProductCategoryCreateReqDTO convert(ProductCategoryCreateReqVO bean); - - ProductCategoryUpdateReqDTO convert(ProductCategoryUpdateReqVO bean); - - ProductCategoryRespVO convert(ProductCategoryRespDTO bean); - - ProductCategoryTreeNodeRespVO convertTreeNode(ProductCategoryRespDTO bean); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductSpuConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductSpuConvert.java deleted file mode 100644 index ec943e223..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/product/ProductSpuConvert.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.product; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuCreateReqVO; -import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuPageReqVO; -import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuRespVO; -import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuUpdateReqVO; -import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuAndSkuCreateReqDTO; -import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuAndSkuUpdateReqDTO; -import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuPageReqDTO; -import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface ProductSpuConvert { - - ProductSpuConvert INSTANCE = Mappers.getMapper(ProductSpuConvert.class); - - ProductSpuAndSkuCreateReqDTO convert(ProductSpuCreateReqVO bean); - - ProductSpuAndSkuUpdateReqDTO convert(ProductSpuUpdateReqVO bean); - - ProductSpuRespVO convert(ProductSpuRespDTO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - ProductSpuPageReqDTO convert(ProductSpuPageReqVO bean); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/user/UserConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/user/UserConvert.java deleted file mode 100644 index 844147223..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/user/UserConvert.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.user; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.user.vo.UserPageReqVO; -import cn.iocoder.mall.managementweb.controller.user.vo.UserRespVO; -import cn.iocoder.mall.managementweb.controller.user.vo.UserUpdateInfoReqVO; -import cn.iocoder.mall.managementweb.controller.user.vo.UserUpdateStatusReqVO; -import cn.iocoder.mall.userservice.rpc.user.dto.UserPageReqDTO; -import cn.iocoder.mall.userservice.rpc.user.dto.UserRespDTO; -import cn.iocoder.mall.userservice.rpc.user.dto.UserUpdateReqDTO; -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface UserConvert { - - UserConvert INSTANCE = Mappers.getMapper(UserConvert.class); - - UserUpdateReqDTO convert(UserUpdateInfoReqVO bean); - - UserRespVO convert(UserRespDTO bean); - - List convertList(List list); - - UserPageReqDTO convert(UserPageReqVO bean); - - PageResult convertPage(PageResult bean); - - @Mapping(source = "userId", target = "id") - UserUpdateReqDTO convert(UserUpdateStatusReqVO bean); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductBrandManager.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductBrandManager.java deleted file mode 100644 index bed770850..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductBrandManager.java +++ /dev/null @@ -1,93 +0,0 @@ -package cn.iocoder.mall.managementweb.manager.product; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandCreateReqVO; -import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandPageReqVO; -import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandRespVO; -import cn.iocoder.mall.managementweb.controller.product.vo.brand.ProductBrandUpdateReqVO; -import cn.iocoder.mall.managementweb.convert.product.ProductBrandConvert; -import cn.iocoder.mall.productservice.rpc.brand.ProductBrandFeign; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** -* 商品品牌 Manager -*/ -@Service -public class ProductBrandManager { - - @Autowired - ProductBrandFeign productBrandFeign; - /** - * 创建商品品牌 - * - * @param createVO 创建商品品牌 VO - * @return 商品品牌 - */ - public Integer createProductBrand(ProductBrandCreateReqVO createVO) { - CommonResult createProductBrandResult = productBrandFeign.createProductBrand(ProductBrandConvert.INSTANCE.convert(createVO)); - createProductBrandResult.checkError(); - return createProductBrandResult.getData(); - } - - /** - * 更新商品品牌 - * - * @param updateVO 更新商品品牌 VO - */ - public void updateProductBrand(ProductBrandUpdateReqVO updateVO) { - CommonResult updateProductBrandResult = productBrandFeign.updateProductBrand(ProductBrandConvert.INSTANCE.convert(updateVO)); - updateProductBrandResult.checkError(); - } - - /** - * 删除商品品牌 - * - * @param productBrandId 商品品牌编号 - */ - public void deleteProductBrand(Integer productBrandId) { - CommonResult deleteProductBrandResult = productBrandFeign.deleteProductBrand(productBrandId); - deleteProductBrandResult.checkError(); - } - - /** - * 获得商品品牌 - * - * @param productBrandId 商品品牌编号 - * @return 商品品牌 - */ - public ProductBrandRespVO getProductBrand(Integer productBrandId) { - CommonResult getProductBrandResult = productBrandFeign.getProductBrand(productBrandId); - getProductBrandResult.checkError(); - return ProductBrandConvert.INSTANCE.convert(getProductBrandResult.getData()); - } - - /** - * 获得商品品牌列表 - * - * @param productBrandIds 商品品牌编号列表 - * @return 商品品牌列表 - */ - public List listProductBrands(List productBrandIds) { - CommonResult> listProductBrandResult = productBrandFeign.listProductBrands(productBrandIds); - listProductBrandResult.checkError(); - return ProductBrandConvert.INSTANCE.convertList(listProductBrandResult.getData()); - } - - /** - * 获得商品品牌分页 - * - * @param pageVO 商品品牌分页查询 - * @return 商品品牌分页结果 - */ - public PageResult pageProductBrand(ProductBrandPageReqVO pageVO) { - CommonResult> pageProductBrandResult = productBrandFeign.pageProductBrand(ProductBrandConvert.INSTANCE.convert(pageVO)); - pageProductBrandResult.checkError(); - return ProductBrandConvert.INSTANCE.convertPage(pageProductBrandResult.getData()); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductCategoryManager.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductCategoryManager.java deleted file mode 100644 index b6a43eeda..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductCategoryManager.java +++ /dev/null @@ -1,106 +0,0 @@ -package cn.iocoder.mall.managementweb.manager.product; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryCreateReqVO; -import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryTreeNodeRespVO; -import cn.iocoder.mall.managementweb.controller.product.vo.category.ProductCategoryUpdateReqVO; -import cn.iocoder.mall.managementweb.convert.product.ProductCategoryConvert; -import cn.iocoder.mall.productservice.enums.category.ProductCategoryIdEnum; -import cn.iocoder.mall.productservice.rpc.category.ProductCategoryFeign; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.*; -import java.util.stream.Collectors; - -/** -* 商品分类表 Manager -*/ -@Service -@Slf4j -public class ProductCategoryManager { - - - @Autowired - private ProductCategoryFeign productCategoryFeign; - /** - * 创建商品分类表 - * - * @param createVO 创建商品分类表 VO - * @return 商品分类表 - */ - public Integer createProductCategory(ProductCategoryCreateReqVO createVO) { - CommonResult createProductCategoryResult = productCategoryFeign.createProductCategory(ProductCategoryConvert.INSTANCE.convert(createVO)); - createProductCategoryResult.checkError(); - return createProductCategoryResult.getData(); - } - - /** - * 更新商品分类表 - * - * @param updateVO 更新商品分类表 VO - */ - public void updateProductCategory(ProductCategoryUpdateReqVO updateVO) { - CommonResult updateProductCategoryResult = productCategoryFeign.updateProductCategory(ProductCategoryConvert.INSTANCE.convert(updateVO)); - updateProductCategoryResult.checkError(); - } - - /** - * 删除商品分类表 - * - * @param productCategoryId 商品分类表编号 - */ - public void deleteProductCategory(Integer productCategoryId) { - CommonResult deleteProductCategoryResult = productCategoryFeign.deleteProductCategory(productCategoryId); - deleteProductCategoryResult.checkError(); - } - - /** - * 获得商品分类树结构 - * - * @return 商品分类树结构 - */ - public List treeProductCategory() { - // 获得商品分类全列表 - CommonResult> listProductCategories = productCategoryFeign.listProductCategories(new ProductCategoryListQueryReqDTO()); - listProductCategories.checkError(); - // 构建菜单树 - return buildProductCategoryTree(listProductCategories.getData()); - } - - /** - * 构建商品分类树 - * - * @param productCategories 商品分类列表 - * @return 商品分类树 - */ - private static List buildProductCategoryTree(List productCategories) { - // 排序,保证菜单的有序性 - productCategories.sort(Comparator.comparing(ProductCategoryRespDTO::getSort)); - // 构建菜单树 - // 使用 LinkedHashMap 的原因,是为了排序 。实际也可以用 Stream API ,就是太丑了。 - Map treeNodeMap = new LinkedHashMap<>(); - productCategories.forEach(category -> treeNodeMap.put(category.getId(), ProductCategoryConvert.INSTANCE.convertTreeNode(category))); - // 处理父子关系 - treeNodeMap.values().stream().filter(node -> !node.getPid().equals(ProductCategoryIdEnum.ROOT.getId())).forEach((childNode) -> { - // 获得父节点 - ProductCategoryTreeNodeRespVO parentNode = treeNodeMap.get(childNode.getPid()); - if (parentNode == null) { - log.error("[buildProductCategoryTree][category({}) 找不到父商品分类({})]", childNode.getId(), childNode.getPid()); - return; - } - // 将自己添加到父节点中 - if (parentNode.getChildren() == null) { - parentNode.setChildren(new ArrayList<>()); - } - parentNode.getChildren().add(childNode); - }); - // 获得到所有的根节点 - return treeNodeMap.values().stream().filter(node -> node.getPid().equals(ProductCategoryIdEnum.ROOT.getId())) - .collect(Collectors.toList()); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductSpuManager.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductSpuManager.java deleted file mode 100644 index b178b3fbd..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/product/ProductSpuManager.java +++ /dev/null @@ -1,63 +0,0 @@ -package cn.iocoder.mall.managementweb.manager.product; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuCreateReqVO; -import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuPageReqVO; -import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuRespVO; -import cn.iocoder.mall.managementweb.controller.product.vo.spu.ProductSpuUpdateReqVO; -import cn.iocoder.mall.managementweb.convert.product.ProductSpuConvert; -import cn.iocoder.mall.productservice.rpc.spu.ProductSpuFeign; -import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** -* 商品 SPU Manager -*/ -@Service -public class ProductSpuManager { - - - @Autowired - private ProductSpuFeign productSpuFeign; - - /** - * 获得商品 SPU - * - * @param productSpuId 商品 SPU编号 - * @return 商品 SPU - */ - public ProductSpuRespVO getProductSpu(Integer productSpuId) { - CommonResult getProductSpuResult = productSpuFeign.getProductSpu(productSpuId); - getProductSpuResult.checkError(); - return ProductSpuConvert.INSTANCE.convert(getProductSpuResult.getData()); - } - - /** - * 获得商品 SPU列表 - * - * @param productSpuIds 商品 SPU编号列表 - * @return 商品 SPU列表 - */ - public List listProductSpus(List productSpuIds) { - CommonResult> listProductSpuResult = productSpuFeign.listProductSpus(productSpuIds); - listProductSpuResult.checkError(); - return ProductSpuConvert.INSTANCE.convertList(listProductSpuResult.getData()); - } - - /** - * 获得商品 SPU分页 - * - * @param pageVO 商品 SPU分页查询 - * @return 商品 SPU分页结果 - */ - public PageResult pageProductSpu(ProductSpuPageReqVO pageVO) { - CommonResult> pageProductSpuResult = productSpuFeign.pageProductSpu(ProductSpuConvert.INSTANCE.convert(pageVO)); - pageProductSpuResult.checkError(); - return ProductSpuConvert.INSTANCE.convertPage(pageProductSpuResult.getData()); - } - -} diff --git a/归档/moved/product/product-service-impl/pom.xml b/归档/moved/product/product-service-impl/pom.xml deleted file mode 100644 index 4d9696434..000000000 --- a/归档/moved/product/product-service-impl/pom.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - product - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - product-service-impl - - - - - cn.iocoder.mall - product-service-api - 1.0-SNAPSHOT - - - cn.iocoder.mall - user-service-api - 1.0-SNAPSHOT - - - - - mysql - mysql-connector-java - - - - org.springframework - spring-tx - - - org.springframework - spring-jdbc - - - - com.alibaba - druid-spring-boot-starter - - - - com.baomidou - mybatis-plus-boot-starter - - - - cn.iocoder.mall - mall-spring-boot-starter-mybatis - 1.0-SNAPSHOT - - - - - com.alibaba.cloud - spring-cloud-starter-dubbo - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - - - com.alibaba.cloud - spring-cloud-alibaba-seata - - - - - com.alibaba.cloud - spring-cloud-starter-stream-rocketmq - - - - - com.google.guava - guava - - - cn.iocoder.mall - user-biz - 1.0-SNAPSHOT - compile - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - - diff --git a/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductAttrConvert.java b/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductAttrConvert.java deleted file mode 100644 index fa032b8b9..000000000 --- a/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductAttrConvert.java +++ /dev/null @@ -1,58 +0,0 @@ -package cn.iocoder.mall.product.convert; - -import cn.iocoder.mall.product.api.bo.*; -import cn.iocoder.mall.product.api.dto.ProductAttrAddDTO; -import cn.iocoder.mall.product.api.dto.ProductAttrUpdateDTO; -import cn.iocoder.mall.product.api.dto.ProductAttrValueAddDTO; -import cn.iocoder.mall.product.api.dto.ProductAttrValueUpdateDTO; -import cn.iocoder.mall.product.dataobject.ProductAttrDO; -import cn.iocoder.mall.product.dataobject.ProductAttrValueDO; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface ProductAttrConvert { - - ProductAttrConvert INSTANCE = Mappers.getMapper(ProductAttrConvert.class); - - @Mappings({}) - List convert(List attrs); - - @Mappings({}) - ProductAttrValueDetailBO convert(ProductAttrValueDO value); - - @Mappings({}) - List convert2(List values); - - @Mappings({}) - List convert3(List attrs); - - @Mappings({}) - ProductAttrValueSimpleBO convert3(ProductAttrValueDO value); // 保证 convert4 能够映射到这个方法 - - @Mappings({}) - List convert4(List values); - - @Mappings({}) - ProductAttrDO convert(ProductAttrAddDTO productAttrAddDTO); - - @Mappings({}) - ProductAttrDO convert(ProductAttrUpdateDTO productAttrUpdateDTO); - - @Mappings({}) - ProductAttrValueDO convert(ProductAttrValueAddDTO productAttrValueAddDTO); - - @Mappings({}) - ProductAttrValueDO convert(ProductAttrValueUpdateDTO productAttrValueUpdateDTO); - - @Mappings({}) - ProductAttrBO convert(ProductAttrDO productAttrDO); - - @Mappings({}) - ProductAttrValueBO convert2(ProductAttrValueDO productAttrValueDO); - - -} \ No newline at end of file diff --git a/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductAttrMapper.java b/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductAttrMapper.java deleted file mode 100644 index ca2726ca7..000000000 --- a/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductAttrMapper.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.iocoder.mall.product.dao; - -import cn.iocoder.mall.product.dataobject.ProductAttrDO; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -import java.util.Collection; -import java.util.List; - -@Repository -public interface ProductAttrMapper { - - ProductAttrDO selectById(@Param("id") Integer id); - - ProductAttrDO selectByName(@Param("name") String name); - - List selectListByIds(@Param("ids") Collection ids); - - List selectListByStatus(@Param("status") Integer status); - - List selectListByNameLike(@Param("name") String name, - @Param("offset") Integer offset, - @Param("limit") Integer limit); - - Integer selectCountByNameLike(@Param("name") String name); - - void insert(ProductAttrDO productAttrDO); - - void update(ProductAttrDO productAttrDO); - -} \ No newline at end of file diff --git a/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductAttrValueMapper.java b/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductAttrValueMapper.java deleted file mode 100644 index 1f026f2a2..000000000 --- a/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductAttrValueMapper.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.mall.product.dao; - -import cn.iocoder.mall.product.dataobject.ProductAttrValueDO; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -import java.util.Collection; -import java.util.List; - -@Repository -public interface ProductAttrValueMapper { - - ProductAttrValueDO selectById(@Param("id") Integer id); - - List selectListByIds(@Param("ids") Collection ids); - - List selectListByStatus(@Param("status") Integer status); - - List selectListByAttrIds(@Param("attrIds") Collection attrIds); - - ProductAttrValueDO selectByAttrIdAndName(@Param("attrId") Integer attrId, - @Param("name") String name); - - - void insert(ProductAttrValueDO productAttrValueDO); - - void update(ProductAttrValueDO productAttrValueDO); - -} \ No newline at end of file diff --git a/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductSkuMapper.java b/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductSkuMapper.java deleted file mode 100644 index 467e3cba2..000000000 --- a/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/ProductSkuMapper.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.iocoder.mall.product.dao; - -import cn.iocoder.mall.product.dataobject.ProductSkuDO; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -import java.util.Collection; -import java.util.List; - -@Repository -public interface ProductSkuMapper { - - ProductSkuDO selectById(Integer id); - - List selectByIds(@Param("ids") Collection ids); - - List selectListBySpuIdAndStatus(@Param("spuId") Integer spuId, - @Param("status") Integer status); - - void insertList(@Param("productSkuDOs") List productSkuDOs); - - int update(ProductSkuDO productSkuDO); - - int updateToDeleted(@Param("ids") List ids); - -} diff --git a/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/UserProductSpuCollectionsMapper.java b/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/UserProductSpuCollectionsMapper.java deleted file mode 100644 index dca4610c8..000000000 --- a/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dao/UserProductSpuCollectionsMapper.java +++ /dev/null @@ -1,51 +0,0 @@ -package cn.iocoder.mall.product.dao; - -import cn.iocoder.mall.product.dataobject.UserProductSpuCollectionsDO; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** - * 用户_商品_收藏记录表 - * - * @author xiaofeng - * @date 2019-07-01 20:23:30 - */ -@Repository -public interface UserProductSpuCollectionsMapper extends BaseMapper { - - /** - * 根据用户id 和 spuId 查找用户商品收藏 - * @param userId - * @param spuId - * @return - */ - default UserProductSpuCollectionsDO getUserSpuCollectionsByUserIdAndSpuId(final Integer userId, - final Integer spuId) { - QueryWrapper query = new QueryWrapper() - .eq("user_id", userId).eq("spu_id", spuId); - return selectOne(query); - } - - - /** - * 查询用户收藏列表 - * @param userId - * @param offset - * @param limit - * @return - */ - List selectListByUser(@Param("userId") Integer userId, @Param("offset") Integer offset, - @Param("limit") Integer limit); - - /** - * 根据用户ID 查找总数 - * @param userId - * @return - */ - Integer selectCountByUser(Integer userId); - -} diff --git a/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductStockDO.java b/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductStockDO.java deleted file mode 100644 index 8bc60d659..000000000 --- a/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/ProductStockDO.java +++ /dev/null @@ -1,44 +0,0 @@ -package cn.iocoder.mall.product.dataobject; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; - -/** - * Product 库存 - */ -@Deprecated // TODO 芋艿,咱暂时不加库存表和库存服务 -@Data -@Accessors(chain = true) -public class ProductStockDO { - - /** - * 编号,自增 - */ - private Integer id; - /** - * SKU 编号 - */ - private Integer skuId; - /** - * 库存数 - */ - private Integer quantity; - /** - * 创建时间 - */ - private Date createTime; - /** - * 最后更新时间 - */ - private Date updateTime; - /** - * 状态 - * - * 1-正常 - * 2-删除 - */ - private Integer status; - -} diff --git a/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/UserProductSpuCollectionsDO.java b/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/UserProductSpuCollectionsDO.java deleted file mode 100644 index d72fc5a79..000000000 --- a/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/dataobject/UserProductSpuCollectionsDO.java +++ /dev/null @@ -1,79 +0,0 @@ -package cn.iocoder.mall.product.dataobject; - -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; - - -/** - * 用户_商品_收藏记录表 - * - * @author xiaofeng - * @date 2019-07-01 20:23:30 - */ -@TableName("user_spu_collections") -@Data -@Accessors(chain = true) -public class UserProductSpuCollectionsDO implements Serializable { - private static final long serialVersionUID = 1L; - - /** - * id自增长 - */ - private Integer id; - - /** - * 用户id - */ - private Integer userId; - - /** - * 用户名称 - */ - private String nickname; - - /** - * 商品id - */ - private Integer spuId; - - /** - * 商品名字 - */ - private String spuName; - - /** - * 图片名字 - */ - private String spuImage; - - /** - * 卖点 - */ - private String sellPoint; - - /** - * 价格,单位:分 - */ - private Integer price; - - /** - * 创建时间 - */ - private Date createTime; - - /** - * 更新时间 - */ - private Date updateTime; - - /** - * 删除状态 - */ - private Integer deleted; - - -} diff --git a/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuCollectionServiceImpl.java b/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuCollectionServiceImpl.java deleted file mode 100644 index cf557d361..000000000 --- a/归档/moved/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuCollectionServiceImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -package cn.iocoder.mall.product.service; - -import cn.iocoder.common.framework.util.ServiceExceptionUtil; -import cn.iocoder.mall.product.api.ProductSpuCollectionService; -import cn.iocoder.mall.product.api.constant.ProductErrorCodeEnum; -import cn.iocoder.mall.product.api.message.ProductSpuCollectionMessage; -import cn.iocoder.mall.product.dao.ProductSpuMapper; -import cn.iocoder.mall.product.dataobject.ProductSpuDO; -import com.google.common.base.Splitter; -import com.google.common.collect.Lists; -import org.apache.rocketmq.spring.core.RocketMQTemplate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.List; - -/** - * ProductSpuCollectionServiceImpl - * @author xiaofeng - * @date 2019/07/01 23:14 - * @version 1.0 - */ -@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示 -@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.ProductSpuCollectionService.version}") -public class ProductSpuCollectionServiceImpl implements ProductSpuCollectionService { - - @Autowired - private ProductSpuMapper productSpuMapper; - - @Resource - private RocketMQTemplate rocketMQTemplate; - - @Override - public boolean productSpuCollection(Integer spuId, Integer hasCollectionType, Integer userId) { - ProductSpuDO productSpuDO = this.productSpuMapper.selectById(spuId); - // 校验 Spu 是否存在 - if (productSpuDO == null) { - throw ServiceExceptionUtil.exception(ProductErrorCodeEnum.PRODUCT_SPU_NOT_EXISTS.getCode()); - } - this.sendProductSpuCollectionMessage(productSpuDO, hasCollectionType, userId); - return Boolean.TRUE; - } - - /** - * 发送商品收藏或取消消息 - * @param productSpuDO - * @param hasCollectionType - */ - // TODO FROM 芋艿 to ??:切换到 Spring Cloud Stream 发送消息 - private void sendProductSpuCollectionMessage(final ProductSpuDO productSpuDO, final Integer hasCollectionType, - final Integer userId) { - List result = Lists.newArrayList(Splitter.on(",").omitEmptyStrings().trimResults().split(productSpuDO.getPicUrls())); - ProductSpuCollectionMessage productSpuCollectionMessage = new ProductSpuCollectionMessage() - .setSpuId(productSpuDO.getId()) - .setSpuName(productSpuDO.getName()) - .setSpuImage(result.size() > 0 ? result.get(0) : "") - .setSellPoint(productSpuDO.getSellPoint()) - .setPrice(productSpuDO.getPrice()) - .setHasCollectionType(hasCollectionType) - .setUserId(userId); - rocketMQTemplate.convertAndSend(ProductSpuCollectionMessage.TOPIC, productSpuCollectionMessage); - } -} diff --git a/归档/moved/product/product-service-impl/src/main/resources/config/application.yaml b/归档/moved/product/product-service-impl/src/main/resources/config/application.yaml deleted file mode 100644 index 10a3e9425..000000000 --- a/归档/moved/product/product-service-impl/src/main/resources/config/application.yaml +++ /dev/null @@ -1,91 +0,0 @@ -spring: - # datasource - datasource: - url: jdbc:mysql://s1.iocoder.cn:3306/mall_product?useSSL=false&useUnicode=true&characterEncoding=UTF-8 - driver-class-name: com.mysql.jdbc.Driver - username: root - password: zhuyang - - # Spring Cloud 配置项 - cloud: - nacos: - # Spring Cloud Nacos Discovery 配置项 - discovery: - server-addr: s1.iocoder.cn:8848 # Nacos 服务器地址 - - # Spring Cloud Stream 配置 - stream: - # Binding 配置项 - bindings: - product-update-output: - destination: ProductUpdate - # Spring Cloud Stream RocketMQ 配置项 - rocketmq: - # RocketMQ Binder 配置项 - binder: - name-server: s1.iocoder.cn:9876 # RocketMQ Namesrv 地址 - # RocketMQ 默认 Binding 配置项 - default: - # RocketMQ 生产者 - producer: - group: product-producer-group # 生产者分组 - sync: true # 是否同步发送消息,默认为 false 异步。 - -# mybatis -mybatis-plus: - config-location: classpath:mybatis-config.xml - mapper-locations: classpath:mapper/*.xml - type-aliases-package: cn.iocoder.mall.product.dataobject - -# Dubbo 配置项 -dubbo: - # Dubbo 注册中心 - registry: - address: spring-cloud://s1.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址 - # Spring Cloud Alibaba Dubbo 专属配置 - cloud: - subscribed-services: admin-application, user-application # 设置订阅的应用列表,默认为 * 订阅所有应用 - # Dubbo 提供者的协议 - protocol: - name: dubbo - port: -1 - # Dubbo 提供服务的扫描基础包 - scan: - base-packages: cn.iocoder.mall.product.service - # Dubbo 服务提供者的配置 - provider: - filter: -exception - ProductAttrService: - version: 1.0.0 - ProductCategoryService: - version: 1.0.0 - ProductSpuService: - version: 1.0.0 - ProductBrandService: - version: 1.0.0 - OAuth2Service: - version: 1.0.0 - ProductSpuCollectionService: - version: 1.0.0 - UserProductSpuCollectionsService: - version: 1.0.0 - consumer: - UserService: - version: 1.0.0 - -# Seata 配置项 -seata: - tx-service-group: default # Seata 事务组编号,用于 TC 集群名 - # 服务配置项,对应 ServiceProperties 类 - service: - # 虚拟组和分组的映射 - vgroup-mapping: - default: default - # Seata 注册中心配置项 - registry: - type: nacos # 注册中心类型 - nacos: - serverAddr: ${spring.cloud.nacos.discovery.server-addr} # Nacos 服务地址 - namespace: # Nacos 命名空间 - cluster: default # 使用的 Seata 分组 - diff --git a/归档/moved/product/product-service-impl/src/main/resources/mapper/ProductAttrMapper.xml b/归档/moved/product/product-service-impl/src/main/resources/mapper/ProductAttrMapper.xml deleted file mode 100644 index bf0ec38a5..000000000 --- a/归档/moved/product/product-service-impl/src/main/resources/mapper/ProductAttrMapper.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - INSERT INTO product_attr ( - name, status, create_time, deleted - ) VALUES ( - #{name}, #{status}, #{createTime}, #{deleted} - ) - - - - UPDATE product_attr - - - name = #{name}, - - - status = #{status}, - - - deleted = #{deleted} - - - WHERE id = #{id} - - - - - - - - - - - diff --git a/归档/moved/product/product-service-impl/src/main/resources/mapper/ProductAttrValueMapper.xml b/归档/moved/product/product-service-impl/src/main/resources/mapper/ProductAttrValueMapper.xml deleted file mode 100644 index 17ad319f8..000000000 --- a/归档/moved/product/product-service-impl/src/main/resources/mapper/ProductAttrValueMapper.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - id, attr_id, name, status, create_time - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - INSERT INTO product_attr_value ( - attr_id, name, status, create_time, deleted - ) VALUES ( - #{attrId}, #{name}, #{status}, #{createTime}, #{deleted} - ) - - - - UPDATE product_attr_value - - - name = #{name}, - - - status = #{status}, - - - deleted = #{deleted} - - - WHERE id = #{id} - - - - \ No newline at end of file diff --git a/归档/moved/product/product-service-impl/src/main/resources/mapper/ProductSkuMapper.xml b/归档/moved/product/product-service-impl/src/main/resources/mapper/ProductSkuMapper.xml deleted file mode 100644 index 2d6c96448..000000000 --- a/归档/moved/product/product-service-impl/src/main/resources/mapper/ProductSkuMapper.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - id, spu_id, status, pic_url, attrs, - price, quantity, create_time - - - - - - - - INSERT INTO product_sku ( - spu_id, status, pic_url, attrs, price, - quantity, deleted, create_time - ) VALUES - - (#{productSkuDO.spuId}, #{productSkuDO.status}, #{productSkuDO.picUrl}, #{productSkuDO.attrs}, #{productSkuDO.price}, - #{productSkuDO.quantity}, #{productSkuDO.deleted}, #{productSkuDO.createTime} - ) - - - - - - - UPDATE product_sku - - - spu_id = #{spuId}, - - - status = #{status}, - - - pic_url = #{picUrl}, - - - attrs = #{attrs}, - - - price = #{price}, - - - quantity = #{quantity}, - - - deleted = #{deleted} - - - WHERE id = #{id} - - - - UPDATE product_sku - SET deleted = 1 - WHERE id IN - - #{id} - - - - diff --git a/归档/product-service-project/pom.xml b/归档/product-service-project/pom.xml deleted file mode 100644 index 9a3f4adca..000000000 --- a/归档/product-service-project/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - onemall - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - product-service-project - pom - - product-service-api - product-service-app - - - - - - - cn.iocoder.mall - mall-dependencies - 1.0-SNAPSHOT - pom - import - - - - - cn.iocoder.mall - product-service-api - 1.0-SNAPSHOT - - - - - diff --git a/归档/product-service-project/product-service-api/pom.xml b/归档/product-service-project/product-service-api/pom.xml deleted file mode 100644 index 1cbc81a0c..000000000 --- a/归档/product-service-project/product-service-api/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - product-service-project - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - product-service-api - - - - cn.iocoder.mall - common-framework - - - - - javax.validation - validation-api - - - org.projectlombok - lombok - - - org.springframework.cloud - spring-cloud-openfeign-core - RELEASE - - - - diff --git a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/enums/ProductErrorCodeConstants.java b/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/enums/ProductErrorCodeConstants.java deleted file mode 100644 index 2c43d8797..000000000 --- a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/enums/ProductErrorCodeConstants.java +++ /dev/null @@ -1,37 +0,0 @@ -package cn.iocoder.mall.productservice.enums; - -import cn.iocoder.common.framework.exception.ErrorCode; - -/** - * 错误码枚举类 - * - * 商品系统,使用 1-003-000-000 段 - */ -public interface ProductErrorCodeConstants { - - // ========== PRODUCT CATEGORY 模块 ========== - ErrorCode PRODUCT_CATEGORY_PARENT_NOT_EXISTS = new ErrorCode(1003001000, "父分类不存在"); - ErrorCode PRODUCT_CATEGORY_NOT_EXISTS = new ErrorCode(1003001001, "商品分类不存在"); - ErrorCode PRODUCT_CATEGORY_PARENT_NOT_SELF = new ErrorCode(1003001002, "不能设置自己为父分类"); - ErrorCode PRODUCT_CATEGORY_DELETE_ONLY_NO_CHILD = new ErrorCode(1002001004, "只有无子分类的商品分类才可以删除"); - ErrorCode PRODUCT_CATEGORY_MUST_ENABLE = new ErrorCode(1002001005, "只有开启的商品分类,才可以使用"); - ErrorCode PRODUCT_CATEGORY_PARENT_CAN_NOT_BE_LEVEL2 = new ErrorCode(1002001005, "父分类必须是一级分类"); - - // ========== PRODUCT SPU + SKU 模块 ========== - ErrorCode PRODUCT_SKU_ATTR_CANT_NOT_DUPLICATE = new ErrorCode(1003002000, "一个 SKU 下,不能有重复的规格"); - ErrorCode PRODUCT_SPU_ATTR_NUMBERS_MUST_BE_EQUALS = new ErrorCode(1003002001, "一个 Spu 下的每个 SKU ,其规格数必须一致"); - ErrorCode PRODUCT_SPU_SKU_NOT_DUPLICATE = new ErrorCode(1003002002, "一个 SPU 下的每个 SKU ,必须不重复"); - ErrorCode PRODUCT_SPU_NOT_EXISTS = new ErrorCode(1003002003, "SPU 不存在"); - ErrorCode PRODUCT_SPU_CATEGORY_MUST_BE_LEVEL2 = new ErrorCode(1003002003, "SPU 只能添加在二级分类下"); - - // ========== PRODUCT ATTR + ATTR_VALUE 模块 ========== - ErrorCode PRODUCT_ATTR_VALUE_NOT_EXIST = new ErrorCode(1003003000, "商品属性值不存在"); - ErrorCode PRODUCT_ATTR_KEY_NOT_EXIST = new ErrorCode(1003003001, "商品属性键不存在"); - ErrorCode PRODUCT_ATTR_KEY_EXISTS = new ErrorCode(1003003002, "商品规格键已经存在"); - ErrorCode PRODUCT_ATTR_VALUE_EXISTS = new ErrorCode(1003003004, "商品规格值已经存在"); - - // ========== PRODUCT BRAND模块 ========== - ErrorCode PRODUCT_BRAND_NAME_EXIST = new ErrorCode(1003004000,"商品品牌的名字已经存在"); - ErrorCode PRODUCT_BRAND_NOT_FOUND = new ErrorCode(1003004001, "商品品牌不粗糙你在"); - -} diff --git a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/enums/category/ProductCategoryIdEnum.java b/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/enums/category/ProductCategoryIdEnum.java deleted file mode 100644 index dd1807b6c..000000000 --- a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/enums/category/ProductCategoryIdEnum.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.iocoder.mall.productservice.enums.category; - -/** - * 商品分类的编号枚举 - */ -public enum ProductCategoryIdEnum { - - /** - * 根节点 - */ - ROOT(0); - - private final Integer id; - - ProductCategoryIdEnum(Integer id) { - this.id = id; - } - - public Integer getId() { - return id; - } - -} diff --git a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/ProductBrandFeign.java b/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/ProductBrandFeign.java deleted file mode 100644 index 69b279de1..000000000 --- a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/ProductBrandFeign.java +++ /dev/null @@ -1,69 +0,0 @@ -package cn.iocoder.mall.productservice.rpc.brand; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; - -import java.util.List; - -@FeignClient(value = "product-service") -public interface ProductBrandFeign { - /** - * 创建商品品牌 - * - * @param createDTO 创建商品品牌 DTO - * @return 商品品牌编号 - */ - @PostMapping("/product/brand/createProductBrand") - CommonResult createProductBrand(@RequestBody ProductBrandCreateReqDTO createDTO); - - /** - * 更新商品品牌 - * - * @param updateDTO 更新商品品牌 DTO - */ - @PostMapping("/product/brand/updateProductBrand") - CommonResult updateProductBrand(@RequestBody ProductBrandUpdateReqDTO updateDTO); - - /** - * 删除商品品牌 - * - * @param productBrandId 商品品牌编号 - */ - @GetMapping("/product/brand/deleteProductBrand") - CommonResult deleteProductBrand(@RequestParam("productBrandId") Integer productBrandId); - /** - * 获得商品品牌 - * - * @param productBrandId 商品品牌编号 - * @return 商品品牌 - */ - @GetMapping("/product/brand/getProductBrand") - CommonResult getProductBrand(@RequestParam("productBrandId")Integer productBrandId); - /** - * 获得商品品牌列表 - * - * @param productBrandIds 商品品牌编号列表 - * @return 商品品牌列表 - */ - @GetMapping("/product/brand/listProductBrands") - CommonResult> listProductBrands(@RequestParam("productBrandIds") List productBrandIds); - - /** - * 获得商品品牌分页 - * - * @param pageDTO 商品品牌分页查询 - * @return 商品品牌分页结果 - */ - @PostMapping("/product/brand/pageProductBrand") - CommonResult> pageProductBrand(@RequestBody ProductBrandPageReqDTO pageDTO); - -} diff --git a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandCreateReqDTO.java b/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandCreateReqDTO.java deleted file mode 100644 index c8d6971e1..000000000 --- a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandCreateReqDTO.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.iocoder.mall.productservice.rpc.brand.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** -* 商品品牌创建 Request DTO -*/ -@Data -@Accessors(chain = true) -public class ProductBrandCreateReqDTO implements Serializable { - - /** - * 品牌名称 - */ - @NotEmpty(message = "品牌名称不能为空") - private String name; - /** - * 品牌描述 - */ - private String description; - /** - * 品牌名图片 - */ - private String picUrl; - /** - * 状态 - */ - @NotNull(message = "状态不能为空") - private Integer status; - -} diff --git a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandPageReqDTO.java b/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandPageReqDTO.java deleted file mode 100644 index bb56f1b23..000000000 --- a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandPageReqDTO.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.iocoder.mall.productservice.rpc.brand.dto; - -import cn.iocoder.common.framework.vo.PageParam; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** -* 商品品牌分页 Request DTO -*/ -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class ProductBrandPageReqDTO extends PageParam { - - /** - * 品牌名称 - */ - private String name; - /** - * 状态 - */ - private Integer status; - -} diff --git a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandRespDTO.java b/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandRespDTO.java deleted file mode 100644 index feaf58fcd..000000000 --- a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandRespDTO.java +++ /dev/null @@ -1,41 +0,0 @@ -package cn.iocoder.mall.productservice.rpc.brand.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; - -/** -* 商品品牌 Response DTO -*/ -@Data -@Accessors(chain = true) -public class ProductBrandRespDTO implements Serializable { - - /** - * 品牌编号(主键) - */ - private Integer id; - /** - * 品牌名称 - */ - private String name; - /** - * 品牌描述 - */ - private String description; - /** - * 品牌名图片 - */ - private String picUrl; - /** - * 状态 - */ - private Integer status; - /** - * 创建时间 - */ - private Date createTime; - -} diff --git a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandUpdateReqDTO.java b/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandUpdateReqDTO.java deleted file mode 100644 index d940a9103..000000000 --- a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/brand/dto/ProductBrandUpdateReqDTO.java +++ /dev/null @@ -1,41 +0,0 @@ -package cn.iocoder.mall.productservice.rpc.brand.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** -* 商品品牌更新 Request DTO -*/ -@Data -@Accessors(chain = true) -public class ProductBrandUpdateReqDTO implements Serializable { - - /** - * 品牌编号 - */ - @NotNull(message = "品牌编号不能为空") - private Integer id; - /** - * 品牌名称 - */ - @NotEmpty(message = "品牌名称不能为空") - private String name; - /** - * 品牌描述 - */ - private String description; - /** - * 品牌名图片 - */ - private String picUrl; - /** - * 状态 - */ - @NotNull(message = "状态不能为空") - private Integer status; - -} diff --git a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/ProductCategoryFeign.java b/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/ProductCategoryFeign.java deleted file mode 100644 index 6a21efc11..000000000 --- a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/ProductCategoryFeign.java +++ /dev/null @@ -1,68 +0,0 @@ -package cn.iocoder.mall.productservice.rpc.category; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryCreateReqDTO; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryUpdateReqDTO; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; - -import java.util.Collection; -import java.util.List; - -@FeignClient(value = "product-service") -public interface ProductCategoryFeign { - - /** - * 创建商品分类 - * - * @param createDTO 创建商品分类 DTO - * @return 商品分类编号 - */ - @PostMapping("/product/category/createProductCategory") - CommonResult createProductCategory(@RequestBody ProductCategoryCreateReqDTO createDTO); - /** - * 更新商品分类 - * - * @param updateDTO 更新商品分类 DTO - */ - @PostMapping("/product/category/updateProductCategory") - CommonResult updateProductCategory(@RequestBody ProductCategoryUpdateReqDTO updateDTO); - - /** - * 删除商品分类 - * - * @param productCategoryId 商品分类编号 - */ - @GetMapping("/product/category/deleteProductCategory") - CommonResult deleteProductCategory(@RequestParam("productCategoryId") Integer productCategoryId); - /** - * 获得商品分类 - * - * @param productCategoryId 商品分类编号 - * @return 商品分类 - */ - @GetMapping("/product/category/getProductCategory") - CommonResult getProductCategory(@RequestParam("productCategoryId")Integer productCategoryId); - /** - * 获得商品分类列表 - * - * @param productCategoryIds 商品分类编号列表 - * @return 商品分类列表 - */ - @GetMapping("/product/category/listProductCategoriesByIds") - CommonResult> listProductCategoriesByIds(@RequestParam("productCategoryIds")Collection productCategoryIds); - - /** - * 获得符合条件的商品分类列表 - * - * @return 商品分类列表 - */ - @PostMapping("/product/category/listProductCategories") - CommonResult> listProductCategories(@RequestBody ProductCategoryListQueryReqDTO listQueryReqDTO); - -} diff --git a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryCreateReqDTO.java b/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryCreateReqDTO.java deleted file mode 100644 index cb895f39d..000000000 --- a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryCreateReqDTO.java +++ /dev/null @@ -1,49 +0,0 @@ -package cn.iocoder.mall.productservice.rpc.category.dto; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** -* 商品分类创建 Request DTO -*/ -@Data -@Accessors(chain = true) -public class ProductCategoryCreateReqDTO implements Serializable { - - /** - * 父分类编号 - */ - @NotNull(message = "父分类编号不能为空") - private Integer pid; - /** - * 分类名称 - */ - @NotEmpty(message = "分类名称不能为空") - private String name; - /** - * 分类描述 - */ - private String description; - /** - * 分类图片 - */ - private String picUrl; - /** - * 分类排序 - */ - @NotNull(message = "分类排序不能为空") - private Integer sort; - /** - * 状态 - */ - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "状态必须是 {value}") - private Integer status; - -} diff --git a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryListQueryReqDTO.java b/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryListQueryReqDTO.java deleted file mode 100644 index ed168e7d2..000000000 --- a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryListQueryReqDTO.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.iocoder.mall.productservice.rpc.category.dto; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - * 商品分类列表查询 DTO - */ -@Data -@Accessors(chain = true) -public class ProductCategoryListQueryReqDTO implements Serializable { - - /** - * 父编号 - */ - private Integer pid; - /** - * 状态 - */ - @InEnum(value = CommonStatusEnum.class, message = "状态必须是 {value}") - private Integer status; - -} diff --git a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryRespDTO.java b/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryRespDTO.java deleted file mode 100644 index 3e40afcf9..000000000 --- a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryRespDTO.java +++ /dev/null @@ -1,49 +0,0 @@ -package cn.iocoder.mall.productservice.rpc.category.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; - -/** -* 商品分类 Response DTO -*/ -@Data -@Accessors(chain = true) -public class ProductCategoryRespDTO implements Serializable { - - /** - * 分类编号 - */ - private Integer id; - /** - * 父分类编号 - */ - private Integer pid; - /** - * 分类名称 - */ - private String name; - /** - * 分类描述 - */ - private String description; - /** - * 分类图片 - */ - private String picUrl; - /** - * 分类排序 - */ - private Integer sort; - /** - * 状态 - */ - private Integer status; - /** - * 创建时间 - */ - private Date createTime; - -} diff --git a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryUpdateReqDTO.java b/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryUpdateReqDTO.java deleted file mode 100644 index 95ab82806..000000000 --- a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/category/dto/ProductCategoryUpdateReqDTO.java +++ /dev/null @@ -1,54 +0,0 @@ -package cn.iocoder.mall.productservice.rpc.category.dto; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** -* 商品分类更新 Request DTO -*/ -@Data -@Accessors(chain = true) -public class ProductCategoryUpdateReqDTO implements Serializable { - - /** - * 分类编号 - */ - @NotNull(message = "分类编号不能为空") - private Integer id; - /** - * 父分类编号 - */ - @NotNull(message = "父分类编号不能为空") - private Integer pid; - /** - * 分类名称 - */ - @NotEmpty(message = "分类名称不能为空") - private String name; - /** - * 分类描述 - */ - private String description; - /** - * 分类图片 - */ - private String picUrl; - /** - * 分类排序 - */ - @NotNull(message = "分类排序不能为空") - private Integer sort; - /** - * 状态 - */ - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "状态必须是 {value}") - private Integer status; - -} diff --git a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/ProductSpuFeign.java b/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/ProductSpuFeign.java deleted file mode 100644 index 1a8cde8ea..000000000 --- a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/ProductSpuFeign.java +++ /dev/null @@ -1,57 +0,0 @@ -package cn.iocoder.mall.productservice.rpc.spu; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.productservice.rpc.spu.dto.*; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; - -import java.util.Collection; -import java.util.List; - -@FeignClient(value = "product-service") -public interface ProductSpuFeign { - /** - * 获得商品 SPU - * - * @param productSpuId 商品 SPU 编号 - * @return 商品 SPU - */ - @GetMapping(value = "/product/spu/get") - CommonResult getProductSpu(@RequestParam("productSpuId") Integer productSpuId); - - /** - * 获得商品 SPU列表 - * - * @param productSpuIds 商品 SPU 编号列表 - * @return 商品 SPU 列表 - */ - @GetMapping(value = "/product/spu/list") - CommonResult> listProductSpus(@RequestParam("productSpuIds") Collection productSpuIds); - - /** - * 获得商品 SPU 分页 - * - * @param pageDTO 商品 SPU 分页查询 - * @return 商品 SPU 分页结果 - */ - @PostMapping(value = "/product/spu/page") - CommonResult> pageProductSpu(@RequestBody ProductSpuPageReqDTO pageDTO); - - /** - * 顺序获得商品 SPU 编号数组 - * - * @param lastSpuId 最后一个商品 SPU 编号 - * @param limit 数量 - * @return 商品 SPU 编号数组 - */ - @GetMapping(value = "/product/spu/lislistProductSpuIdst") - CommonResult> listProductSpuIds(@RequestParam("lastSpuId")Integer lastSpuId, @RequestParam("limit")Integer limit); - - @GetMapping(value = "/product/spu/getProductSpuDetail") - CommonResult getProductSpuDetail(@RequestParam("productSpuId") Integer productSpuId,@RequestParam("fields") Collection fields); - -} diff --git a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuPageReqDTO.java b/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuPageReqDTO.java deleted file mode 100644 index ead77560f..000000000 --- a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuPageReqDTO.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.iocoder.mall.productservice.rpc.spu.dto; - -import cn.iocoder.common.framework.vo.PageParam; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** -* 商品 SPU 分页 Request DTO -*/ -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class ProductSpuPageReqDTO extends PageParam { - - /** - * SPU 名字 - */ - private String name; - /** - * 分类编号 - */ - private Integer cid; - /** - * 是否可见 - */ - private Boolean visible; - /** - * 是否有库存 - */ - private Boolean hasQuantity; - -} diff --git a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuRespDTO.java b/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuRespDTO.java deleted file mode 100644 index b0210d267..000000000 --- a/归档/product-service-project/product-service-api/src/main/java/cn/iocoder/mall/productservice/rpc/spu/dto/ProductSpuRespDTO.java +++ /dev/null @@ -1,62 +0,0 @@ -package cn.iocoder.mall.productservice.rpc.spu.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -/** -* 商品 SPU 信息 Response DTO -*/ -@Data -@Accessors(chain = true) -public class ProductSpuRespDTO implements Serializable { - - /** - * 商品 SPU 编号 - */ - private Integer id; - /** - * SPU 名字 - */ - private String name; - /** - * 卖点 - */ - private String sellPoint; - /** - * 描述 - */ - private String description; - /** - * 分类编号 - */ - private Integer cid; - /** - * 商品主图地址 - */ - private List picUrls; - /** - * 是否上架商品 - */ - private Boolean visible; - /** - * 排序字段 - */ - private Integer sort; - /** - * 价格 - */ - private Integer price; - /** - * 库存数量 - */ - private Integer quantity; - /** - * 创建时间 - */ - private Date createTime; - -} diff --git a/归档/product-service-project/product-service-app/pom.xml b/归档/product-service-project/product-service-app/pom.xml deleted file mode 100644 index 4c886ba44..000000000 --- a/归档/product-service-project/product-service-app/pom.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - product-service-project - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - product-service-app - - - - cn.iocoder.mall - mall-spring-boot-starter-dubbo - - - - - cn.iocoder.mall - system-service-api - ${project.version} - - - - - cn.iocoder.mall - product-service-api - - - - - org.springframework.boot - spring-boot-starter-web - - - - - cn.iocoder.mall - mall-spring-boot-starter-rocketmq - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - - - mysql - mysql-connector-java - - - - com.alibaba - druid-spring-boot-starter - - - - cn.iocoder.mall - mall-spring-boot-starter-mybatis - - - - - org.springframework.boot - spring-boot-starter-actuator - - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - org.springframework.boot - spring-boot-starter-validation - - - - org.projectlombok - lombok - - - - org.mapstruct - mapstruct - - - org.mapstruct - mapstruct-jdk8 - - - - org.aspectj - aspectjweaver - 1.9.6 - - - io.swagger - swagger-annotations - - - - - - ${project.artifactId} - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/ProductServiceApplication.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/ProductServiceApplication.java deleted file mode 100644 index 5c5c30edc..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/ProductServiceApplication.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.iocoder.mall.productservice; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.cloud.openfeign.EnableFeignClients; - -@SpringBootApplication -@EnableDiscoveryClient -@EnableFeignClients -public class ProductServiceApplication { - - public static void main(String[] args) { - SpringApplication.run(ProductServiceApplication.class, args); - } - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/config/AopConfiguration.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/config/AopConfiguration.java deleted file mode 100644 index 8de5329ef..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/config/AopConfiguration.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.iocoder.mall.productservice.config; - -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.EnableAspectJAutoProxy; - -/** - * Spring Aop 配置类 - */ -@Configuration -@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true) -public class AopConfiguration { -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/config/DatabaseConfiguration.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/config/DatabaseConfiguration.java deleted file mode 100644 index 84fcef6fa..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/config/DatabaseConfiguration.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.productservice.config; - -import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector; -import com.baomidou.mybatisplus.core.injector.ISqlInjector; -import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -@Configuration -@MapperScan("cn.iocoder.mall.productservice.dal.mysql.mapper") // 扫描对应的 Mapper 接口 -@EnableTransactionManagement(proxyTargetClass = true) // 启动事务管理。 -public class DatabaseConfiguration { - - // 数据库连接池 Druid - - @Bean - public ISqlInjector sqlInjector() { - return new DefaultSqlInjector(); // MyBatis Plus 逻辑删除 - } - - @Bean - public PaginationInterceptor paginationInterceptor() { - return new PaginationInterceptor(); // MyBatis Plus 分页插件 - } - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/controller/ProductBrandController.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/controller/ProductBrandController.java deleted file mode 100644 index 1b568aacc..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/controller/ProductBrandController.java +++ /dev/null @@ -1,98 +0,0 @@ -package cn.iocoder.mall.productservice.controller; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.productservice.manager.brand.ProductBrandManager; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO; -import io.swagger.annotations.Api; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** - * Title: - * Description: - * - * @author zhuyang - * @version 1.0 2021/10/7 - */ -@RestController -@RequestMapping("/product/brand") -@Api("商品品牌") -public class ProductBrandController { - @Autowired - private ProductBrandManager productBrandManager; - - /** - * 创建商品品牌 - * - * @param createDTO 创建商品品牌 DTO - * @return 商品品牌编号 - */ - @PostMapping("createProductBrand") - CommonResult createProductBrand(@RequestBody ProductBrandCreateReqDTO createDTO){ - return success(productBrandManager.createProductBrand(createDTO)); - } - - /** - * 更新商品品牌 - * - * @param updateDTO 更新商品品牌 DTO - */ - @PostMapping("updateProductBrand") - CommonResult updateProductBrand(@RequestBody ProductBrandUpdateReqDTO updateDTO){ - productBrandManager.updateProductBrand(updateDTO); - return success(true); - } - - /** - * 删除商品品牌 - * - * @param productBrandId 商品品牌编号 - */ - @GetMapping("deleteProductBrand") - CommonResult deleteProductBrand(@RequestParam("productBrandId") Integer productBrandId){ - productBrandManager.deleteProductBrand(productBrandId); - return success(true); - } - - /** - * 获得商品品牌 - * - * @param productBrandId 商品品牌编号 - * @return 商品品牌 - */ - @GetMapping("getProductBrand") - CommonResult getProductBrand(@RequestParam("productBrandId")Integer productBrandId){ - return success(productBrandManager.getProductBrand(productBrandId)); - } - - /** - * 获得商品品牌列表 - * - * @param productBrandIds 商品品牌编号列表 - * @return 商品品牌列表 - */ - @GetMapping("listProductBrands") - CommonResult> listProductBrands(@RequestParam("productBrandIds") List productBrandIds){ - return success(productBrandManager.listProductBrands(productBrandIds)); - } - - /** - * 获得商品品牌分页 - * - * @param pageDTO 商品品牌分页查询 - * @return 商品品牌分页结果 - */ - @PostMapping("pageProductBrand") - CommonResult> pageProductBrand(@RequestBody ProductBrandPageReqDTO pageDTO){ - return success(productBrandManager.pageProductBrand(pageDTO)); - } - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/controller/ProductCategoryController.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/controller/ProductCategoryController.java deleted file mode 100644 index 5e36faebf..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/controller/ProductCategoryController.java +++ /dev/null @@ -1,107 +0,0 @@ -package cn.iocoder.mall.productservice.controller; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.productservice.manager.brand.ProductBrandManager; -import cn.iocoder.mall.productservice.manager.category.ProductCategoryManager; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryCreateReqDTO; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryUpdateReqDTO; -import io.swagger.annotations.Api; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.Collection; -import java.util.List; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** - * Title: - * Description: - * - * @author zhuyang - * @version 1.0 2021/10/7 - */ -@RestController -@RequestMapping("/product/category") -@Api("商品品牌") -public class ProductCategoryController { - @Autowired - private ProductCategoryManager productCategoryManager; - - - /** - * 创建商品分类 - * - * @param createDTO 创建商品分类 DTO - * @return 商品分类编号 - */ - @PostMapping("createProductCategory") - CommonResult createProductCategory(@RequestBody ProductCategoryCreateReqDTO createDTO){ - return success(productCategoryManager.createProductCategory(createDTO)); - } - - /** - * 更新商品分类 - * - * @param updateDTO 更新商品分类 DTO - */ - @PostMapping("updateProductCategory") - CommonResult updateProductCategory(@RequestBody ProductCategoryUpdateReqDTO updateDTO){ - productCategoryManager.updateProductCategory(updateDTO); - return success(true); - - } - - /** - * 删除商品分类 - * - * @param productCategoryId 商品分类编号 - */ - @GetMapping("deleteProductCategory") - CommonResult deleteProductCategory(@RequestParam("productCategoryId") Integer productCategoryId){ - productCategoryManager.deleteProductCategory(productCategoryId); - return success(true); - } - - /** - * 获得商品分类 - * - * @param productCategoryId 商品分类编号 - * @return 商品分类 - */ - @GetMapping("getProductCategory") - CommonResult getProductCategory(@RequestParam("productCategoryId")Integer productCategoryId){ - return success(productCategoryManager.getProductCategory(productCategoryId)); - } - - /** - * 获得商品分类列表 - * - * @param productCategoryIds 商品分类编号列表 - * @return 商品分类列表 - */ - @GetMapping("listProductCategoriesByIds") - CommonResult> listProductCategoriesByIds(@RequestParam("productCategoryIds")Collection productCategoryIds){ - return success(productCategoryManager.listProductCategories(productCategoryIds)); - } - - /** - * 获得符合条件的商品分类列表 - * - * @return 商品分类列表 - */ - @PostMapping("listProductCategories") - CommonResult> listProductCategories(@RequestBody ProductCategoryListQueryReqDTO listQueryReqDTO){ - return success(productCategoryManager.listProductCategories(listQueryReqDTO)); - - } - - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/attr/ProductAttrConvert.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/attr/ProductAttrConvert.java deleted file mode 100644 index 9489b607d..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/attr/ProductAttrConvert.java +++ /dev/null @@ -1,61 +0,0 @@ -package cn.iocoder.mall.productservice.convert.attr; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.productservice.dal.mysql.dataobject.attr.ProductAttrKeyDO; -import cn.iocoder.mall.productservice.dal.mysql.dataobject.attr.ProductAttrValueDO; -import cn.iocoder.mall.productservice.rpc.attr.dto.*; -import cn.iocoder.mall.productservice.service.attr.bo.*; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface ProductAttrConvert { - - ProductAttrConvert INSTANCE = Mappers.getMapper(ProductAttrConvert.class); - - ProductAttrKeyDO convert(ProductAttrKeyCreateBO bean); - - ProductAttrKeyBO convert(ProductAttrKeyDO bean); - - ProductAttrKeyDO convert(ProductAttrKeyUpdateBO bean); - - List convertList(List list); - - @Mapping(source = "records", target = "list") - PageResult convertPage(IPage page); - - ProductAttrKeyCreateBO convert(ProductAttrKeyCreateReqDTO bean); - - ProductAttrKeyUpdateBO convert(ProductAttrKeyUpdateReqDTO bean); - - ProductAttrKeyRespDTO convert(ProductAttrKeyBO bean); - - List convertList02(List list); - - ProductAttrKeyPageBO convert(ProductAttrKeyPageReqDTO bean); - - PageResult convertPage(PageResult page); - - ProductAttrValueDO convert(ProductAttrValueCreateBO bean); - - ProductAttrValueBO convert(ProductAttrValueDO bean); - - ProductAttrValueDO convert(ProductAttrValueUpdateBO bean); - - List convertList03(List list); - - ProductAttrValueCreateBO convert(ProductAttrValueCreateReqDTO bean); - - ProductAttrValueUpdateBO convert(ProductAttrValueUpdateReqDTO bean); - - ProductAttrValueRespDTO convert(ProductAttrValueBO bean); - - List convertList04(List list); - - ProductAttrValueListQueryBO convert(ProductAttrValueListQueryReqDTO bean); - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/brand/ProductBrandConvert.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/brand/ProductBrandConvert.java deleted file mode 100644 index 9c8a221f7..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/brand/ProductBrandConvert.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.iocoder.mall.productservice.convert.brand; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.productservice.dal.mysql.dataobject.brand.ProductBrandDO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO; -import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandBO; -import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandCreateBO; -import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandPageBO; -import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandUpdateBO; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface ProductBrandConvert { - - ProductBrandConvert INSTANCE = Mappers.getMapper(ProductBrandConvert.class); - - ProductBrandDO convert(ProductBrandCreateBO bean); - - ProductBrandBO convert(ProductBrandDO bean); - - ProductBrandDO convert(ProductBrandUpdateBO bean); - - List convertList(List list); - - @Mapping(source = "records", target = "list") - PageResult convertPage(IPage page); - - ProductBrandCreateBO convert(ProductBrandCreateReqDTO bean); - - ProductBrandUpdateBO convert(ProductBrandUpdateReqDTO bean); - - ProductBrandRespDTO convert(ProductBrandBO bean); - - List convertList02(List list); - - ProductBrandPageBO convert(ProductBrandPageReqDTO bean); - - PageResult convertPage(PageResult page); - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/category/ProductCategoryConvert.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/category/ProductCategoryConvert.java deleted file mode 100644 index 29451b12e..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/convert/category/ProductCategoryConvert.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.iocoder.mall.productservice.convert.category; - -import cn.iocoder.mall.productservice.dal.mysql.dataobject.category.ProductCategoryDO; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryCreateReqDTO; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryUpdateReqDTO; -import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryBO; -import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryCreateBO; -import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryListQueryBO; -import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryUpdateBO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface ProductCategoryConvert { - - ProductCategoryConvert INSTANCE = Mappers.getMapper(ProductCategoryConvert.class); - - ProductCategoryDO convert(ProductCategoryCreateBO bean); - - ProductCategoryBO convert(ProductCategoryDO bean); - - List convertList(List list); - - ProductCategoryDO convert(ProductCategoryUpdateBO bean); - - ProductCategoryCreateBO convert(ProductCategoryCreateReqDTO bean); - - ProductCategoryUpdateBO convert(ProductCategoryUpdateReqDTO bean); - - ProductCategoryRespDTO convert(ProductCategoryBO bean); - - List convertList02(List list); - - ProductCategoryListQueryBO convert(ProductCategoryListQueryReqDTO bean); - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/attr/ProductAttrKeyDO.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/attr/ProductAttrKeyDO.java deleted file mode 100644 index 528c6e0fa..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/attr/ProductAttrKeyDO.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.mall.productservice.dal.mysql.dataobject.attr; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - * Product 规格键 DO - */ -@TableName("product_attr_key") -@Data -@Accessors(chain = true) -@EqualsAndHashCode(callSuper = true) -public class ProductAttrKeyDO extends DeletableDO { - - /** - * 规格编号 - */ - private Integer id; - /** - * 名称 - */ - private String name; - /** - * 状态 - * - * 枚举 {@link CommonStatusEnum} - */ - private Integer status; - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/attr/ProductAttrValueDO.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/attr/ProductAttrValueDO.java deleted file mode 100644 index 75bb844b2..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/attr/ProductAttrValueDO.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.iocoder.mall.productservice.dal.mysql.dataobject.attr; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - * 商品规格值 DO - */ -@TableName("product_attr_value") -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class ProductAttrValueDO extends DeletableDO { - - /** - * 规格值编号 - */ - private Integer id; - /** - * 规格键编号 - * - * 外键 {@link ProductAttrKeyDO#getId()} - */ - private Integer attrKeyId; - /** - * 规格值名字 - */ - private String name; - /** - * 状态 - * - * 枚举 {@link CommonStatusEnum} - */ - private Integer status; - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/brand/ProductBrandDO.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/brand/ProductBrandDO.java deleted file mode 100644 index 0e489cbf6..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/brand/ProductBrandDO.java +++ /dev/null @@ -1,41 +0,0 @@ -package cn.iocoder.mall.productservice.dal.mysql.dataobject.brand; - -import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** -* 商品品牌 -*/ -@TableName("product_brand") -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class ProductBrandDO extends DeletableDO { - - /** - * 品牌编号(主键) - */ - @TableId - private Integer id; - /** - * 品牌名称 - */ - private String name; - /** - * 品牌描述 - */ - private String description; - /** - * 品牌名图片 - */ - private String picUrl; - /** - * 状态 - */ - private Integer status; - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/category/ProductCategoryDO.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/category/ProductCategoryDO.java deleted file mode 100644 index eba468822..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/category/ProductCategoryDO.java +++ /dev/null @@ -1,52 +0,0 @@ -package cn.iocoder.mall.productservice.dal.mysql.dataobject.category; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** -* 商品分类 DO -*/ -@TableName("product_category") -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class ProductCategoryDO extends DeletableDO { - - /** - * 分类编号 - */ - @TableId - private Integer id; - /** - * 父分类编号 - */ - private Integer pid; - /** - * 分类名称 - */ - private String name; - /** - * 分类描述 - */ - private String description; - /** - * 分类图片 - */ - private String picUrl; - /** - * 分类排序 - */ - private Integer sort; - /** - * 状态 - * - * 枚举 {@link CommonStatusEnum} - */ - private Integer status; - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/attr/ProductAttrKeyMapper.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/attr/ProductAttrKeyMapper.java deleted file mode 100644 index f9083143e..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/attr/ProductAttrKeyMapper.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.iocoder.mall.productservice.dal.mysql.mapper.attr; - -import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; -import cn.iocoder.mall.productservice.dal.mysql.dataobject.attr.ProductAttrKeyDO; -import cn.iocoder.mall.productservice.service.attr.bo.ProductAttrKeyPageBO; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.stereotype.Repository; - -@Repository -public interface ProductAttrKeyMapper extends BaseMapper { - - default IPage selectPage(ProductAttrKeyPageBO pageBO) { - return selectPage(new Page<>(pageBO.getPageNo(), pageBO.getPageSize()), - new QueryWrapperX().likeIfPresent("name", pageBO.getName()) - .eqIfPresent("status", pageBO.getStatus())); - } - - default ProductAttrKeyDO selectByName(String name) { - return selectOne(new QueryWrapper().eq("name", name)); - } - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/attr/ProductAttrValueMapper.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/attr/ProductAttrValueMapper.java deleted file mode 100644 index 76f6a8456..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/attr/ProductAttrValueMapper.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.iocoder.mall.productservice.dal.mysql.mapper.attr; - -import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; -import cn.iocoder.mall.productservice.dal.mysql.dataobject.attr.ProductAttrValueDO; -import cn.iocoder.mall.productservice.service.attr.bo.ProductAttrValueListQueryBO; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Repository -public interface ProductAttrValueMapper extends BaseMapper { - - default ProductAttrValueDO selectByAttrKeyIdAndName(Integer attrKeyId, String name) { - return selectOne(new QueryWrapper().eq("attr_key_id", attrKeyId).eq("name", name)); - } - - default List selectList(ProductAttrValueListQueryBO queryBO) { - return selectList(new QueryWrapperX().inIfPresent("id", queryBO.getProductAttrValueIds()) - .eqIfPresent("attr_key_id", queryBO.getProductAttrKeyId())); - } - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/brand/ProductBrandMapper.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/brand/ProductBrandMapper.java deleted file mode 100644 index 538ffbb69..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/brand/ProductBrandMapper.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.iocoder.mall.productservice.dal.mysql.mapper.brand; - -import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; -import cn.iocoder.mall.productservice.dal.mysql.dataobject.brand.ProductBrandDO; -import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandPageBO; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.stereotype.Repository; - -@Repository -public interface ProductBrandMapper extends BaseMapper { - - default IPage selectPage(ProductBrandPageBO pageBO) { - return selectPage(new Page<>(pageBO.getPageNo(), pageBO.getPageSize()), - new QueryWrapperX().likeIfPresent("name", pageBO.getName()) - .eqIfPresent("status", pageBO.getStatus())); - } - - default ProductBrandDO selectByName(String name) { - return selectOne(new QueryWrapper().eq("name", name)); - } - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/category/ProductCategoryMapper.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/category/ProductCategoryMapper.java deleted file mode 100644 index 8bede9aa2..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/category/ProductCategoryMapper.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.iocoder.mall.productservice.dal.mysql.mapper.category; - -import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; -import cn.iocoder.mall.productservice.dal.mysql.dataobject.category.ProductCategoryDO; -import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryListQueryBO; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Repository -public interface ProductCategoryMapper extends BaseMapper { - - default Integer selectCountByPid(Integer pid) { - return selectCount(new QueryWrapper().eq("pid", pid)); - } - - default List selectList(ProductCategoryListQueryBO listQueryBO) { - return selectList(new QueryWrapperX().eqIfPresent("pid", listQueryBO.getPid()) - .eqIfPresent("status", listQueryBO.getStatus())); - } - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/brand/ProductBrandManager.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/brand/ProductBrandManager.java deleted file mode 100644 index 5a586466d..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/brand/ProductBrandManager.java +++ /dev/null @@ -1,86 +0,0 @@ -package cn.iocoder.mall.productservice.manager.brand; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.productservice.convert.brand.ProductBrandConvert; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandCreateReqDTO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandPageReqDTO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandRespDTO; -import cn.iocoder.mall.productservice.rpc.brand.dto.ProductBrandUpdateReqDTO; -import cn.iocoder.mall.productservice.service.brand.ProductBrandService; -import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandBO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** -* 商品品牌 Manager -*/ -@Service -public class ProductBrandManager { - - @Autowired - private ProductBrandService productBrandService; - - /** - * 创建商品品牌 - * - * @param createDTO 创建商品品牌 DTO - * @return 商品品牌 - */ - public Integer createProductBrand(ProductBrandCreateReqDTO createDTO) { - ProductBrandBO productBrandBO = productBrandService.createProductBrand(ProductBrandConvert.INSTANCE.convert(createDTO)); - return productBrandBO.getId(); - } - - /** - * 更新商品品牌 - * - * @param updateDTO 更新商品品牌 DTO - */ - public void updateProductBrand(ProductBrandUpdateReqDTO updateDTO) { - productBrandService.updateProductBrand(ProductBrandConvert.INSTANCE.convert(updateDTO)); - } - - /** - * 删除商品品牌 - * - * @param productBrandId 商品品牌编号 - */ - public void deleteProductBrand(Integer productBrandId) { - productBrandService.deleteProductBrand(productBrandId); - } - - /** - * 获得商品品牌 - * - * @param productBrandId 商品品牌编号 - * @return 商品品牌 - */ - public ProductBrandRespDTO getProductBrand(Integer productBrandId) { - ProductBrandBO productBrandBO = productBrandService.getProductBrand(productBrandId); - return ProductBrandConvert.INSTANCE.convert(productBrandBO); - } - - /** - * 获得商品品牌列表 - * - * @param productBrandIds 商品品牌编号列表 - * @return 商品品牌列表 - */ - public List listProductBrands(List productBrandIds) { - List productBrandBOs = productBrandService.listProductBrands(productBrandIds); - return ProductBrandConvert.INSTANCE.convertList02(productBrandBOs); - } - - /** - * 获得商品品牌分页 - * - * @param pageDTO 商品品牌分页查询 - * @return 商品品牌分页结果 - */ - public PageResult pageProductBrand(ProductBrandPageReqDTO pageDTO) { - PageResult pageResultBO = productBrandService.pageProductBrand(ProductBrandConvert.INSTANCE.convert(pageDTO)); - return ProductBrandConvert.INSTANCE.convertPage(pageResultBO); - } -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/category/ProductCategoryManager.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/category/ProductCategoryManager.java deleted file mode 100644 index a59a28d7e..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/category/ProductCategoryManager.java +++ /dev/null @@ -1,87 +0,0 @@ -package cn.iocoder.mall.productservice.manager.category; - -import cn.iocoder.mall.productservice.convert.category.ProductCategoryConvert; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryCreateReqDTO; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryListQueryReqDTO; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO; -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryUpdateReqDTO; -import cn.iocoder.mall.productservice.service.category.ProductCategoryService; -import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryBO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.Collection; -import java.util.List; - -/** -* 商品分类 Manager -*/ -@Service -public class ProductCategoryManager { - - @Autowired - private ProductCategoryService productCategoryService; - - /** - * 创建商品分类 - * - * @param createDTO 创建商品分类 DTO - * @return 商品分类 - */ - public Integer createProductCategory(ProductCategoryCreateReqDTO createDTO) { - ProductCategoryBO productCategoryBO = productCategoryService.createProductCategory(ProductCategoryConvert.INSTANCE.convert(createDTO)); - return productCategoryBO.getId(); - } - - /** - * 更新商品分类 - * - * @param updateDTO 更新商品分类 DTO - */ - public void updateProductCategory(ProductCategoryUpdateReqDTO updateDTO) { - productCategoryService.updateProductCategory(ProductCategoryConvert.INSTANCE.convert(updateDTO)); - } - - /** - * 删除商品分类 - * - * @param productCategoryId 商品分类编号 - */ - public void deleteProductCategory(Integer productCategoryId) { - productCategoryService.deleteProductCategory(productCategoryId); - } - - /** - * 获得商品分类 - * - * @param productCategoryId 商品分类编号 - * @return 商品分类 - */ - public ProductCategoryRespDTO getProductCategory(Integer productCategoryId) { - ProductCategoryBO productCategoryBO = productCategoryService.getProductCategory(productCategoryId); - return ProductCategoryConvert.INSTANCE.convert(productCategoryBO); - } - - /** - * 获得商品分类列表 - * - * @param productCategoryIds 商品分类编号列表 - * @return 商品分类列表 - */ - public List listProductCategories(Collection productCategoryIds) { - List productCategoryBOs = productCategoryService.listProductCategories(productCategoryIds); - return ProductCategoryConvert.INSTANCE.convertList02(productCategoryBOs); - } - - /** - * 获得商品分类全列表 - * - * @return 商品分类全列表 - */ - public List listProductCategories(ProductCategoryListQueryReqDTO listQueryReqDTO) { - List productCategoryBOs = productCategoryService.listProductCategories( - ProductCategoryConvert.INSTANCE.convert(listQueryReqDTO)); - return ProductCategoryConvert.INSTANCE.convertList02(productCategoryBOs); - } - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/spu/ProductSpuManager.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/spu/ProductSpuManager.java index 80392c15b..500007f75 100644 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/spu/ProductSpuManager.java +++ b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/spu/ProductSpuManager.java @@ -114,40 +114,6 @@ public class ProductSpuManager { return productSpuService.listProductSpuIds(lastSpuId, limit); } - private List checkProductAttr(List skuBOs) { - // 第一步,校验 SKU 使用到的规格是否存在 - Set attrValueIds = new HashSet<>(); - skuBOs.forEach(sku -> attrValueIds.addAll(sku.getAttrValueIds())); - List attrKeyValueBOs = productAttrService.validProductAttr(attrValueIds, true); - // 第二步,校验 SKU 设置的规格是否合法,例如说数量是否一致,是否重复等等 - // 创建 ProductAttrDetailBO 的映射。其中,KEY 为 ProductAttrDetailBO.attrValueId ,即规格值的编号 - Map productAttrDetailBOMap = attrKeyValueBOs.stream().collect( - Collectors.toMap(ProductAttrKeyValueBO::getAttrValueId, productAttrDetailBO -> productAttrDetailBO)); - // 1. 先校验,一个 Sku 下,没有重复的规格。校验方式是,遍历每个 Sku ,看看是否有重复的规格 attrId - for (ProductSkuCreateOrUpdateBO sku : skuBOs) { - Set attrIds = sku.getAttrValueIds().stream().map(attrValueId -> productAttrDetailBOMap.get(attrValueId).getAttrKeyId()) - .collect(Collectors.toSet()); - if (attrIds.size() != sku.getAttrValueIds().size()) { - throw ServiceExceptionUtil.exception(PRODUCT_SKU_ATTR_CANT_NOT_DUPLICATE); - } - } - // 2. 再校验,每个 Sku 的规格值的数量,是一致的。 - int attrValueIdsSize = skuBOs.get(0).getAttrValueIds().size(); - for (int i = 1; i < skuBOs.size(); i++) { - if (attrValueIdsSize != skuBOs.get(i).getAttrValueIds().size()) { - throw ServiceExceptionUtil.exception(PRODUCT_SPU_ATTR_NUMBERS_MUST_BE_EQUALS); - } - } - // 3. 最后校验,每个 Sku 之间不是重复的 - Set> skuAttrValues = new HashSet<>(); // 每个元素,都是一个 Sku 的 attrValueId 集合。这样,通过最外层的 Set ,判断是否有重复的. - for (ProductSkuCreateOrUpdateBO sku : skuBOs) { - if (!skuAttrValues.add(new HashSet<>(sku.getAttrValueIds()))) { // 添加失败,说明重复 - throw ServiceExceptionUtil.exception(PRODUCT_SPU_SKU_NOT_DUPLICATE); - } - } - return attrKeyValueBOs; - } - public ProductSpuDetailRespDTO getProductSpuDetail(Integer productSpuId, Collection fields) { // 获得商品 SPU 信息 ProductSpuBO spuBO = productSpuService.getProductSpu(productSpuId); diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/ProductBrandService.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/ProductBrandService.java deleted file mode 100644 index 08a8ed357..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/ProductBrandService.java +++ /dev/null @@ -1,119 +0,0 @@ -package cn.iocoder.mall.productservice.service.brand; - -import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.productservice.convert.brand.ProductBrandConvert; -import cn.iocoder.mall.productservice.dal.mysql.dataobject.brand.ProductBrandDO; -import cn.iocoder.mall.productservice.dal.mysql.mapper.brand.ProductBrandMapper; -import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandBO; -import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandCreateBO; -import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandPageBO; -import cn.iocoder.mall.productservice.service.brand.bo.ProductBrandUpdateBO; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.util.List; - -import static cn.iocoder.mall.productservice.enums.ProductErrorCodeConstants.PRODUCT_BRAND_NAME_EXIST; -import static cn.iocoder.mall.productservice.enums.ProductErrorCodeConstants.PRODUCT_BRAND_NOT_FOUND; - -/** -* 商品品牌 Service -*/ -@Service -@Validated -public class ProductBrandService { - - @Autowired - private ProductBrandMapper productBrandMapper; - - /** - * 创建商品品牌 - * - * @param createBO 创建商品品牌 BO - * @return 商品品牌 - */ - public ProductBrandBO createProductBrand(@Valid ProductBrandCreateBO createBO) { - // 校验商品品牌的名字是否已经使用 - if (productBrandMapper.selectByName(createBO.getName()) != null) { - throw ServiceExceptionUtil.exception(PRODUCT_BRAND_NAME_EXIST); - } - // 插入到数据库 - ProductBrandDO productBrandDO = ProductBrandConvert.INSTANCE.convert(createBO); - productBrandMapper.insert(productBrandDO); - // 返回 - return ProductBrandConvert.INSTANCE.convert(productBrandDO); - } - - /** - * 更新商品品牌 - * - * @param updateBO 更新商品品牌 BO - */ - public void updateProductBrand(@Valid ProductBrandUpdateBO updateBO) { - // 校验更新的商品品牌是否存在 - if (productBrandMapper.selectById(updateBO.getId()) == null) { - throw ServiceExceptionUtil.exception(PRODUCT_BRAND_NOT_FOUND); - } - // 校验商品品牌的名字是否已经使用 - ProductBrandDO productBrandDOByName = productBrandMapper.selectByName(updateBO.getName()); - if (productBrandDOByName != null && !updateBO.getId().equals(productBrandDOByName.getId())) { - throw ServiceExceptionUtil.exception(PRODUCT_BRAND_NAME_EXIST); - } - // 更新到数据库 - ProductBrandDO updateObject = ProductBrandConvert.INSTANCE.convert(updateBO); - productBrandMapper.updateById(updateObject); - } - - /** - * 删除商品品牌 - * - * @param productBrandId 商品品牌编号 - */ - public void deleteProductBrand(Integer productBrandId) { - // 校验删除的商品品牌是否存在 - if (productBrandMapper.selectById(productBrandId) == null) { - throw ServiceExceptionUtil.exception(PRODUCT_BRAND_NOT_FOUND); - } - // TODO 功能点:需要品牌下没有分类 - // 标记删除 - productBrandMapper.deleteById(productBrandId); - } - - /** - * 获得商品品牌 - * - * @param productBrandId 商品品牌编号 - * @return 商品品牌 - */ - public ProductBrandBO getProductBrand(Integer productBrandId) { - ProductBrandDO productBrandDO = productBrandMapper.selectById(productBrandId); - return ProductBrandConvert.INSTANCE.convert(productBrandDO); - } - - /** - * 获得商品品牌列表 - * - * @param productBrandIds 商品品牌编号列表 - * @return 商品品牌列表 - */ - public List listProductBrands(List productBrandIds) { - List productBrandDOs = productBrandMapper.selectBatchIds(productBrandIds); - return ProductBrandConvert.INSTANCE.convertList(productBrandDOs); - } - - /** - * 获得商品品牌分页 - * - * @param pageBO 商品品牌分页查询 - * @return 商品品牌分页结果 - */ - public PageResult pageProductBrand(ProductBrandPageBO pageBO) { - IPage productBrandDOPage = productBrandMapper.selectPage(pageBO); - return ProductBrandConvert.INSTANCE.convertPage(productBrandDOPage); - } - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandBO.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandBO.java deleted file mode 100644 index 1d16313e8..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandBO.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.iocoder.mall.productservice.service.brand.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; - -/** -* 商品品牌 BO -*/ -@Data -@Accessors(chain = true) -public class ProductBrandBO { - - /** - * 品牌编号(主键) - */ - private Integer id; - /** - * 品牌名称 - */ - private String name; - /** - * 品牌描述 - */ - private String description; - /** - * 品牌名图片 - */ - private String picUrl; - /** - * 状态 - */ - private Integer status; - /** - * 创建时间 - */ - private Date createTime; - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandCreateBO.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandCreateBO.java deleted file mode 100644 index b66d9def3..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandCreateBO.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.iocoder.mall.productservice.service.brand.bo; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -/** -* 商品品牌创建 BO -*/ -@Data -@Accessors(chain = true) -public class ProductBrandCreateBO { - - /** - * 品牌名称 - */ - @NotEmpty(message = "品牌名称不能为空") - private String name; - /** - * 品牌描述 - */ - private String description; - /** - * 品牌名图片 - */ - private String picUrl; - /** - * 状态 - */ - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandPageBO.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandPageBO.java deleted file mode 100644 index bc727eff0..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandPageBO.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.iocoder.mall.productservice.service.brand.bo; - -import cn.iocoder.common.framework.vo.PageParam; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** -* 商品品牌分页 BO -*/ -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class ProductBrandPageBO extends PageParam { - - /** - * 品牌名称 - * - * 模糊匹配 - */ - private String name; - /** - * 状态 - */ - private Integer status; - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandUpdateBO.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandUpdateBO.java deleted file mode 100644 index ff6c59bc1..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/brand/bo/ProductBrandUpdateBO.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.iocoder.mall.productservice.service.brand.bo; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -/** -* 商品品牌更新 BO -*/ -@Data -@Accessors(chain = true) -public class ProductBrandUpdateBO { - - /** - * 品牌编号(主键) - */ - @NotNull(message = "品牌编号(主键)不能为空") - private Integer id; - /** - * 品牌名称 - */ - @NotEmpty(message = "品牌名称不能为空") - private String name; - /** - * 品牌描述 - */ - private String description; - /** - * 品牌名图片 - */ - private String picUrl; - /** - * 状态 - */ - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/ProductCategoryService.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/ProductCategoryService.java deleted file mode 100644 index 003fc8bd3..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/ProductCategoryService.java +++ /dev/null @@ -1,135 +0,0 @@ -package cn.iocoder.mall.productservice.service.category; - -import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; -import cn.iocoder.mall.productservice.convert.category.ProductCategoryConvert; -import cn.iocoder.mall.productservice.dal.mysql.dataobject.category.ProductCategoryDO; -import cn.iocoder.mall.productservice.dal.mysql.mapper.category.ProductCategoryMapper; -import cn.iocoder.mall.productservice.enums.category.ProductCategoryIdEnum; -import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryBO; -import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryCreateBO; -import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryListQueryBO; -import cn.iocoder.mall.productservice.service.category.bo.ProductCategoryUpdateBO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.util.Collection; -import java.util.List; - -import static cn.iocoder.mall.productservice.enums.ProductErrorCodeConstants.*; - -/** -* 商品分类 Service -*/ -@Service -@Validated -public class ProductCategoryService { - - @Autowired - private ProductCategoryMapper productCategoryMapper; - - /** - * 创建商品分类 - * - * @param createBO 创建商品分类 BO - * @return 商品分类 - */ - public ProductCategoryBO createProductCategory(@Valid ProductCategoryCreateBO createBO) { - // 校验父分类 - validParent(createBO.getPid()); - // 插入到数据库 - ProductCategoryDO productCategoryDO = ProductCategoryConvert.INSTANCE.convert(createBO); - productCategoryMapper.insert(productCategoryDO); - // 返回 - return ProductCategoryConvert.INSTANCE.convert(productCategoryDO); - } - - /** - * 更新商品分类 - * - * @param updateBO 更新商品分类 BO - */ - public void updateProductCategory(@Valid ProductCategoryUpdateBO updateBO) { - // 校验父分类 - validParent(updateBO.getPid()); - // 校验不能设置自己为父分类 - if (updateBO.getId().equals(updateBO.getPid())) { - throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_PARENT_NOT_SELF); - } - // 校验更新的商品分类是否存在 - if (productCategoryMapper.selectById(updateBO.getId()) == null) { - throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_NOT_EXISTS); - } - // 更新到数据库 - ProductCategoryDO updateObject = ProductCategoryConvert.INSTANCE.convert(updateBO); - productCategoryMapper.updateById(updateObject); - } - - /** - * 删除商品分类 - * - * @param productCategoryId 商品分类编号 - */ - public void deleteProductCategory(Integer productCategoryId) { - // 校验删除的商品分类是否存在 - if (productCategoryMapper.selectById(productCategoryId) == null) { - throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_NOT_EXISTS); - } - // 只有不存在子分类才可以删除 - Integer childCount = productCategoryMapper.selectCountByPid(productCategoryId); - if (childCount > 0) { - throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_DELETE_ONLY_NO_CHILD); - } - // TODO 芋艿 补充只有不存在商品才可以删除 - // 标记删除 - productCategoryMapper.deleteById(productCategoryId); - } - - /** - * 获得商品分类 - * - * @param productCategoryId 商品分类编号 - * @return 商品分类 - */ - public ProductCategoryBO getProductCategory(Integer productCategoryId) { - ProductCategoryDO productCategoryDO = productCategoryMapper.selectById(productCategoryId); - return ProductCategoryConvert.INSTANCE.convert(productCategoryDO); - } - - /** - * 获得商品分类列表 - * - * @param productCategoryIds 商品分类编号列表 - * @return 商品分类列表 - */ - public List listProductCategories(Collection productCategoryIds) { - List productCategoryDOs = productCategoryMapper.selectBatchIds(productCategoryIds); - return ProductCategoryConvert.INSTANCE.convertList(productCategoryDOs); - } - - /** - * 获得商品分类全列表 - * - * @return 商品分类全列表 - */ - public List listProductCategories(ProductCategoryListQueryBO listQueryBO) { - List resourceDOs = productCategoryMapper.selectList(listQueryBO); - return ProductCategoryConvert.INSTANCE.convertList(resourceDOs); - } - - private void validParent(Integer pid) { - if (!ProductCategoryIdEnum.ROOT.getId().equals(pid)) { - ProductCategoryDO parentCategory = productCategoryMapper.selectById(pid); - // 校验父分类是否存在 - if (parentCategory == null) { - throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_PARENT_NOT_EXISTS); - } - // 父分类必须是一级分类 - if (!ProductCategoryIdEnum.ROOT.getId().equals(parentCategory.getPid())) { - throw ServiceExceptionUtil.exception((PRODUCT_CATEGORY_PARENT_CAN_NOT_BE_LEVEL2)); - } - } - } - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryBO.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryBO.java deleted file mode 100644 index c7fc7152f..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryBO.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.iocoder.mall.productservice.service.category.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; - -/** -* 商品分类 BO -*/ -@Data -@Accessors(chain = true) -public class ProductCategoryBO { - - /** - * 分类编号 - */ - private Integer id; - /** - * 父分类编号 - */ - private Integer pid; - /** - * 分类名称 - */ - private String name; - /** - * 分类描述 - */ - private String description; - /** - * 分类图片 - */ - private String picUrl; - /** - * 分类排序 - */ - private Integer sort; - /** - * 状态 - */ - private Integer status; - /** - * 创建时间 - */ - private Date createTime; - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryCreateBO.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryCreateBO.java deleted file mode 100644 index b58aa3769..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryCreateBO.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.iocoder.mall.productservice.service.category.bo; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -/** -* 商品分类创建 BO -*/ -@Data -@Accessors(chain = true) -public class ProductCategoryCreateBO { - - /** - * 父分类编号 - */ - @NotNull(message = "父分类编号不能为空") - private Integer pid; - /** - * 分类名称 - */ - @NotEmpty(message = "分类名称不能为空") - private String name; - /** - * 分类描述 - */ - private String description; - /** - * 分类图片 - */ - private String picUrl; - /** - * 分类排序 - */ - @NotNull(message = "分类排序不能为空") - private Integer sort; - /** - * 状态 - */ - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryListQueryBO.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryListQueryBO.java deleted file mode 100644 index 1c3ed7600..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryListQueryBO.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.iocoder.mall.productservice.service.category.bo; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * 商品分类列表查询 BO - */ -@Data -@Accessors(chain = true) -public class ProductCategoryListQueryBO { - - /** - * 父编号 - */ - private Integer pid; - /** - * 状态 - */ - @InEnum(value = CommonStatusEnum.class, message = "状态必须是 {value}") - private Integer status; - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryUpdateBO.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryUpdateBO.java deleted file mode 100644 index c32b43197..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/category/bo/ProductCategoryUpdateBO.java +++ /dev/null @@ -1,53 +0,0 @@ -package cn.iocoder.mall.productservice.service.category.bo; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -/** -* 商品分类更新 BO -*/ -@Data -@Accessors(chain = true) -public class ProductCategoryUpdateBO { - - /** - * 分类编号 - */ - @NotNull(message = "分类编号不能为空") - private Integer id; - /** - * 父分类编号 - */ - @NotNull(message = "父分类编号不能为空") - private Integer pid; - /** - * 分类名称 - */ - @NotEmpty(message = "分类名称不能为空") - private String name; - /** - * 分类描述 - */ - private String description; - /** - * 分类图片 - */ - private String picUrl; - /** - * 分类排序 - */ - @NotNull(message = "分类排序不能为空") - private Integer sort; - /** - * 状态 - */ - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/ProductSpuService.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/ProductSpuService.java deleted file mode 100644 index a24df5acf..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/ProductSpuService.java +++ /dev/null @@ -1,110 +0,0 @@ -package cn.iocoder.mall.productservice.service.spu; - -import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; -import cn.iocoder.common.framework.util.CollectionUtils; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.productservice.convert.spu.ProductSpuConvert; -import cn.iocoder.mall.productservice.dal.mysql.dataobject.spu.ProductSpuDO; -import cn.iocoder.mall.productservice.dal.mysql.mapper.spu.ProductSpuMapper; -import cn.iocoder.mall.productservice.service.spu.bo.ProductSpuBO; -import cn.iocoder.mall.productservice.service.spu.bo.ProductSpuCreateBO; -import cn.iocoder.mall.productservice.service.spu.bo.ProductSpuPageBO; -import cn.iocoder.mall.productservice.service.spu.bo.ProductSpuUpdateBO; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.util.Collection; -import java.util.List; - -import static cn.iocoder.mall.productservice.enums.ProductErrorCodeConstants.PRODUCT_SPU_NOT_EXISTS; - -/** -* 商品 SPU Service -*/ -@Service -@Validated -public class ProductSpuService { - - @Autowired - private ProductSpuMapper productSpuMapper; - - /** - * 创建商品 SPU - * - * @param createBO 创建商品 SPU BO - * @return 商品 SPU - */ - public ProductSpuBO createProductSpu(@Valid ProductSpuCreateBO createBO) { - // 插入到数据库 - ProductSpuDO productSpuDO = ProductSpuConvert.INSTANCE.convert(createBO); - productSpuMapper.insert(productSpuDO); - // 返回 - return ProductSpuConvert.INSTANCE.convert(productSpuDO); - } - - /** - * 更新商品 SPU - * - * @param updateBO 更新商品 SPU BO - */ - public void updateProductSpu(@Valid ProductSpuUpdateBO updateBO) { - // 校验更新的商品 SPU是否存在 - if (productSpuMapper.selectById(updateBO.getId()) == null) { - throw ServiceExceptionUtil.exception(PRODUCT_SPU_NOT_EXISTS); - } - // 更新到数据库 - ProductSpuDO updateObject = ProductSpuConvert.INSTANCE.convert(updateBO); - productSpuMapper.updateById(updateObject); - } - - /** - * 获得商品 SPU - * - * @param productSpuId 商品 SPU编号 - * @return 商品 SPU - */ - public ProductSpuBO getProductSpu(Integer productSpuId) { - ProductSpuDO productSpuDO = productSpuMapper.selectById(productSpuId); - return ProductSpuConvert.INSTANCE.convert(productSpuDO); - } - - /** - * 获得商品 SPU列表 - * - * @param productSpuIds 商品 SPU编号列表 - * @return 商品 SPU列表 - */ - public List listProductSpus(Collection productSpuIds) { - List productSpuDOs = productSpuMapper.selectBatchIds(productSpuIds); - return ProductSpuConvert.INSTANCE.convertList(productSpuDOs); - } - - /** - * 获得商品 SPU分页 - * - * @param pageBO 商品 SPU分页查询 - * @return 商品 SPU分页结果 - */ - public PageResult pageProductSpu(ProductSpuPageBO pageBO) { - IPage productSpuDOPage = productSpuMapper.selectPage(pageBO); - return ProductSpuConvert.INSTANCE.convertPage(productSpuDOPage); - } - - /** - * 顺序获得商品 SPU 编号数组 - * - * 一般情况下,该接口我们用于提供顺序的 SPU 编号数组,以便调用方进一步根据自己需要获取商品信息 - * 例如说,搜索服务会不断获取商品编号,重建该商品编号的索引 - * - * @param lastSpuId 最后一个商品 SPU 编号 - * @param limit 数量 - * @return 商品 SPU 编号数组 - */ - public List listProductSpuIds(Integer lastSpuId, Integer limit) { - return CollectionUtils.convertList(productSpuMapper.selectListByIdGt(lastSpuId, limit), ProductSpuDO::getId); - } - -} diff --git a/归档/product-service-project/product-service-app/src/main/resources/application-dev.yaml b/归档/product-service-project/product-service-app/src/main/resources/application-dev.yaml deleted file mode 100644 index 7256a5bb2..000000000 --- a/归档/product-service-project/product-service-app/src/main/resources/application-dev.yaml +++ /dev/null @@ -1,21 +0,0 @@ -spring: - # 数据源配置项 - datasource: - url: jdbc:mysql://localhost:3306/mall_product?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT - driver-class-name: com.mysql.jdbc.Driver - username: root - password: zhuyang - # Spring Cloud 配置项 - cloud: - nacos: - # Spring Cloud Nacos Discovery 配置项 - discovery: - server-addr: localhost:8848 # Nacos 服务器地址 - namespace: dev # Nacos 命名空间 - -# Dubbo 配置项 -dubbo: - # Dubbo 注册中心 - registry: - # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 diff --git a/归档/product-service-project/product-service-app/src/main/resources/application-local.yaml b/归档/product-service-project/product-service-app/src/main/resources/application-local.yaml deleted file mode 100644 index 8c2752534..000000000 --- a/归档/product-service-project/product-service-app/src/main/resources/application-local.yaml +++ /dev/null @@ -1,24 +0,0 @@ -spring: - # 数据源配置项 - datasource: - url: jdbc:mysql://localhost:3306/mall_product?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT - driver-class-name: com.mysql.jdbc.Driver - username: root - password: zhuyang - # Spring Cloud 配置项 - cloud: - nacos: - # Spring Cloud Nacos Discovery 配置项 - discovery: - server-addr: localhost:8848 # Nacos 服务器地址 - namespace: dev # Nacos 命名空间 - -# Dubbo 配置项 -dubbo: - # Dubbo 注册中心 - registry: -# address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 - # Dubbo 服务提供者的配置 - provider: - tag: ${DUBBO_TAG} # Dubbo 路由分组 diff --git a/归档/product-service-project/product-service-app/src/main/resources/application.yaml b/归档/product-service-project/product-service-app/src/main/resources/application.yaml deleted file mode 100644 index 296e61a84..000000000 --- a/归档/product-service-project/product-service-app/src/main/resources/application.yaml +++ /dev/null @@ -1,60 +0,0 @@ -spring: - # Application 的配置项 - application: - name: product-service - # Profile 的配置项 - profiles: - active: local - -# MyBatis Plus 配置项 -mybatis-plus: - configuration: - map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。 - global-config: - db-config: - id-type: auto - logic-delete-value: 1 # 逻辑已删除值(默认为 1) - logic-not-delete-value: 0 # 逻辑未删除值(默认为 0) - mapper-locations: classpath*:mapper/*.xml - type-aliases-package: cn.iocoder.mall.productservice.dal.mysql.dataobject - -# Dubbo 配置项 -dubbo: - # Spring Cloud Alibaba Dubbo 专属配置 - cloud: - subscribed-services: '' # 设置订阅的应用列表,默认为 * 订阅所有应用 - # Dubbo 提供者的协议 - protocol: - name: dubbo - port: -1 - # Dubbo 提供服务的扫描基础包 - scan: - base-packages: cn.iocoder.mall.productservice.rpc - # Dubbo 服务提供者的配置 - provider: - filter: -exception - validation: true # 开启 Provider 参数校验 - version: 1.0.0 # 服务的版本号 - # Dubbo 服务消费者的配置 - consumer: - ErrorCodeRpc: - version: 1.0.0 - -# RocketMQ 配置项 -rocketmq: - name-server: localhost:9876 - producer: - group: ${spring.application.name}-producer-group - -# Actuator 监控配置项 -management: - server.port: 38082 # 独立端口,避免被暴露出去 - endpoints.web.exposure.include: '*' # 暴露所有监控端点 -server.port: ${management.server.port} # 设置使用 Actuator 的服务器端口,因为 RPC 服务不需要 Web 端口 - -# Mall 配置项 -mall: - # 错误码配置项对应 ErrorCodeProperties 配置类 - error-code: - group: ${spring.application.name} - constants-class: cn.iocoder.mall.productservice.enums.ProductErrorCodeConstants diff --git a/归档/product-service-project/product-service-app/src/main/resources/mapper/ProductSkuMapper.xml b/归档/product-service-project/product-service-app/src/main/resources/mapper/ProductSkuMapper.xml deleted file mode 100644 index 884f67c8c..000000000 --- a/归档/product-service-project/product-service-app/src/main/resources/mapper/ProductSkuMapper.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - INSERT INTO product_sku ( - spu_id, status, pic_url, attrs, price, - quantity - ) VALUES - - (#{productSkuDO.spuId}, #{productSkuDO.status}, #{productSkuDO.picUrl}, #{productSkuDO.attrs}, #{productSkuDO.price}, - #{productSkuDO.quantity} - ) - - - - diff --git a/归档/product-service-project/product-service-app/src/main/resources/sql/mall_product_data.sql b/归档/product-service-project/product-service-app/src/main/resources/sql/mall_product_data.sql deleted file mode 100644 index 9931b7cc5..000000000 --- a/归档/product-service-project/product-service-app/src/main/resources/sql/mall_product_data.sql +++ /dev/null @@ -1,216 +0,0 @@ --- ---------------------------- --- Table structure for product_spu --- ---------------------------- -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (7, '测试商品', '又大又长', '厮大牛逼', 791, 'https://img2.woyaogexing.com/2019/03/15/5d4374f27d078462!400x400_big.jpg', 1, 0, 7, 10, '2019-03-05 02:45:44', '2019-04-24 11:47:20', b'1'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (8, '测试商品', '又大又长', '厮大牛逼', 791, 'https://img2.woyaogexing.com/2019/03/15/52c349020e992e04!400x400_big.jpg', 1, 0, 8, 20, '2019-03-05 02:48:52', '2019-04-24 11:47:22', b'1'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (9, '测试商品', '又大又长', '厮大牛逼', 791, 'https://img2.woyaogexing.com/2019/03/15/4ba4264eb3416283!400x400_big.jpg', 1, 0, 9, 30, '2019-03-05 02:51:22', '2019-04-24 11:47:23', b'1'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (10, '测试商品', '又大又长', '厮大牛逼', 791, 'https://img2.woyaogexing.com/2019/03/15/b258b691c543172d!400x400_big.jpg', 1, 0, 10, 40, '2019-03-05 02:52:25', '2019-04-24 11:47:25', b'1'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (11, '测试商品', '又大又长', '厮大牛逼', 791, 'https://img2.woyaogexing.com/2019/03/15/976d2210182f6816!400x400_big.jpg', 1, 0, 11, 50, '2019-03-05 03:21:46', '2019-04-24 11:47:47', b'1'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (28, '测试商品', '又大又长', '

厮大牛逼

', 638, 'https://user-gold-cdn.xitu.io/2019/4/1/169d694b02ef0df7?imageView2/0/w/1280/h/960/format/jpeg/ignore-error/1,http://static.shop.iocoder.cn/49ace70a-bebc-4d1c-b4e7-2115cedbf2a8', 1, 1, 100, 300, '2019-03-07 01:34:15', '2019-05-13 14:48:36', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (29, 'kafka 实战第一版', '最强', '

我是一个骚气的描述

', 637, 'https://user-gold-cdn.xitu.io/2019/4/1/169d694ae392047b?imageView2/0/w/1280/h/960/format/jpeg/ignore-error/1,http://static.shop.iocoder.cn/ab34d8e5-3b28-4f74-bafa-48aa66b4cf58', 1, 2, 10000000, 60, '2019-03-18 17:50:00', '2019-05-06 15:31:21', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (32, '农夫山泉', '有点甜', '

我就是一个水

', 637, 'https://img.1000.com/qm-a-img/prod/000000/68635d48f57444c8a5ffd47a257dc3d7.jpg', 1, 1, 125000000, 50, '2019-04-16 13:45:13', '2019-09-06 10:58:36', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (33, 'Kafka 书籍汇总', '分布式发布订阅消息系统', 'kafka是一种高吞吐量的分布式发布订阅消息系统,她有如下特性:\n\n通过O(1)的磁盘数据结构提供消息的持久化,这种结构对于即使数以TB的消息存储也能够保持长时间的稳定性能。\n\n高吞吐量:即使是非常普通的硬件kafka也可以支持每秒数十万的消息。\n\n支持通过kafka服务器和消费机集群来分区消息。\n\n支持Hadoop并行数据加载。\n\n卡夫卡的目的是提供一个发布订阅解决方案,它可以处理消费者规模的网站中的所有动作流数据。 这种动作(网页浏览,搜索和其他用户的行动)是在现代网络上的许多社会功能的一个关键因素。 这些数据通常是由于吞吐量的要求而通过处理日志和日志聚合来解决。 对于像Hadoop的一样的日志数据和离线分析系统,但又要求实时处理的限制,这是一个可行的解决方案。kafka的目的是通过Hadoop的并行加载机制来统一线上和离线的消息处理,也是为了通过集群机来提供实时的消费。', 783, 'http://static.iocoder.cn/kafka.png', 1, 0, 10000, 120, '2019-04-22 13:08:27', '2019-04-22 13:08:26', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (34, 'MySQL', '数据库服务器', 'MySQL是一个开放源码的小型关联式数据库管理系统,开发者为瑞典MySQL AB公司。目前MySQL被广泛地应用在Internet上的中小型网站中。由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,许多中小型网站为了降低网站总体拥有成本而选择了MySQL作为网站数据库。', 579, 'https://static.oschina.net/img/logo/mysql.png', 1, 0, 2000, 300, '2019-04-22 13:11:56', '2019-04-22 13:11:55', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (35, 'Oracle', '数据库服务器', '

Oracle是一个面向Internet计算环境的数据库。它是在数据库领域一直处于领先地位的Oracle(即甲骨文公司)的产品。可以说Oracle 关系数据库系统是目前世界上流行的关系数据库管理系统,系统可移植性好、使用方便、功能强,适用于各类大、中、小、微机环境。它是一种高效率、可靠性好的 适应高吞吐量的数据库解决方案。

', 639, 'https://static.oschina.net/img/logo/oracle.gif', 1, 0, 200000, 33, '2019-04-22 13:14:33', '2019-08-12 23:38:32', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (36, 'Java', '编程语言', 'Java,是由Sun Microsystems公司于1995年5月推出的Java程序设计语言和Java平台的总称,最初推出的时候提出 “Write Once, Run Anywhere” 的理想愿景。\n\n 用 Java 实现的 HotJava 浏览器(支持Java applet)显示了 Java 的魅力:跨平台、动态的Web、Internet计算。从此,Java被广泛接受并推动了Web的迅速发展,常用的浏览器现在均支持Java applet。', 639, 'https://static.oschina.net/img/logo/java.png', 1, 0, 2100, 33, '2019-04-22 13:15:15', '2019-04-22 13:15:14', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (37, '狼哥很骚', '骚气十足', '狼哥,死于 JVM 之手', 637, 'https://img.1000.com/qm-a-img/prod/000000/68635d48f57444c8a5ffd47a257dc3d7.jpg', 1, 0, 2000, 90, '2019-04-25 15:42:36', '2019-04-25 15:42:35', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (38, '天天吃饭', '不吃不行', '美团外卖饿了么外卖', 783, 'https://static.oschina.net/img/logo/mysql.png', 1, 0, 1000, 20, '2019-04-25 15:44:56', '2019-04-25 15:44:56', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (39, 'admin-server', '测试卖点', '30', 637, 'http://static.shop.iocoder.cn/8702680d-9145-490c-9bc1-13ed3337c4d1', 1, 0, 1000, 20, '2019-05-02 02:20:50', '2019-05-02 02:20:49', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (40, '测试多规格商品', '我是多规格', 'nice', 637, 'http://static.shop.iocoder.cn/d434dc76-3766-4d82-bdb7-229d1db4749c', 1, 0, 1000, 60, '2019-05-02 12:38:00', '2019-05-02 12:37:59', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (41, 'kafka 实战', '很吊', '厮大牛逼', 637, 'https://user-gold-cdn.xitu.io/2019/4/1/169d694ae392047b?imageView2/0/w/1280/h/960/format/jpeg/ignore-error/1', 1, 0, 1000, 0, '2019-05-02 17:44:05', '2019-05-06 13:27:22', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (42, '我和僵尸有个约会', '有点甜', '我就是描述', 637, 'http://static.shop.iocoder.cn/e3904ca3-d37c-47ae-b53f-3b46c5916e41', 0, 0, 1000, 60, '2019-05-02 22:17:01', '2019-05-06 13:27:05', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (43, '111', '111', '

123

', 784, 'http://static.shop.iocoder.cn/f97c1bce-48ff-4b26-8d34-d38137a306dd', 1, 0, 111100, 2222, '2019-07-02 11:36:25', '2019-07-02 11:36:24', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (44, '111', '111', '

123

', 784, 'http://static.shop.iocoder.cn/f97c1bce-48ff-4b26-8d34-d38137a306dd', 1, 0, 111100, 2222, '2019-07-02 11:36:39', '2019-07-02 11:36:38', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (45, '111', '111', '

123

', 784, 'http://static.shop.iocoder.cn/f97c1bce-48ff-4b26-8d34-d38137a306dd', 1, 0, 11100, 222, '2019-07-02 11:37:53', '2019-07-02 11:37:52', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (46, 'aaaa', 'a', '

111111111111111111111111

', 784, 'http://static.shop.iocoder.cn/c7f1a2c8-4015-4c28-bc64-a92ad72fbe12', 1, 0, 1100, 1222, '2019-07-05 15:41:02', '2019-07-05 15:41:01', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (47, '测试', '测试', '

21121212121

', 784, 'http://static.shop.iocoder.cn/1b4195db-93b9-4f8d-b8bb-3a88df28459d', 1, 0, 21213300, 23123, '2019-07-09 20:29:30', '2019-07-09 20:29:30', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (48, '测试', '测试', '

21121212121

', 784, 'http://static.shop.iocoder.cn/1b4195db-93b9-4f8d-b8bb-3a88df28459d', 1, 0, 21213300, 23123, '2019-07-09 20:29:40', '2019-07-09 20:29:40', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (49, '测试', '测试', '

21121212121

', 784, 'http://static.shop.iocoder.cn/124519dc-5b11-4bf1-96e3-ac29d18a603b', 1, 0, 21213300, 23123, '2019-07-09 20:32:27', '2019-07-09 20:32:26', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (50, '', '123', '

123123321

', 784, 'http://static.shop.iocoder.cn/a7c70291-3d6e-46c2-90b8-f2b43f134b2b', 1, 0, 1200, 2, '2019-08-12 18:48:58', '2019-08-12 18:48:58', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (51, '', '123', '

123123321

', 784, 'http://static.shop.iocoder.cn/a7c70291-3d6e-46c2-90b8-f2b43f134b2b', 1, 0, 1200, 2, '2019-08-12 18:49:03', '2019-08-12 18:49:02', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (52, '', '123', '

123123321

', 784, 'http://static.shop.iocoder.cn/a7c70291-3d6e-46c2-90b8-f2b43f134b2b', 1, 0, 1200, 2, '2019-08-12 18:49:19', '2019-08-12 18:49:19', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (53, '', '123', '

123123321

', 784, 'http://static.shop.iocoder.cn/a7c70291-3d6e-46c2-90b8-f2b43f134b2b', 1, 0, 1200, 2, '2019-08-12 18:50:48', '2019-08-12 18:50:48', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (54, 'Hadoop', '有点小贵', '

好看的不得了

', 794, 'http://static.shop.iocoder.cn/4870d103-1c00-42e1-8eb7-177e227d5e03', 1, 0, 10000, 100, '2019-08-12 23:46:12', '2019-08-12 23:46:11', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (55, '金坷垃', '农民伯伯都爱它', '

金坷拉

', 783, 'http://static.shop.iocoder.cn/8fb41fd6-2ace-4e66-870d-28cff91084ae', 1, 0, 10000, 0, '2019-09-05 10:41:24', '2020-07-27 14:12:59', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (58, '测试商品标题', '丑', '测试商品描述', 637, '1,2,3', 1, 0, 1, 150, '2020-07-27 23:22:56', '2020-07-27 23:22:56', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (59, '测试商品标题', '丑', '测试商品描述', 637, '1,2,3', 1, 0, 1, 150, '2020-07-28 11:38:43', '2020-07-28 11:38:43', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (60, '测试商品标题', '丑', '测试商品描述', 637, '1,2,3', 1, 0, 1, 150, '2020-07-28 13:08:35', '2020-07-28 13:08:35', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (61, '测试商品标题', '丑', '测试商品描述', 637, '1,2,3', 1, 0, 1, 150, '2020-07-30 16:25:47', '2020-07-30 16:25:47', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (62, '测试商品标题', '丑', '测试商品描述', 637, '1,2,3', 1, 0, 1, 150, '2020-07-30 16:26:02', '2020-07-30 16:26:02', b'0'); -INSERT INTO `mall_product`.`product_spu`(`id`, `name`, `sell_point`, `description`, `cid`, `pic_urls`, `visible`, `sort`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (63, '测试商品标题', '丑', '测试商品描述', 637, '1,2,3', 1, 0, 1, 150, '2020-07-30 16:26:13', '2020-07-30 16:26:13', b'0'); - --- ---------------------------- --- Table structure for product_sku --- ---------------------------- -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (3, 8, 1, NULL, '1', 1, 100, '2019-03-05 02:48:52', '2019-03-05 16:48:52', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (4, 8, 1, NULL, '2', 1, 100, '2019-03-05 02:48:52', '2019-03-05 16:48:52', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (5, 9, 1, NULL, '1', 1, 100, '2019-03-05 02:51:22', '2019-03-05 16:51:21', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (6, 9, 1, NULL, '2', 1, 100, '2019-03-05 02:51:22', '2019-03-05 16:51:21', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (7, 10, 1, NULL, '1', 1, 100, '2019-03-05 02:52:25', '2019-03-05 16:52:25', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (8, 10, 1, NULL, '2', 1, 100, '2019-03-05 02:52:25', '2019-03-05 16:52:25', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (9, 13, 1, NULL, '1', 1, 100, '2019-03-05 03:22:24', '2019-03-05 17:22:26', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (10, 13, 1, NULL, '2', 1, 100, '2019-03-05 03:22:24', '2019-03-05 17:22:26', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (11, 14, 1, NULL, '1', 1, 100, '2019-03-05 03:22:33', '2019-03-05 17:22:40', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (12, 14, 1, NULL, '2', 1, 100, '2019-03-05 03:22:33', '2019-03-05 17:22:40', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (13, 20, 1, NULL, '1,3', 1, 100, '2019-03-05 03:25:39', '2019-03-05 17:25:39', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (14, 20, 1, NULL, '1,4', 1, 100, '2019-03-05 03:25:39', '2019-03-05 17:25:39', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (15, 21, 1, NULL, '1,3', 1, 100, '2019-03-05 03:34:07', '2019-03-05 17:34:06', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (16, 21, 1, NULL, '1,4', 1, 100, '2019-03-05 03:34:07', '2019-03-05 17:34:06', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (17, 22, 1, NULL, '1,3', 1, 100, '2019-03-05 03:34:50', '2019-03-05 17:34:49', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (18, 22, 1, NULL, '1,4', 1, 100, '2019-03-05 03:34:50', '2019-03-05 17:34:49', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (19, 23, 1, NULL, '1,3', 1, 1, '2019-03-05 03:37:03', '2019-03-26 23:51:23', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (20, 23, 1, NULL, '1,4', 2, 10, '2019-03-05 03:37:03', '2019-03-26 23:51:25', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (23, 25, 1, NULL, '1,3', 1, 100, '2019-03-05 03:43:30', '2019-03-05 17:43:30', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (24, 25, 1, NULL, '1,4', 1, 100, '2019-03-05 03:43:30', '2019-03-05 17:43:30', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (25, 26, 1, NULL, '1', 1, 100, '2019-03-05 07:00:38', '2019-03-05 21:00:38', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (26, 27, 1, NULL, '1', 1, 100, '2019-03-05 07:01:33', '2019-03-05 21:10:52', b'1'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (27, 27, 1, NULL, '2', 21, 200, '2019-03-05 07:01:33', '2019-03-05 21:10:52', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (30, 27, 1, NULL, '3', 3, 300, '2019-03-05 07:10:52', '2019-03-05 21:10:52', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (31, 28, 1, NULL, '1', 100, 100, '2019-03-07 01:34:15', '2019-05-13 14:48:36', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (32, 28, 1, NULL, '2', 200, 200, '2019-03-07 01:34:15', '2019-05-13 14:48:36', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (33, 29, 1, NULL, '1', 10000000, 20, '2019-03-18 17:50:01', '2019-05-05 23:48:10', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (34, 32, 1, NULL, '1,3', 125000000, 20, '2019-04-16 13:45:13', '2019-05-09 10:43:55', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (35, 32, 1, NULL, '1,4', 1410065408, 30, '2019-04-16 13:45:13', '2019-05-09 10:43:55', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (36, 33, 1, NULL, '3', 10000, 100, '2019-04-22 13:08:27', '2019-04-22 13:08:26', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (37, 33, 1, NULL, '4', 20000, 20, '2019-04-22 13:08:27', '2019-04-22 13:08:26', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (38, 34, 1, NULL, '1', 2000, 100, '2019-04-22 13:11:56', '2019-04-22 13:11:55', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (39, 34, 1, NULL, '2', 3000, 200, '2019-04-22 13:11:56', '2019-04-22 13:11:55', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (40, 35, 1, NULL, '3', 500000, 11, '2019-04-22 13:14:33', '2019-08-12 23:38:32', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (41, 35, 1, NULL, '4', 200000, 22, '2019-04-22 13:14:33', '2019-08-12 23:38:33', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (42, 36, 1, NULL, '3', 5100, 11, '2019-04-22 13:15:15', '2019-04-22 13:15:14', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (43, 36, 1, NULL, '4', 2100, 22, '2019-04-22 13:15:15', '2019-04-22 13:15:14', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (44, 37, 1, NULL, '3,2', 2000, 40, '2019-04-25 15:42:36', '2019-04-25 15:42:35', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (45, 37, 1, NULL, '4,2', 3000, 50, '2019-04-25 15:42:36', '2019-04-25 15:42:35', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (46, 38, 1, NULL, '2', 1000, 20, '2019-04-25 15:44:56', '2019-04-25 15:44:56', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (47, 39, 1, NULL, '1,3', 1000, 20, '2019-05-02 02:20:50', '2019-05-02 02:20:49', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (48, 40, 1, NULL, '1', 1000, 20, '2019-05-02 12:38:00', '2019-05-02 12:37:59', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (49, 40, 1, NULL, '2', 3000, 40, '2019-05-02 12:38:00', '2019-05-02 12:37:59', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (50, 41, 1, NULL, '1', 1000, 20, '2019-05-02 17:44:05', '2019-05-02 17:44:05', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (51, 29, 1, NULL, '2', 30000000, 40, '2019-05-02 18:19:15', '2019-05-05 23:48:10', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (54, 42, 1, NULL, '2', 3000, 40, '2019-05-02 22:25:19', '2019-05-02 22:54:16', b'1'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (55, 42, 1, NULL, '28', 1000, 20, '2019-05-02 22:54:17', '2019-05-02 22:54:16', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (56, 42, 1, NULL, '35', 3000, 40, '2019-05-02 23:01:17', '2019-05-02 23:01:17', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (57, 43, 1, NULL, '1,3', 111100, 1111, '2019-07-02 11:36:25', '2019-07-02 11:36:25', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (58, 43, 1, NULL, '2,3', 111100, 1111, '2019-07-02 11:36:25', '2019-07-02 11:36:25', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (59, 44, 1, NULL, '1,3', 111100, 1111, '2019-07-02 11:36:39', '2019-07-02 11:36:38', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (60, 44, 1, NULL, '2,3', 111100, 1111, '2019-07-02 11:36:39', '2019-07-02 11:36:38', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (61, 45, 1, NULL, '1,3,6', 11100, 111, '2019-07-02 11:37:53', '2019-07-02 11:37:52', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (62, 45, 1, NULL, '2,3,6', 11100, 111, '2019-07-02 11:37:53', '2019-07-02 11:37:52', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (63, 46, 1, NULL, '46', 1100, 1111, '2019-07-05 15:41:02', '2019-07-05 15:41:01', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (64, 46, 1, NULL, '4', 1100, 111, '2019-07-05 15:41:02', '2019-07-05 15:41:01', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (65, 47, 1, NULL, '3', 21213300, 23123, '2019-07-09 20:29:31', '2019-07-09 20:29:30', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (66, 48, 1, NULL, '3', 21213300, 23123, '2019-07-09 20:29:40', '2019-07-09 20:29:40', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (67, 49, 1, NULL, '3', 21213300, 23123, '2019-07-09 20:32:27', '2019-07-09 20:32:27', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (68, 50, 1, NULL, '47,48', 1200, 2, '2019-08-12 18:48:58', '2019-08-12 18:48:58', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (69, 51, 1, NULL, '47,48', 1200, 2, '2019-08-12 18:49:03', '2019-08-12 18:49:02', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (70, 52, 1, NULL, '47,48', 1200, 2, '2019-08-12 18:49:19', '2019-08-12 18:49:19', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (71, 53, 1, NULL, '47,48', 1200, 2, '2019-08-12 18:50:48', '2019-08-12 18:50:48', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (72, 54, 1, NULL, '1', 10000, 100, '2019-08-12 23:46:12', '2019-08-12 23:46:11', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (73, 55, 1, NULL, '49,50', 10000, 100, '2019-09-05 10:41:24', '2019-09-05 10:41:24', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (76, 58, 1, NULL, '1,3', 1, 100, '2020-07-27 23:22:56', '2020-07-27 23:22:56', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (77, 58, 1, NULL, '2,4', 2, 50, '2020-07-27 23:22:56', '2020-07-27 23:22:56', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (78, 59, 1, NULL, '1,3', 1, 100, '2020-07-28 11:38:43', '2020-07-28 11:38:43', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (79, 59, 1, NULL, '2,4', 2, 50, '2020-07-28 11:38:43', '2020-07-28 11:38:43', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (80, 60, 1, NULL, '1,3', 1, 100, '2020-07-28 13:08:35', '2020-07-28 13:08:35', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (81, 60, 1, NULL, '2,4', 2, 50, '2020-07-28 13:08:35', '2020-07-28 13:08:35', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (82, 61, 1, NULL, '1,3', 1, 100, '2020-07-30 16:25:47', '2020-07-30 16:25:47', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (83, 61, 1, NULL, '2,4', 2, 50, '2020-07-30 16:25:47', '2020-07-30 16:25:47', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (84, 62, 1, NULL, '1,3', 1, 100, '2020-07-30 16:26:02', '2020-07-30 16:26:02', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (85, 62, 1, NULL, '2,4', 2, 50, '2020-07-30 16:26:02', '2020-07-30 16:26:02', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (86, 63, 1, NULL, '1,3', 1, 100, '2020-07-30 16:26:13', '2020-07-30 16:26:13', b'0'); -INSERT INTO `mall_product`.`product_sku`(`id`, `spu_id`, `status`, `pic_url`, `attrs`, `price`, `quantity`, `create_time`, `update_time`, `deleted`) VALUES (87, 63, 1, NULL, '2,4', 2, 50, '2020-07-30 16:26:13', '2020-07-30 16:26:13', b'0'); - - --- ---------------------------- --- Table structure for product_attr_key --- ---------------------------- -INSERT INTO `mall_product`.`product_attr_key`(`id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (1, '颜色', 1, '2019-03-05 15:40:56', '2019-03-05 15:40:58', b'0'); -INSERT INTO `mall_product`.`product_attr_key`(`id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (2, '尺寸', 1, '2019-03-05 17:23:07', '2019-03-05 17:23:07', b'0'); -INSERT INTO `mall_product`.`product_attr_key`(`id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (3, '测试规格1', 1, '2019-03-06 10:29:58', '2020-07-29 11:13:41', b'0'); -INSERT INTO `mall_product`.`product_attr_key`(`id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (4, '厮大牛逼规格', 1, '2019-03-06 10:31:01', '2019-03-07 00:33:53', b'0'); -INSERT INTO `mall_product`.`product_attr_key`(`id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (5, '狼哥规格', 2, '2019-03-06 10:31:47', '2019-03-07 00:34:27', b'0'); -INSERT INTO `mall_product`.`product_attr_key`(`id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (6, '老徐规格', 1, '2019-03-06 10:48:42', '2019-03-07 00:48:41', b'0'); -INSERT INTO `mall_product`.`product_attr_key`(`id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (7, '徐妈规格', 1, '2019-03-06 10:53:37', '2019-03-07 00:53:37', b'0'); -INSERT INTO `mall_product`.`product_attr_key`(`id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (8, '粉色', 1, '2019-05-02 22:05:21', '2019-05-02 22:05:21', b'0'); -INSERT INTO `mall_product`.`product_attr_key`(`id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (9, 'test', 1, '2020-07-29 11:04:26', '2020-07-29 11:04:26', b'0'); -INSERT INTO `mall_product`.`product_attr_key`(`id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (10, 'test02', 1, '2020-07-29 11:13:48', '2020-07-29 11:13:48', b'0'); -INSERT INTO `mall_product`.`product_attr_key`(`id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (11, '电视剧', 1, '2020-07-30 00:37:52', '2020-07-30 00:37:52', b'0'); - - --- ---------------------------- --- Table structure for product_attr_value --- ---------------------------- -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (1, 1, '蓝色', 1, '2019-03-05 15:41:09', '2019-03-05 15:41:09', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (2, 1, '绿色', 1, '2019-03-05 15:41:14', '2019-03-05 15:42:58', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (3, 2, 'XL', 1, '2019-03-05 17:23:19', '2019-03-05 17:23:19', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (4, 2, 'L', 1, '2019-03-05 17:23:25', '2019-03-05 17:23:25', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (5, 1, '红色', 1, '2019-03-05 20:59:48', '2019-03-05 20:59:48', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (6, 4, '狼哥规格', 1, '2019-03-06 19:55:38', '2019-03-07 09:55:38', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (7, 4, '狼哥规格1', 1, '2019-03-06 19:56:26', '2019-03-07 09:56:25', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (8, 4, '狼哥规格2', 1, '2019-03-06 19:57:19', '2019-03-07 09:57:19', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (9, 4, '狼哥规格345', 1, '2019-03-06 20:00:02', '2019-03-07 10:01:18', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (10, 9, '狼哥规格34', 2, '2019-03-06 20:00:59', '2019-03-07 10:02:43', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (11, 1, '粉色', 1, '2019-05-02 22:08:22', '2019-05-02 22:08:21', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (12, 1, '黄色', 1, '2019-05-02 22:10:30', '2019-05-02 22:10:30', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (13, 1, '橙色', 1, '2019-05-02 22:12:20', '2019-05-02 22:12:19', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (14, 1, '青色', 1, '2019-05-02 22:13:12', '2019-05-02 22:13:11', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (15, 1, '海蓝色', 1, '2019-05-02 22:15:47', '2019-05-02 22:15:47', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (16, 1, '浅蓝色', 1, '2019-05-02 22:16:25', '2019-05-02 22:16:25', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (17, 1, '天蓝色', 1, '2019-05-02 22:17:36', '2019-05-02 22:17:35', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (18, 9, '不破不灭', 1, '2019-05-02 22:18:24', '2019-05-02 22:30:29', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (19, 9, '各种浪', 1, '2019-05-02 22:19:17', '2019-05-02 22:30:27', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (20, 9, '测试01', 1, '2019-05-02 22:21:21', '2019-05-02 22:30:27', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (21, 9, '测试02', 1, '2019-05-02 22:23:17', '2019-05-02 22:30:25', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (22, 9, '测试03', 1, '2019-05-02 22:24:13', '2019-05-02 22:30:24', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (23, 9, 'biubiubiu', 1, '2019-05-02 22:24:42', '2019-05-02 22:30:23', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (24, 9, '特特', 1, '2019-05-02 22:35:35', '2019-05-02 22:35:42', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (25, 9, '01', 1, '2019-05-02 22:37:24', '2019-05-02 22:37:56', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (26, 9, 'liubi', 1, '2019-05-02 22:38:02', '2019-05-02 22:38:14', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (27, 9, 'zei6', 1, '2019-05-02 22:38:33', '2019-05-02 22:39:52', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (28, 3, 'niubi', 1, '2019-05-02 22:52:03', '2019-05-02 22:52:03', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (29, 3, 'wocao', 1, '2019-05-02 22:52:27', '2019-05-02 22:52:27', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (30, 3, '666', 1, '2019-05-02 22:54:44', '2019-05-02 22:54:43', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (31, 3, 'gouwazi', 1, '2019-05-02 22:58:52', '2019-05-02 22:58:51', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (32, 3, 'abc', 1, '2019-05-02 22:59:46', '2019-05-02 22:59:46', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (33, 3, 'qilin', 1, '2019-05-02 23:00:06', '2019-05-02 23:00:05', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (34, 3, 'xigua', 1, '2019-05-02 23:00:43', '2019-05-02 23:00:43', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (35, 3, 'zhanxiaolang', 1, '2019-05-02 23:01:07', '2019-05-02 23:01:07', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (36, 1, '粉绿色', 1, '2019-05-02 23:33:55', '2020-07-30 00:59:01', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (37, 6, '111', 1, '2019-05-31 18:55:56', '2019-05-31 18:55:55', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (38, 3, '22', 1, '2019-05-31 18:55:59', '2019-05-31 18:55:58', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (39, 2, '112', 1, '2019-05-31 18:56:06', '2019-05-31 18:56:05', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (40, 7, 'kk', 1, '2019-05-31 19:53:01', '2019-05-31 19:53:00', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (41, 7, 'nm', 1, '2019-05-31 19:53:05', '2019-05-31 19:53:04', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (42, 6, 'sss', 1, '2019-06-02 12:22:44', '2019-06-02 12:22:43', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (43, 6, 'sds', 1, '2019-06-02 12:22:46', '2019-06-02 12:22:45', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (44, 2, '3333', 1, '2019-07-02 11:19:32', '2019-07-02 11:19:32', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (45, 2, '123', 1, '2019-07-02 11:33:15', '2019-07-02 11:33:15', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (46, 2, 'a', 1, '2019-07-05 15:40:51', '2019-07-05 15:40:51', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (47, 2, '12312', 1, '2019-08-12 18:48:48', '2019-08-12 18:48:47', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (48, 3, '222', 1, '2019-08-12 18:48:54', '2019-08-12 18:48:53', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (49, 1, '金色', 1, '2019-09-05 10:38:55', '2019-09-05 10:38:55', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (50, 2, '一克拉', 1, '2019-09-05 10:39:05', '2019-09-05 10:39:04', b'0'); -INSERT INTO `mall_product`.`product_attr_value`(`id`, `attr_key_id`, `name`, `status`, `create_time`, `update_time`, `deleted`) VALUES (51, 1, '花色', 1, '2020-07-30 01:00:22', '2020-07-30 01:00:22', b'0'); - - --- ---------------------------- --- Table structure for product_category --- ---------------------------- -INSERT INTO `mall_product`.`product_category`(`id`, `pid`, `name`, `description`, `pic_url`, `sort`, `status`, `create_time`, `update_time`, `deleted`) VALUES (90, 0, '电视影音', NULL, NULL, 0, 1, '2019-02-21 18:35:00', '2019-03-03 20:42:01', b'0'); -INSERT INTO `mall_product`.`product_category`(`id`, `pid`, `name`, `description`, `pic_url`, `sort`, `status`, `create_time`, `update_time`, `deleted`) VALUES (579, 0, '手机电脑', NULL, NULL, 0, 1, '2019-02-21 18:33:26', '2019-03-03 20:42:03', b'0'); -INSERT INTO `mall_product`.`product_category`(`id`, `pid`, `name`, `description`, `pic_url`, `sort`, `status`, `create_time`, `update_time`, `deleted`) VALUES (637, 90, '32-40英寸', NULL, 'https://shop.io.mi-img.com/app/shop/img?id=shop_904483f8aa3bbaaa9f53e4aae2382275.jpeg', 1, 1, '2019-02-21 18:35:20', '2019-03-03 20:42:05', b'0'); -INSERT INTO `mall_product`.`product_category`(`id`, `pid`, `name`, `description`, `pic_url`, `sort`, `status`, `create_time`, `update_time`, `deleted`) VALUES (638, 90, '43英寸', NULL, 'https://shop.io.mi-img.com/app/shop/img?id=shop_0f26088b420afbe2c63df02246b94a34.jpeg', 2, 1, '2019-02-21 18:35:41', '2019-03-03 20:42:07', b'0'); -INSERT INTO `mall_product`.`product_category`(`id`, `pid`, `name`, `description`, `pic_url`, `sort`, `status`, `create_time`, `update_time`, `deleted`) VALUES (639, 90, '49-50英寸', NULL, 'https://shop.io.mi-img.com/app/shop/img?id=shop_c2c741283b2ce1c4bc8b0abe9ea4f65e.jpeg', 3, 1, '2019-02-21 18:36:01', '2019-03-03 20:42:10', b'0'); -INSERT INTO `mall_product`.`product_category`(`id`, `pid`, `name`, `description`, `pic_url`, `sort`, `status`, `create_time`, `update_time`, `deleted`) VALUES (783, 579, '小米系列', NULL, 'https://shop.io.mi-img.com/app/shop/img?id=shop_af3ae1e1444bc54af8b2251dd14aaa6b.jpeg', 1, 1, '2019-02-21 18:33:56', '2019-03-03 20:42:12', b'0'); -INSERT INTO `mall_product`.`product_category`(`id`, `pid`, `name`, `description`, `pic_url`, `sort`, `status`, `create_time`, `update_time`, `deleted`) VALUES (784, 579, '红米系列', NULL, 'https://shop.io.mi-img.com/app/shop/img?id=shop_72605808146ee82c9961f9e3be6d8696.jpeg', 2, 1, '2019-02-21 18:34:29', '2019-03-03 20:42:14', b'0'); -INSERT INTO `mall_product`.`product_category`(`id`, `pid`, `name`, `description`, `pic_url`, `sort`, `status`, `create_time`, `update_time`, `deleted`) VALUES (793, 0, '图书', '书是个好东西,可惜看的少。', NULL, 3, 1, '2019-05-05 16:12:39', '2019-05-05 16:12:39', b'0'); -INSERT INTO `mall_product`.`product_category`(`id`, `pid`, `name`, `description`, `pic_url`, `sort`, `status`, `create_time`, `update_time`, `deleted`) VALUES (794, 793, 'Java', '半年一更,妥妥的', 'http://static.shop.iocoder.cn/5fd5709e-988d-4efd-b5d8-54a599ca538f', 1, 1, '2019-05-05 16:35:03', '2019-05-06 23:05:53', b'0'); -INSERT INTO `mall_product`.`product_category`(`id`, `pid`, `name`, `description`, `pic_url`, `sort`, `status`, `create_time`, `update_time`, `deleted`) VALUES (796, 579, '订单系统设计', 'sss', 'http://static.shop.iocoder.cn/3fd98e94-ad50-415a-8f17-8bd8a998e508', 5, 1, '2019-06-26 20:28:35', '2019-06-26 20:28:34', b'0'); -INSERT INTO `mall_product`.`product_category`(`id`, `pid`, `name`, `description`, `pic_url`, `sort`, `status`, `create_time`, `update_time`, `deleted`) VALUES (797, 0, '测试分类', NULL, NULL, 1, 1, '2020-07-25 19:16:24', '2020-07-25 19:16:24', b'0'); - - --- ---------------------------- --- Table structure for product_brand --- ---------------------------- -INSERT INTO `mall_product`.`product_brand`(`id`, `name`, `description`, `pic_url`, `status`, `create_time`, `update_time`, `deleted`) VALUES (1, '安踏更新', '安踏拖鞋更新', 'https://pic.17qq.com/uploads/hddeefhgbz.jpeg', 1, '2019-05-30 13:43:44', '2020-07-26 00:27:23', b'0'); -INSERT INTO `mall_product`.`product_brand`(`id`, `name`, `description`, `pic_url`, `status`, `create_time`, `update_time`, `deleted`) VALUES (2, '特步', '特步描述', 'https://www.mask9.com/re/wp-content/uploads/2020/02/87285695_2755663391137244_8679130282952782166_n.jpg', 1, '2019-05-31 13:42:22', '2020-07-26 00:27:40', b'0'); diff --git a/归档/product-service-project/product-service-app/src/main/resources/sql/mall_product_schema.sql b/归档/product-service-project/product-service-app/src/main/resources/sql/mall_product_schema.sql deleted file mode 100644 index ae8a55107..000000000 --- a/归档/product-service-project/product-service-app/src/main/resources/sql/mall_product_schema.sql +++ /dev/null @@ -1,103 +0,0 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for product_spu --- ---------------------------- -CREATE TABLE `product_spu` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'SPU 编号', - `name` varchar(50) NOT NULL DEFAULT '' COMMENT 'SPU 名字', - `sell_point` varchar(50) NOT NULL DEFAULT '' COMMENT '卖点', - `description` text NOT NULL COMMENT '描述', - `cid` int(11) NOT NULL DEFAULT '-1' COMMENT '分类编号', - `pic_urls` varchar(1024) NOT NULL DEFAULT '' COMMENT '商品主图地址\n *\n * 数组,以逗号分隔\n *\n * 建议尺寸:800*800像素,你可以拖拽图片调整顺序,最多上传15张', - `visible` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否上架商品(是否可见)。\n *\n * true 为已上架\n * false 为已下架', - `sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序字段', - `price` int(11) NOT NULL COMMENT '价格', - `quantity` int(11) NOT NULL COMMENT '库存数量', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间', - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=utf8mb4 COMMENT='商品 SPU'; - - --- ---------------------------- --- Table structure for product_sku --- ---------------------------- -CREATE TABLE `product_sku` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'sku 编号', - `spu_id` int(11) NOT NULL DEFAULT '-1' COMMENT '商品编号', - `status` int(11) NOT NULL DEFAULT '-1' COMMENT '状态\n *\n * 1-正常\n * 2-禁用', - `pic_url` varchar(50) DEFAULT '' COMMENT '图片地址', - `attrs` varchar(50) NOT NULL DEFAULT '' COMMENT '规格值({@link ProductAttrDO})数组\n *\n * 数组,以逗号分隔', - `price` int(11) NOT NULL DEFAULT '-1' COMMENT '价格,单位:分', - `quantity` int(11) NOT NULL DEFAULT '-1' COMMENT '库存数量', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间', - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=88 DEFAULT CHARSET=utf8mb4 COMMENT='商品 SKU'; - - --- ---------------------------- --- Table structure for product_attr_key --- ---------------------------- -CREATE TABLE `product_attr_key` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '规格键编号', - `name` varchar(50) NOT NULL DEFAULT '' COMMENT '规格键名称', - `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态\n *\n * 1-开启\n * 2-禁用', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间', - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COMMENT='商品规格键'; - - --- ---------------------------- --- Table structure for product_attr_value --- ---------------------------- -CREATE TABLE `product_attr_value` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '规格值编号', - `attr_key_id` int(11) NOT NULL COMMENT '规格键编号', - `name` varchar(50) NOT NULL DEFAULT '' COMMENT '规格值名字', - `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态\n *\n * 1-开启\n * 2-禁用', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间', - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=utf8mb4 COMMENT='商品规格值'; - - --- ---------------------------- --- Table structure for product_category --- ---------------------------- -CREATE TABLE `product_category` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '分类编号', - `pid` int(11) NOT NULL COMMENT '父分类编号', - `name` varchar(16) NOT NULL COMMENT '分类名称', - `description` varchar(255) DEFAULT NULL COMMENT '分类描述', - `pic_url` varchar(255) DEFAULT NULL COMMENT '分类图片', - `sort` int(11) NOT NULL COMMENT '分类排序', - `status` tinyint(4) NOT NULL COMMENT '状态', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间', - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=801 DEFAULT CHARSET=utf8mb4 COMMENT='商品分类表'; - - --- ---------------------------- --- Table structure for product_brand --- ---------------------------- -CREATE TABLE `product_brand` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '品牌编号', - `name` varchar(50) NOT NULL COMMENT '品牌名称', - `description` varchar(255) DEFAULT NULL COMMENT '品牌描述', - `pic_url` varchar(1024) DEFAULT NULL COMMENT '品牌名图片', - `status` tinyint(4) NOT NULL COMMENT '状态 1开启 2禁用', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间', - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COMMENT='商品品牌'; diff --git a/归档/product-service-project/product-service-app/src/test/java/cn/iocoder/mall/productservice/manager/spu/ProductSkuManagerTest.java b/归档/product-service-project/product-service-app/src/test/java/cn/iocoder/mall/productservice/manager/spu/ProductSkuManagerTest.java deleted file mode 100644 index 0a4993742..000000000 --- a/归档/product-service-project/product-service-app/src/test/java/cn/iocoder/mall/productservice/manager/spu/ProductSkuManagerTest.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.mall.productservice.manager.spu; - -import cn.iocoder.mall.productservice.enums.sku.ProductSkuDetailFieldEnum; -import cn.iocoder.mall.productservice.manager.sku.ProductSkuManager; -import cn.iocoder.mall.productservice.rpc.sku.dto.ProductSkuListQueryReqDTO; -import cn.iocoder.mall.productservice.rpc.sku.dto.ProductSkuRespDTO; -import lombok.extern.slf4j.Slf4j; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import java.util.Arrays; -import java.util.List; - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -@Slf4j -public class ProductSkuManagerTest { - - @Autowired - private ProductSkuManager productSkuManager; - - @Test - public void testListProductSkus() { - List skuRespDTOs = productSkuManager.listProductSkus( - new ProductSkuListQueryReqDTO().setProductSkuIds(Arrays.asList(3, 4)) - .setFields(Arrays.asList(ProductSkuDetailFieldEnum.SPU.getField(), - ProductSkuDetailFieldEnum.ATTR.getField()))); - log.info("结果:{}", skuRespDTOs); - } - -} diff --git a/归档/product-service-project/product-service-app/src/test/java/cn/iocoder/mall/productservice/package-info.java b/归档/product-service-project/product-service-app/src/test/java/cn/iocoder/mall/productservice/package-info.java deleted file mode 100644 index 80135f6ed..000000000 --- a/归档/product-service-project/product-service-app/src/test/java/cn/iocoder/mall/productservice/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package cn.iocoder.mall.productservice; From 239c38cf64a19d5542265d334fd2a767e371da9b Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 12 Sep 2022 10:00:17 +0800 Subject: [PATCH 02/29] =?UTF-8?q?=E6=B8=85=E7=90=86=E5=B7=B2=E8=BF=81?= =?UTF-8?q?=E7=A7=BB=E7=9A=84=20cart=20=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../convert/promotion/BannerConvert.java | 28 -- .../manager/promotion/brand/BannerManager.java | 68 ----- .../iocoder/mall/order/biz/dataobject/README.md | 21 -- .../src/main/resources/mapper/CartMapper.xml | 129 -------- .../dal/mysql/dataobject/sku/ProductSkuDO.java | 64 ---- .../dal/mysql/dataobject/spu/ProductSpuDO.java | 82 ----- .../dal/mysql/mapper/sku/ProductSkuMapper.java | 2 - .../manager/sku/ProductSkuManager.java | 11 - .../manager/spu/ProductSpuManager.java | 30 -- .../service/sku/ProductSkuService.java | 20 -- .../service/sku/bo/ProductSkuBO.java | 60 ---- .../service/spu/bo/ProductSpuBO.java | 61 ---- .../service/spu/bo/ProductSpuCreateBO.java | 63 ---- .../service/spu/bo/ProductSpuUpdateBO.java | 67 ----- .../promotion/api/rpc/banner/BannerFeign.java | 35 --- .../api/rpc/banner/dto/BannerCreateReqDTO.java | 58 ---- .../api/rpc/banner/dto/BannerListReqDTO.java | 23 -- .../api/rpc/banner/dto/BannerPageReqDTO.java | 21 -- .../api/rpc/banner/dto/BannerRespDTO.java | 49 --- .../api/rpc/banner/dto/BannerUpdateReqDTO.java | 63 ---- .../controller/BannerController.java | 57 ---- .../convert/banner/BannerConvert.java | 29 -- .../manager/banner/BannerManager.java | 42 --- 归档/shop-web-app/pom.xml | 137 --------- .../mall/shopweb/ShopWebApplication.java | 19 -- .../shopweb/client/user/UserAddressClient.java | 14 - .../vo/category/ProductCategoryRespVO.java | 18 -- .../product/vo/product/ProductSpuRespVO.java | 61 ---- .../controller/user/PassportController.http | 19 -- .../controller/user/PassportController.java | 56 ---- .../controller/user/UserAddressController.http | 6 - .../controller/user/UserAddressController.java | 80 ----- .../shopweb/controller/user/UserController.java | 50 ---- .../user/vo/address/UserAddressCreateReqVO.java | 33 --- .../user/vo/address/UserAddressRespVO.java | 31 -- .../user/vo/address/UserAddressUpdateReqVO.java | 36 --- .../vo/passport/PassportAccessTokenRespVO.java | 22 -- .../vo/passport/PassportLoginBySmsReqVO.java | 30 -- .../user/vo/passport/PassportSendSmsRespVO.java | 23 -- .../controller/user/vo/user/UserRespVO.java | 22 -- .../convert/product/ProductCategoryConvert.java | 17 -- .../convert/promotion/BannerConvert.java | 17 -- .../shopweb/convert/user/PassportConvert.java | 25 -- .../convert/user/UserAddressConvert.java | 27 -- .../mall/shopweb/convert/user/UserConvert.java | 15 - .../service/promotion/BannerManager.java | 35 --- .../mall/shopweb/service/trade/CartManager.java | 62 ---- .../shopweb/service/user/PassportManager.java | 60 ---- .../service/user/UserAddressManager.java | 129 -------- .../mall/shopweb/service/user/UserManager.java | 33 --- .../src/main/resources/application-dev.yml | 15 - .../src/main/resources/application-local.yml | 18 -- .../src/main/resources/application.yml | 75 ----- .../trade-service-api/pom.xml | 36 --- .../enums/OrderErrorCodeConstants.java | 5 - .../mall/tradeservice/rpc/cart/CartFeign.java | 61 ---- .../rpc/cart/dto/CartItemAddReqDTO.java | 34 --- .../rpc/cart/dto/CartItemDeleteListReqDTO.java | 28 -- .../rpc/cart/dto/CartItemListReqDTO.java | 26 -- .../rpc/cart/dto/CartItemRespDTO.java | 67 ----- .../cart/dto/CartItemUpdateQuantityReqDTO.java | 34 --- .../cart/dto/CartItemUpdateSelectedReqDTO.java | 33 --- .../trade-service-app/pom.xml | 147 --------- .../tradeservice/TradeServiceApplication.java | 17 -- .../client/user/UserAddressClient.java | 27 -- .../tradeservice/config/AopConfiguration.java | 12 - .../config/DatabaseConfiguration.java | 28 -- .../tradeservice/controller/CartController.java | 74 ----- .../tradeservice/convert/cart/CartConvert.java | 30 -- .../convert/order/TradeOrderConvert.java | 29 -- .../dal/mysql/dataobject/cart/CartItemDO.java | 73 ----- .../dal/mysql/mapper/cart/CartItemMapper.java | 49 --- .../tradeservice/service/cart/CartManager.java | 114 ------- .../tradeservice/service/cart/CartService.java | 136 --------- .../service/cart/bo/CartItemAddBO.java | 38 --- .../service/cart/bo/CartItemBO.java | 65 ---- .../service/cart/bo/CartItemListQueryBO.java | 25 -- .../service/order/TradeOrderService.java | 48 --- .../order/impl/TradeOrderServiceImpl.java | 279 ------------------ .../src/main/resources/application-dev.yaml | 21 -- .../src/main/resources/application-local.yaml | 32 -- .../src/main/resources/application.yaml | 75 ----- 归档/user-service-project/pom.xml | 52 ---- .../user-service-api/pom.xml | 37 --- .../enums/UserErrorCodeConstants.java | 16 - .../mall/userservice/rpc/user/UserFeign.java | 35 --- .../rpc/user/dto/UserCreateReqDTO.java | 35 --- .../rpc/user/dto/UserPageReqDTO.java | 28 -- .../userservice/rpc/user/dto/UserRespDTO.java | 44 --- .../rpc/user/dto/UserUpdateReqDTO.java | 47 --- .../user-service-app/pom.xml | 108 ------- .../userservice/UserServiceApplication.java | 17 -- .../controller/UserManageController.java | 50 ---- .../dal/mysql/dataobject/sms/UserSmsCodeDO.java | 62 ---- .../dal/mysql/dataobject/user/UserDO.java | 57 ---- .../mysql/dataobject/user/UserThirdAuthDO.java | 73 ----- .../mysql/mapper/address/UserAddressMapper.java | 19 -- .../dal/mysql/mapper/sms/UserSmsCodeMapper.java | 27 -- .../dal/mysql/mapper/user/UserMapper.java | 27 -- .../manager/sms/UserSmsCodeManager.java | 27 -- .../userservice/manager/user/UserManager.java | 91 ------ .../service/sms/UserSmsCodeService.java | 105 ------- .../userservice/service/user/UserService.java | 117 -------- .../userservice/service/user/bo/UserBO.java | 51 ---- .../service/user/bo/UserCreateBO.java | 41 --- .../userservice/service/user/bo/UserPageBO.java | 30 -- .../service/user/bo/UserUpdateBO.java | 46 --- .../src/main/resources/application-dev.yaml | 21 -- .../src/main/resources/application-local.yaml | 24 -- .../src/main/resources/application.properties | 5 - .../src/main/resources/application.yaml | 52 ---- .../src/main/resources/sql/mall_user_data.sql | 15 - .../src/main/resources/sql/mall_user_schema.sql | 40 --- 113 files changed, 5310 deletions(-) delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/BannerConvert.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/brand/BannerManager.java delete mode 100644 归档/moved/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/README.md delete mode 100644 归档/moved/order/order-service-impl/src/main/resources/mapper/CartMapper.xml delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/sku/ProductSkuDO.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/spu/ProductSpuDO.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/sku/bo/ProductSkuBO.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuBO.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuCreateBO.java delete mode 100644 归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuUpdateBO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/BannerFeign.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerCreateReqDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerListReqDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerPageReqDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerRespDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerUpdateReqDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/BannerController.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/banner/BannerConvert.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/banner/BannerManager.java delete mode 100644 归档/shop-web-app/pom.xml delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/ShopWebApplication.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/client/user/UserAddressClient.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/product/vo/category/ProductCategoryRespVO.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/product/vo/product/ProductSpuRespVO.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/PassportController.http delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/PassportController.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/UserAddressController.http delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/UserAddressController.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/UserController.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/address/UserAddressCreateReqVO.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/address/UserAddressRespVO.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/address/UserAddressUpdateReqVO.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/passport/PassportAccessTokenRespVO.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/passport/PassportLoginBySmsReqVO.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/passport/PassportSendSmsRespVO.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/user/UserRespVO.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/product/ProductCategoryConvert.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/promotion/BannerConvert.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/user/PassportConvert.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/user/UserAddressConvert.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/user/UserConvert.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/promotion/BannerManager.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/user/PassportManager.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/user/UserAddressManager.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/user/UserManager.java delete mode 100644 归档/shop-web-app/src/main/resources/application-dev.yml delete mode 100644 归档/shop-web-app/src/main/resources/application-local.yml delete mode 100644 归档/shop-web-app/src/main/resources/application.yml delete mode 100644 归档/trade-service-project/trade-service-api/pom.xml delete mode 100644 归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/CartFeign.java delete mode 100644 归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemAddReqDTO.java delete mode 100644 归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemDeleteListReqDTO.java delete mode 100644 归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemListReqDTO.java delete mode 100644 归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemRespDTO.java delete mode 100644 归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemUpdateQuantityReqDTO.java delete mode 100644 归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemUpdateSelectedReqDTO.java delete mode 100644 归档/trade-service-project/trade-service-app/pom.xml delete mode 100644 归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/TradeServiceApplication.java delete mode 100644 归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/client/user/UserAddressClient.java delete mode 100644 归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/config/AopConfiguration.java delete mode 100644 归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/config/DatabaseConfiguration.java delete mode 100644 归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/controller/CartController.java delete mode 100644 归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/convert/cart/CartConvert.java delete mode 100644 归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/convert/order/TradeOrderConvert.java delete mode 100644 归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/dal/mysql/dataobject/cart/CartItemDO.java delete mode 100644 归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/dal/mysql/mapper/cart/CartItemMapper.java delete mode 100644 归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/CartManager.java delete mode 100644 归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/CartService.java delete mode 100644 归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/bo/CartItemAddBO.java delete mode 100644 归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/bo/CartItemBO.java delete mode 100644 归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/bo/CartItemListQueryBO.java delete mode 100644 归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/order/TradeOrderService.java delete mode 100644 归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/order/impl/TradeOrderServiceImpl.java delete mode 100644 归档/trade-service-project/trade-service-app/src/main/resources/application-dev.yaml delete mode 100644 归档/trade-service-project/trade-service-app/src/main/resources/application-local.yaml delete mode 100644 归档/trade-service-project/trade-service-app/src/main/resources/application.yaml delete mode 100644 归档/user-service-project/pom.xml delete mode 100644 归档/user-service-project/user-service-api/pom.xml delete mode 100644 归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/enums/UserErrorCodeConstants.java delete mode 100644 归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/UserFeign.java delete mode 100644 归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/dto/UserCreateReqDTO.java delete mode 100644 归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/dto/UserPageReqDTO.java delete mode 100644 归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/dto/UserRespDTO.java delete mode 100644 归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/dto/UserUpdateReqDTO.java delete mode 100644 归档/user-service-project/user-service-app/pom.xml delete mode 100644 归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/UserServiceApplication.java delete mode 100644 归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/controller/UserManageController.java delete mode 100644 归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/sms/UserSmsCodeDO.java delete mode 100644 归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/user/UserDO.java delete mode 100644 归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/user/UserThirdAuthDO.java delete mode 100644 归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/address/UserAddressMapper.java delete mode 100644 归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/sms/UserSmsCodeMapper.java delete mode 100644 归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/user/UserMapper.java delete mode 100644 归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/manager/sms/UserSmsCodeManager.java delete mode 100644 归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/manager/user/UserManager.java delete mode 100644 归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/sms/UserSmsCodeService.java delete mode 100644 归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/UserService.java delete mode 100644 归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/bo/UserBO.java delete mode 100644 归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/bo/UserCreateBO.java delete mode 100644 归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/bo/UserPageBO.java delete mode 100644 归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/bo/UserUpdateBO.java delete mode 100644 归档/user-service-project/user-service-app/src/main/resources/application-dev.yaml delete mode 100644 归档/user-service-project/user-service-app/src/main/resources/application-local.yaml delete mode 100644 归档/user-service-project/user-service-app/src/main/resources/application.properties delete mode 100644 归档/user-service-project/user-service-app/src/main/resources/application.yaml delete mode 100644 归档/user-service-project/user-service-app/src/main/resources/sql/mall_user_data.sql delete mode 100644 归档/user-service-project/user-service-app/src/main/resources/sql/mall_user_schema.sql diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/BannerConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/BannerConvert.java deleted file mode 100644 index e4e7aa871..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/BannerConvert.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.promotion; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerCreateReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerPageReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerRespVO; -import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerUpdateReqVO; -import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerCreateReqDTO; -import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerPageReqDTO; -import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerRespDTO; -import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerUpdateReqDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface BannerConvert { - - BannerConvert INSTANCE = Mappers.getMapper(BannerConvert.class); - - BannerCreateReqDTO convert(BannerCreateReqVO bean); - - BannerUpdateReqDTO convert(BannerUpdateReqVO bean); - - BannerPageReqDTO convert(BannerPageReqVO bean); - - PageResult convertPage(PageResult page); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/brand/BannerManager.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/brand/BannerManager.java deleted file mode 100644 index 8b621f640..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/brand/BannerManager.java +++ /dev/null @@ -1,68 +0,0 @@ -package cn.iocoder.mall.managementweb.manager.promotion.brand; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerCreateReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerPageReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerRespVO; -import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerUpdateReqVO; -import cn.iocoder.mall.managementweb.convert.promotion.BannerConvert; -import cn.iocoder.mall.promotion.api.rpc.banner.BannerFeign; -import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerRespDTO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** -* Banner Manager -*/ -@Service -public class BannerManager { - - @Autowired - private BannerFeign bannerFeign; - - /** - * 创建 Banner - * - * @param createVO 创建 Banner VO - * @return Banner - */ - public Integer createBanner(BannerCreateReqVO createVO) { - CommonResult createBannerResult = bannerFeign.createBanner(BannerConvert.INSTANCE.convert(createVO)); - createBannerResult.checkError(); - return createBannerResult.getData(); - } - - /** - * 更新 Banner - * - * @param updateVO 更新 Banner VO - */ - public void updateBanner(BannerUpdateReqVO updateVO) { - CommonResult updateBannerResult = bannerFeign.updateBanner(BannerConvert.INSTANCE.convert(updateVO)); - updateBannerResult.checkError(); - } - - /** - * 删除 Banner - * - * @param bannerId Banner 编号 - */ - public void deleteBanner(Integer bannerId) { - CommonResult deleteBannerResult = bannerFeign.deleteBanner(bannerId); - deleteBannerResult.checkError(); - } - - /** - * 获得 Banner 分页 - * - * @param pageVO Banner 分页查询 - * @return Banner 分页结果 - */ - public PageResult pageBanner(BannerPageReqVO pageVO) { - CommonResult> pageBannerResult = bannerFeign.pageBanner(BannerConvert.INSTANCE.convert(pageVO)); - pageBannerResult.checkError(); - return BannerConvert.INSTANCE.convertPage(pageBannerResult.getData()); - } - -} diff --git a/归档/moved/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/README.md b/归档/moved/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/README.md deleted file mode 100644 index f42e41382..000000000 --- a/归档/moved/order/order-service-impl/src/main/java/cn/iocoder/mall/order/biz/dataobject/README.md +++ /dev/null @@ -1,21 +0,0 @@ - -## 订单 - - -TODO - - -**退货** - -1. 商家未发货,退货原因 - - - 拍错/勿拍/多拍 - - 缺货 - -2. 商家已发货,退货原因 - - - 七天无理由 - - 质量问题 - - 不想要了 - - 其他 - \ No newline at end of file diff --git a/归档/moved/order/order-service-impl/src/main/resources/mapper/CartMapper.xml b/归档/moved/order/order-service-impl/src/main/resources/mapper/CartMapper.xml deleted file mode 100644 index b5ca5f4c4..000000000 --- a/归档/moved/order/order-service-impl/src/main/resources/mapper/CartMapper.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - id, status, delete_time, selected, user_id, - spu_id, sku_id, quantity, order_id, order_create_time, - create_time - - - - - - - - - - - - - - INSERT INTO cart_item ( - status, delete_time, selected, user_id, - spu_id, sku_id, quantity, order_id, order_create_time, - create_time - ) VALUES ( - #{status}, #{deleteTime}, #{selected}, #{userId}, - #{spuId}, #{skuId}, #{quantity}, #{orderId}, #{orderCreateTime}, - #{createTime} - ) - - - - UPDATE cart_item - - - status = #{status}, - - - delete_time = #{deleteTime}, - - - selected = #{selected}, - - - quantity = #{quantity}, - - - order_id = #{orderId}, - - - order_create_time = #{orderCreateTime}, - - - price = #{price}, - - - quantity = #{quantity}, - - - WHERE id = #{id} - - - - UPDATE cart_item - SET quantity = quantity + #{quantityIncr} - WHERE id = #{id} - - - - UPDATE cart_item - - - selected = #{selected}, - - - status = #{status}, - - - WHERE user_id = #{userId} - AND sku_id IN - - #{skuId} - - -- AND deleted = 0 - - - diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/sku/ProductSkuDO.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/sku/ProductSkuDO.java deleted file mode 100644 index a0f2f31e3..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/sku/ProductSkuDO.java +++ /dev/null @@ -1,64 +0,0 @@ -package cn.iocoder.mall.productservice.dal.mysql.dataobject.sku; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; -import cn.iocoder.mall.productservice.dal.mysql.dataobject.attr.ProductAttrValueDO; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - * 商品 SKU - */ -@TableName("product_sku") -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class ProductSkuDO extends DeletableDO { - - /** - * sku 编号 - */ - private Integer id; - /** - * 商品编号 - */ - private Integer spuId; - - // TODO 店铺编号 - - /** - * 状态 - * - * 枚举 {@link CommonStatusEnum} - */ - private Integer status; - /** - * 图片地址 - */ - private String picUrl; - /** - * 规格值({@link ProductAttrValueDO#getId()})数组 - * - * 数组,以逗号分隔 - */ - private String attrs; - /** - * 价格,单位:分 - */ - private Integer price; - /** - * 库存数量 - */ - private Integer quantity; -// /** -// * 商品在付款减库存的状态下,该Sku上未付款的订单数量 -// */ -// private Integer withHoldQuantity; -// /** -// * 销量 -// */ -// private Integer soldNum; - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/spu/ProductSpuDO.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/spu/ProductSpuDO.java deleted file mode 100644 index 1fd18129b..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/dataobject/spu/ProductSpuDO.java +++ /dev/null @@ -1,82 +0,0 @@ -package cn.iocoder.mall.productservice.dal.mysql.dataobject.spu; - -import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - * 商品 SPU - * - * TODO 芋艿,后面增加商品普通参数。例如说,正面材料,背面材料,屏幕尺寸。 - */ -@TableName("product_spu") -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class ProductSpuDO extends DeletableDO { - - /** - * SPU 编号 - */ - private Integer id; - - // TODO 店铺编号 先不考虑,因为第一个版本,不做 B2B2C - - // ========== 基本信息 ========= - /** - * SPU 名字 - */ - private String name; - /** - * 卖点 - */ - private String sellPoint; - /** - * 描述 - */ - private String description; - /** - * 分类编号 - */ - private Integer cid; - /** - * 商品主图地址 - * - * 数组,以逗号分隔 - * - * 建议尺寸:800*800像素,你可以拖拽图片调整顺序,最多上传15张 - */ - private String picUrls; - - // TODO 运费信息 - - // ========== 其他信息 ========= - /** - * 是否上架商品(是否可见)。 - * - * true 为已上架 - * false 为已下架 - */ - private Boolean visible; - /** - * 排序字段 - */ - private Integer sort; - - // ========== Sku 相关字段 ========= - /** - * 价格 - * - * 目前的计算方式是,以 Sku 最小价格为准 - */ - private Integer price; - /** - * 库存数量 - * - * 目前的计算方式是,以 Sku 库存累加为准 - */ - private Integer quantity; - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/sku/ProductSkuMapper.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/sku/ProductSkuMapper.java index a688109e2..ae5dfae1b 100644 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/sku/ProductSkuMapper.java +++ b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/dal/mysql/mapper/sku/ProductSkuMapper.java @@ -17,8 +17,6 @@ public interface ProductSkuMapper extends BaseMapper { .eq("status", status)); } - void insertList(@Param("productSkuDOs") List productSkuDOs); - default List selectList(ProductSkuListQueryBO queryBO) { return selectList(new QueryWrapperX().eqIfPresent("id", queryBO.getProductSkuId()) .inIfPresent("id", queryBO.getProductSkuIds()) diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/sku/ProductSkuManager.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/sku/ProductSkuManager.java index 7a54adfa7..ffbc6d278 100644 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/sku/ProductSkuManager.java +++ b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/sku/ProductSkuManager.java @@ -32,17 +32,6 @@ public class ProductSkuManager { @Autowired private ProductAttrService productAttrService; - /** - * 获得商品 SKU - * - * @param productSkuId 商品 SKU编号 - * @return 商品 SKU - */ - public ProductSkuRespDTO getProductSku(Integer productSkuId) { - ProductSkuBO productSkuBO = productSkuService.getProductSku(productSkuId); - return ProductSkuConvert.INSTANCE.convert(productSkuBO); - } - /** * 获得商品 SKU 列表 * diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/spu/ProductSpuManager.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/spu/ProductSpuManager.java index 500007f75..a0fa80ab0 100644 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/spu/ProductSpuManager.java +++ b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/manager/spu/ProductSpuManager.java @@ -51,17 +51,6 @@ public class ProductSpuManager { @Autowired private ProductMQProducer productMQProducer; - /** - * 获得商品 SPU - * - * @param productSpuId 商品 SPU编号 - * @return 商品 SPU - */ - public ProductSpuRespDTO getProductSpu(Integer productSpuId) { - ProductSpuBO productSpuBO = productSpuService.getProductSpu(productSpuId); - return ProductSpuConvert.INSTANCE.convert(productSpuBO); - } - /** * 获得商品 SPU列表 * @@ -84,25 +73,6 @@ public class ProductSpuManager { return ProductSpuConvert.INSTANCE.convertPage(pageResultBO); } - /** - * 添加或修改商品 SPU 时,校验商品分类是否合法 - * - * @param cid 商品分类编号 - * @return 商品分类 - */ - private ProductCategoryBO checkProductCategory(Integer cid) { - ProductCategoryBO categoryBO = productCategoryService.getProductCategory(cid); - if (categoryBO == null) { - // 不存在 - throw ServiceExceptionUtil.exception(PRODUCT_CATEGORY_NOT_EXISTS); - } - if (ProductCategoryIdEnum.ROOT.getId().equals(categoryBO.getPid())) { - // 商品只能添加到二级分类下 - throw ServiceExceptionUtil.exception(PRODUCT_SPU_CATEGORY_MUST_BE_LEVEL2); - } - return categoryBO; - } - /** * 顺序获得商品 SPU 编号数组 * diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/sku/ProductSkuService.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/sku/ProductSkuService.java index b134dea93..70cf1a2e7 100644 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/sku/ProductSkuService.java +++ b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/sku/ProductSkuService.java @@ -22,15 +22,6 @@ public class ProductSkuService { @Autowired private ProductSkuMapper productSkuMapper; - public void createProductSkus(Integer spuId, List createSkuBOs) { - List skus = ProductSkuConvert.INSTANCE.convertList(createSkuBOs); - skus.forEach(sku -> { - sku.setStatus(CommonStatusEnum.ENABLE.getValue()); - sku.setSpuId(spuId); - }); - productSkuMapper.insertList(skus); - } - /** * 获得 sku 数组中,指定规格的 sku * @@ -54,17 +45,6 @@ public class ProductSkuService { return null; } - /** - * 获得商品 SKU - * - * @param productSkuId 商品 SKU 编号 - * @return 商品 SKU - */ - public ProductSkuBO getProductSku(Integer productSkuId) { - ProductSkuDO productSkuDO = productSkuMapper.selectById(productSkuId); - return ProductSkuConvert.INSTANCE.convert(productSkuDO); - } - /** * 获得商品 SKU 列表 * diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/sku/bo/ProductSkuBO.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/sku/bo/ProductSkuBO.java deleted file mode 100644 index b927f92ea..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/sku/bo/ProductSkuBO.java +++ /dev/null @@ -1,60 +0,0 @@ -package cn.iocoder.mall.productservice.service.sku.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; -import java.util.List; - -/** - * 商品 SKU BO - */ -@Data -@Accessors(chain = true) -public class ProductSkuBO { - - /** - * sku 编号 - */ - private Integer id; - /** - * 商品编号 - */ - private Integer spuId; - /** - * 状态 - * - * 1-正常 - * 2-禁用 - */ - private Integer status; - /** - * 图片地址 - */ - private String picUrl; - /** - * 规格值编号数组 - */ - private List attrValueIds; - /** - * 价格,单位:分 - */ - private Integer price; - /** - * 库存数量 - */ - private Integer quantity; - /** - * 创建时间 - */ - private Date createTime; - /** - * 最后更新时间 - */ - private Date updateTime; - /** - * 是否删除 - */ - private Integer deleted; - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuBO.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuBO.java deleted file mode 100644 index 5bf311054..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuBO.java +++ /dev/null @@ -1,61 +0,0 @@ -package cn.iocoder.mall.productservice.service.spu.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; -import java.util.List; - -/** -* 商品 SPU 信息 BO -*/ -@Data -@Accessors(chain = true) -public class ProductSpuBO { - - /** - * 商品 SPU 编号 - */ - private Integer id; - /** - * SPU 名字 - */ - private String name; - /** - * 卖点 - */ - private String sellPoint; - /** - * 描述 - */ - private String description; - /** - * 分类编号 - */ - private Integer cid; - /** - * 商品主图地址 - */ - private List picUrls; - /** - * 是否上架商品 - */ - private Boolean visible; - /** - * 排序字段 - */ - private Integer sort; - /** - * 价格 - */ - private Integer price; - /** - * 库存数量 - */ - private Integer quantity; - /** - * 创建时间 - */ - private Date createTime; - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuCreateBO.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuCreateBO.java deleted file mode 100644 index 7944c68ab..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuCreateBO.java +++ /dev/null @@ -1,63 +0,0 @@ -package cn.iocoder.mall.productservice.service.spu.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.List; - -/** -* 商品 SPU 创建 BO -*/ -@Data -@Accessors(chain = true) -public class ProductSpuCreateBO { - - /** - * SPU 名字 - */ - @NotEmpty(message = "SPU 名字不能为空") - private String name; - /** - * 卖点 - */ - @NotEmpty(message = "卖点不能为空") - private String sellPoint; - /** - * 描述 - */ - @NotEmpty(message = "描述不能为空") - private String description; - /** - * 分类编号 - */ - @NotNull(message = "分类编号不能为空") - private Integer cid; - /** - * 商品主图地址 - */ - @NotEmpty(message = "商品主图地址不能为空") - private List picUrls; - /** - * 是否上架商品 - */ - @NotNull(message = "是否上架商品不能为空") - private Boolean visible; - /** - * 排序字段 - */ - @NotNull(message = "排序字段不能为空") - private Integer sort; - /** - * 价格 - */ - @NotNull(message = "价格不能为空") - private Integer price; - /** - * 库存数量 - */ - @NotNull(message = "库存数量不能为空") - private Integer quantity; - -} diff --git a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuUpdateBO.java b/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuUpdateBO.java deleted file mode 100644 index 5e88acfa4..000000000 --- a/归档/product-service-project/product-service-app/src/main/java/cn/iocoder/mall/productservice/service/spu/bo/ProductSpuUpdateBO.java +++ /dev/null @@ -1,67 +0,0 @@ -package cn.iocoder.mall.productservice.service.spu.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.List; - -/** -* 商品 SPU 更新 BO -*/ -@Data -@Accessors(chain = true) -public class ProductSpuUpdateBO { - - /** - * 商品 SPU 编号 - */ - @NotNull(message = "商品 SPU 编号不能为空") - private Integer id; - /** - * SPU 名字 - */ - @NotEmpty(message = "SPU 名字不能为空") - private String name; - /** - * 卖点 - */ - @NotEmpty(message = "卖点不能为空") - private String sellPoint; - /** - * 描述 - */ - @NotEmpty(message = "描述不能为空") - private String description; - /** - * 分类编号 - */ - @NotNull(message = "分类编号不能为空") - private Integer cid; - /** - * 商品主图地址 - */ - @NotEmpty(message = "商品主图地址不能为空") - private List picUrls; - /** - * 是否上架商品 - */ - @NotNull(message = "是否上架商品不能为空") - private Boolean visible; - /** - * 排序字段 - */ - private Integer sort; - /** - * 价格 - */ - @NotNull(message = "价格不能为空") - private Integer price; - /** - * 库存数量 - */ - @NotNull(message = "库存数量不能为空") - private Integer quantity; - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/BannerFeign.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/BannerFeign.java deleted file mode 100644 index cd8344e0a..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/BannerFeign.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.banner; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.banner.dto.*; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; - -import java.util.List; - -/** - * Title: - * Description: - * - * @author zhuyang - * @version 1.0 2021/10/9 - */ -@FeignClient("promotion-service") -public interface BannerFeign { - - @PostMapping("/promotion/banner/createBanner") - public CommonResult createBanner(@RequestBody BannerCreateReqDTO createDTO) ; - @PostMapping("/promotion/banner/updateBanner") - public CommonResult updateBanner(@RequestBody BannerUpdateReqDTO updateDTO) ; - - @PostMapping("/promotion/banner/deleteBanner") - public CommonResult deleteBanner(@RequestBody Integer bannerId) ; - - @PostMapping("/promotion/banner/listBanners") - public CommonResult> listBanners(@RequestBody BannerListReqDTO listDTO) ; - - @PostMapping("/promotion/banner/pageBanner") - public CommonResult> pageBanner(@RequestBody BannerPageReqDTO pageDTO); -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerCreateReqDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerCreateReqDTO.java deleted file mode 100644 index 1713a5075..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerCreateReqDTO.java +++ /dev/null @@ -1,58 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.banner.dto; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import lombok.Data; -import lombok.experimental.Accessors; -import org.hibernate.validator.constraints.Length; -import org.hibernate.validator.constraints.URL; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - * Banner 创建 Request DTO - */ -@Data -@Accessors(chain = true) -public class BannerCreateReqDTO implements Serializable { - - /** - * 标题 - */ - @NotEmpty(message = "标题不能为空") - @Length(min = 2, max = 32, message = "标题长度为 2-32 位") - private String title; - /** - * 跳转链接 - */ - @NotEmpty(message = "跳转链接不能为空") - @URL(message = "跳转链接格式不正确") - @Length(max = 255, message = "跳转链接最大长度为 255 位") - private String url; - /** - * 图片链接 - */ - @NotEmpty(message = "图片链接不能为空") - @URL(message = "图片链接格式不正确") - @Length(max = 255, message = "图片链接最大长度为 255 位") - private String picUrl; - /** - * 排序 - */ - @NotNull(message = "排序不能为空") - private Integer sort; - /** - * 状态 - */ - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - /** - * 备注 - */ - @Length(max = 255, message = "备注最大长度为 255 位") - private String memo; - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerListReqDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerListReqDTO.java deleted file mode 100644 index b62d160a5..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerListReqDTO.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.banner.dto; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - * Banner 列表 Request DTO - */ -@Data -@Accessors(chain = true) -public class BannerListReqDTO implements Serializable { - - /** - * 状态 - */ - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerPageReqDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerPageReqDTO.java deleted file mode 100644 index c9543556f..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerPageReqDTO.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.banner.dto; - -import cn.iocoder.common.framework.vo.PageParam; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - * Banner 分页 Request DTO - */ -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class BannerPageReqDTO extends PageParam { - - /** - * 标题,模糊匹配 - */ - private String title; - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerRespDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerRespDTO.java deleted file mode 100644 index 1a204c23b..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerRespDTO.java +++ /dev/null @@ -1,49 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.banner.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; - -/** - * Banner Response DTO - */ -@Data -@Accessors(chain = true) -public class BannerRespDTO implements Serializable { - - /** - * 编号 - */ - private Integer id; - /** - * 标题 - */ - private String title; - /** - * 跳转链接 - */ - private String url; - /** - * 图片链接 - */ - private String picUrl; - /** - * 排序 - */ - private Integer sort; - /** - * 状态 - */ - private Integer status; - /** - * 备注 - */ - private String memo; - /** - * 创建时间 - */ - private Date createTime; - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerUpdateReqDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerUpdateReqDTO.java deleted file mode 100644 index 2b006a7e7..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/banner/dto/BannerUpdateReqDTO.java +++ /dev/null @@ -1,63 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.banner.dto; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import lombok.Data; -import lombok.experimental.Accessors; -import org.hibernate.validator.constraints.Length; -import org.hibernate.validator.constraints.URL; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - * Banner 更新 Request DTO - */ -@Data -@Accessors(chain = true) -public class BannerUpdateReqDTO implements Serializable { - - /** - * 编号 - */ - @NotNull(message = "编号不能为空") - private Integer id; - /** - * 标题 - */ - @NotEmpty(message = "标题不能为空") - @Length(min = 2, max = 32, message = "标题长度为 2-32 位") - private String title; - /** - * 跳转链接 - */ - @NotEmpty(message = "跳转链接不能为空") - @URL(message = "跳转链接格式不正确") - @Length(max = 255, message = "跳转链接最大长度为 255 位") - private String url; - /** - * 图片链接 - */ - @NotEmpty(message = "图片链接不能为空") - @URL(message = "图片链接格式不正确") - @Length(max = 255, message = "图片链接最大长度为 255 位") - private String picUrl; - /** - * 排序 - */ - @NotNull(message = "排序不能为空") - private Integer sort; - /** - * 状态 - */ - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - /** - * 备注 - */ - @Length(max = 255, message = "备注最大长度为 255 位") - private String memo; - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/BannerController.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/BannerController.java deleted file mode 100644 index e4b473b27..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/BannerController.java +++ /dev/null @@ -1,57 +0,0 @@ -package cn.iocoder.mall.promotionservice.controller; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.banner.dto.*; -import cn.iocoder.mall.promotionservice.manager.banner.BannerManager; -import org.springframework.beans.factory.annotation.Autowired; -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; - -import java.util.List; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** - * Title: - * Description: - * - * @author zhuyang - * @version 1.0 2021/10/9 - */ -@RestController -@RequestMapping("/promotion/banner") -public class BannerController { - - @Autowired - private BannerManager bannerManager; - - @PostMapping("createBanner") - public CommonResult createBanner(@RequestBody BannerCreateReqDTO createDTO) { - return success(bannerManager.createBanner(createDTO)); - } - - @PostMapping("updateBanner") - public CommonResult updateBanner(@RequestBody BannerUpdateReqDTO updateDTO) { - bannerManager.updateBanner(updateDTO); - return success(true); - } - - @PostMapping("deleteBanner") - public CommonResult deleteBanner(@RequestBody Integer bannerId) { - bannerManager.deleteBanner(bannerId); - return success(true); - } - - @PostMapping("listBanners") - public CommonResult> listBanners(@RequestBody BannerListReqDTO listDTO) { - return success(bannerManager.listBanners(listDTO)); - } - - @PostMapping("pageBanner") - public CommonResult> pageBanner(@RequestBody BannerPageReqDTO pageDTO) { - return success(bannerManager.pageBanner(pageDTO)); - } -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/banner/BannerConvert.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/banner/BannerConvert.java deleted file mode 100644 index e57643a2a..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/banner/BannerConvert.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.mall.promotionservice.convert.banner; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerCreateReqDTO; -import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerRespDTO; -import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerUpdateReqDTO; -import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.banner.BannerDO; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface BannerConvert { - - BannerConvert INSTANCE = Mappers.getMapper(BannerConvert.class); - - BannerDO convert(BannerCreateReqDTO bean); - - BannerDO convert(BannerUpdateReqDTO bean); - - @Mapping(source = "records", target = "list") - PageResult convertPage(IPage page); - - List convertList(List list); - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/banner/BannerManager.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/banner/BannerManager.java deleted file mode 100644 index 7f9669233..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/banner/BannerManager.java +++ /dev/null @@ -1,42 +0,0 @@ -package cn.iocoder.mall.promotionservice.manager.banner; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.banner.dto.*; -import cn.iocoder.mall.promotionservice.service.banner.BannerService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.validation.Valid; -import java.util.List; - -/** - * Banner Manager - */ -@Service -@Valid -public class BannerManager { - - @Autowired - private BannerService bannerService; - - public Integer createBanner(BannerCreateReqDTO createDTO) { - return bannerService.createBanner(createDTO); - } - - public void updateBanner(BannerUpdateReqDTO updateDTO) { - bannerService.updateBanner(updateDTO); - } - - public void deleteBanner(Integer bannerId) { - bannerService.deleteBanner(bannerId); - } - - public List listBanners(BannerListReqDTO listDTO) { - return bannerService.listBanners(listDTO); - } - - public PageResult pageBanner(BannerPageReqDTO pageDTO) { - return bannerService.pageBanner(pageDTO); - } - -} diff --git a/归档/shop-web-app/pom.xml b/归档/shop-web-app/pom.xml deleted file mode 100644 index d649bfd9e..000000000 --- a/归档/shop-web-app/pom.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - onemall - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - shop-web-app - 商城,用于用户购物 - - - - - - cn.iocoder.mall - mall-dependencies - 1.0-SNAPSHOT - pom - import - - - - - - - - cn.iocoder.mall - mall-spring-boot-starter-web - - - - cn.iocoder.mall - mall-spring-boot-starter-swagger - - - - cn.iocoder.mall - mall-spring-boot-starter-security-user - - - - - cn.iocoder.mall - mall-spring-boot-starter-dubbo - - - - - cn.iocoder.mall - user-service-api - 1.0-SNAPSHOT - - - - cn.iocoder.mall - product-service-api - 1.0-SNAPSHOT - - - - cn.iocoder.mall - search-service-api - 1.0-SNAPSHOT - - - - cn.iocoder.mall - trade-service-api - 1.0-SNAPSHOT - - - - cn.iocoder.mall - promotion-service-api - 1.0-SNAPSHOT - - - - cn.iocoder.mall - system-service-api - 1.0-SNAPSHOT - - - - cn.iocoder.mall - pay-service-api - 1.0-SNAPSHOT - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - - - org.springframework.boot - spring-boot-starter-actuator - - - - - org.projectlombok - lombok - - - - org.mapstruct - mapstruct - - - org.mapstruct - mapstruct-jdk8 - - - org.springframework.cloud - spring-cloud-starter-openfeign - - - - - - ${project.artifactId} - - - - org.springframework.boot - spring-boot-maven-plugin - - - - diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/ShopWebApplication.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/ShopWebApplication.java deleted file mode 100644 index 3c879fed7..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/ShopWebApplication.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.mall.shopweb; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.cloud.openfeign.EnableFeignClients; - -@SpringBootApplication -@EnableDiscoveryClient -@EnableFeignClients(basePackages = {"cn.iocoder.mall.productservice.rpc","cn.iocoder.mall.searchservice.rpc", - "cn.iocoder.mall.tradeservice.rpc","cn.iocoder.mall.payservice.rpc","cn.iocoder.mall.promotion.api.rpc", -"cn.iocoder.mall.systemservice.rpc","cn.iocoder.mall.userservice.rpc"}) -public class ShopWebApplication { - - public static void main(String[] args) { - SpringApplication.run(ShopWebApplication.class, args); - } - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/client/user/UserAddressClient.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/client/user/UserAddressClient.java deleted file mode 100644 index 5f552e19a..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/client/user/UserAddressClient.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.iocoder.mall.shopweb.client.user; - -import cn.iocoder.mall.userservice.rpc.address.UserAddressFeign; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class UserAddressClient { - @Autowired - private UserAddressFeign userAddressFeign; - - - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/product/vo/category/ProductCategoryRespVO.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/product/vo/category/ProductCategoryRespVO.java deleted file mode 100644 index 89d78b20b..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/product/vo/category/ProductCategoryRespVO.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.iocoder.mall.shopweb.controller.product.vo.category; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -@ApiModel("商品分类 Response VO") -@Data -public class ProductCategoryRespVO { - - @ApiModelProperty(value = "分类编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "分类名称", required = true, example = "手机") - private String name; - @ApiModelProperty(value = "分类图片", notes = "一般情况下,只有根分类才有图片", example = "http://www.iocoder.cn/xx.jpg") - private String picUrl; - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/product/vo/product/ProductSpuRespVO.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/product/vo/product/ProductSpuRespVO.java deleted file mode 100644 index aa1c824e5..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/product/vo/product/ProductSpuRespVO.java +++ /dev/null @@ -1,61 +0,0 @@ -package cn.iocoder.mall.shopweb.controller.product.vo.product; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.List; - -@ApiModel("商品 SPU Response VO") -@Data -@Accessors(chain = true) -public class ProductSpuRespVO { - - @ApiModelProperty(value = "SPU 编号", required = true, example = "1") - private Integer id; - - // ========== 基本信息 ========= - @ApiModelProperty(value = "SPU 名字", required = true, example = "芋艿") - private String name; - @ApiModelProperty(value = "卖点", required = true, example = "好吃好玩") - private String sellPoint; - @ApiModelProperty(value = "描述", required = true, example = "我是哈哈哈") - private String description; - @ApiModelProperty(value = "分类编号", required = true, example = "1") - private Integer cid; - @ApiModelProperty(value = "分类名字", required = true, example = "蔬菜") - private String categoryName; - @ApiModelProperty(value = "商品主图地址", required = true, example = "http://www.iocoder.cn/xxx.jpg", notes = "多个之间,使用逗号分隔") - private List picUrls; - - // ========== 其他信息 ========= - @ApiModelProperty(value = "是否上架商品", required = true, example = "true") - private Boolean visible; - @ApiModelProperty(value = "排序字段", required = true, example = "1024") - private Integer sort; - - // ========== Sku 相关字段 ========= - @ApiModelProperty(value = "原始价格,单位:分", required = true, example = "233", notes = "该价格为商品的原始价格") - private Integer originalPrice; - @ApiModelProperty(value = "购买价格,单位:分", required = true, example = "233", notes = "该价格为商品经过优惠计算后的价格") - private Integer buyPrice; - @ApiModelProperty(value = "库存数量", required = true, example = "1024") - private Integer quantity; - - // ========== 促销活动相关字段 ========= TODO 芋艿:等做到促销在处理 - // 目前只促销单体商品促销,目前仅限制折扣。 - /** - * 促销活动编号 - */ - private Integer promotionActivityId; - /** - * 促销活动标题 - */ - private String promotionActivityTitle; - /** - * 促销活动类型 - */ - private Integer promotionActivityType; - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/PassportController.http b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/PassportController.http deleted file mode 100644 index 5af6ff1bb..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/PassportController.http +++ /dev/null @@ -1,19 +0,0 @@ -### /passport/login-by-sms 成功 -POST {{shop-api-base-url}}/passport/login-by-sms -Content-Type: application/x-www-form-urlencoded - -mobile=15601691300&code=9999 - -### /passport/send-sms-code 成功 -POST {{shop-api-base-url}}/passport/send-sms-code -Content-Type: application/x-www-form-urlencoded - -mobile=15601691300&scene=1 - -### /passport/refresh-token -POST {{shop-api-base-url}}/passport/refresh-token -Content-Type: application/x-www-form-urlencoded - -refreshToken=77abd74e84e34cfc8aba9625317a14a3 - -### diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/PassportController.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/PassportController.java deleted file mode 100644 index 42079e601..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/PassportController.java +++ /dev/null @@ -1,56 +0,0 @@ -package cn.iocoder.mall.shopweb.controller.user; - -import cn.iocoder.common.framework.util.HttpUtil; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.shopweb.controller.user.vo.passport.PassportAccessTokenRespVO; -import cn.iocoder.mall.shopweb.controller.user.vo.passport.PassportLoginBySmsReqVO; -import cn.iocoder.mall.shopweb.controller.user.vo.passport.PassportSendSmsRespVO; -import cn.iocoder.mall.shopweb.service.user.PassportManager; -import cn.iocoder.security.annotations.RequiresNone; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import javax.servlet.http.HttpServletRequest; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -@Api(tags = "用户 Passport API") -@RestController -@RequestMapping("/passport") -public class PassportController { - - @Autowired - private PassportManager passportManager; - - @PostMapping("/login-by-sms") - @ApiOperation("手机验证码登陆") - @RequiresNone - public CommonResult loginBySms(PassportLoginBySmsReqVO loginBySmsDTO, - HttpServletRequest request) { - return success(passportManager.loginBySms(loginBySmsDTO, HttpUtil.getIp(request))); - } - - @PostMapping("/send-sms-code") - @ApiOperation("发送手机验证码") - @RequiresNone - public CommonResult sendSmsCode(PassportSendSmsRespVO sendSmsCodeDTO, - HttpServletRequest request) { - passportManager.sendSmsCode(sendSmsCodeDTO, HttpUtil.getIp(request)); - // 返回成功 - return success(true); - } - - @PostMapping("/refresh-token") - @ApiOperation("刷新令牌") - @RequiresNone - public CommonResult refreshToken(@RequestParam("refreshToken") String refreshToken, - HttpServletRequest request) { - return success(passportManager.refreshToken(refreshToken, HttpUtil.getIp(request))); - } - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/UserAddressController.http b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/UserAddressController.http deleted file mode 100644 index 95baf0cbc..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/UserAddressController.http +++ /dev/null @@ -1,6 +0,0 @@ -### /user-address/get-default 成功 -GET {{shop-api-base-url}}/user-address/get-default -Authorization: Bearer {{user-access-token}} -dubbo-tag: {{dubboTag}} - -### diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/UserAddressController.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/UserAddressController.java deleted file mode 100644 index d338feacf..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/UserAddressController.java +++ /dev/null @@ -1,80 +0,0 @@ -package cn.iocoder.mall.shopweb.controller.user; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.security.user.core.context.UserSecurityContextHolder; -import cn.iocoder.mall.shopweb.controller.user.vo.address.UserAddressCreateReqVO; -import cn.iocoder.mall.shopweb.controller.user.vo.address.UserAddressRespVO; -import cn.iocoder.mall.shopweb.controller.user.vo.address.UserAddressUpdateReqVO; -import cn.iocoder.mall.shopweb.service.user.UserAddressManager; -import cn.iocoder.security.annotations.RequiresPermissions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.List; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** -* 用户收件地址 Controller -*/ -@RestController -@RequestMapping("/user-address") -@Api(tags = "用户收件地址") -@Validated -public class UserAddressController { - - @Autowired - private UserAddressManager userAddressManager; - - @PostMapping("/create") - @ApiOperation("创建用户收件地址") - @RequiresPermissions - public CommonResult createUserAddress(@Valid UserAddressCreateReqVO createVO) { - return success(userAddressManager.createUserAddress(UserSecurityContextHolder.getUserId(), createVO)); - } - - @PostMapping("/update") - @ApiOperation("更新用户收件地址") - @RequiresPermissions - public CommonResult updateUserAddress(@Valid UserAddressUpdateReqVO updateVO) { - userAddressManager.updateUserAddress(UserSecurityContextHolder.getUserId(), updateVO); - return success(true); - } - - @PostMapping("/delete") - @ApiOperation("删除用户收件地址") - @ApiImplicitParam(name = "userAddressId", value = "用户收件地址编号", required = true) - @RequiresPermissions - public CommonResult deleteUserAddress(@RequestParam("userAddressId") Integer userAddressId) { - userAddressManager.deleteUserAddress(UserSecurityContextHolder.getUserId(), userAddressId); - return success(true); - } - - @GetMapping("/get") - @ApiOperation("获得用户收件地址") - @ApiImplicitParam(name = "userAddressId", value = "用户收件地址编号", required = true) - @RequiresPermissions - public CommonResult getUserAddress(@RequestParam("userAddressId") Integer userAddressId) { - return success(userAddressManager.getUserAddress(UserSecurityContextHolder.getUserId(), userAddressId)); - } - - @GetMapping("/get-default") - @ApiOperation("获得默认的用户收件地址") - @RequiresPermissions - public CommonResult getDefaultUserAddress() { - return success(userAddressManager.getDefaultUserAddress(UserSecurityContextHolder.getUserId())); - } - - @GetMapping("/list") - @ApiOperation("获得用户收件地址列表") - @RequiresPermissions - public CommonResult> listUserAddresses() { - return success(userAddressManager.listUserAddresses(UserSecurityContextHolder.getUserId())); - } - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/UserController.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/UserController.java deleted file mode 100644 index 8dc433aa8..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/UserController.java +++ /dev/null @@ -1,50 +0,0 @@ -package cn.iocoder.mall.shopweb.controller.user; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.security.user.core.context.UserSecurityContextHolder; -import cn.iocoder.mall.shopweb.controller.user.vo.user.UserRespVO; -import cn.iocoder.mall.shopweb.service.user.UserManager; -import cn.iocoder.security.annotations.RequiresAuthenticate; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -@Api(tags = "用户信息 API") -@RestController -@RequestMapping("/user") -public class UserController { - - @Autowired - private UserManager userManager; - - @ApiOperation(value = "用户信息") - @GetMapping("/info") - @RequiresAuthenticate - public CommonResult getUserInfo() { - UserRespVO user = userManager.getUser(UserSecurityContextHolder.getUserId()); - return success(user); - } - - @PostMapping("/update-avatar") - @RequiresAuthenticate - @ApiOperation(value = "更新头像") - @ApiImplicitParam(name = "avatar", value = "头像", required = true, example = "http://www.iocoder.cn/xxx.png") - public CommonResult updateUserAvatar(@RequestParam("avatar") String avatar) { - userManager.updateUserAvatar(UserSecurityContextHolder.getUserId(), avatar); - return success(true); - } - - @PostMapping("/update-nickname") - @RequiresAuthenticate - @ApiOperation(value = "更新昵称") - @ApiImplicitParam(name = "nickname", value = "昵称", required = true, example = "蠢艿艿") - public CommonResult updateUserNickname(@RequestParam("nickname") String nickname) { - userManager.updateUserNickname(UserSecurityContextHolder.getUserId(), nickname); - return success(true); - } - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/address/UserAddressCreateReqVO.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/address/UserAddressCreateReqVO.java deleted file mode 100644 index bf510bc28..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/address/UserAddressCreateReqVO.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.iocoder.mall.shopweb.controller.user.vo.address; - -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.userservice.enums.address.UserAddressType; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("用户收件地址创建 Request VO") -@Data -public class UserAddressCreateReqVO { - - @ApiModelProperty(value = "收件人名称", required = true, example = "帅艿艿") - @NotEmpty(message = "收件人名称不能为空") - private String name; - @ApiModelProperty(value = "手机号", required = true, example = "15601691300") - @NotEmpty(message = "手机号不能为空") - private String mobile; - @ApiModelProperty(value = "区域编号", required = true, example = "610632") - @NotNull(message = "地区编码不能为空") - private Integer areaCode; - @ApiModelProperty(value = "收件详细地址", required = true, example = "芋道源码 233 号 666 室") - @NotEmpty(message = "收件详细地址不能为空") - private String detailAddress; - @ApiModelProperty(value = "地址类型", required = true, example = "1", notes = "参见 UserAddressType 枚举类") - @NotNull(message = "地址类型不能为空") - @InEnum(value = UserAddressType.class, message = "地址类型必须是 {value}") - private Integer type; - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/address/UserAddressRespVO.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/address/UserAddressRespVO.java deleted file mode 100644 index 26b22d313..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/address/UserAddressRespVO.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.iocoder.mall.shopweb.controller.user.vo.address; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import java.util.Date; - -@ApiModel("用户收件地址 Response VO") -@Data -public class UserAddressRespVO { - - @ApiModelProperty(value = "收件地址编号", required = true, example = "1024") - private Integer id; - @ApiModelProperty(value = "用户编号", required = true, example = "2048") - private Integer userId; - @ApiModelProperty(value = "收件人名称", required = true, example = "帅艿艿") - private String name; - @ApiModelProperty(value = "手机号", required = true, example = "15601691300") - private String mobile; - @ApiModelProperty(value = "区域编号", required = true, example = "610632") - private Integer areaCode; - @ApiModelProperty(value = "收件详细地址", required = true, example = "芋道源码 233 号 666 室") - private String detailAddress; - @ApiModelProperty(value = "地址类型", required = true, example = "1", notes = "参见 UserAddressType 枚举类") - private Integer type; - @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; - -} - diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/address/UserAddressUpdateReqVO.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/address/UserAddressUpdateReqVO.java deleted file mode 100644 index 6fdd23c9c..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/address/UserAddressUpdateReqVO.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.iocoder.mall.shopweb.controller.user.vo.address; - -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.userservice.enums.address.UserAddressType; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("用户收件地址更新 Request VO") -@Data -public class UserAddressUpdateReqVO { - - @ApiModelProperty(value = "收件地址编号", required = true, example = "1024") - @NotNull(message = "收件地址编号不能为空") - private Integer id; - @ApiModelProperty(value = "收件人名称", required = true, example = "帅艿艿") - @NotEmpty(message = "收件人名称不能为空") - private String name; - @ApiModelProperty(value = "手机号", required = true, example = "15601691300") - @NotEmpty(message = "手机号不能为空") - private String mobile; - @ApiModelProperty(value = "区域编号", required = true, example = "610632") - @NotNull(message = "地区编码不能为空") - private Integer areaCode; - @ApiModelProperty(value = "收件详细地址", required = true, example = "芋道源码 233 号 666 室") - @NotEmpty(message = "收件详细地址不能为空") - private String detailAddress; - @ApiModelProperty(value = "地址类型", required = true, example = "1", notes = "参见 UserAddressType 枚举类") - @NotNull(message = "地址类型不能为空") - @InEnum(value = UserAddressType.class, message = "地址类型必须是 {value}") - private Integer type; - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/passport/PassportAccessTokenRespVO.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/passport/PassportAccessTokenRespVO.java deleted file mode 100644 index cb7099088..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/passport/PassportAccessTokenRespVO.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.iocoder.mall.shopweb.controller.user.vo.passport; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; - -@ApiModel("访问令牌信息 Response VO") -@Data -@Accessors(chain = true) -public class PassportAccessTokenRespVO { - - @ApiModelProperty(value = "访问令牌", required = true, example = "001e8f49b20e47f7b3a2de774497cd50") - private String accessToken; - @ApiModelProperty(value = "刷新令牌", required = true, example = "001e8f49b20e47f7b3a2de774497cd50") - private String refreshToken; - @ApiModelProperty(value = "过期时间", required = true) - private Date expiresTime; - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/passport/PassportLoginBySmsReqVO.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/passport/PassportLoginBySmsReqVO.java deleted file mode 100644 index 270fc3fd3..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/passport/PassportLoginBySmsReqVO.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.mall.shopweb.controller.user.vo.passport; - -import cn.iocoder.common.framework.validator.Mobile; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.Pattern; -import java.io.Serializable; - -@ApiModel("用户短信验证码登陆 Request VO") -@Data -@Accessors(chain = true) -public class PassportLoginBySmsReqVO implements Serializable { - - @ApiModelProperty(value = "手机号", required = true, example = "15601691300") - @NotEmpty(message = "手机号不能为空") - @Mobile - private String mobile; - - @ApiModelProperty(value = "手机验证码", required = true, example = "1024") - @NotEmpty(message = "手机验证码不能为空") - @Length(min = 4, max = 6, message = "手机验证码长度为 4-6 位") - @Pattern(regexp = "^[0-9]+$", message = "手机验证码必须都是数字") - private String code; - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/passport/PassportSendSmsRespVO.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/passport/PassportSendSmsRespVO.java deleted file mode 100644 index b4fd44483..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/passport/PassportSendSmsRespVO.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.iocoder.mall.shopweb.controller.user.vo.passport; - -import cn.iocoder.common.framework.validator.Mobile; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; - -@ApiModel("发送手机验证码 Response VO") -@Data -@Accessors(chain = true) -public class PassportSendSmsRespVO { - - @ApiModelProperty(value = "手机号", example = "15601691234") - @Mobile - private String mobile; - @ApiModelProperty(value = "发送场景", example = "1", notes = "对应 UserSmsSceneEnum 枚举") - @NotNull(message = "发送场景不能为空") - private Integer scene; - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/user/UserRespVO.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/user/UserRespVO.java deleted file mode 100644 index 1b341e44d..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/user/vo/user/UserRespVO.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.iocoder.mall.shopweb.controller.user.vo.user; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -@ApiModel("用户信息 VO") -@Data -@Accessors(chain = true) -public class UserRespVO { - - @ApiModelProperty(value = "用户编号", required = true, example = "123") - private Integer id; - @ApiModelProperty(value = "手机号", required = true, example = "15601691300") - private String mobile; - @ApiModelProperty(value = "昵称", required = true, example = "小王") - private String nickname; - @ApiModelProperty(value = "头像", required = true, example = "http://www.iocoder.cn/xxx.jpg") - private String avatar; - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/product/ProductCategoryConvert.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/product/ProductCategoryConvert.java deleted file mode 100644 index 472d81a5b..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/product/ProductCategoryConvert.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.iocoder.mall.shopweb.convert.product; - -import cn.iocoder.mall.productservice.rpc.category.dto.ProductCategoryRespDTO; -import cn.iocoder.mall.shopweb.controller.product.vo.category.ProductCategoryRespVO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface ProductCategoryConvert { - - ProductCategoryConvert INSTANCE = Mappers.getMapper(ProductCategoryConvert.class); - - List convertList(List list); - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/promotion/BannerConvert.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/promotion/BannerConvert.java deleted file mode 100644 index c0868fa9a..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/promotion/BannerConvert.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.iocoder.mall.shopweb.convert.promotion; - -import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerRespDTO; -import cn.iocoder.mall.shopweb.controller.promotion.vo.brand.BannerRespVO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface BannerConvert { - - BannerConvert INSTANCE = Mappers.getMapper(BannerConvert.class); - - List convertList(List list); - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/user/PassportConvert.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/user/PassportConvert.java deleted file mode 100644 index 3089aa626..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/user/PassportConvert.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.iocoder.mall.shopweb.convert.user; - -import cn.iocoder.mall.shopweb.controller.user.vo.passport.PassportAccessTokenRespVO; -import cn.iocoder.mall.shopweb.controller.user.vo.passport.PassportLoginBySmsReqVO; -import cn.iocoder.mall.shopweb.controller.user.vo.passport.PassportSendSmsRespVO; -import cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2AccessTokenRespDTO; -import cn.iocoder.mall.userservice.rpc.sms.dto.UserSendSmsCodeReqDTO; -import cn.iocoder.mall.userservice.rpc.sms.dto.UserVerifySmsCodeReqDTO; -import cn.iocoder.mall.userservice.rpc.user.dto.UserCreateReqDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface PassportConvert { - - PassportConvert INSTANCE = Mappers.getMapper(PassportConvert.class); - - UserVerifySmsCodeReqDTO convert(PassportLoginBySmsReqVO bean); - UserCreateReqDTO convert02(PassportLoginBySmsReqVO bean); - - UserSendSmsCodeReqDTO convert(PassportSendSmsRespVO bean); - - PassportAccessTokenRespVO convert(OAuth2AccessTokenRespDTO bean); - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/user/UserAddressConvert.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/user/UserAddressConvert.java deleted file mode 100644 index ec14dee81..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/user/UserAddressConvert.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.iocoder.mall.shopweb.convert.user; - -import cn.iocoder.mall.shopweb.controller.user.vo.address.UserAddressCreateReqVO; -import cn.iocoder.mall.shopweb.controller.user.vo.address.UserAddressRespVO; -import cn.iocoder.mall.shopweb.controller.user.vo.address.UserAddressUpdateReqVO; -import cn.iocoder.mall.userservice.rpc.address.dto.UserAddressCreateReqDTO; -import cn.iocoder.mall.userservice.rpc.address.dto.UserAddressRespDTO; -import cn.iocoder.mall.userservice.rpc.address.dto.UserAddressUpdateReqDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface UserAddressConvert { - - UserAddressConvert INSTANCE = Mappers.getMapper(UserAddressConvert.class); - - UserAddressUpdateReqDTO convert(UserAddressUpdateReqVO bean); - - UserAddressRespVO convert(UserAddressRespDTO bean); - - List convertList(List list); - - UserAddressCreateReqDTO convert(UserAddressCreateReqVO bean); - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/user/UserConvert.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/user/UserConvert.java deleted file mode 100644 index 59956d49e..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/convert/user/UserConvert.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.iocoder.mall.shopweb.convert.user; - -import cn.iocoder.mall.shopweb.controller.user.vo.user.UserRespVO; -import cn.iocoder.mall.userservice.rpc.user.dto.UserRespDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface UserConvert { - - UserConvert INSTANCE = Mappers.getMapper(UserConvert.class); - - UserRespVO convert(UserRespDTO bean); - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/promotion/BannerManager.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/promotion/BannerManager.java deleted file mode 100644 index ba2f90b0e..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/promotion/BannerManager.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.iocoder.mall.shopweb.service.promotion; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.promotion.api.rpc.banner.BannerFeign; -import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerListReqDTO; -import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerRespDTO; -import cn.iocoder.mall.shopweb.controller.promotion.vo.brand.BannerRespVO; -import cn.iocoder.mall.shopweb.convert.promotion.BannerConvert; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import java.util.Comparator; -import java.util.List; - -/** - * Banner Manager - */ -@Service -@Validated -public class BannerManager { - @Autowired - private BannerFeign bannerFeign; - public List listBanners() { - // 获取 Banner 列表 - CommonResult> listBannersResult = bannerFeign.listBanners( - new BannerListReqDTO().setStatus(CommonStatusEnum.ENABLE.getValue())); - listBannersResult.checkError(); - // 排序返回 - listBannersResult.getData().sort(Comparator.comparing(BannerRespDTO::getSort)); - return BannerConvert.INSTANCE.convertList(listBannersResult.getData()); - } - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/trade/CartManager.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/trade/CartManager.java index e29777ff9..4d1180458 100644 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/trade/CartManager.java +++ b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/trade/CartManager.java @@ -28,68 +28,6 @@ import java.util.stream.Collectors; @Service public class CartManager { - @Autowired - private CartFeign cartFeign; - @Autowired - private PriceFeign priceFeign; - - @Autowired - private PromotionActivityFeign promotionActivityFeign; - - @Autowired - private ProductSkuFeign productSkuFeign; - - /** - * 添加商品到购物车 - * - * @param userId 用户编号 - * @param skuId 商品 SKU 编号 - * @param quantity 增加数量 - */ - public void addCartItem(Integer userId, Integer skuId, Integer quantity) { - CommonResult addCartItemResult = cartFeign.addCartItem(new CartItemAddReqDTO().setUserId(userId) - .setSkuId(skuId).setQuantity(quantity)); - addCartItemResult.checkError(); - } - - /** - * 查询用户在购物车中的商品数量 - * - * @param userId 用户编号 - * @return 商品数量 - */ - public Integer sumCartItemQuantity(Integer userId) { - CommonResult sumCartItemQuantityResult = cartFeign.sumCartItemQuantity(userId); - sumCartItemQuantityResult.checkError(); - return sumCartItemQuantityResult.getData(); - } - - /** - * 更新购物车商品数量 - * - * @param userId 用户编号 - * @param skuId 商品 SKU 编号 - * @param quantity 数量 - */ - public void updateCartItemQuantity(Integer userId, Integer skuId, Integer quantity) { - CommonResult updateCartItemQuantityResult = cartFeign.updateCartItemQuantity(new CartItemUpdateQuantityReqDTO() - .setUserId(userId).setSkuId(skuId).setQuantity(quantity)); - updateCartItemQuantityResult.checkError(); - } - - /** - * 更新购物车商品是否选中 - * - * @param userId 用户编号 - * @param skuIds 商品 SKU 编号数组 - * @param selected 是否选中 - */ - public void updateCartItemSelected(Integer userId, Set skuIds, Boolean selected) { - CommonResult updateCartItemSelectedResult = cartFeign.updateCartItemSelected(new CartItemUpdateSelectedReqDTO() - .setUserId(userId).setSkuIds(skuIds).setSelected(selected)); - updateCartItemSelectedResult.checkError(); - } - /** * 查询用户的购物车的商品列表 * diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/user/PassportManager.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/user/PassportManager.java deleted file mode 100644 index 210afc2b5..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/user/PassportManager.java +++ /dev/null @@ -1,60 +0,0 @@ -package cn.iocoder.mall.shopweb.service.user; - -import cn.iocoder.common.framework.enums.UserTypeEnum; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.shopweb.controller.user.vo.passport.PassportAccessTokenRespVO; -import cn.iocoder.mall.shopweb.controller.user.vo.passport.PassportLoginBySmsReqVO; -import cn.iocoder.mall.shopweb.controller.user.vo.passport.PassportSendSmsRespVO; -import cn.iocoder.mall.shopweb.convert.user.PassportConvert; -import cn.iocoder.mall.systemservice.rpc.oauth.OAuthFeign; -import cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2AccessTokenRespDTO; -import cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2CreateAccessTokenReqDTO; -import cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2RefreshAccessTokenReqDTO; -import cn.iocoder.mall.userservice.enums.sms.UserSmsSceneEnum; -import cn.iocoder.mall.userservice.rpc.sms.UserSmsCodeFeign; -import cn.iocoder.mall.userservice.rpc.user.UserFeign; -import cn.iocoder.mall.userservice.rpc.user.dto.UserRespDTO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class PassportManager { - - private UserSmsCodeFeign userSmsCodeFeign; - private UserFeign userFeign; - - @Autowired - private OAuthFeign oAuthFeign; - - public PassportAccessTokenRespVO loginBySms(PassportLoginBySmsReqVO loginBySmsDTO, String ip) { - // 校验验证码 - CommonResult verifySmsCodeResult = userSmsCodeFeign.verifySmsCode( - PassportConvert.INSTANCE.convert(loginBySmsDTO).setScene(UserSmsSceneEnum.LOGIN_BY_SMS.getValue()).setIp(ip)); - verifySmsCodeResult.checkError(); - // 获得用户 - CommonResult createUserResult = userFeign.createUserIfAbsent( - PassportConvert.INSTANCE.convert02(loginBySmsDTO).setIp(ip)); - createUserResult.checkError(); - // 创建访问令牌 - CommonResult createAccessTokenResult = oAuthFeign.createAccessToken( - new OAuth2CreateAccessTokenReqDTO().setUserId(createUserResult.getData().getId()) - .setUserType(UserTypeEnum.USER.getValue()).setCreateIp(ip)); - createAccessTokenResult.checkError(); - // 返回 - return PassportConvert.INSTANCE.convert(createAccessTokenResult.getData()); - } - - public void sendSmsCode(PassportSendSmsRespVO sendSmsCodeDTO, String ip) { - CommonResult sendSmsCodeResult = userSmsCodeFeign.sendSmsCode( - PassportConvert.INSTANCE.convert(sendSmsCodeDTO).setIp(ip)); - sendSmsCodeResult.checkError(); - } - - public PassportAccessTokenRespVO refreshToken(String refreshToken, String ip) { - CommonResult refreshAccessTokenResult = oAuthFeign.refreshAccessToken( - new OAuth2RefreshAccessTokenReqDTO().setRefreshToken(refreshToken).setCreateIp(ip)); - refreshAccessTokenResult.checkError(); - return PassportConvert.INSTANCE.convert(refreshAccessTokenResult.getData()); - } - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/user/UserAddressManager.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/user/UserAddressManager.java deleted file mode 100644 index 2bf2f10a3..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/user/UserAddressManager.java +++ /dev/null @@ -1,129 +0,0 @@ -package cn.iocoder.mall.shopweb.service.user; - -import cn.iocoder.common.framework.exception.GlobalException; -import cn.iocoder.common.framework.util.CollectionUtils; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.shopweb.controller.user.vo.address.UserAddressCreateReqVO; -import cn.iocoder.mall.shopweb.controller.user.vo.address.UserAddressRespVO; -import cn.iocoder.mall.shopweb.controller.user.vo.address.UserAddressUpdateReqVO; -import cn.iocoder.mall.shopweb.convert.user.UserAddressConvert; -import cn.iocoder.mall.userservice.enums.address.UserAddressType; -import cn.iocoder.mall.userservice.rpc.address.UserAddressFeign; -import cn.iocoder.mall.userservice.rpc.address.dto.UserAddressRespDTO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -import static cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants.FORBIDDEN; - -/** -* 用户收件地址 Manager -*/ -@Service -public class UserAddressManager { - - @Autowired - private UserAddressFeign userAddressFeign; - /** - * 创建用户收件地址 - * - * @param userId 用户编号 - * @param createVO 创建用户收件地址 VO - * @return 用户收件地址 - */ - public Integer createUserAddress(Integer userId, UserAddressCreateReqVO createVO) { - CommonResult createUserAddressResult = userAddressFeign.createUserAddress( - UserAddressConvert.INSTANCE.convert(createVO).setUserId(userId)); - createUserAddressResult.checkError(); - return createUserAddressResult.getData(); - } - - /** - * 更新用户收件地址 - * - * @param userId 用户编号 - * @param updateVO 更新用户收件地址 VO - */ - public void updateUserAddress(Integer userId, UserAddressUpdateReqVO updateVO) { - // 校验是否能够操作 - check(userId, updateVO.getId()); - // 执行更新 - CommonResult updateUserAddressResult = userAddressFeign.updateUserAddress(UserAddressConvert.INSTANCE.convert(updateVO) - .setUserId(userId)); - updateUserAddressResult.checkError(); - } - - /** - * 删除用户收件地址 - * - * @param userId 用户编号 - * @param userAddressId 用户收件地址编号 - */ - public void deleteUserAddress(Integer userId, Integer userAddressId) { - // 校验是否能够操作 - check(userId, userAddressId); - // 执行删除 - CommonResult deleteUserAddressResult = userAddressFeign.deleteUserAddress(userAddressId); - deleteUserAddressResult.checkError(); - } - - /** - * 获得用户收件地址 - * - * @param userId 用户编号 - * @param userAddressId 用户收件地址编号 - * @return 用户收件地址 - */ - public UserAddressRespVO getUserAddress(Integer userId, Integer userAddressId) { - CommonResult getUserAddressResult = userAddressFeign.getUserAddress(userAddressId); - getUserAddressResult.checkError(); - // 校验是否能够操作 - this.check(userId, userAddressId); - return UserAddressConvert.INSTANCE.convert(getUserAddressResult.getData()); - } - - /** - * 获得用户收件地址列表 - * - * @param userId 用户编号 - * @return 用户收件地址列表 - */ - public List listUserAddresses(Integer userId) { - CommonResult> listUserAddressResult = userAddressFeign.listUserAddresses(userId, null); - listUserAddressResult.checkError(); - return UserAddressConvert.INSTANCE.convertList(listUserAddressResult.getData()); - } - - /** - * 获得用户的默认收件地址 - * - * @param userId 用户编号 - * @return 用户收件地址 - */ - public UserAddressRespVO getDefaultUserAddress(Integer userId) { - CommonResult> listUserAddressResult = userAddressFeign.listUserAddresses(userId, UserAddressType.DEFAULT.getType()); - listUserAddressResult.checkError(); - return !CollectionUtils.isEmpty(listUserAddressResult.getData()) ? - UserAddressConvert.INSTANCE.convert(listUserAddressResult.getData().get(0)) : null; - } - - /** - * 校验用户收件地址是不是属于该用户 - * - * @param userId 用户编号 - * @param userAddressId 用户收件地址 - */ - private void check(Integer userId, Integer userAddressId) { - CommonResult getUserAddressResult = userAddressFeign.getUserAddress(userAddressId); - getUserAddressResult.checkError(); - this.check(userId, getUserAddressResult.getData()); - } - - private void check(Integer userId, UserAddressRespDTO userAddressRespDTO) { - if (!userAddressRespDTO.getUserId().equals(userId)) { - throw new GlobalException(FORBIDDEN); - } - } - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/user/UserManager.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/user/UserManager.java deleted file mode 100644 index 81956a133..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/user/UserManager.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.iocoder.mall.shopweb.service.user; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.shopweb.controller.user.vo.user.UserRespVO; -import cn.iocoder.mall.shopweb.convert.user.UserConvert; -import cn.iocoder.mall.userservice.rpc.user.UserFeign; -import cn.iocoder.mall.userservice.rpc.user.dto.UserRespDTO; -import cn.iocoder.mall.userservice.rpc.user.dto.UserUpdateReqDTO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class UserManager { - - @Autowired - private UserFeign userFeign; - public UserRespVO getUser(Integer id) { - CommonResult userResult = userFeign.getUser(id); - userResult.checkError(); - return UserConvert.INSTANCE.convert(userResult.getData()); - } - - public void updateUserAvatar(Integer userId, String avatar) { - CommonResult updateUserResult = userFeign.updateUser(new UserUpdateReqDTO().setId(userId).setAvatar(avatar)); - updateUserResult.checkError(); - } - - public void updateUserNickname(Integer userId, String nickname) { - CommonResult updateUserResult = userFeign.updateUser(new UserUpdateReqDTO().setId(userId).setNickname(nickname)); - updateUserResult.checkError(); - } - -} diff --git a/归档/shop-web-app/src/main/resources/application-dev.yml b/归档/shop-web-app/src/main/resources/application-dev.yml deleted file mode 100644 index fede4927b..000000000 --- a/归档/shop-web-app/src/main/resources/application-dev.yml +++ /dev/null @@ -1,15 +0,0 @@ -spring: - # Spring Cloud 配置项 - cloud: - nacos: - # Spring Cloud Nacos Discovery 配置项 - discovery: - server-addr: localhost:8848 # Nacos 服务器地址 - namespace: dev # Nacos 命名空间 - -# Dubbo 配置项 -dubbo: - # Dubbo 注册中心 - registry: - # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 diff --git a/归档/shop-web-app/src/main/resources/application-local.yml b/归档/shop-web-app/src/main/resources/application-local.yml deleted file mode 100644 index d8b2b0c81..000000000 --- a/归档/shop-web-app/src/main/resources/application-local.yml +++ /dev/null @@ -1,18 +0,0 @@ -spring: - # Spring Cloud 配置项 - cloud: - nacos: - # Spring Cloud Nacos Discovery 配置项 - discovery: - server-addr: localhost:8848 # Nacos 服务器地址 - namespace: dev # Nacos 命名空间 - # Spring 主应用配置 - main: - lazy-initialization: true # 开启延迟加载,保证本地开发的性能 - -# Dubbo 配置项 -dubbo: - # Dubbo 注册中心 - registry: - # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 diff --git a/归档/shop-web-app/src/main/resources/application.yml b/归档/shop-web-app/src/main/resources/application.yml deleted file mode 100644 index cba54393c..000000000 --- a/归档/shop-web-app/src/main/resources/application.yml +++ /dev/null @@ -1,75 +0,0 @@ -# 服务器的配置项 -server: - port: 18084 - servlet: - context-path: /shop-api/ - -spring: - # Application 的配置项 - application: - name: shop-web - # Profile 的配置项 - profiles: - active: local - # SpringMVC 配置项 - mvc: - throw-exception-if-no-handler-found: true # 匹配不到路径时,抛出 NoHandlerFoundException 异常 - static-path-pattern: /doc.html # 静态资源的路径 - -# Dubbo 配置项 -dubbo: - # Spring Cloud Alibaba Dubbo 专属配置 - cloud: - subscribed-services: 'user-service,system-service' # 设置订阅的应用列表,默认为 * 订阅所有应用 - # Dubbo 服务消费者的配置 - consumer: - timeout: 10000 - validation: true # 开启 Consumer 的参数校验 - UserRpc: - version: 1.0.0 - OAuth2Rpc: - version: 1.0.0 - SystemAccessLogRpc: - version: 1.0.0 - SystemExceptionLogRpc: - version: 1.0.0 - ProductCategoryRpc: - version: 1.0.0 - ProductSpuRpc: - version: 1.0.0 - ProductSkuRpc: - version: 1.0.0 - SearchProductRpc: - version: 1.0.0 - PriceRpc: - version: 1.0.0 - PromotionActivityRpc: - version: 1.0.0 - CouponCardRpc: - version: 1.0.0 - CouponTemplateRpc: - version: 1.0.0 - BannerRpc: - version: 1.0.0 - ProductRecommendRpc: - version: 1.0.0 - TradeOrderRpc: - version: 1.0.0 - PayTransactionRpc: - version: 1.0.0 - UserSmsCodeRpc: - version: 1.0.0 - UserAddressRpc: - version: 1.0.0 - -# Swagger 配置项 -swagger: - title: 商城中心 - description: 提供用户商城购物流程中的 API - version: 1.0.0 - base-package: cn.iocoder.mall.shopweb.controller - -# Actuator 监控配置项 -management: - server.port: 38088 # 独立端口,避免被暴露出去 - endpoints.web.exposure.include: '*' # 暴露所有监控端点 diff --git a/归档/trade-service-project/trade-service-api/pom.xml b/归档/trade-service-project/trade-service-api/pom.xml deleted file mode 100644 index 750838dfa..000000000 --- a/归档/trade-service-project/trade-service-api/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - trade-service-project - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - trade-service-api - - - - cn.iocoder.mall - common-framework - - - - - javax.validation - validation-api - - - org.projectlombok - lombok - - - org.springframework.cloud - spring-cloud-openfeign-core - RELEASE - - - - diff --git a/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/enums/OrderErrorCodeConstants.java b/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/enums/OrderErrorCodeConstants.java index 3d3d11a41..20f3261fd 100644 --- a/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/enums/OrderErrorCodeConstants.java +++ b/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/enums/OrderErrorCodeConstants.java @@ -39,11 +39,6 @@ public interface OrderErrorCodeConstants { ErrorCode ORDER_RETURN_NOT_EXISTENT = new ErrorCode(1008000401, "退货订单不存在"); ErrorCode ORDER_RETURN_REFUND_FAILED = new ErrorCode(1008000402, "退款失败"); - // ========== 购物车 ========== - ErrorCode CARD_ITEM_NOT_FOUND = new ErrorCode(1008003000, "购物车项不存在"); - ErrorCode CARD_ITEM_SKU_NOT_FOUND = new ErrorCode(1008003001, "商品不存在"); - ErrorCode CARD_ITEM_SKU_QUANTITY_NOT_ENOUGH = new ErrorCode(1008003002, "商品库存不足"); - // 工具类服务 1008004000 ErrorCode DICT_SERVER_INVOKING_FAIL = new ErrorCode(1008004000, "字典服务调用失败!"); ErrorCode ORDER_LOGISTICS_INVOKING_FAIL = new ErrorCode(1008004001, "订单物流调用失败!"); diff --git a/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/CartFeign.java b/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/CartFeign.java deleted file mode 100644 index e3b3e816e..000000000 --- a/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/CartFeign.java +++ /dev/null @@ -1,61 +0,0 @@ -package cn.iocoder.mall.tradeservice.rpc.cart; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.tradeservice.rpc.cart.dto.*; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; - -import java.util.List; - -/** - * Title: - * Description: - * - * @author zhuyang - * @version 1.0 2021/10/9 - */ -@FeignClient(value = "trade-service") -public interface CartFeign { - /** - * 添加商品到购物车 - * - * @param addReqDTO 添加商品信息 - * @return 成功 - */ - @PostMapping("/trade/cart/addCartItem") - CommonResult addCartItem(@RequestBody CartItemAddReqDTO addReqDTO); - - /** - * 更新购物车商品数量 - * - * @param updateQuantityReqDTO 更新商品数量 DTO - * @return 成功 - */ - @PostMapping("/trade/cart/updateCartItemQuantity") - CommonResult updateCartItemQuantity(@RequestBody CartItemUpdateQuantityReqDTO updateQuantityReqDTO); - - /** - * 更新购物车商品是否选中 - * - * @param updateSelectedReqDTO 更新商品是否选中 DTO - * @return 成功 - */ - @PostMapping("/trade/cart/updateCartItemSelected") - CommonResult updateCartItemSelected(@RequestBody CartItemUpdateSelectedReqDTO updateSelectedReqDTO); - - /** - * 删除购物车商品列表 - * - * @param deleteListReqDTO 删除商品列表 DTO - * @return 成功 - */ - @PostMapping("/trade/cart/deleteCartItems") - CommonResult deleteCartItems(@RequestBody CartItemDeleteListReqDTO deleteListReqDTO); - @GetMapping("/sumCartItemQuantity") - public CommonResult sumCartItemQuantity(@RequestParam("userId") Integer userId) ; - @PostMapping("/trade/cart/listCartItems") - public CommonResult> listCartItems(@RequestBody CartItemListReqDTO listReqDTO) ; -} diff --git a/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemAddReqDTO.java b/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemAddReqDTO.java deleted file mode 100644 index e27aab27f..000000000 --- a/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemAddReqDTO.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.mall.tradeservice.rpc.cart.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - * 购物车添加购物项 Request DTO - */ -@Data -@Accessors(chain = true) -public class CartItemAddReqDTO implements Serializable { - - /** - * 用户编号 - */ - @NotNull(message = "用户编号不能为空") - private Integer userId; - /** - * 商品 SKU 编号 - */ - @NotNull(message = "商品 SKU 编号不能为空") - private Integer skuId; - /** - * 数量 - */ - @NotNull(message = "数量不能为空") - @Min(message = "数量必须大于 0", value = 1L) - private Integer quantity; - -} diff --git a/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemDeleteListReqDTO.java b/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemDeleteListReqDTO.java deleted file mode 100644 index 3d22779f2..000000000 --- a/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemDeleteListReqDTO.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.tradeservice.rpc.cart.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.List; - -/** - * 购物车删除商品列表 Request DTO - */ -@Data -@Accessors(chain = true) -public class CartItemDeleteListReqDTO implements Serializable { - - /** - * 用户编号 - */ - @NotNull(message = "用户编号不能为空") - private Integer userId; - /** - * 商品 SKU 编号列表 - */ - @NotNull(message = "商品 SKU 编号列表不能为空") - private List skuIds; - -} diff --git a/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemListReqDTO.java b/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemListReqDTO.java deleted file mode 100644 index c5c9a8080..000000000 --- a/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemListReqDTO.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.iocoder.mall.tradeservice.rpc.cart.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - * 购物车的商品信息查询 BO - */ -@Data -@Accessors(chain = true) -public class CartItemListReqDTO implements Serializable { - - /** - * 用户编号 - */ - @NotNull(message = "用户编号不能为空") - private Integer userId; - /** - * 是否选中 - */ - private Boolean selected; - -} diff --git a/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemRespDTO.java b/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemRespDTO.java deleted file mode 100644 index 60cfb7ecb..000000000 --- a/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemRespDTO.java +++ /dev/null @@ -1,67 +0,0 @@ -package cn.iocoder.mall.tradeservice.rpc.cart.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - * 购物车的商品信息 Response DTO - */ -@Data -@Accessors(chain = true) -public class CartItemRespDTO implements Serializable { - - // ========= 基础字段 BEGIN ========= - - /** - * 编号,唯一自增。 - */ - private Integer id; - /** - * 是否选中 - */ - private Boolean selected; - - // ========= 基础字段 END ========= - - // ========= 买家信息 BEGIN ========= - - /** - * 用户编号 - */ - private Integer userId; - - // ========= 买家信息 END ========= - - // ========= 商品信息 BEGIN ========= - - /** - * 商品 SPU 编号 - */ - private Integer spuId; - /** - * 商品 SKU 编号 - */ - private Integer skuId; - /** - * 商品购买数量 - */ - private Integer quantity; - - // ========= 商品信息 END ========= - - // ========= 优惠信息 BEGIN ========= - -// /** -// * 商品营销活动编号 -// */ -// private Integer activityId; -// /** -// * 商品营销活动类型 -// */ -// private Integer activityType; - - // ========= 优惠信息 END ========= - -} diff --git a/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemUpdateQuantityReqDTO.java b/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemUpdateQuantityReqDTO.java deleted file mode 100644 index 1b7fefdd7..000000000 --- a/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemUpdateQuantityReqDTO.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.mall.tradeservice.rpc.cart.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - * 购物车更新数量 Request DTO - */ -@Data -@Accessors(chain = true) -public class CartItemUpdateQuantityReqDTO implements Serializable { - - /** - * 用户编号 - */ - @NotNull(message = "用户编号不能为空") - private Integer userId; - /** - * 商品 SKU 编号 - */ - @NotNull(message = "商品 SKU 编号不能为空") - private Integer skuId; - /** - * 数量 - */ - @NotNull(message = "数量不能为空") - @Min(message = "数量必须大于 0", value = 1L) - private Integer quantity; - -} diff --git a/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemUpdateSelectedReqDTO.java b/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemUpdateSelectedReqDTO.java deleted file mode 100644 index c5e59c90f..000000000 --- a/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/cart/dto/CartItemUpdateSelectedReqDTO.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.iocoder.mall.tradeservice.rpc.cart.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.Collection; - -/** - * 购物车更新是否选中 Request DTO - */ -@Data -@Accessors(chain = true) -public class CartItemUpdateSelectedReqDTO implements Serializable { - - /** - * 用户编号 - */ - @NotNull(message = "用户编号不能为空") - private Integer userId; - /** - * 商品 SKU 编号列表 - */ - @NotNull(message = "商品 SKU 编号列表不能为空") - private Collection skuIds; - /** - * 是否选中 - */ - @NotNull(message = "是否选中不能为空") - private Boolean selected; - -} diff --git a/归档/trade-service-project/trade-service-app/pom.xml b/归档/trade-service-project/trade-service-app/pom.xml deleted file mode 100644 index 3146fe4a0..000000000 --- a/归档/trade-service-project/trade-service-app/pom.xml +++ /dev/null @@ -1,147 +0,0 @@ - - - - trade-service-project - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - trade-service-app - - - - cn.iocoder.mall - mall-spring-boot-starter-dubbo - - - - - cn.iocoder.mall - trade-service-api - - - - - cn.iocoder.mall - system-service-api - 1.0-SNAPSHOT - - - - - cn.iocoder.mall - user-service-api - 1.0-SNAPSHOT - - - - - cn.iocoder.mall - product-service-api - 1.0-SNAPSHOT - - - - - cn.iocoder.mall - pay-service-api - 1.0-SNAPSHOT - - - - - cn.iocoder.mall - promotion-service-api - 1.0-SNAPSHOT - - - - - org.springframework.boot - spring-boot-starter-web - - - - - cn.iocoder.mall - mall-spring-boot-starter-rocketmq - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - - - mysql - mysql-connector-java - - - - com.alibaba - druid-spring-boot-starter - - - - cn.iocoder.mall - mall-spring-boot-starter-mybatis - - - - - org.springframework.boot - spring-boot-starter-actuator - - - - - org.springframework.boot - spring-boot-starter-validation - - - - org.projectlombok - lombok - - - - org.mapstruct - mapstruct - - - org.mapstruct - mapstruct-jdk8 - - - - org.aspectj - aspectjweaver - 1.9.6 - - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - ${project.artifactId} - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - diff --git a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/TradeServiceApplication.java b/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/TradeServiceApplication.java deleted file mode 100644 index df175b0fc..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/TradeServiceApplication.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.iocoder.mall.tradeservice; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.cloud.openfeign.EnableFeignClients; - -@SpringBootApplication -@EnableDiscoveryClient -@EnableFeignClients(basePackages = {"cn.iocoder.mall.productservice.rpc","cn.iocoder.mall.promotion.api.rpc","cn.iocoder.mall.userservice.rpc"}) -public class TradeServiceApplication { - - public static void main(String[] args) { - SpringApplication.run(TradeServiceApplication.class, args); - } - -} diff --git a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/client/user/UserAddressClient.java b/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/client/user/UserAddressClient.java deleted file mode 100644 index 1429ce4dc..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/client/user/UserAddressClient.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.iocoder.mall.tradeservice.client.user; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.userservice.rpc.address.UserAddressFeign; -import cn.iocoder.mall.userservice.rpc.address.dto.UserAddressRespDTO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.Objects; - -@Service -public class UserAddressClient { - - @Autowired - private UserAddressFeign userAddressFeign; - public UserAddressRespDTO getUserAddress(Integer userAddressId, Integer userId) { - CommonResult getUserAddressResult = userAddressFeign.getUserAddress(userAddressId); - getUserAddressResult.checkError(); - if (getUserAddressResult.getData() == null) { - return null; - } - // 如果用户编号不匹配,则返回 null - return Objects.equals(getUserAddressResult.getData().getUserId(), userId) ? - getUserAddressResult.getData() : null; - } - -} diff --git a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/config/AopConfiguration.java b/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/config/AopConfiguration.java deleted file mode 100644 index 7e905a58e..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/config/AopConfiguration.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.iocoder.mall.tradeservice.config; - -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.EnableAspectJAutoProxy; - -/** - * Spring Aop 配置类 - */ -@Configuration -@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true) -public class AopConfiguration { -} diff --git a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/config/DatabaseConfiguration.java b/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/config/DatabaseConfiguration.java deleted file mode 100644 index 99f71b602..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/config/DatabaseConfiguration.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.tradeservice.config; - -import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector; -import com.baomidou.mybatisplus.core.injector.ISqlInjector; -import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -@Configuration -@MapperScan("cn.iocoder.mall.tradeservice.dal.mysql.mapper") // 扫描对应的 Mapper 接口 -@EnableTransactionManagement(proxyTargetClass = true) // 启动事务管理。 -public class DatabaseConfiguration { - - // 数据库连接池 Druid - - @Bean - public ISqlInjector sqlInjector() { - return new DefaultSqlInjector(); // MyBatis Plus 逻辑删除 - } - - @Bean - public PaginationInterceptor paginationInterceptor() { - return new PaginationInterceptor(); // MyBatis Plus 分页插件 - } - -} diff --git a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/controller/CartController.java b/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/controller/CartController.java deleted file mode 100644 index fa6067bef..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/controller/CartController.java +++ /dev/null @@ -1,74 +0,0 @@ -package cn.iocoder.mall.tradeservice.controller; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.tradeservice.rpc.cart.dto.*; -import cn.iocoder.mall.tradeservice.service.cart.CartManager; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -@RestController -@RequestMapping("/trade/cart") -public class CartController { - @Autowired - private CartManager cartManager; - - /** - * 添加商品到购物车 - * - * @param addReqDTO 添加商品信息 - * @return 成功 - */ - @PostMapping("addCartItem") - CommonResult addCartItem(@RequestBody CartItemAddReqDTO addReqDTO){ - cartManager.addCartItem(addReqDTO); - return success(true); - } - - /** - * 更新购物车商品数量 - * - * @param updateQuantityReqDTO 更新商品数量 DTO - * @return 成功 - */ - @PostMapping("updateCartItemQuantity") - CommonResult updateCartItemQuantity(@RequestBody CartItemUpdateQuantityReqDTO updateQuantityReqDTO){ - cartManager.updateCartItemSelected(updateQuantityReqDTO); - return success(true); - } - - /** - * 更新购物车商品是否选中 - * - * @param updateSelectedReqDTO 更新商品是否选中 DTO - * @return 成功 - */ - @PostMapping("updateCartItemSelected") - CommonResult updateCartItemSelected(@RequestBody CartItemUpdateSelectedReqDTO updateSelectedReqDTO){ - cartManager.updateCartItemSelected(updateSelectedReqDTO); - return success(true); - } - - /** - * 删除购物车商品列表 - * - * @param deleteListReqDTO 删除商品列表 DTO - * @return 成功 - */ - @PostMapping("deleteCartItems") - CommonResult deleteCartItems(@RequestBody CartItemDeleteListReqDTO deleteListReqDTO){ - cartManager.deleteCartItems(deleteListReqDTO); - return success(true); - } - @GetMapping("/sumCartItemQuantity") - public CommonResult sumCartItemQuantity(@RequestParam("userId") Integer userId) { - return success(cartManager.sumCartItemQuantity(userId)); - } - @PostMapping("/listCartItems") - public CommonResult> listCartItems(@RequestBody CartItemListReqDTO listReqDTO) { - return success(cartManager.listCartItems(listReqDTO)); - } -} diff --git a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/convert/cart/CartConvert.java b/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/convert/cart/CartConvert.java deleted file mode 100644 index 5495d835c..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/convert/cart/CartConvert.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.mall.tradeservice.convert.cart; - -import cn.iocoder.mall.tradeservice.dal.mysql.dataobject.cart.CartItemDO; -import cn.iocoder.mall.tradeservice.rpc.cart.dto.CartItemAddReqDTO; -import cn.iocoder.mall.tradeservice.rpc.cart.dto.CartItemListReqDTO; -import cn.iocoder.mall.tradeservice.rpc.cart.dto.CartItemRespDTO; -import cn.iocoder.mall.tradeservice.service.cart.bo.CartItemAddBO; -import cn.iocoder.mall.tradeservice.service.cart.bo.CartItemBO; -import cn.iocoder.mall.tradeservice.service.cart.bo.CartItemListQueryBO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface CartConvert { - - CartConvert INSTANCE = Mappers.getMapper(CartConvert.class); - - CartItemDO convert(CartItemAddBO bean); - - CartItemAddBO convert(CartItemAddReqDTO bean); - - List convertList(List list); - - CartItemListQueryBO convert(CartItemListReqDTO bean); - - List convertList02(List list); - -} diff --git a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/convert/order/TradeOrderConvert.java b/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/convert/order/TradeOrderConvert.java deleted file mode 100644 index 4e60bf115..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/convert/order/TradeOrderConvert.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.mall.tradeservice.convert.order; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.tradeservice.dal.mysql.dataobject.order.TradeOrderDO; -import cn.iocoder.mall.tradeservice.dal.mysql.dataobject.order.TradeOrderItemDO; -import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderItemRespDTO; -import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderRespDTO; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface TradeOrderConvert { - - TradeOrderConvert INSTANCE = Mappers.getMapper(TradeOrderConvert.class); - - TradeOrderRespDTO convert(TradeOrderDO bean); - - @Mapping(source = "records", target = "list") - PageResult convertPage(IPage page); - - List convertList(List list); - - TradeOrderItemRespDTO convert(TradeOrderItemDO bean); - -} diff --git a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/dal/mysql/dataobject/cart/CartItemDO.java b/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/dal/mysql/dataobject/cart/CartItemDO.java deleted file mode 100644 index 48103dc77..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/dal/mysql/dataobject/cart/CartItemDO.java +++ /dev/null @@ -1,73 +0,0 @@ -package cn.iocoder.mall.tradeservice.dal.mysql.dataobject.cart; - -import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - * 购物车的商品信息 DO - */ -@TableName("cart_item") -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class CartItemDO extends DeletableDO { - - // ========= 基础字段 BEGIN ========= - - /** - * 编号,唯一自增。 - */ - private Integer id; - /** - * 是否选中 - */ - private Boolean selected; - - // ========= 基础字段 END ========= - - // ========= 买家信息 BEGIN ========= - - /** - * 用户编号 - */ - private Integer userId; - - // ========= 买家信息 END ========= - - // ========= 商品信息 BEGIN ========= - - /** - * 商品 SPU 编号 - */ - private Integer spuId; - /** - * 商品 SKU 编号 - */ - private Integer skuId; - /** - * 商品购买数量 - */ - private Integer quantity; - - // TODO 冗余字段 - - - // ========= 商品信息 END ========= - - // ========= 优惠信息 BEGIN ========= - -// /** -// * 商品营销活动编号 -// */ -// private Integer activityId; -// /** -// * 商品营销活动类型 -// */ -// private Integer activityType; - - // ========= 优惠信息 END ========= - -} diff --git a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/dal/mysql/mapper/cart/CartItemMapper.java b/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/dal/mysql/mapper/cart/CartItemMapper.java deleted file mode 100644 index 81973aac0..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/dal/mysql/mapper/cart/CartItemMapper.java +++ /dev/null @@ -1,49 +0,0 @@ -package cn.iocoder.mall.tradeservice.dal.mysql.mapper.cart; - -import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; -import cn.iocoder.mall.tradeservice.dal.mysql.dataobject.cart.CartItemDO; -import cn.iocoder.mall.tradeservice.service.cart.bo.CartItemListQueryBO; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -import java.math.BigDecimal; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; - -@Repository -public interface CartItemMapper extends BaseMapper { - - default CartItemDO selectByUserIdAndSkuId(Integer userId, Integer skuId) { - return selectOne(new QueryWrapper().eq("user_id", userId) - .eq("sku_id", skuId)); - } - - default List selectListByUserIdAndSkuIds(Integer userId, Collection skuIds) { - return selectList(new QueryWrapperX().eq("user_id", userId) - .inIfPresent("sku_id", skuIds)); - } - - default void updateByIds(@Param("ids") Set ids, @Param("updateObject") CartItemDO updateObject) { - // TODO 芋艿:batch update ,在 mybatis plus 做拓展,这里先临时处理 - ids.forEach(id -> updateById(updateObject.setId(id))); - } - - default Integer selectSumQuantityByUserId(Integer userId) { - // SQL sum 查询 - List> result = selectMaps(new QueryWrapper() - .select("SUM(quantity) AS sumQuantity") - .eq("user_id", userId)); - // 获得数量 - return ((BigDecimal) result.get(0).get("sumQuantity")).intValue(); - } - - default List selectList(CartItemListQueryBO queryBO) { - return selectList(new QueryWrapperX().eq("user_id", queryBO.getUserId()) - .eqIfPresent("selected", queryBO.getSelected())); - } - -} diff --git a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/CartManager.java b/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/CartManager.java deleted file mode 100644 index 2543d51ac..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/CartManager.java +++ /dev/null @@ -1,114 +0,0 @@ -package cn.iocoder.mall.tradeservice.service.cart; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.productservice.rpc.sku.ProductSkuFeign; -import cn.iocoder.mall.productservice.rpc.sku.dto.ProductSkuRespDTO; -import cn.iocoder.mall.tradeservice.convert.cart.CartConvert; -import cn.iocoder.mall.tradeservice.rpc.cart.dto.*; -import cn.iocoder.mall.tradeservice.service.cart.bo.CartItemBO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -import static cn.iocoder.mall.tradeservice.enums.OrderErrorCodeConstants.CARD_ITEM_SKU_NOT_FOUND; - -/** - * 购物车 Manager - */ -@Service -public class CartManager { - - @Autowired - private ProductSkuFeign productSkuFeign; - - @Autowired - private CartService cartService; - - /** - * 添加商品到购物车 - * - * @param addReqDTO 添加商品信息 - */ - public void addCartItem(CartItemAddReqDTO addReqDTO) { - // 校验商品 SKU 是否合法 - ProductSkuRespDTO skuDTO = this.checkProductSku(addReqDTO.getSkuId()); - // 添加购物车项 - cartService.addCartItem(CartConvert.INSTANCE.convert(addReqDTO).setSpuId(skuDTO.getSpuId()), skuDTO.getQuantity()); - } - - /** - * 更新购物车商品数量 - * - * @param updateQuantityReqDTO 更新商品数量 - */ - public void updateCartItemSelected(CartItemUpdateQuantityReqDTO updateQuantityReqDTO) { - // 校验商品 SKU 是否合法 - ProductSkuRespDTO skuDTO = this.checkProductSku(updateQuantityReqDTO.getSkuId()); - // 更新购物车商品数量 - cartService.updateCartItemQuantity(updateQuantityReqDTO.getUserId(), updateQuantityReqDTO.getSkuId(), - updateQuantityReqDTO.getQuantity(), skuDTO.getQuantity()); - } - - /** - * 更新购物车商品是否选中 - * - * @param updateSelectedReqDTO 更新商品是否选中 DTO - */ - public void updateCartItemSelected(CartItemUpdateSelectedReqDTO updateSelectedReqDTO) { - cartService.updateCartItemSelected(updateSelectedReqDTO.getUserId(), - updateSelectedReqDTO.getSkuIds(), updateSelectedReqDTO.getSelected()); - } - - /** - * 删除购物车商品列表 - * - * @param deleteListReqDTO 删除商品列表 DTO - */ - public void deleteCartItems(CartItemDeleteListReqDTO deleteListReqDTO) { - cartService.deleteCartItems(deleteListReqDTO.getUserId(), - deleteListReqDTO.getSkuIds()); - } - - /** - * 查询用户在购物车中的商品数量 - * - * @param userId 用户编号 - * @return 商品数量 - */ - public Integer sumCartItemQuantity(Integer userId) { - return cartService.sumCartItemQuantity(userId); - } - - /** - * 查询用户在购物车种的商品列表 - * - * @param listReqDTO 查询条件 DTO - * @return 购物车中商品列表信息 - */ - public List listCartItems(CartItemListReqDTO listReqDTO) { - List cartItemBOs = cartService.listCartItems(CartConvert.INSTANCE.convert(listReqDTO)); - return CartConvert.INSTANCE.convertList02(cartItemBOs); - } - - /** - * 校验商品 SKU 是否合法 - * 1. 是否存在 - * 2. 是否下架 - * - * @param skuId 商品 SKU 编号 - * @return 商品 SKU 信息 - */ - private ProductSkuRespDTO checkProductSku(Integer skuId) { - CommonResult getProductSkuResult = productSkuFeign.getProductSku(skuId); - getProductSkuResult.checkError(); - ProductSkuRespDTO skuDTO = getProductSkuResult.getData(); - if (skuDTO == null || CommonStatusEnum.DISABLE.getValue().equals(skuDTO.getStatus())) { - throw ServiceExceptionUtil.exception(CARD_ITEM_SKU_NOT_FOUND); - } - return skuDTO; - } - -} diff --git a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/CartService.java b/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/CartService.java deleted file mode 100644 index 056834cfa..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/CartService.java +++ /dev/null @@ -1,136 +0,0 @@ -package cn.iocoder.mall.tradeservice.service.cart; - -import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; -import cn.iocoder.common.framework.util.CollectionUtils; -import cn.iocoder.mall.tradeservice.convert.cart.CartConvert; -import cn.iocoder.mall.tradeservice.dal.mysql.dataobject.cart.CartItemDO; -import cn.iocoder.mall.tradeservice.dal.mysql.mapper.cart.CartItemMapper; -import cn.iocoder.mall.tradeservice.service.cart.bo.CartItemAddBO; -import cn.iocoder.mall.tradeservice.service.cart.bo.CartItemBO; -import cn.iocoder.mall.tradeservice.service.cart.bo.CartItemListQueryBO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.util.Collection; -import java.util.List; - -import static cn.iocoder.mall.tradeservice.enums.OrderErrorCodeConstants.CARD_ITEM_NOT_FOUND; -import static cn.iocoder.mall.tradeservice.enums.OrderErrorCodeConstants.CARD_ITEM_SKU_QUANTITY_NOT_ENOUGH; - -/** - * 购物车 Service - */ -@Service -@Validated -public class CartService { - - @Autowired - private CartItemMapper cartItemMapper; - - /** - * 添加商品到购物车 - * - * @param addBO 添加商品信息 - * @param skuQuantity 商品 SKU 的库存,主要用于库存校验 - */ - public void addCartItem(@Valid CartItemAddBO addBO, Integer skuQuantity) { - // 查询 CartItemDO - CartItemDO itemDO = cartItemMapper.selectByUserIdAndSkuId(addBO.getUserId(), addBO.getSkuId()); - // 存在,则进行数量更新 - if (itemDO != null) { - if (addBO.getQuantity() + itemDO.getQuantity() > skuQuantity) { - // 校验库存 - throw ServiceExceptionUtil.exception(CARD_ITEM_SKU_QUANTITY_NOT_ENOUGH); - } - cartItemMapper.updateById(new CartItemDO().setId(itemDO.getId()).setSelected(true) - .setQuantity(addBO.getQuantity() + itemDO.getQuantity())); - return; - } - // 不存在,则进行插入 - if (addBO.getQuantity() > skuQuantity) { - // 校验库存 - throw ServiceExceptionUtil.exception(CARD_ITEM_SKU_QUANTITY_NOT_ENOUGH); - } - cartItemMapper.insert(CartConvert.INSTANCE.convert(addBO).setSelected(true)); - } - - /** - * 更新购物车商品数量 - * - * @param userId 用户编号 - * @param skuId 商品 SKU 编号 - * @param quantity 数量 - * @param skuQuantity 商品 SKU 的库存,主要用于库存校验 - */ - public void updateCartItemQuantity(Integer userId, Integer skuId, Integer quantity, Integer skuQuantity) { - if (quantity > skuQuantity) { - // 校验库存 - throw ServiceExceptionUtil.exception(CARD_ITEM_SKU_QUANTITY_NOT_ENOUGH); - } - // 查询 CartItemDO - CartItemDO itemDO = cartItemMapper.selectByUserIdAndSkuId(userId, skuId); - if (itemDO == null) { - throw ServiceExceptionUtil.exception(CARD_ITEM_NOT_FOUND); - } - // 更新数量 - cartItemMapper.updateById(new CartItemDO().setId(itemDO.getId()).setQuantity(quantity)); - } - - /** - * 更新购物车商品是否选中 - * - * @param userId 用户编号 - * @param skuIds 商品 SKU 编号数组 - * @param selected 是否选中 - */ - public void updateCartItemSelected(Integer userId, Collection skuIds, Boolean selected) { - // 查询 CartItemDO 列表 - List itemDOs = cartItemMapper.selectListByUserIdAndSkuIds(userId, skuIds); - if (skuIds.size() != itemDOs.size()) { - throw ServiceExceptionUtil.exception(CARD_ITEM_NOT_FOUND); - } - // 更新选中 - cartItemMapper.updateByIds(CollectionUtils.convertSet(itemDOs, CartItemDO::getId), - new CartItemDO().setSelected(selected)); - } - - /** - * 购物车删除商品 - * - * @param userId 用户编号 - * @param skuIds 商品 SKU 编号的数组 - */ - public void deleteCartItems(Integer userId, List skuIds) { - // 查询 CartItemDO 列表 - List itemDOs = cartItemMapper.selectListByUserIdAndSkuIds(userId, skuIds); - if (CollectionUtils.isEmpty(itemDOs)) { - return; - } - // 批量标记删除 - cartItemMapper.deleteBatchIds(CollectionUtils.convertSet(itemDOs, CartItemDO::getId)); - } - - /** - * 查询用户在购物车中的商品数量 - * - * @param userId 用户编号 - * @return 商品数量 - */ - public Integer sumCartItemQuantity(Integer userId) { - return cartItemMapper.selectSumQuantityByUserId(userId); - } - - /** - * 查询用户在购物车种的商品列表 - * - * @param queryBO 查询条件 BO - * @return 购物车中商品列表信息 - */ - public List listCartItems(CartItemListQueryBO queryBO) { - List cartItemDOs = cartItemMapper.selectList(queryBO); - return CartConvert.INSTANCE.convertList(cartItemDOs); - } - -} diff --git a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/bo/CartItemAddBO.java b/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/bo/CartItemAddBO.java deleted file mode 100644 index 20cc4c1c0..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/bo/CartItemAddBO.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.iocoder.mall.tradeservice.service.cart.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; - -/** - * 购物车添加购物项 Request DTO - */ -@Data -@Accessors(chain = true) -public class CartItemAddBO { - - /** - * 用户编号 - */ - @NotNull(message = "用户编号不能为空") - private Integer userId; - /** - * 商品 SPU 编号 - */ - @NotNull(message = "商品 SPU 编号不能为空") - private Integer spuId; - /** - * 商品 SKU 编号 - */ - @NotNull(message = "商品 SKU 编号不能为空") - private Integer skuId; - /** - * 数量 - */ - @NotNull(message = "数量不能为空") - @Min(message = "数量必须大于 0", value = 1L) - private Integer quantity; - -} diff --git a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/bo/CartItemBO.java b/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/bo/CartItemBO.java deleted file mode 100644 index d54c7f810..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/bo/CartItemBO.java +++ /dev/null @@ -1,65 +0,0 @@ -package cn.iocoder.mall.tradeservice.service.cart.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * 购物车的商品信息 BO - */ -@Data -@Accessors(chain = true) -public class CartItemBO { - - // ========= 基础字段 BEGIN ========= - - /** - * 编号,唯一自增。 - */ - private Integer id; - /** - * 是否选中 - */ - private Boolean selected; - - // ========= 基础字段 END ========= - - // ========= 买家信息 BEGIN ========= - - /** - * 用户编号 - */ - private Integer userId; - - // ========= 买家信息 END ========= - - // ========= 商品信息 BEGIN ========= - - /** - * 商品 SPU 编号 - */ - private Integer spuId; - /** - * 商品 SKU 编号 - */ - private Integer skuId; - /** - * 商品购买数量 - */ - private Integer quantity; - - // ========= 商品信息 END ========= - - // ========= 优惠信息 BEGIN ========= - -// /** -// * 商品营销活动编号 -// */ -// private Integer activityId; -// /** -// * 商品营销活动类型 -// */ -// private Integer activityType; - - // ========= 优惠信息 END ========= - -} diff --git a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/bo/CartItemListQueryBO.java b/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/bo/CartItemListQueryBO.java deleted file mode 100644 index dc934bc6b..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/cart/bo/CartItemListQueryBO.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.iocoder.mall.tradeservice.service.cart.bo; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; - -/** - * 购物车的商品信息查询 BO - */ -@Data -@Accessors(chain = true) -public class CartItemListQueryBO { - - /** - * 用户编号 - */ - @NotNull(message = "用户编号不能为空") - private Integer userId; - /** - * 是否选中 - */ - private Boolean selected; - -} diff --git a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/order/TradeOrderService.java b/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/order/TradeOrderService.java deleted file mode 100644 index 468f5e27b..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/order/TradeOrderService.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.iocoder.mall.tradeservice.service.order; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderCreateReqDTO; -import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderPageReqDTO; -import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderRespDTO; - -import java.util.Collection; - -/** - * 交易订单 Service 接口 - */ -public interface TradeOrderService { - - /** - * 创建交易订单 - * - * @param createReqDTO 订单信息 - * @return 订单编号 - */ - Integer createTradeOrder(TradeOrderCreateReqDTO createReqDTO); - - /** - * 获得订单交易 - * - * @param tradeOrderId 订单交易编号 - * @param fields 额外返回字段,可见 {@link cn.iocoder.mall.tradeservice.enums.order.TradeOrderDetailFieldEnum} - * @return 订单交易 - */ - TradeOrderRespDTO getTradeOrder(Integer tradeOrderId, Collection fields); - - /** - * 获得订单交易分页 - * - * @param pageReqDTO 订单交易分页查询 - * @return 订单交易分页结果 - */ - PageResult pageTradeOrder(TradeOrderPageReqDTO pageReqDTO); - - /** - * 更新交易订单支付成功 - * - * @param tradeOrderId 交易订单编号 - * @param payAmount 支付金额 - */ - void updateTradeOrderPaySuccess(Integer tradeOrderId, Integer payAmount); - -} diff --git a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/order/impl/TradeOrderServiceImpl.java b/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/order/impl/TradeOrderServiceImpl.java deleted file mode 100644 index f9eaaf24d..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/service/order/impl/TradeOrderServiceImpl.java +++ /dev/null @@ -1,279 +0,0 @@ -package cn.iocoder.mall.tradeservice.service.order.impl; - -import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; -import cn.iocoder.common.framework.util.CollectionUtils; -import cn.iocoder.common.framework.util.DateUtil; -import cn.iocoder.common.framework.util.MathUtil; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.payservice.rpc.transaction.dto.PayTransactionCreateReqDTO; -import cn.iocoder.mall.productservice.enums.sku.ProductSkuDetailFieldEnum; -import cn.iocoder.mall.productservice.rpc.sku.dto.ProductSkuRespDTO; -import cn.iocoder.mall.promotion.api.rpc.price.dto.PriceProductCalcReqDTO; -import cn.iocoder.mall.promotion.api.rpc.price.dto.PriceProductCalcRespDTO; -import cn.iocoder.mall.tradeservice.client.pay.PayTransactionClient; -import cn.iocoder.mall.tradeservice.client.product.ProductSkuClient; -import cn.iocoder.mall.tradeservice.client.promotion.CouponCardClient; -import cn.iocoder.mall.tradeservice.client.promotion.PriceClient; -import cn.iocoder.mall.tradeservice.client.user.UserAddressClient; -import cn.iocoder.mall.tradeservice.config.TradeBizProperties; -import cn.iocoder.mall.tradeservice.convert.order.TradeOrderConvert; -import cn.iocoder.mall.tradeservice.dal.mysql.dataobject.order.TradeOrderDO; -import cn.iocoder.mall.tradeservice.dal.mysql.dataobject.order.TradeOrderItemDO; -import cn.iocoder.mall.tradeservice.dal.mysql.mapper.order.TradeOrderItemMapper; -import cn.iocoder.mall.tradeservice.dal.mysql.mapper.order.TradeOrderMapper; -import cn.iocoder.mall.tradeservice.enums.logistics.LogisticsDeliveryTypeEnum; -import cn.iocoder.mall.tradeservice.enums.order.TradeOrderAfterSaleStatusEnum; -import cn.iocoder.mall.tradeservice.enums.order.TradeOrderDetailFieldEnum; -import cn.iocoder.mall.tradeservice.enums.order.TradeOrderStatusEnum; -import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderCreateReqDTO; -import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderPageReqDTO; -import cn.iocoder.mall.tradeservice.rpc.order.dto.TradeOrderRespDTO; -import cn.iocoder.mall.tradeservice.service.order.TradeOrderService; -import cn.iocoder.mall.userservice.rpc.address.dto.UserAddressRespDTO; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.*; -import java.util.stream.Collectors; - -import static cn.iocoder.common.framework.util.CollectionUtils.convertSet; -import static cn.iocoder.mall.tradeservice.enums.OrderErrorCodeConstants.*; -import static cn.iocoder.mall.userservice.enums.UserErrorCodeConstants.USER_ADDRESS_NOT_FOUND; - -/** - * 交易订单 Service 实现 - */ -@Service -public class TradeOrderServiceImpl implements TradeOrderService { - - @Autowired - private TradeOrderMapper tradeOrderMapper; - @Autowired - private TradeOrderItemMapper tradeOrderItemMapper; - - @Autowired // 注入自己,用于调用事务方法 - private TradeOrderServiceImpl self; - - @Autowired - private UserAddressClient userAddressClient; - @Autowired - private ProductSkuClient productSkuClient; - @Autowired - private PriceClient priceClient; - @Autowired - private CouponCardClient couponCardClient; - @Autowired - private PayTransactionClient payTransactionClient; - - @Autowired - private TradeBizProperties tradeBizProperties; - - @Override -// @GlobalTransactional TODO 芋艿,使用 seata 实现分布式事务 - public Integer createTradeOrder(TradeOrderCreateReqDTO createReqDTO) { - // 获得收件地址 - UserAddressRespDTO userAddressRespDTO = userAddressClient.getUserAddress(createReqDTO.getUserAddressId(), - createReqDTO.getUserId()); - if (userAddressRespDTO == null) { - throw ServiceExceptionUtil.exception(USER_ADDRESS_NOT_FOUND); - } - // 获得商品信息 - List listProductSkus = productSkuClient.listProductSkus( - convertSet(createReqDTO.getOrderItems(), TradeOrderCreateReqDTO.OrderItem::getSkuId), - ProductSkuDetailFieldEnum.SPU.getField()); - if (listProductSkus.size() != createReqDTO.getOrderItems().size()) { // 校验获得的数量,是否匹配 - throw ServiceExceptionUtil.exception(ORDER_GET_GOODS_INFO_INCORRECT); - } - // 价格计算 - PriceProductCalcRespDTO priceProductCalcRespDTO = priceClient.calcProductPrice(createReqDTO.getUserId(), - createReqDTO.getOrderItems().stream().map(orderItem -> new PriceProductCalcReqDTO.Item().setSkuId(orderItem.getSkuId()) - .setQuantity(orderItem.getQuantity()).setSelected(true)).collect(Collectors.toList()), - createReqDTO.getCouponCardId()); - - // TODO 芋艿,扣除库存 - - // 标记优惠劵已使用 - if (createReqDTO.getCouponCardId() != null) { - couponCardClient.useCouponCard(createReqDTO.getUserId(), createReqDTO.getCouponCardId()); - } - - // 创建交易订单(本地事务) - TradeOrderDO tradeOrderDO = self.createTradeOrder0(createReqDTO, listProductSkus, priceProductCalcRespDTO, userAddressRespDTO); - - // 创建支付订单,对接支付服务 - createPayTransaction(tradeOrderDO, createReqDTO, listProductSkus); - return tradeOrderDO.getId(); - } - - @Transactional - public TradeOrderDO createTradeOrder0(TradeOrderCreateReqDTO createReqDTO, List listProductSkus, - PriceProductCalcRespDTO priceProductCalcRespDTO, UserAddressRespDTO userAddressRespDTO) { - // 构建 TradeOrderDO 对象,并进行保存 - TradeOrderDO tradeOrderDO = new TradeOrderDO(); - // 1. 基本信息 - tradeOrderDO.setUserId(createReqDTO.getUserId()).setOrderNo(generateTradeOrderNo()) - .setOrderStatus(TradeOrderStatusEnum.WAITING_PAYMENT.getValue()).setRemark(createReqDTO.getRemark()); - // 2. 价格 + 支付基本信息 - tradeOrderDO.setBuyPrice(priceProductCalcRespDTO.getFee().getBuyTotal()) - .setDiscountPrice(priceProductCalcRespDTO.getFee().getDiscountTotal()) - .setLogisticsPrice(priceProductCalcRespDTO.getFee().getPostageTotal()) - .setPresentPrice(priceProductCalcRespDTO.getFee().getPresentTotal()) - .setPayPrice(0).setRefundPrice(0); - // 3. 收件 + 物流基本信息 - tradeOrderDO.setDeliveryType(LogisticsDeliveryTypeEnum.EXPRESS.getDeliveryType()) - .setReceiverName(userAddressRespDTO.getName()).setReceiverMobile(userAddressRespDTO.getMobile()) - .setReceiverAreaCode(userAddressRespDTO.getAreaCode()).setReceiverDetailAddress(userAddressRespDTO.getDetailAddress()); - // 4. 售后基本信息 - tradeOrderDO.setAfterSaleStatus(TradeOrderAfterSaleStatusEnum.NULL.getStatus()); - // 5. 营销基本信息 - tradeOrderDO.setCouponCardId(createReqDTO.getCouponCardId()); - // 最终保存 - tradeOrderMapper.insert(tradeOrderDO); - - // 创建 TradeOrderItemDO 数组,并进行保存 - List tradeOrderItemDOs = new ArrayList<>(listProductSkus.size()); - Map listProductSkuMap = CollectionUtils.convertMap(listProductSkus, ProductSkuRespDTO::getId); - Map priceItemMap = new HashMap<>(); // 商品 SKU 价格的映射 - priceProductCalcRespDTO.getItemGroups().forEach(itemGroup -> - itemGroup.getItems().forEach(item -> priceItemMap.put(item.getSkuId(), item))); - for (TradeOrderCreateReqDTO.OrderItem orderItem : createReqDTO.getOrderItems()) { - TradeOrderItemDO tradeOrderItemDO = new TradeOrderItemDO(); - tradeOrderItemDOs.add(tradeOrderItemDO); - // 1. 基本信息 - tradeOrderItemDO.setOrderId(tradeOrderDO.getId()).setStatus(tradeOrderDO.getOrderStatus()); - // 2. 商品基本信息 - ProductSkuRespDTO productSkuRespDTO = listProductSkuMap.get(orderItem.getSkuId()); - tradeOrderItemDO.setSpuId(productSkuRespDTO.getSpuId()).setSkuId(productSkuRespDTO.getId()) - .setSkuName(productSkuRespDTO.getSpu().getName()) - .setSkuImage(CollectionUtils.getFirst(productSkuRespDTO.getSpu().getPicUrls())) - .setQuantity(orderItem.getQuantity()); - // 3. 价格 + 支付基本信息 - PriceProductCalcRespDTO.Item priceItem = priceItemMap.get(orderItem.getSkuId()); - tradeOrderItemDO.setOriginPrice(priceItem.getOriginPrice()).setBuyPrice(priceItem.getBuyPrice()) - .setPresentPrice(priceItem.getPresentPrice()).setBuyTotal(priceItem.getBuyTotal()) - .setDiscountTotal(priceItem.getDiscountTotal()).setPresentTotal(priceItem.getPresentTotal()) - .setRefundTotal(0); - // 4. 物流基本信息 - // 5. 售后基本信息 - tradeOrderItemDO.setAfterSaleStatus(TradeOrderAfterSaleStatusEnum.NULL.getStatus()); - } - // 最终保存 - tradeOrderItemMapper.insertList(tradeOrderItemDOs); - - return tradeOrderDO; - } - - private void createPayTransaction(TradeOrderDO tradeOrderDO, TradeOrderCreateReqDTO createReqDTO, - List listProductSkus) { - // 创建支付单 - String orderSubject = listProductSkus.get(0).getSpu().getName(); - Date expireTime = DateUtil.addDate(Calendar.MINUTE, tradeBizProperties.getPayExpireTime()); - Integer payTransactionId = payTransactionClient.createPayTransaction( - new PayTransactionCreateReqDTO().setUserId(createReqDTO.getUserId()) - .setCreateIp(createReqDTO.getIp()).setAppId(tradeBizProperties.getPayAppId()) - .setOrderId(tradeOrderDO.getId().toString()).setExpireTime(expireTime) - .setPrice(tradeOrderDO.getPresentPrice()).setOrderSubject(orderSubject) - .setOrderMemo("测试备注") // TODO 芋艿,后面补充 - .setOrderDescription("测试描述") // TODO 芋艿,后面补充 - ); - - // 更新 - tradeOrderMapper.updateById(new TradeOrderDO().setId(tradeOrderDO.getId()).setPayTransactionId(payTransactionId)); - } - - private String generateTradeOrderNo() { -// wx -// 2014 -// 10 -// 27 -// 20 -// 09 -// 39 -// 5522657 -// a690389285100 - // 目前的算法 - // 时间序列,年月日时分秒 14 位 - // 纯随机,6 位 TODO 此处估计是会有问题的,后续在调整 - return DateUtil.format(new Date(), "yyyyMMddHHmmss") + // 时间序列 - MathUtil.random(100000, 999999) // 随机。为什么是这个范围,因为偷懒 - ; - } - - @Override - public TradeOrderRespDTO getTradeOrder(Integer tradeOrderId, Collection fields) { - // 查询交易订单 - TradeOrderDO tradeOrderDO = tradeOrderMapper.selectById(tradeOrderId); - if (tradeOrderDO == null) { - return null; - } - TradeOrderRespDTO tradeOrderRespDTO = TradeOrderConvert.INSTANCE.convert(tradeOrderDO); - // 查询交易订单项 - if (fields.contains(TradeOrderDetailFieldEnum.ITEM.getField())) { - List tradeOrderItemDOs = tradeOrderItemMapper.selectListByOrderIds( - Collections.singleton(tradeOrderDO.getId())); - tradeOrderRespDTO.setOrderItems(TradeOrderConvert.INSTANCE.convertList(tradeOrderItemDOs)); - } - // 返回 - return tradeOrderRespDTO; - } - - @Override - public PageResult pageTradeOrder(TradeOrderPageReqDTO pageReqDTO) { - // 查询交易订单分页 - IPage tradeOrderDOPage = tradeOrderMapper.selectPage(pageReqDTO); - PageResult pageResult = TradeOrderConvert.INSTANCE.convertPage(tradeOrderDOPage); - if (CollectionUtils.isEmpty(pageResult.getList())) { - return pageResult; - } - // 查询交易订单项们 - if (pageReqDTO.getFields().contains(TradeOrderDetailFieldEnum.ITEM.getField())) { - List tradeOrderItemDOs = tradeOrderItemMapper.selectListByOrderIds( - convertSet(tradeOrderDOPage.getRecords(), TradeOrderDO::getId)); - Map> tradeOrderItemDOMultiMap = CollectionUtils.convertMultiMap( - tradeOrderItemDOs, TradeOrderItemDO::getOrderId); - pageResult.getList().forEach(tradeOrderRespDTO -> tradeOrderRespDTO.setOrderItems( - TradeOrderConvert.INSTANCE.convertList(tradeOrderItemDOMultiMap.get(tradeOrderRespDTO.getId())))); - } - // 返回 - return pageResult; - } - - - @Override - @Transactional - public void updateTradeOrderPaySuccess(Integer tradeOrderId, Integer payAmount) { -// if (true) { -// throw new IllegalArgumentException("测试失败的情况"); -// } - // 校验交易订单,是否可以 - TradeOrderDO tradeOrderDO = tradeOrderMapper.selectById(tradeOrderId); - if (tradeOrderDO == null) { // 订单不存在 - throw ServiceExceptionUtil.exception(ORDER_NOT_EXISTENT); - } - if (!tradeOrderDO.getOrderStatus().equals(TradeOrderStatusEnum.WAITING_PAYMENT.getValue())) { // 状态不处于等待支付 - throw ServiceExceptionUtil.exception(ORDER_STATUS_NOT_WAITING_PAYMENT); - } - if (!tradeOrderDO.getPresentPrice().equals(payAmount)) { // 支付金额不正确 - throw ServiceExceptionUtil.exception(ORDER_PAY_AMOUNT_ERROR); - } - - // 更新 TradeOrderDO 状态为已支付,等待发货 - TradeOrderDO updateOrderObj = new TradeOrderDO().setId(tradeOrderId) - .setOrderStatus(TradeOrderStatusEnum.WAIT_SHIPMENT.getValue()) - .setPayPrice(payAmount) - .setPayTime(new Date()); - int updateCount = tradeOrderMapper.update(updateOrderObj, TradeOrderStatusEnum.WAITING_PAYMENT.getValue()); - if (updateCount <= 0) { - throw ServiceExceptionUtil.exception(ORDER_STATUS_NOT_WAITING_PAYMENT); - } - - // 更新 TradeOrderItemDO 状态为已支付,等待发货 - TradeOrderItemDO updateOrderItemObj = new TradeOrderItemDO() - .setStatus(TradeOrderStatusEnum.WAIT_SHIPMENT.getValue()); - tradeOrderItemMapper.updateListByOrderId(updateOrderItemObj, tradeOrderId, - TradeOrderStatusEnum.WAITING_PAYMENT.getValue()); - } - -} diff --git a/归档/trade-service-project/trade-service-app/src/main/resources/application-dev.yaml b/归档/trade-service-project/trade-service-app/src/main/resources/application-dev.yaml deleted file mode 100644 index a371d4a54..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/resources/application-dev.yaml +++ /dev/null @@ -1,21 +0,0 @@ -spring: - # 数据源配置项 - datasource: - url: jdbc:mysql://localhost:3306/mall_trade?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT - driver-class-name: com.mysql.jdbc.Driver - username: root - password: zhuyang - # Spring Cloud 配置项 - cloud: - nacos: - # Spring Cloud Nacos Discovery 配置项 - discovery: - server-addr: localhost:8848 # Nacos 服务器地址 - namespace: dev # Nacos 命名空间 - -# Dubbo 配置项 -dubbo: - # Dubbo 注册中心 - registry: - # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 diff --git a/归档/trade-service-project/trade-service-app/src/main/resources/application-local.yaml b/归档/trade-service-project/trade-service-app/src/main/resources/application-local.yaml deleted file mode 100644 index 99ebfb162..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/resources/application-local.yaml +++ /dev/null @@ -1,32 +0,0 @@ -spring: - # 数据源配置项 - datasource: - url: jdbc:mysql://localhost:3306/mall_trade?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT - driver-class-name: com.mysql.jdbc.Driver - username: root - password: zhuyang - # Spring Cloud 配置项 - cloud: - nacos: - # Spring Cloud Nacos Discovery 配置项 - discovery: - server-addr: localhost:8848 # Nacos 服务器地址 - namespace: dev # Nacos 命名空间 -# # Spring 主应用配置 -# main: -# lazy-initialization: true # 开启延迟加载,保证本地开发的性能 - -# Dubbo 配置项 -dubbo: - # Dubbo 注册中心 - registry: -# address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 - # Dubbo 服务提供者的配置 - provider: - tag: ${DUBBO_TAG} # Dubbo 路由分组 - -# MyBatis Plus 配置 -mybatis-plus: - configuration: - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 本地开发环境下,多打印 SQL 到控制台 diff --git a/归档/trade-service-project/trade-service-app/src/main/resources/application.yaml b/归档/trade-service-project/trade-service-app/src/main/resources/application.yaml deleted file mode 100644 index fe35cf834..000000000 --- a/归档/trade-service-project/trade-service-app/src/main/resources/application.yaml +++ /dev/null @@ -1,75 +0,0 @@ -spring: - # Application 的配置项 - application: - name: trade-service - # Profile 的配置项 - profiles: - active: local - -# MyBatis Plus 配置项 -mybatis-plus: - configuration: - map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。 - global-config: - db-config: - id-type: auto - logic-delete-value: 1 # 逻辑已删除值(默认为 1) - logic-not-delete-value: 0 # 逻辑未删除值(默认为 0) - mapper-locations: classpath*:mapper/*.xml - type-aliases-package: cn.iocoder.mall.tradeservice.dal.mysql.dataobject - -# Dubbo 配置项 -dubbo: - # Spring Cloud Alibaba Dubbo 专属配置 - cloud: - subscribed-services: '' # 设置订阅的应用列表,默认为 * 订阅所有应用 - # Dubbo 提供者的协议 - protocol: - name: dubbo - port: -1 - # Dubbo 提供服务的扫描基础包 - scan: - base-packages: cn.iocoder.mall.tradeservice.rpc - # Dubbo 服务提供者的配置 - provider: - filter: -exception - validation: true # 开启 Provider 参数校验 - version: 1.0.0 # 服务的版本号 - # Dubbo 服务消费者的配置 - consumer: - ErrorCodeRpc: - version: 1.0.0 - ProductSkuRpc: - version: 1.0.0 - UserAddressRpc: - version: 1.0.0 - PriceRpc: - version: 1.0.0 - CouponCardRpc: - version: 1.0.0 - PayTransactionRpc: - version: 1.0.0 - -# RocketMQ 配置项 -rocketmq: - name-server: localhost:9876 - producer: - group: ${spring.application.name}-producer-group - -# Actuator 监控配置项 -management: - server.port: 38084 # 独立端口,避免被暴露出去 - endpoints.web.exposure.include: '*' # 暴露所有监控端点 -server.port: ${management.server.port} # 设置使用 Actuator 的服务器端口,因为 RPC 服务不需要 Web 端口 - -# Mall 配置项 -mall: - # 错误码配置项对应 ErrorCodeProperties 配置类 - error-code: - group: ${spring.application.name} - constants-class: cn.iocoder.mall.tradeservice.enums.OrderErrorCodeConstants - -# 业务配置 -biz: - pay-app-id: POd4RC6a - pay-expire-time: 120 diff --git a/归档/user-service-project/pom.xml b/归档/user-service-project/pom.xml deleted file mode 100644 index f21e37c9f..000000000 --- a/归档/user-service-project/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - onemall - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - user-service-project - pom - 用户服务 - - user-service-api - user-service-app - - - - - - - cn.iocoder.mall - mall-dependencies - 1.0-SNAPSHOT - pom - import - - - - cn.iocoder.mall - common-framework - 1.0-SNAPSHOT - - - - cn.iocoder.mall - system-service-api - 1.0-SNAPSHOT - - - - - cn.iocoder.mall - user-service-api - 1.0-SNAPSHOT - - - - - diff --git a/归档/user-service-project/user-service-api/pom.xml b/归档/user-service-project/user-service-api/pom.xml deleted file mode 100644 index 955a736a4..000000000 --- a/归档/user-service-project/user-service-api/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - user-service-project - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - user-service-api - - - - cn.iocoder.mall - common-framework - - - - - javax.validation - validation-api - - - org.projectlombok - lombok - - - org.springframework.cloud - spring-cloud-openfeign-core - RELEASE - - - - - diff --git a/归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/enums/UserErrorCodeConstants.java b/归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/enums/UserErrorCodeConstants.java deleted file mode 100644 index f1d17e3d8..000000000 --- a/归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/enums/UserErrorCodeConstants.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.iocoder.mall.userservice.enums; - -import cn.iocoder.common.framework.exception.ErrorCode; - -/** - * 错误码枚举类 - * - * user-service 服务,使用 1-002-000-000 段 - */ -public interface UserErrorCodeConstants { - - // ========== 用户地址 ========== - ErrorCode USER_ADDRESS_NOT_FOUND = new ErrorCode(1001004000, "用户地址不存在!"); - ErrorCode USER_GET_ADDRESS_NOT_EXISTS = new ErrorCode(1001004001, "获取的地址不存在!"); - -} diff --git a/归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/UserFeign.java b/归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/UserFeign.java deleted file mode 100644 index 6a7a3545d..000000000 --- a/归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/UserFeign.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.iocoder.mall.userservice.rpc.user; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.userservice.rpc.user.dto.UserCreateReqDTO; -import cn.iocoder.mall.userservice.rpc.user.dto.UserPageReqDTO; -import cn.iocoder.mall.userservice.rpc.user.dto.UserRespDTO; -import cn.iocoder.mall.userservice.rpc.user.dto.UserUpdateReqDTO; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; - -import java.util.List; - -/** - * 用户短信验证码 Rpc 接口 - */ -@FeignClient("user-service") -public interface UserFeign { - @GetMapping("/user/manage/getUser") - public CommonResult getUser(@RequestParam("id") Integer id) ; - - @GetMapping("/user/manage/listUsers") - public CommonResult> listUsers(@RequestParam("userIds") List userIds) ; - - @PostMapping("/user/manage/createUserIfAbsent") - public CommonResult createUserIfAbsent(@RequestBody UserCreateReqDTO createDTO); - @PostMapping("/user/manage/updateUser") - public CommonResult updateUser(@RequestBody UserUpdateReqDTO updateDTO); - - @PostMapping("/user/manage/pageUser") - public CommonResult> pageUser(@RequestBody UserPageReqDTO pageDTO); -} diff --git a/归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/dto/UserCreateReqDTO.java b/归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/dto/UserCreateReqDTO.java deleted file mode 100644 index 4f7e0f924..000000000 --- a/归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/dto/UserCreateReqDTO.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.iocoder.mall.userservice.rpc.user.dto; - -import cn.iocoder.common.framework.validator.Mobile; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - * 用户创建 Request DTO - */ -@Data -@Accessors(chain = true) -public class UserCreateReqDTO implements Serializable { - - /** - * 手机号 - */ - @NotNull(message = "手机号不能为空") - @Mobile(message = "手机格式不正确") - private String mobile; - /** - * 密码 - * - * 允许为空,自动生成 - */ - private String password; - /** - * IP - */ - @NotNull(message = "IP 不能为空") - private String ip; - -} diff --git a/归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/dto/UserPageReqDTO.java b/归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/dto/UserPageReqDTO.java deleted file mode 100644 index 8a6ee3d13..000000000 --- a/归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/dto/UserPageReqDTO.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.userservice.rpc.user.dto; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.common.framework.vo.PageParam; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** -* 用户分页 Request DTO -*/ -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class UserPageReqDTO extends PageParam { - - /** - * 昵称,模糊匹配 - */ - private String nickname; - /** - * 状态 - */ - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - -} diff --git a/归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/dto/UserRespDTO.java b/归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/dto/UserRespDTO.java deleted file mode 100644 index 02ab476d9..000000000 --- a/归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/dto/UserRespDTO.java +++ /dev/null @@ -1,44 +0,0 @@ -package cn.iocoder.mall.userservice.rpc.user.dto; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; - -/** - * 用户信息 Response DTO - */ -@Data -@Accessors(chain = true) -public class UserRespDTO implements Serializable { - - /** - * 用户编号 - */ - private Integer id; - /** - * 手机号 - */ - private String mobile; - /** - * 昵称 - */ - private String nickname; - /** - * 头像 - */ - private String avatar; - /** - * 用户状态 - * - * 枚举 {@link CommonStatusEnum} - */ - private Integer status; - /** - * 注册时间 - */ - private Date createTime; - -} diff --git a/归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/dto/UserUpdateReqDTO.java b/归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/dto/UserUpdateReqDTO.java deleted file mode 100644 index a41a0729a..000000000 --- a/归档/user-service-project/user-service-api/src/main/java/cn/iocoder/mall/userservice/rpc/user/dto/UserUpdateReqDTO.java +++ /dev/null @@ -1,47 +0,0 @@ -package cn.iocoder.mall.userservice.rpc.user.dto; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.common.framework.validator.Mobile; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** -* 用户更新 Request DTO -*/ -@Data -@Accessors(chain = true) -public class UserUpdateReqDTO implements Serializable { - - /** - * 用户编号 - */ - @NotNull(message = "用户编号不能为空") - private Integer id; - /** - * 昵称 - */ - private String nickname; - /** - * 头像 - */ - private String avatar; - /** - * 状态 - */ - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - /** - * 手机号 - */ - @Mobile - private String mobile; - /** - * 加密后的密码 - */ - private String password; - -} diff --git a/归档/user-service-project/user-service-app/pom.xml b/归档/user-service-project/user-service-app/pom.xml deleted file mode 100644 index 230f662c6..000000000 --- a/归档/user-service-project/user-service-app/pom.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - user-service-project - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - user-service-app - - - - cn.iocoder.mall - mall-spring-boot-starter-dubbo - - - - - cn.iocoder.mall - system-service-api - - - - - cn.iocoder.mall - user-service-api - - - - - org.springframework.boot - spring-boot-starter-web - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - - - mysql - mysql-connector-java - - - - org.springframework - spring-tx - - - org.springframework - spring-jdbc - - - com.alibaba - druid-spring-boot-starter - - - - cn.iocoder.mall - mall-spring-boot-starter-mybatis - - - - - org.springframework.boot - spring-boot-starter-actuator - - - - - org.springframework.boot - spring-boot-starter-validation - - - - org.projectlombok - lombok - - - - org.mapstruct - mapstruct - - - org.mapstruct - mapstruct-jdk8 - - - - - - - ${project.artifactId} - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - diff --git a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/UserServiceApplication.java b/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/UserServiceApplication.java deleted file mode 100644 index 18017dc4d..000000000 --- a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/UserServiceApplication.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.iocoder.mall.userservice; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.cloud.openfeign.EnableFeignClients; - -@SpringBootApplication -@EnableFeignClients(basePackages = {"cn.iocoder.mall.systemservice.rpc"}) -@EnableDiscoveryClient -public class UserServiceApplication { - - public static void main(String[] args) { - SpringApplication.run(UserServiceApplication.class, args); - } - -} diff --git a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/controller/UserManageController.java b/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/controller/UserManageController.java deleted file mode 100644 index f43ec9e91..000000000 --- a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/controller/UserManageController.java +++ /dev/null @@ -1,50 +0,0 @@ -package cn.iocoder.mall.userservice.controller; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.userservice.manager.user.UserManager; -import cn.iocoder.mall.userservice.rpc.user.dto.UserCreateReqDTO; -import cn.iocoder.mall.userservice.rpc.user.dto.UserPageReqDTO; -import cn.iocoder.mall.userservice.rpc.user.dto.UserRespDTO; -import cn.iocoder.mall.userservice.rpc.user.dto.UserUpdateReqDTO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -@RestController -@RequestMapping("/user/manage") -public class UserManageController { - - @Autowired - private UserManager userManager; - - @GetMapping("getUser") - public CommonResult getUser(@RequestParam("id") Integer id) { - return success(userManager.getUser(id)); - } - - @GetMapping("listUsers") - public CommonResult> listUsers(@RequestParam("userIds") List userIds) { - return success(userManager.listUsers(userIds)); - } - - @PostMapping("createUserIfAbsent") - public CommonResult createUserIfAbsent(@RequestBody UserCreateReqDTO createDTO) { - return success(userManager.createUserIfAbsent(createDTO)); - } - - @PostMapping("updateUser") - public CommonResult updateUser(@RequestBody UserUpdateReqDTO updateDTO) { - userManager.updateUser(updateDTO); - return success(true); - } - - @PostMapping("pageUser") - public CommonResult> pageUser(@RequestBody UserPageReqDTO pageDTO) { - return success(userManager.pageUser(pageDTO)); - } - -} \ No newline at end of file diff --git a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/sms/UserSmsCodeDO.java b/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/sms/UserSmsCodeDO.java deleted file mode 100644 index 8b459b98a..000000000 --- a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/sms/UserSmsCodeDO.java +++ /dev/null @@ -1,62 +0,0 @@ -package cn.iocoder.mall.userservice.dal.mysql.dataobject.sms; - -import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; -import cn.iocoder.mall.userservice.enums.sms.UserSmsSceneEnum; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.util.Date; - -/** - * 手机验证码 DO - * - * idx_mobile 索引:基于 {@link #mobile} 字段 - */ -@TableName("user_sms_code") -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class UserSmsCodeDO extends BaseDO { - - /** - * 编号 - */ - private Integer id; - /** - * 手机号 - */ - private String mobile; - /** - * 验证码 - */ - private String code; - /** - * 发送场景 - * - * 外键 {@link UserSmsSceneEnum} - */ - private Integer scene; - /** - * 创建 IP - */ - private String createIp; - /** - * 今日发送的第几条 - */ - private Integer todayIndex; - /** - * 是否使用 - */ - private Boolean used; - /** - * 使用时间 - */ - private Date usedTime; - /** - * 使用 IP - */ - private String usedIp; - -} diff --git a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/user/UserDO.java b/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/user/UserDO.java deleted file mode 100644 index 0a9254b79..000000000 --- a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/user/UserDO.java +++ /dev/null @@ -1,57 +0,0 @@ -package cn.iocoder.mall.userservice.dal.mysql.dataobject.user; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - * 用户实体 - * - * uk_mobile 索引:基于 {@link #mobile} 字段 - */ -@TableName(value = "users") -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class UserDO extends BaseDO { - - /** - * 用户编号 - */ - private Integer id; - /** - * 昵称 - */ - private String nickname; - /** - * 头像 - */ - private String avatar; - /** - * 用户状态 - * - * 枚举 {@link CommonStatusEnum} - */ - private Integer status; - - /** - * 手机 - */ - private String mobile; - /** - * 经过加密的密码串 - */ - private String password; - /** - * {@link #password} 的盐 - */ - private String passwordSalt; - /** - * 注册 IP - */ - private String createIp; - -} diff --git a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/user/UserThirdAuthDO.java b/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/user/UserThirdAuthDO.java deleted file mode 100644 index feb3fa5c7..000000000 --- a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/dataobject/user/UserThirdAuthDO.java +++ /dev/null @@ -1,73 +0,0 @@ -package cn.iocoder.mall.userservice.dal.mysql.dataobject.user; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; - -/** - * 用户三方开放平台授权,例如:QQ / 微博 / 微信等等。 - * - * TODO 优化点:需要在改改 - */ -@Data -@Accessors(chain = true) -public class UserThirdAuthDO { - - /** - * 用户编号 - * - * 外键 {@link UserDO#uid} - */ - private Long uid; - - // ========== 授权相关字段 - - /** - * 用户的唯一标识 - */ - private String openid; - /** - * 开放平台 - * - * @see cn.iocoder.mall.user.api.constant.ThirdPlatformConstant - */ - private Integer platform; - /** - * 访问令牌 - */ - private Date accessToken; - /** - * 过期时间 - */ - private Date expireTime; - /** - * 刷新令牌 - */ - private Date refreshToken; - /** - * 授权范围。一般情况下,使用逗号分隔 - */ - private String scopes; - - // ========== 基础信息 - /** - * 用户昵称 - */ - private String nickname; - /** - * 性别 - * - * TODO 芋艿,找地方统一枚举。0-未知,1-男,2-女 - */ - private Integer gender; - // TODO https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140842 - // TODO 芋艿,其他字段,国家/省份/城市/地区等 - // TODO 芋艿,头像 - // TODO 芋艿,微信独有 unionid - /** - * 统一存储基础信息,使用 JSON 格式化,避免未有效解析的情况。 - */ - private String extras; - -} diff --git a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/address/UserAddressMapper.java b/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/address/UserAddressMapper.java deleted file mode 100644 index 83dbff4a7..000000000 --- a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/address/UserAddressMapper.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.mall.userservice.dal.mysql.mapper.address; - -import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; -import cn.iocoder.mall.userservice.dal.mysql.dataobject.address.UserAddressDO; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.springframework.stereotype.Repository; - -import javax.annotation.Nullable; -import java.util.List; - -@Repository -public interface UserAddressMapper extends BaseMapper { - - default List selectListByUserIdAndType(Integer userId, @Nullable Integer type) { - return selectList(new QueryWrapperX().eq("user_id", userId) - .eqIfPresent("type", type)); - } - -} diff --git a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/sms/UserSmsCodeMapper.java b/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/sms/UserSmsCodeMapper.java deleted file mode 100644 index 6a02b2c64..000000000 --- a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/sms/UserSmsCodeMapper.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.iocoder.mall.userservice.dal.mysql.mapper.sms; - -import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; -import cn.iocoder.mall.userservice.dal.mysql.dataobject.sms.UserSmsCodeDO; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.springframework.stereotype.Repository; - -@Repository -public interface UserSmsCodeMapper extends BaseMapper { - - /** - * 获得手机号的最后一个手机验证码 - * - * @param mobile 手机号 - * @param scene 发送场景,选填 - * @return 手机验证码 - */ - default UserSmsCodeDO selectLastByMobile(String mobile, Integer scene) { - QueryWrapperX query = new QueryWrapperX() - .eq("mobile", mobile) - .eqIfPresent("scene", scene) - .orderByDesc("id") - .last("limit 1"); - return selectOne(query); - } - -} diff --git a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/user/UserMapper.java b/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/user/UserMapper.java deleted file mode 100644 index 2ee8c9820..000000000 --- a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/dal/mysql/mapper/user/UserMapper.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.iocoder.mall.userservice.dal.mysql.mapper.user; - -import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; -import cn.iocoder.mall.userservice.dal.mysql.dataobject.user.UserDO; -import cn.iocoder.mall.userservice.service.user.bo.UserPageBO; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.stereotype.Repository; - -@Repository -public interface UserMapper extends BaseMapper { - - default UserDO selectByMobile(String mobile) { - return selectOne(new QueryWrapper() - .eq("mobile", mobile) - ); - } - - default IPage selectPage(UserPageBO pageBO) { - return selectPage(new Page<>(pageBO.getPageNo(), pageBO.getPageSize()), - new QueryWrapperX().likeIfPresent("nickname", pageBO.getNickname()) - .eqIfPresent("status", pageBO.getStatus())); - } - -} diff --git a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/manager/sms/UserSmsCodeManager.java b/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/manager/sms/UserSmsCodeManager.java deleted file mode 100644 index 76ac53a28..000000000 --- a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/manager/sms/UserSmsCodeManager.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.iocoder.mall.userservice.manager.sms; - -import cn.iocoder.mall.userservice.rpc.sms.dto.UserSendSmsCodeReqDTO; -import cn.iocoder.mall.userservice.rpc.sms.dto.UserVerifySmsCodeReqDTO; -import cn.iocoder.mall.userservice.service.sms.UserSmsCodeService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class UserSmsCodeManager { - - @Autowired - private UserSmsCodeService userSmsCodeService; - - public void sendSmsCode(UserSendSmsCodeReqDTO sendSmsCodeDTO) { - // 生成短信验证码 - String smsCode = userSmsCodeService.createSmsCode(sendSmsCodeDTO.getMobile(), - sendSmsCodeDTO.getScene(), sendSmsCodeDTO.getIp()); - // TODO 调用发送验证码 - } - - public void verifySmsCode(UserVerifySmsCodeReqDTO verifySmsCodeDTO) { - userSmsCodeService.verifySmsCode(verifySmsCodeDTO.getMobile(), verifySmsCodeDTO.getCode(), - verifySmsCodeDTO.getScene(), verifySmsCodeDTO.getIp()); - } - -} diff --git a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/manager/user/UserManager.java b/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/manager/user/UserManager.java deleted file mode 100644 index e77a5e3f3..000000000 --- a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/manager/user/UserManager.java +++ /dev/null @@ -1,91 +0,0 @@ -package cn.iocoder.mall.userservice.manager.user; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.enums.UserTypeEnum; -import cn.iocoder.common.framework.util.StringUtils; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.systemservice.rpc.oauth.OAuthFeign; -import cn.iocoder.mall.systemservice.rpc.oauth.dto.OAuth2RemoveTokenByUserReqDTO; -import cn.iocoder.mall.userservice.convert.user.UserConvert; -import cn.iocoder.mall.userservice.rpc.user.dto.UserCreateReqDTO; -import cn.iocoder.mall.userservice.rpc.user.dto.UserPageReqDTO; -import cn.iocoder.mall.userservice.rpc.user.dto.UserRespDTO; -import cn.iocoder.mall.userservice.rpc.user.dto.UserUpdateReqDTO; -import cn.iocoder.mall.userservice.service.user.UserService; -import cn.iocoder.mall.userservice.service.user.bo.UserBO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -@Service -public class UserManager { - - @Autowired - private UserService userService; - - - @Autowired - private OAuthFeign oAuthFeign; - - public UserRespDTO createUserIfAbsent(UserCreateReqDTO createDTO) { - // 用户已经存在 - UserBO userBO = userService.getUser(createDTO.getMobile()); - if (userBO != null) { - return UserConvert.INSTANCE.convert(userBO); - } - // 用户不存在,则进行创建 - userBO = userService.createUser(UserConvert.INSTANCE.convert(createDTO)); - return UserConvert.INSTANCE.convert(userBO); - } - - /** - * 更新用户 - * - * @param updateDTO 更新用户 DTO - */ - public void updateUser(UserUpdateReqDTO updateDTO) { - // 更新管理员信息 - userService.updateUser(UserConvert.INSTANCE.convert(updateDTO)); - // 如果修改密码,或者禁用管理员 - if (StringUtils.hasText(updateDTO.getPassword()) - || CommonStatusEnum.DISABLE.getValue().equals(updateDTO.getStatus())) { - oAuthFeign.removeToken(new OAuth2RemoveTokenByUserReqDTO().setUserId(updateDTO.getId()) - .setUserType(UserTypeEnum.ADMIN.getValue())); - } - } - - /** - * 获得用户 - * - * @param userId 用户编号 - * @return 用户 - */ - public UserRespDTO getUser(Integer userId) { - UserBO userBO = userService.getUser(userId); - return UserConvert.INSTANCE.convert(userBO); - } - - /** - * 获得用户列表 - * - * @param userIds 用户编号列表 - * @return 用户列表 - */ - public List listUsers(List userIds) { - List userBOs = userService.listUsers(userIds); - return UserConvert.INSTANCE.convertList02(userBOs); - } - - /** - * 获得用户分页 - * - * @param pageDTO 用户分页查询 - * @return 用户分页结果 - */ - public PageResult pageUser(UserPageReqDTO pageDTO) { - PageResult pageResultBO = userService.pageUser(UserConvert.INSTANCE.convert(pageDTO)); - return UserConvert.INSTANCE.convertPage(pageResultBO); - } - -} diff --git a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/sms/UserSmsCodeService.java b/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/sms/UserSmsCodeService.java deleted file mode 100644 index e3e627c45..000000000 --- a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/sms/UserSmsCodeService.java +++ /dev/null @@ -1,105 +0,0 @@ -package cn.iocoder.mall.userservice.service.sms; - -import cn.iocoder.common.framework.exception.ServiceException; -import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; -import cn.iocoder.common.framework.validator.Mobile; -import cn.iocoder.mall.userservice.dal.mysql.dataobject.sms.UserSmsCodeDO; -import cn.iocoder.mall.userservice.dal.mysql.mapper.sms.UserSmsCodeMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import java.util.Date; - -import static cn.iocoder.mall.userservice.enums.UserErrorCodeConstants.*; - -@Service -@Validated -public class UserSmsCodeService { - - /** - * 每条验证码的过期时间,单位:毫秒 - */ - @Value("${modules.user-sms-code-service.code-expire-time-millis}") - private int codeExpireTimes; - /** - * 每日发送最大数量 - */ - @Value("${modules.user-sms-code-service.send-maximum-quantity-per-day}") - private int sendMaximumQuantityPerDay; - /** - * 短信发送频率,单位:毫秒 - */ - @Value("${modules.user-sms-code-service.send-frequency}") - private int sendFrequency; - - @Autowired - private UserSmsCodeMapper userSmsCodeMapper; - - /** - * 创建短信验证码,并返回它 - * - * 注意,不包括发送逻辑 - * - * @param mobile 手机号 - * @param scene 发送场景 - * @param ip IP - * @return 短信验证码 - */ - public String createSmsCode(@Mobile String mobile, Integer scene, String ip) { - // 校验是否可以发送验证码,不用筛选场景 - UserSmsCodeDO lastUserSmsCodeDO = userSmsCodeMapper.selectLastByMobile(mobile, null); - if (lastUserSmsCodeDO != null) { - if (lastUserSmsCodeDO.getTodayIndex() >= sendMaximumQuantityPerDay) { // 超过当天发送的上限。 - throw ServiceExceptionUtil.exception(USER_SMS_CODE_EXCEED_SEND_MAXIMUM_QUANTITY_PER_DAY); - } - if (System.currentTimeMillis() - lastUserSmsCodeDO.getCreateTime().getTime() < sendFrequency) { // 发送过于频繁 - throw ServiceExceptionUtil.exception(USER_SMS_CODE_SEND_TOO_FAST); - } - // TODO 提升,每个 IP 每天可发送数量 - // TODO 提升,每个 IP 每小时可发送数量 - } - // 创建验证码记录 - UserSmsCodeDO newMobileCodePO = new UserSmsCodeDO().setMobile(mobile) - .setCode("9999") // TODO 芋艿,随机 4 位验证码 or 6 位验证码 - .setScene(scene) - .setTodayIndex(lastUserSmsCodeDO != null ? lastUserSmsCodeDO.getTodayIndex() : 1) - .setCreateIp(ip).setUsed(false); - newMobileCodePO.setCreateTime(new Date()); - userSmsCodeMapper.insert(newMobileCodePO); - return newMobileCodePO.getCode(); - } - - /** - * 验证短信验证码是否正确。 - * 如果正确,则将验证码标记成已使用 - * 如果错误,则抛出 {@link ServiceException} 异常 - * - * @param mobile 手机号 - * @param code 验证码 - * @param scene 发送场景 - * @param ip IP - */ - public void verifySmsCode(String mobile, String code, Integer scene, String ip) { - // 校验验证码 - UserSmsCodeDO mobileCodeDO = userSmsCodeMapper.selectLastByMobile(mobile, scene); - if (mobileCodeDO == null) { // 若验证码不存在,抛出异常 - throw ServiceExceptionUtil.exception(USER_SMS_CODE_NOT_FOUND); - } - if (System.currentTimeMillis() - mobileCodeDO.getCreateTime().getTime() >= codeExpireTimes) { // 验证码已过期 - throw ServiceExceptionUtil.exception(USER_SMS_CODE_EXPIRED); - } - if (mobileCodeDO.getUsed()) { // 验证码已使用 - throw ServiceExceptionUtil.exception(USER_SMS_CODE_USED); - } - if (!mobileCodeDO.getCode().equals(code)) { - throw ServiceExceptionUtil.exception(USER_SMS_CODE_NOT_CORRECT); - } - // 使用验证码 - UserSmsCodeDO updateObj = new UserSmsCodeDO().setId(mobileCodeDO.getId()) - .setUsed(true).setUsedTime(new Date()).setUsedIp(ip); - userSmsCodeMapper.updateById(updateObj); - } - -} diff --git a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/UserService.java b/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/UserService.java deleted file mode 100644 index 2e326e5fd..000000000 --- a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/UserService.java +++ /dev/null @@ -1,117 +0,0 @@ -package cn.iocoder.mall.userservice.service.user; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; -import cn.iocoder.common.framework.util.DigestUtils; -import cn.iocoder.common.framework.util.StringUtils; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.userservice.convert.user.UserConvert; -import cn.iocoder.mall.userservice.dal.mysql.dataobject.user.UserDO; -import cn.iocoder.mall.userservice.dal.mysql.mapper.user.UserMapper; -import cn.iocoder.mall.userservice.service.user.bo.UserBO; -import cn.iocoder.mall.userservice.service.user.bo.UserCreateBO; -import cn.iocoder.mall.userservice.service.user.bo.UserPageBO; -import cn.iocoder.mall.userservice.service.user.bo.UserUpdateBO; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; - -import static cn.iocoder.mall.userservice.enums.UserErrorCodeConstants.*; - -@Service -public class UserService { - - @Autowired - private UserMapper userMapper; - - public UserBO getUser(Integer id) { - UserDO userDO = userMapper.selectById(id); - return UserConvert.INSTANCE.convert(userDO); - } - - /** - * 获得用户列表 - * - * @param userIds 用户编号列表 - * @return 用户列表 - */ - public List listUsers(List userIds) { - List userDOs = userMapper.selectBatchIds(userIds); - return UserConvert.INSTANCE.convertList(userDOs); - } - - public UserBO getUser(String mobile) { - UserDO userDO = userMapper.selectByMobile(mobile); - return UserConvert.INSTANCE.convert(userDO); - } - - public UserBO createUser(UserCreateBO createBO) { - UserDO userDO = UserConvert.INSTANCE.convert(createBO) - .setStatus(CommonStatusEnum.ENABLE.getValue()); - // 加密密码 - String passwordSalt = genPasswordSalt(); - String password = createBO.getPassword(); - if (!StringUtils.hasText(password)) { - password = genPassword(); - } - password = encodePassword(password, passwordSalt); - userDO.setPassword(password).setPasswordSalt(passwordSalt); - // 保存用户 - userMapper.insert(userDO); - return UserConvert.INSTANCE.convert(userDO); - } - - public void updateUser(UserUpdateBO updateBO) { - // 校验用户存在 - UserDO userDO = userMapper.selectById(updateBO.getId()); - if (userDO == null) { - throw ServiceExceptionUtil.exception(USER_NOT_EXISTS); - } - // 校验手机唯一 - if (StringUtils.hasText(updateBO.getMobile())) { - UserDO mobileAdmin = userMapper.selectByMobile(updateBO.getMobile()); - if (mobileAdmin != null && !mobileAdmin.getId().equals(updateBO.getId())) { - throw ServiceExceptionUtil.exception(USER_MOBILE_EXISTS); - } - } - // 如果有更新状态,则校验是否已经是该状态 - if (updateBO.getStatus() != null && updateBO.getStatus().equals(userDO.getStatus())) { - throw ServiceExceptionUtil.exception(USER_STATUS_EQUALS); - } - // 更新到数据库 - UserDO updateUser = UserConvert.INSTANCE.convert(updateBO); - // 如果更新密码,需要特殊加密 - if (StringUtils.hasText(updateBO.getPassword())) { - String passwordSalt = genPasswordSalt(); - String password = encodePassword(updateBO.getPassword(), passwordSalt); - updateUser.setPassword(password).setPasswordSalt(passwordSalt); - } - userMapper.updateById(updateUser); - } - - /** - * 获得用户分页 - * - * @param pageBO 用户分页查询 - * @return 用户分页结果 - */ - public PageResult pageUser(UserPageBO pageBO) { - IPage userDOPage = userMapper.selectPage(pageBO); - return UserConvert.INSTANCE.convertPage(userDOPage); - } - - private String genPasswordSalt() { - return DigestUtils.genBcryptSalt(); - } - - private String genPassword() { - return StringUtils.uuid(true); - } - - private String encodePassword(String password, String salt) { - return DigestUtils.bcrypt(password, salt); - } - -} diff --git a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/bo/UserBO.java b/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/bo/UserBO.java deleted file mode 100644 index 95647520d..000000000 --- a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/bo/UserBO.java +++ /dev/null @@ -1,51 +0,0 @@ -package cn.iocoder.mall.userservice.service.user.bo; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; - -/** - * 用户信息 - */ -@Data -@Accessors(chain = true) -public class UserBO { - - /** - * 用户编号 - */ - private Integer id; - /** - * 昵称 - */ - private String nickname; - /** - * 头像 - */ - private String avatar; - /** - * 用户状态 - * - * 枚举 {@link CommonStatusEnum} - */ - private Integer status; - /** - * 手机 - */ - private String mobile; - /** - * 经过加密的密码串 - */ - private String password; - /** - * {@link #password} 的盐 - */ - private String passwordSalt; - /** - * 注册时间 - */ - private Date createTime; - -} diff --git a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/bo/UserCreateBO.java b/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/bo/UserCreateBO.java deleted file mode 100644 index 6771d4d5d..000000000 --- a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/bo/UserCreateBO.java +++ /dev/null @@ -1,41 +0,0 @@ -package cn.iocoder.mall.userservice.service.user.bo; - -import cn.iocoder.common.framework.validator.Mobile; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; - -/** - * 用户创建 BO - */ -@Data -@Accessors(chain = true) -public class UserCreateBO { - - /** - * 昵称,允许空 - */ - private String nickname; - /** - * 头像,允许空 - */ - private String avatar; - /** - * 手机 - */ - @NotNull(message = "手机号不能为空") - @Mobile - private String mobile; - /** - * 原始密码,允许空 - * - * 当为空时,会自动进行生成 - */ - private String password; - /** - * IP 地址 - */ - private String createIp; - -} diff --git a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/bo/UserPageBO.java b/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/bo/UserPageBO.java deleted file mode 100644 index ad244cc9f..000000000 --- a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/bo/UserPageBO.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.mall.userservice.service.user.bo; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.common.framework.vo.PageParam; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** -* 用户分页 BO -*/ -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class UserPageBO extends PageParam { - - /** - * 昵称 - * - * 模糊 - */ - private String nickname; - /** - * 状态 - */ - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - -} diff --git a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/bo/UserUpdateBO.java b/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/bo/UserUpdateBO.java deleted file mode 100644 index 2480ebdb7..000000000 --- a/归档/user-service-project/user-service-app/src/main/java/cn/iocoder/mall/userservice/service/user/bo/UserUpdateBO.java +++ /dev/null @@ -1,46 +0,0 @@ -package cn.iocoder.mall.userservice.service.user.bo; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.common.framework.validator.Mobile; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; - -/** -* 用户更新 BO -*/ -@Data -@Accessors(chain = true) -public class UserUpdateBO { - - /** - * 用户编号 - */ - @NotNull(message = "用户编号不能为空") - private Integer id; - /** - * 昵称 - */ - private String nickname; - /** - * 头像 - */ - private String avatar; - /** - * 状态 - */ - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - /** - * 手机号 - */ - @Mobile - private String mobile; - /** - * 密码 - */ - private String password; - -} diff --git a/归档/user-service-project/user-service-app/src/main/resources/application-dev.yaml b/归档/user-service-project/user-service-app/src/main/resources/application-dev.yaml deleted file mode 100644 index 32a4152b1..000000000 --- a/归档/user-service-project/user-service-app/src/main/resources/application-dev.yaml +++ /dev/null @@ -1,21 +0,0 @@ -spring: - # 数据源配置项 - datasource: - url: jdbc:mysql://localhost:3306/mall_user?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT - driver-class-name: com.mysql.jdbc.Driver - username: root - password: zhuyang - # Spring Cloud 配置项 - cloud: - nacos: - # Spring Cloud Nacos Discovery 配置项 - discovery: - server-addr: localhost:8848 # Nacos 服务器地址 - namespace: dev # Nacos 命名空间 - -# Dubbo 配置项 -dubbo: - # Dubbo 注册中心 - registry: - # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 diff --git a/归档/user-service-project/user-service-app/src/main/resources/application-local.yaml b/归档/user-service-project/user-service-app/src/main/resources/application-local.yaml deleted file mode 100644 index 85a689310..000000000 --- a/归档/user-service-project/user-service-app/src/main/resources/application-local.yaml +++ /dev/null @@ -1,24 +0,0 @@ -spring: - # 数据源配置项 - datasource: - url: jdbc:mysql://localhost:3306/mall_user?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT - driver-class-name: com.mysql.jdbc.Driver - username: root - password: zhuyang - # Spring Cloud 配置项 - cloud: - nacos: - # Spring Cloud Nacos Discovery 配置项 - discovery: - server-addr: localhost:8848 # Nacos 服务器地址 - namespace: dev # Nacos 命名空间 - -# Dubbo 配置项 -dubbo: - # Dubbo 注册中心 - registry: -# address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 - # Dubbo 服务提供者的配置 - provider: - tag: ${DUBBO_TAG} # Dubbo 路由分组 diff --git a/归档/user-service-project/user-service-app/src/main/resources/application.properties b/归档/user-service-project/user-service-app/src/main/resources/application.properties deleted file mode 100644 index 6d7892da2..000000000 --- a/归档/user-service-project/user-service-app/src/main/resources/application.properties +++ /dev/null @@ -1,5 +0,0 @@ -##################### 业务模块 ##################### -## UserSmsCodeService -modules.user-sms-code-service.code-expire-time-millis = 600000 -modules.user-sms-code-service.send-maximum-quantity-per-day = 10 -modules.user-sms-code-service.send-frequency = 60000 diff --git a/归档/user-service-project/user-service-app/src/main/resources/application.yaml b/归档/user-service-project/user-service-app/src/main/resources/application.yaml deleted file mode 100644 index 812b2b658..000000000 --- a/归档/user-service-project/user-service-app/src/main/resources/application.yaml +++ /dev/null @@ -1,52 +0,0 @@ -spring: - # Application 的配置项 - application: - name: user-service - # Profile 的配置项 - profiles: - active: local - -# MyBatis Plus 配置项 -mybatis-plus: - configuration: - map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。 - global-config: - db-config: - id-type: auto - logic-delete-value: 1 # 逻辑已删除值(默认为 1) - logic-not-delete-value: 0 # 逻辑未删除值(默认为 0) - mapper-locations: classpath*:mapper/*.xml - type-aliases-package: cn.iocoder.mall.userservice.dal.mysql.dataobject - -# Dubbo 配置项 -dubbo: - # Spring Cloud Alibaba Dubbo 专属配置 - cloud: - subscribed-services: '' # 设置订阅的应用列表,默认为 * 订阅所有应用 - # Dubbo 提供者的协议 - protocol: - name: dubbo - port: -1 - # Dubbo 提供服务的扫描基础包 - scan: - base-packages: cn.iocoder.mall.userservice.rpc - # Dubbo 服务提供者的配置 - provider: - filter: -exception - validation: true # 开启 Provider 参数校验 - UserRpc: - version: 1.0.0 - UserSmsCodeRpc: - version: 1.0.0 - UserAddressRpc: - version: 1.0.0 - # Dubbo 服务消费者的配置 - consumer: - OAuth2Rpc: - version: 1.0.0 - -# Actuator 监控配置项 -management: - server.port: 38081 # 独立端口,避免被暴露出去 - endpoints.web.exposure.include: '*' # 暴露所有监控端点 -server.port: ${management.server.port} # 设置使用 Actuator 的服务器端口,因为 RPC 服务不需要 Web 端口 diff --git a/归档/user-service-project/user-service-app/src/main/resources/sql/mall_user_data.sql b/归档/user-service-project/user-service-app/src/main/resources/sql/mall_user_data.sql deleted file mode 100644 index fff2b2be2..000000000 --- a/归档/user-service-project/user-service-app/src/main/resources/sql/mall_user_data.sql +++ /dev/null @@ -1,15 +0,0 @@ --- ---------------------------- --- Table structure for users --- ---------------------------- -INSERT INTO `mall_user`.`users`(`id`, `nickname`, `avatar`, `status`, `mobile`, `password`, `password_salt`, `create_ip`, `create_time`, `update_time`) VALUES (243, '芋艿X', 'http://www.iocoder.cn/images/common/zsxq/02.png', 2, '15601691340', '$2a$10$oBHjsjw57u3/g.g47kUAV.Q3i/TrMm62fobwFjGEjNGKUcqfgs2em', '$2a$10$oBHjsjw57u3/g.g47kUAV.', '127.0.0.1', '2020-07-03 20:41:57', '2020-07-26 00:51:38'); - --- ---------------------------- --- Table structure for user_sms_code --- ---------------------------- - - - --- ---------------------------- --- Table structure for user_sms_code --- ---------------------------- - diff --git a/归档/user-service-project/user-service-app/src/main/resources/sql/mall_user_schema.sql b/归档/user-service-project/user-service-app/src/main/resources/sql/mall_user_schema.sql deleted file mode 100644 index 6db934d98..000000000 --- a/归档/user-service-project/user-service-app/src/main/resources/sql/mall_user_schema.sql +++ /dev/null @@ -1,40 +0,0 @@ -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for users --- ---------------------------- -CREATE TABLE `users` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户编号', - `nickname` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '昵称', - `avatar` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '头像', - `status` tinyint(4) NOT NULL COMMENT '状态', - `mobile` varchar(11) COLLATE utf8mb4_bin NOT NULL COMMENT '手机号', - `password` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '加密后的密码', - `password_salt` varchar(64) COLLATE utf8mb4_bin NOT NULL COMMENT '密码的盐', - `create_ip` varchar(32) COLLATE utf8mb4_bin NOT NULL COMMENT '注册 IP', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `uk_mobile` (`mobile`) USING BTREE COMMENT '手机号' -) ENGINE=InnoDB AUTO_INCREMENT=245 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='用户'; - --- ---------------------------- --- Table structure for user_sms_code --- ---------------------------- -CREATE TABLE `user_sms_code` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号', - `mobile` varchar(11) NOT NULL COMMENT '手机号', - `code` varchar(6) NOT NULL COMMENT '验证码', - `create_ip` varchar(15) NOT NULL COMMENT '创建 IP', - `scene` tinyint(4) NOT NULL COMMENT '发送场景', - `today_index` tinyint(4) NOT NULL COMMENT '今日发送的第几条', - `used` tinyint(4) NOT NULL COMMENT '是否使用', - `used_time` datetime DEFAULT NULL COMMENT '使用时间', - `used_ip` varchar(255) DEFAULT NULL COMMENT '使用 IP', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间', - PRIMARY KEY (`id`) USING BTREE, - KEY `idx_mobile` (`mobile`) USING BTREE COMMENT '手机号' -) ENGINE=InnoDB AUTO_INCREMENT=445 DEFAULT CHARSET=utf8mb4 COMMENT='手机验证码'; - From b5474d1d84a5c5a2c0e6b7f1d7c863be33d4bc63 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 24 Sep 2022 18:24:57 +0800 Subject: [PATCH 03/29] =?UTF-8?q?!257=20=E9=80=9A=E8=BF=87=E6=B3=A8?= =?UTF-8?q?=E8=A7=A3=E5=A2=9E=E5=8A=A0=E5=A4=9A=E7=A7=9F=E6=88=B7=E7=BC=93?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-dependencies/pom.xml | 7 +++ .../config/YudaoTenantAutoConfiguration.java | 22 ++++++++ .../core/redis/TenantRedisCacheManager.java | 37 ++++++++++++++ .../yudao-spring-boot-starter-redis/pom.xml | 5 ++ .../config/YudaoCacheAutoConfiguration.java | 2 + .../application/convert/ProductAttrConvert.java | 34 ------------- .../application/convert/ProductSpuConvert.java | 40 --------------- .../activity/PromotionActivityStatusEnum.java | 41 --------------- .../activity/PromotionActivityTypeEnum.java | 34 ------------- .../config/AsyncConfiguration.java | 9 ---- .../config/DatabaseConfiguration.java | 28 ---------- .../dal/mysql/dataobject/banner/BannerDO.java | 51 ------------------- .../dal/mysql/mapper/banner/BannerMapper.java | 26 ---------- .../manager/price/PriceManager.java | 49 ++---------------- .../mall/shopweb/service/trade/CartManager.java | 11 +--- 15 files changed, 77 insertions(+), 319 deletions(-) create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/redis/TenantRedisCacheManager.java delete mode 100644 归档/moved/product/product-start/src/main/java/cn/iocoder/mall/product/application/convert/ProductAttrConvert.java delete mode 100644 归档/moved/product/product-start/src/main/java/cn/iocoder/mall/product/application/convert/ProductSpuConvert.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/activity/PromotionActivityStatusEnum.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/activity/PromotionActivityTypeEnum.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/config/AsyncConfiguration.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/config/DatabaseConfiguration.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/banner/BannerDO.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/banner/BannerMapper.java diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml index 3bf41dcc8..1bac18123 100644 --- a/yudao-dependencies/pom.xml +++ b/yudao-dependencies/pom.xml @@ -64,6 +64,7 @@ 0.1.55 2.4.1 1.3.0 + 4.1.75.Final 8.2.2 4.6.0 @@ -563,6 +564,12 @@ ${jsch.version} + + io.netty + netty-all + ${netty-all.version} + + cn.iocoder.cloud diff --git a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java index e338e2c73..e9ec9772c 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java @@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.tenant.core.db.TenantDatabaseInterceptor; import cn.iocoder.yudao.framework.tenant.core.job.TenantJobAspect; import cn.iocoder.yudao.framework.tenant.core.mq.TenantChannelInterceptor; import cn.iocoder.yudao.framework.tenant.core.mq.TenantFunctionAroundWrapper; +import cn.iocoder.yudao.framework.tenant.core.redis.TenantRedisCacheManager; import cn.iocoder.yudao.framework.tenant.core.security.TenantSecurityWebFilter; import cn.iocoder.yudao.framework.tenant.core.service.TenantFrameworkService; import cn.iocoder.yudao.framework.tenant.core.service.TenantFrameworkServiceImpl; @@ -25,8 +26,16 @@ import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.cloud.function.context.catalog.FunctionAroundWrapper; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.data.redis.cache.RedisCacheConfiguration; +import org.springframework.data.redis.cache.RedisCacheManager; +import org.springframework.data.redis.cache.RedisCacheWriter; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.integration.config.GlobalChannelInterceptor; +import java.util.Objects; + @Configuration @ConditionalOnProperty(prefix = "yudao.tenant", value = "enable", matchIfMissing = true) // 允许使用 yudao.tenant.enable=false 禁用多租户 @EnableConfigurationProperties(TenantProperties.class) @@ -122,4 +131,17 @@ public class YudaoTenantAutoConfiguration { return new TenantJobAspect(tenantFrameworkService); } + // ========== Redis ========== + + @Bean + @Primary // 引入租户时,tenantRedisCacheManager 为主 Bean + public RedisCacheManager tenantRedisCacheManager(RedisTemplate redisTemplate, + RedisCacheConfiguration redisCacheConfiguration) { + // 创建 RedisCacheWriter 对象 + RedisConnectionFactory connectionFactory = Objects.requireNonNull(redisTemplate.getConnectionFactory()); + RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(connectionFactory); + // 创建 TenantRedisCacheManager 对象 + return new TenantRedisCacheManager(cacheWriter, redisCacheConfiguration); + } + } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/redis/TenantRedisCacheManager.java b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/redis/TenantRedisCacheManager.java new file mode 100644 index 000000000..8058b2f54 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/redis/TenantRedisCacheManager.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.framework.tenant.core.redis; + +import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; +import lombok.extern.slf4j.Slf4j; +import org.springframework.cache.Cache; +import org.springframework.data.redis.cache.RedisCacheConfiguration; +import org.springframework.data.redis.cache.RedisCacheManager; +import org.springframework.data.redis.cache.RedisCacheWriter; + +/** + * 多租户的 {@link RedisCacheManager} 实现类 + * + * 操作指定 name 的 {@link Cache} 时,自动拼接租户后缀,格式为 name + ":" + tenantId + 后缀 + * + * @author airhead + */ +@Slf4j +public class TenantRedisCacheManager extends RedisCacheManager { + + public TenantRedisCacheManager(RedisCacheWriter cacheWriter, + RedisCacheConfiguration defaultCacheConfiguration) { + super(cacheWriter, defaultCacheConfiguration); + } + + @Override + public Cache getCache(String name) { + // 如果开启多租户,则 name 拼接租户后缀 + if (!TenantContextHolder.isIgnore() + && TenantContextHolder.getTenantId() != null) { + name = name + ":" + TenantContextHolder.getTenantId(); + } + + // 继续基于父方法 + return super.getCache(name); + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-redis/pom.xml b/yudao-framework/yudao-spring-boot-starter-redis/pom.xml index f1d66e776..06ce85bd3 100644 --- a/yudao-framework/yudao-spring-boot-starter-redis/pom.xml +++ b/yudao-framework/yudao-spring-boot-starter-redis/pom.xml @@ -32,6 +32,11 @@ spring-boot-starter-cache + + io.netty + netty-all + 4.1.75.Final + diff --git a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java index e8c716203..6a8f92efc 100644 --- a/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.framework.redis.config; import org.springframework.boot.autoconfigure.cache.CacheProperties; +import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -13,6 +14,7 @@ import org.springframework.data.redis.serializer.RedisSerializer; * Cache 配置类,基于 Redis 实现 */ @Configuration +@EnableConfigurationProperties({CacheProperties.class}) @EnableCaching public class YudaoCacheAutoConfiguration { diff --git a/归档/moved/product/product-start/src/main/java/cn/iocoder/mall/product/application/convert/ProductAttrConvert.java b/归档/moved/product/product-start/src/main/java/cn/iocoder/mall/product/application/convert/ProductAttrConvert.java deleted file mode 100644 index 2d9a9f9e2..000000000 --- a/归档/moved/product/product-start/src/main/java/cn/iocoder/mall/product/application/convert/ProductAttrConvert.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.mall.product.application.convert; - -import cn.iocoder.mall.product.api.bo.ProductAttrBO; -import cn.iocoder.mall.product.api.bo.ProductAttrPageBO; -import cn.iocoder.mall.product.api.bo.ProductAttrSimpleBO; -import cn.iocoder.mall.product.api.bo.ProductAttrValueBO; -import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrPageVO; -import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrSimpleVO; -import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrVO; -import cn.iocoder.mall.product.application.vo.admins.AdminsProductAttrValueVO; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface ProductAttrConvert { - - ProductAttrConvert INSTANCE = Mappers.getMapper(ProductAttrConvert.class); - - @Mappings({}) - AdminsProductAttrPageVO convert2(ProductAttrPageBO result); - - @Mappings({}) - List convert(List result); - - @Mappings({}) - AdminsProductAttrVO convert3(ProductAttrBO productAttrBO); - - @Mappings({}) - AdminsProductAttrValueVO convert4(ProductAttrValueBO productAttrValueBO); - -} diff --git a/归档/moved/product/product-start/src/main/java/cn/iocoder/mall/product/application/convert/ProductSpuConvert.java b/归档/moved/product/product-start/src/main/java/cn/iocoder/mall/product/application/convert/ProductSpuConvert.java deleted file mode 100644 index ce6b00d03..000000000 --- a/归档/moved/product/product-start/src/main/java/cn/iocoder/mall/product/application/convert/ProductSpuConvert.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.iocoder.mall.product.application.convert; - -import cn.iocoder.mall.product.api.bo.ProductSpuBO; -import cn.iocoder.mall.product.api.bo.ProductSpuDetailBO; -import cn.iocoder.mall.product.api.bo.ProductSpuPageBO; -import cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuDetailVO; -import cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuPageVO; -import cn.iocoder.mall.product.application.vo.admins.AdminsProductSpuVO; -import cn.iocoder.mall.product.application.vo.users.UsersProductSpuDetailVO; -import cn.iocoder.mall.product.application.vo.users.UsersProductSpuPageVO; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface ProductSpuConvert { - - ProductSpuConvert INSTANCE = Mappers.getMapper(ProductSpuConvert.class); - - @Mappings({}) - AdminsProductSpuDetailVO convert(ProductSpuDetailBO productSpuDetailBO); - -// @Mappings({}) -// CommonResult convert(CommonResult result); - - @Mappings({}) - AdminsProductSpuPageVO convert2(ProductSpuPageBO result); - - @Mappings({}) - List convert3(List result); - - @Mappings({}) - UsersProductSpuPageVO convert3(ProductSpuPageBO result); - - @Mappings({}) - UsersProductSpuDetailVO convert4(ProductSpuDetailBO result); - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/activity/PromotionActivityStatusEnum.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/activity/PromotionActivityStatusEnum.java deleted file mode 100644 index 885d9d8c5..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/activity/PromotionActivityStatusEnum.java +++ /dev/null @@ -1,41 +0,0 @@ -package cn.iocoder.mall.promotion.api.enums.activity; - -/** - * 促销活动状态枚举 - */ -public enum PromotionActivityStatusEnum { - - WAIT(10, "未开始"), - RUN(20, "进行中"), - END(30, "已结束"), - /** - * 1. WAIT、RUN、END 可以转换成 INVALID 状态。 - * 2. INVALID 只可以转换成 DELETED 状态。 - */ - INVALID(40, "已撤销"), - DELETED(50, "已删除"), - ; - - /** - * 状态值 - */ - private final Integer value; - /** - * 状态名 - */ - private final String name; - - PromotionActivityStatusEnum(Integer value, String name) { - this.value = value; - this.name = name; - } - - public Integer getValue() { - return value; - } - - public String getName() { - return name; - } - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/activity/PromotionActivityTypeEnum.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/activity/PromotionActivityTypeEnum.java deleted file mode 100644 index a4cbe9fd2..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/activity/PromotionActivityTypeEnum.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.mall.promotion.api.enums.activity; - -/** - * 促销活动类型枚举 - */ -public enum PromotionActivityTypeEnum { - - TIME_LIMITED_DISCOUNT(1, "限时折扣"), - FULL_PRIVILEGE(2, "满减送"), - ; - - /** - * 类型值 - */ - private final Integer value; - /** - * 类型名 - */ - private final String name; - - PromotionActivityTypeEnum(Integer value, String name) { - this.value = value; - this.name = name; - } - - public Integer getValue() { - return value; - } - - public String getName() { - return name; - } - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/config/AsyncConfiguration.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/config/AsyncConfiguration.java deleted file mode 100644 index 84ca8a91f..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/config/AsyncConfiguration.java +++ /dev/null @@ -1,9 +0,0 @@ -package cn.iocoder.mall.promotionservice.config; - -import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.annotation.EnableAsync; - -@Configuration -@EnableAsync(proxyTargetClass = true) // 开启 Spring Async 异步的功能 -public class AsyncConfiguration { -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/config/DatabaseConfiguration.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/config/DatabaseConfiguration.java deleted file mode 100644 index efded6dc4..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/config/DatabaseConfiguration.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.promotionservice.config; - -import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector; -import com.baomidou.mybatisplus.core.injector.ISqlInjector; -import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -@Configuration -@MapperScan("cn.iocoder.mall.promotionservice.dal.mysql.mapper") // 扫描对应的 Mapper 接口 -@EnableTransactionManagement(proxyTargetClass = true) // 启动事务管理。 -public class DatabaseConfiguration { - - // 数据库连接池 Druid - - @Bean - public ISqlInjector sqlInjector() { - return new DefaultSqlInjector(); // MyBatis Plus 逻辑删除 - } - - @Bean - public PaginationInterceptor paginationInterceptor() { - return new PaginationInterceptor(); // MyBatis Plus 分页插件 - } - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/banner/BannerDO.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/banner/BannerDO.java deleted file mode 100644 index 58da17412..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/banner/BannerDO.java +++ /dev/null @@ -1,51 +0,0 @@ -package cn.iocoder.mall.promotionservice.dal.mysql.dataobject.banner; - -import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - * Banner 广告页 - */ -@TableName("banner") -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class BannerDO extends DeletableDO { - - /** - * 编号 - */ - private Integer id; - /** - * 标题 - */ - private String title; - /** - * 跳转链接 - */ - private String url; - /** - * 图片链接 - */ - private String picUrl; - /** - * 排序 - */ - private Integer sort; - /** - * 状态 - * - * {@link cn.iocoder.common.framework.enums.CommonStatusEnum} - */ - private Integer status; - /** - * 备注 - */ - private String memo; - - // TODO 芋艿 点击次数。&& 其他数据相关 - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/banner/BannerMapper.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/banner/BannerMapper.java deleted file mode 100644 index 95e1e0465..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/banner/BannerMapper.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.iocoder.mall.promotionservice.dal.mysql.mapper.banner; - -import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; -import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerListReqDTO; -import cn.iocoder.mall.promotion.api.rpc.banner.dto.BannerPageReqDTO; -import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.banner.BannerDO; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Repository -public interface BannerMapper extends BaseMapper { - - default List selectList(BannerListReqDTO listReqDTO) { - return selectList(new QueryWrapperX().eqIfPresent("status", listReqDTO.getStatus())); - } - - default IPage selectPage(BannerPageReqDTO pageReqDTO) { - return selectPage(new Page<>(pageReqDTO.getPageNo(), pageReqDTO.getPageSize()), - new QueryWrapperX().likeIfPresent("title", pageReqDTO.getTitle())); - } - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/price/PriceManager.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/price/PriceManager.java index 00b259777..807c5ff01 100644 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/price/PriceManager.java +++ b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/price/PriceManager.java @@ -48,26 +48,12 @@ public class PriceManager { private CouponTemplateService couponTemplateService; public PriceProductCalcRespDTO calcProductPrice(PriceProductCalcReqDTO calcReqDTO) { - // TODO 芋艿,补充一些表单校验。例如说,需要传入用户编号。 - // 校验商品都存在 - Map calcProductItemDTOMap = CollectionUtils.convertMap( - calcReqDTO.getItems(), PriceProductCalcReqDTO.Item::getSkuId); - CommonResult> listProductSkusResult = productSkuFeign.listProductSkus( - new ProductSkuListQueryReqDTO().setProductSkuIds(calcProductItemDTOMap.keySet())); - listProductSkusResult.checkError(); - if (calcReqDTO.getItems().size() != listProductSkusResult.getData().size()) { - throw ServiceExceptionUtil.exception(PRICE_PRODUCT_SKU_NOT_EXISTS); - } - // TODO 库存相关 - // 查询促销活动 + // 拼装结果(主要是计算价格) + PriceProductCalcRespDTO calcRespDTO = new PriceProductCalcRespDTO(); + List activityRespDTOs = promotionActivityService.listPromotionActivitiesBySpuIds( CollectionUtils.convertSet(listProductSkusResult.getData(), ProductSkuRespDTO::getSpuId), Collections.singleton(PromotionActivityStatusEnum.RUN.getValue())); - // 拼装结果(主要是计算价格) - PriceProductCalcRespDTO calcRespDTO = new PriceProductCalcRespDTO(); - // 1. 创建初始的每一项的数组 - List calcItemRespDTOs = this.initCalcOrderPriceItems( - listProductSkusResult.getData(), calcProductItemDTOMap); // 2. 计算【限时折扣】促销 this.modifyPriceByTimeLimitDiscount(calcItemRespDTOs, activityRespDTOs); // 3. 计算【满减送】促销 @@ -93,35 +79,6 @@ public class PriceManager { return calcRespDTO; } - private List initCalcOrderPriceItems(List skus, - Map calcProductItemDTOMap) { - // 获得商品分类 Map - CommonResult> listProductSpusResult = productSpuFeign.listProductSpus(CollectionUtils.convertSet(skus, ProductSkuRespDTO::getSpuId)); - listProductSpusResult.checkError(); - Map spuIdCategoryIdMap = CollectionUtils.convertMap(listProductSpusResult.getData(), // SPU 编号与 Category 编号的映射 - ProductSpuRespDTO::getId, ProductSpuRespDTO::getCid); - // 生成商品列表 - List items = new ArrayList<>(); - for (ProductSkuRespDTO sku : skus) { - PriceProductCalcRespDTO.Item item = new PriceProductCalcRespDTO.Item(); - items.add(item); - // 将基本信息,复制到 item 中 - PriceProductCalcReqDTO.Item calcOrderItem = calcProductItemDTOMap.get(sku.getId()); - item.setSpuId(sku.getSpuId()).setSkuId(sku.getId()); - item.setCid(spuIdCategoryIdMap.get(sku.getSpuId())); - item.setSelected(calcOrderItem.getSelected()); - item.setBuyQuantity(calcOrderItem.getQuantity()); - // 计算初始价格 - item.setOriginPrice(sku.getPrice()); - item.setBuyPrice(sku.getPrice()); - item.setPresentPrice(sku.getPrice()); - item.setBuyTotal(sku.getPrice() * calcOrderItem.getQuantity()); - item.setDiscountTotal(0); - item.setPresentTotal(item.getBuyTotal()); - } - return items; - } - private void modifyPriceByTimeLimitDiscount(List items, List activityList) { for (PriceProductCalcRespDTO.Item item : items) { // 获得符合条件的限时折扣 diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/trade/CartManager.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/trade/CartManager.java index 4d1180458..0b62c71b7 100644 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/trade/CartManager.java +++ b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/service/trade/CartManager.java @@ -34,16 +34,7 @@ public class CartManager { * @return 商品列表 */ public CartDetailVO getCartDetail(Integer userId) { - // 获得购物车的商品 - CommonResult> listCartItemsResult = cartFeign.listCartItems(new CartItemListReqDTO().setUserId(userId)); - listCartItemsResult.checkError(); - // 购物车为空时,构造空的 UsersOrderConfirmCreateVO 返回 - if (CollectionUtils.isEmpty(listCartItemsResult.getData())) { - CartDetailVO result = new CartDetailVO(); - result.setItemGroups(Collections.emptyList()); - result.setFee(new CartDetailVO.Fee(0, 0, 0, 0)); - return result; - } + // 计算商品价格 CommonResult calcProductPriceResult = priceFeign.calcProductPrice(new PriceProductCalcReqDTO().setUserId(userId) .setItems(listCartItemsResult.getData().stream() From c54b330cdf636f635bb638edf54bfa25766291d3 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 17 Oct 2022 20:44:30 +0800 Subject: [PATCH 04/29] =?UTF-8?q?!271=20=E5=8D=87=E7=BA=A7=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E5=8F=8A=20vue3=E9=83=A8=E5=88=86=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 +- yudao-dependencies/pom.xml | 44 +++++++++---------- .../framework/common/enums/DocumentEnum.java | 5 ++- .../core/context/TenantContextHolder.java | 4 +- .../excel/core/convert/DictConvert.java | 17 +++---- .../excel/core/convert/JsonConvert.java | 13 ++---- .../core/DefaultLockFailureStrategy.java | 7 +-- .../yudao-spring-boot-starter-redis/pom.xml | 1 - .../convert/message/BpmMessageConvert.java | 6 ++- 9 files changed, 52 insertions(+), 49 deletions(-) diff --git a/pom.xml b/pom.xml index e5986837e..046585f27 100644 --- a/pom.xml +++ b/pom.xml @@ -32,8 +32,8 @@ 3.0.0-M5 3.8.0 - 1.18.20 - 1.4.1.Final + 1.18.24 + 1.5.2.Final UTF-8 diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml index 1bac18123..1ae17d7e6 100644 --- a/yudao-dependencies/pom.xml +++ b/yudao-dependencies/pom.xml @@ -16,19 +16,19 @@ 1.6.2-snapshot - 2.6.9 + 2.6.12 2021.0.1 2021.0.1.0 3.0.3 - 1.6.6 + 1.6.7 2.5 - 1.2.11 - 3.4.3.4 + 1.2.13 + 3.5.2 3.5.2 - 3.5.0 - 3.17.3 + 3.5.2 + 3.17.7 2.7.15 @@ -36,38 +36,38 @@ 2.3.1 - 2.2.0 + 2.2.2 1.7.1 - 8.7.0 - 2.6.7 - 0.31.0 + 8.12.0 + 2.6.9 + 0.33.0 - 7.2.6.RELEASE - 0.1.16 - 4.0.0 + 7.2.9.RELEASE + 1.0.4 + 4.8.0 6.7.2 3.0.4 - 1.18.20 - 1.4.1.Final - 5.8.5 - 2.2.7 + 1.18.24 + 1.5.2.Final + 5.8.8 + 3.1.1 2.3 1.0.5 - 2.0.5 + 1.2.83 30.1.1-jre 5.1.0 - 2.12.2 + 2.14.0 3.8.0 0.1.55 - 2.4.1 + 2.5.0 1.3.0 - 4.1.75.Final + 4.1.82.Final 8.2.2 - 4.6.0 + 4.6.2 2.2.1 3.1.561 1.2.7 diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/enums/DocumentEnum.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/enums/DocumentEnum.java index b304462e5..0d2c64c8b 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/enums/DocumentEnum.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/enums/DocumentEnum.java @@ -12,8 +12,9 @@ import lombok.Getter; @AllArgsConstructor public enum DocumentEnum { - REDIS_INSTALL("https://gitee.com/zhijiantianya/ruoyi-vue-pro/issues/I4VCSJ", "Redis 安装文档"); - + REDIS_INSTALL("https://gitee.com/zhijiantianya/ruoyi-vue-pro/issues/I4VCSJ", "Redis 安装文档"), + TENANT("https://doc.iocoder.cn", "SaaS 多租户文档"); + private final String url; private final String memo; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/context/TenantContextHolder.java b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/context/TenantContextHolder.java index a42acc41c..3b15398d6 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/context/TenantContextHolder.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/context/TenantContextHolder.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.framework.tenant.core.context; +import cn.iocoder.yudao.framework.common.enums.DocumentEnum; import com.alibaba.ttl.TransmittableThreadLocal; /** @@ -36,7 +37,8 @@ public class TenantContextHolder { public static Long getRequiredTenantId() { Long tenantId = getTenantId(); if (tenantId == null) { - throw new NullPointerException("TenantContextHolder 不存在租户编号"); // TODO 芋艿:增加文档链接 + throw new NullPointerException("TenantContextHolder 不存在租户编号!可参考文档:" + + DocumentEnum.TENANT.getUrl()); } return tenantId; } diff --git a/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/convert/DictConvert.java b/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/convert/DictConvert.java index 7698cf4a6..182c83a72 100644 --- a/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/convert/DictConvert.java +++ b/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/convert/DictConvert.java @@ -5,8 +5,9 @@ import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import com.alibaba.excel.converters.Converter; import com.alibaba.excel.enums.CellDataTypeEnum; -import com.alibaba.excel.metadata.CellData; import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.data.ReadCellData; +import com.alibaba.excel.metadata.data.WriteCellData; import com.alibaba.excel.metadata.property.ExcelContentProperty; import lombok.extern.slf4j.Slf4j; @@ -29,11 +30,11 @@ public class DictConvert implements Converter { } @Override - public Object convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, + public Object convertToJavaData(ReadCellData readCellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) { // 使用字典解析 String type = getType(contentProperty); - String label = cellData.getStringValue(); + String label = readCellData.getStringValue(); String value = DictFrameworkUtils.parseDictDataValue(type, label); if (value == null) { log.error("[convertToJavaData][type({}) 解析不掉 label({})]", type, label); @@ -45,11 +46,11 @@ public class DictConvert implements Converter { } @Override - public CellData convertToExcelData(Object object, ExcelContentProperty contentProperty, - GlobalConfiguration globalConfiguration) { + public WriteCellData convertToExcelData(Object object, ExcelContentProperty contentProperty, + GlobalConfiguration globalConfiguration) { // 空时,返回空 if (object == null) { - return new CellData<>(""); + return new WriteCellData<>(""); } // 使用字典格式化 @@ -58,10 +59,10 @@ public class DictConvert implements Converter { String label = DictFrameworkUtils.getDictDataLabel(type, value); if (label == null) { log.error("[convertToExcelData][type({}) 转换不了 label({})]", type, value); - return new CellData<>(""); + return new WriteCellData<>(""); } // 生成 Excel 小表格 - return new CellData<>(label); + return new WriteCellData<>(label); } private static String getType(ExcelContentProperty contentProperty) { diff --git a/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/convert/JsonConvert.java b/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/convert/JsonConvert.java index f0a577c0a..0d4794e5f 100644 --- a/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/convert/JsonConvert.java +++ b/yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/convert/JsonConvert.java @@ -3,8 +3,8 @@ package cn.iocoder.yudao.framework.excel.core.convert; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import com.alibaba.excel.converters.Converter; import com.alibaba.excel.enums.CellDataTypeEnum; -import com.alibaba.excel.metadata.CellData; import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.data.WriteCellData; import com.alibaba.excel.metadata.property.ExcelContentProperty; /** @@ -25,15 +25,10 @@ public class JsonConvert implements Converter { } @Override - public Object convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) { - throw new UnsupportedOperationException("暂不支持,也不需要"); - } - - @Override - public CellData convertToExcelData(Object value, ExcelContentProperty contentProperty, - GlobalConfiguration globalConfiguration) { + public WriteCellData convertToExcelData(Object value, ExcelContentProperty contentProperty, + GlobalConfiguration globalConfiguration) { // 生成 Excel 小表格 - return new CellData<>(JsonUtils.toJsonString(value)); + return new WriteCellData<>(JsonUtils.toJsonString(value)); } } diff --git a/yudao-framework/yudao-spring-boot-starter-protection/src/main/java/cn/iocoder/yudao/framework/lock4j/core/DefaultLockFailureStrategy.java b/yudao-framework/yudao-spring-boot-starter-protection/src/main/java/cn/iocoder/yudao/framework/lock4j/core/DefaultLockFailureStrategy.java index 3af543530..2cea08bf8 100644 --- a/yudao-framework/yudao-spring-boot-starter-protection/src/main/java/cn/iocoder/yudao/framework/lock4j/core/DefaultLockFailureStrategy.java +++ b/yudao-framework/yudao-spring-boot-starter-protection/src/main/java/cn/iocoder/yudao/framework/lock4j/core/DefaultLockFailureStrategy.java @@ -5,6 +5,8 @@ import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstant import com.baomidou.lock.LockFailureStrategy; import lombok.extern.slf4j.Slf4j; +import java.lang.reflect.Method; + /** * 自定义获取锁失败策略,抛出 {@link ServiceException} 异常 */ @@ -12,9 +14,8 @@ import lombok.extern.slf4j.Slf4j; public class DefaultLockFailureStrategy implements LockFailureStrategy { @Override - public void onLockFailure(String key, long acquireTimeout, int acquireCount) { - log.debug("[onLockFailure][线程:{} 获取锁失败,key:{} 获取超时时长:{} ms]", Thread.currentThread().getName(), key, acquireTimeout); + public void onLockFailure(String key, Method method, Object[] arguments) { + log.debug("[onLockFailure][线程:{} 获取锁失败,key:{} 获取失败:{} ]", Thread.currentThread().getName(), key, arguments); throw new ServiceException(GlobalErrorCodeConstants.LOCKED); } - } diff --git a/yudao-framework/yudao-spring-boot-starter-redis/pom.xml b/yudao-framework/yudao-spring-boot-starter-redis/pom.xml index 06ce85bd3..4b11789b4 100644 --- a/yudao-framework/yudao-spring-boot-starter-redis/pom.xml +++ b/yudao-framework/yudao-spring-boot-starter-redis/pom.xml @@ -35,7 +35,6 @@ io.netty netty-all - 4.1.75.Final diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/message/BpmMessageConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/message/BpmMessageConvert.java index 92683f4c9..181e29618 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/message/BpmMessageConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/message/BpmMessageConvert.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.convert.message; import cn.iocoder.yudao.module.system.api.sms.dto.send.SmsSendSingleToUserReqDTO; import org.mapstruct.Mapper; +import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; import java.util.Map; @@ -11,6 +12,9 @@ public interface BpmMessageConvert { BpmMessageConvert INSTANCE = Mappers.getMapper(BpmMessageConvert.class); + @Mapping(target = "mobile", ignore = true) + @Mapping(source = "userId", target = "userId") + @Mapping(source = "templateCode", target = "templateCode") + @Mapping(source = "templateParams", target = "templateParams") SmsSendSingleToUserReqDTO convert(Long userId, String templateCode, Map templateParams); - } From 0e6d94876dfd2db6c874d03714b74267f1424314 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 30 Oct 2022 18:11:52 +0800 Subject: [PATCH 05/29] =?UTF-8?q?=E6=B8=85=E7=90=86=E4=BB=B7=E6=A0=BC?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E7=9B=B8=E5=85=B3=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PromotionServiceApplication.java | 18 - .../mysql/dataobject/coupon/CouponCardDO.java | 123 ------- .../manager/price/PriceManager.java | 336 ------------------ .../service/banner/BannerService.java | 92 ----- 4 files changed, 569 deletions(-) delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/PromotionServiceApplication.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/coupon/CouponCardDO.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/price/PriceManager.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/banner/BannerService.java diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/PromotionServiceApplication.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/PromotionServiceApplication.java deleted file mode 100644 index 0a460a932..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/PromotionServiceApplication.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.iocoder.mall.promotionservice; - - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.cloud.client.discovery.EnableDiscoveryClient; -import org.springframework.cloud.openfeign.EnableFeignClients; - -@SpringBootApplication -@EnableDiscoveryClient -@EnableFeignClients(basePackages = {"cn.iocoder.mall.productservice.rpc"}) -public class PromotionServiceApplication { - - public static void main(String[] args) { - SpringApplication.run(PromotionServiceApplication.class, args); - } - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/coupon/CouponCardDO.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/coupon/CouponCardDO.java deleted file mode 100644 index 1d6a94517..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/coupon/CouponCardDO.java +++ /dev/null @@ -1,123 +0,0 @@ -package cn.iocoder.mall.promotionservice.dal.mysql.dataobject.coupon; - -import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.util.Date; - -/** - * 优惠劵 DO - */ -@TableName("coupon_card") -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class CouponCardDO extends BaseDO { - - // ========== 基本信息 BEGIN ========== - /** - * 优惠劵编号 - */ - private Integer id; - /** - * 优惠劵(码)分组编号,{@link CouponTemplateDO} 的 id - */ - private Integer templateId; - /** - * 优惠劵名 - * - * 冗余自 {@link CouponTemplateDO} 的 title - * - * TODO 芋艿,暂时不考虑冗余的更新 - */ - private String title; -// /** -// * 核销码 -// */ -// private String verifyCode; - /** - * 优惠码状态 - * - * 1-未使用 - * 2-已使用 - * 3-已失效 - */ - private Integer status; - - // ========== 基本信息 END ========== - - // ========== 领取情况 BEGIN ========== - /** - * 用户编号 - */ - private Integer userId; - /** - * 领取类型 - * - * 1 - 用户主动领取 - * 2 - 后台自动发放 - */ - private Integer takeType; - // ========== 领取情况 END ========== - - // ========== 使用规则 BEGIN ========== - /** - * 是否设置满多少金额可用,单位:分 - */ - private Integer priceAvailable; - /** - * 生效开始时间 - */ - private Date validStartTime; - /** - * 生效结束时间 - */ - private Date validEndTime; - // ========== 使用规则 END ========== - - // ========== 使用效果 BEGIN ========== - /** - * 优惠类型 - * - * 1-代金卷 - * 2-折扣卷 - */ - private Integer preferentialType; - /** - * 折扣 - */ - private Integer percentOff; - /** - * 优惠金额,单位:分。 - */ - private Integer priceOff; - /** - * 折扣上限,仅在 {@link #preferentialType} 等于 2 时生效。 - * - * 例如,折扣上限为 20 元,当使用 8 折优惠券,订单金额为 1000 元时,最高只可折扣 20 元,而非 80 元。 - */ - private Integer discountPriceLimit; - // ========== 使用效果 END ========== - - // ========== 使用情况 BEGIN ========== -// /** -// * 使用订单号 -// */ -// private Integer usedOrderId; // TODO 芋艿,暂时不考虑这个字段 -// /** -// * 订单中优惠面值,单位:分 -// */ -// private Integer usedPrice; // TODO 芋艿,暂时不考虑这个字段 - /** - * 使用时间 - */ - private Date usedTime; - - // TODO 芋艿,后续要加优惠劵的使用日志,因为下单后,可能会取消。 - - // ========== 使用情况 END ========== - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/price/PriceManager.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/price/PriceManager.java deleted file mode 100644 index 807c5ff01..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/price/PriceManager.java +++ /dev/null @@ -1,336 +0,0 @@ -package cn.iocoder.mall.promotionservice.manager.price; - -import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; -import cn.iocoder.common.framework.util.CollectionUtils; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.productservice.rpc.sku.ProductSkuFeign; -import cn.iocoder.mall.productservice.rpc.sku.dto.ProductSkuListQueryReqDTO; -import cn.iocoder.mall.productservice.rpc.sku.dto.ProductSkuRespDTO; -import cn.iocoder.mall.productservice.rpc.spu.ProductSpuFeign; -import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO; -import cn.iocoder.mall.promotion.api.enums.MeetTypeEnum; -import cn.iocoder.mall.promotion.api.enums.PreferentialTypeEnum; -import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum; -import cn.iocoder.mall.promotion.api.enums.activity.PromotionActivityStatusEnum; -import cn.iocoder.mall.promotion.api.enums.activity.PromotionActivityTypeEnum; -import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.card.CouponCardRespDTO; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponTemplateRespDTO; -import cn.iocoder.mall.promotion.api.rpc.price.dto.PriceProductCalcReqDTO; -import cn.iocoder.mall.promotion.api.rpc.price.dto.PriceProductCalcRespDTO; -import cn.iocoder.mall.promotionservice.service.activity.PromotionActivityService; -import cn.iocoder.mall.promotionservice.service.coupon.CouponCardService; -import cn.iocoder.mall.promotionservice.service.coupon.CouponTemplateService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.Assert; -import org.springframework.validation.annotation.Validated; - -import java.util.*; -import java.util.stream.Collectors; - -import static cn.iocoder.mall.promotion.api.enums.PromotionErrorCodeConstants.*; - -@Service -@Validated -public class PriceManager { - - @Autowired - private ProductSkuFeign productSkuFeign; - @Autowired - private ProductSpuFeign productSpuFeign; - - @Autowired - private PromotionActivityService promotionActivityService; - @Autowired - private CouponCardService couponCardService; - @Autowired - private CouponTemplateService couponTemplateService; - - public PriceProductCalcRespDTO calcProductPrice(PriceProductCalcReqDTO calcReqDTO) { - // 拼装结果(主要是计算价格) - PriceProductCalcRespDTO calcRespDTO = new PriceProductCalcRespDTO(); - - List activityRespDTOs = promotionActivityService.listPromotionActivitiesBySpuIds( - CollectionUtils.convertSet(listProductSkusResult.getData(), ProductSkuRespDTO::getSpuId), - Collections.singleton(PromotionActivityStatusEnum.RUN.getValue())); - // 2. 计算【限时折扣】促销 - this.modifyPriceByTimeLimitDiscount(calcItemRespDTOs, activityRespDTOs); - // 3. 计算【满减送】促销 - List itemGroups = this.groupByFullPrivilege(calcItemRespDTOs, activityRespDTOs); - calcRespDTO.setItemGroups(itemGroups); - // 4. 计算优惠劵 TODO 芋艿:未详细测试; - if (calcReqDTO.getCouponCardId() != null) { - Integer result = this.modifyPriceByCouponCard(calcReqDTO.getUserId(), calcReqDTO.getCouponCardId(), itemGroups); - calcRespDTO.setCouponCardDiscountTotal(result); - } - // 5. 计算最终的价格 - int buyTotal = 0; - int discountTotal = 0; - int presentTotal = 0; - for (PriceProductCalcRespDTO.ItemGroup itemGroup : calcRespDTO.getItemGroups()) { - buyTotal += itemGroup.getItems().stream().mapToInt(item -> item.getSelected() ? item.getBuyTotal() : 0).sum(); - discountTotal += itemGroup.getItems().stream().mapToInt(item -> item.getSelected() ? item.getDiscountTotal() : 0).sum(); - presentTotal += itemGroup.getItems().stream().mapToInt(item -> item.getSelected() ? item.getPresentTotal() : 0).sum(); - } - Assert.isTrue(buyTotal - discountTotal == presentTotal, - String.format("价格合计( %d - %d == %d )不正确", buyTotal, discountTotal, presentTotal)); - calcRespDTO.setFee(new PriceProductCalcRespDTO.Fee(buyTotal, discountTotal, 0, presentTotal)); - return calcRespDTO; - } - - private void modifyPriceByTimeLimitDiscount(List items, List activityList) { - for (PriceProductCalcRespDTO.Item item : items) { - // 获得符合条件的限时折扣 - PromotionActivityRespDTO timeLimitedDiscount = activityList.stream() - .filter(activity -> PromotionActivityTypeEnum.TIME_LIMITED_DISCOUNT.getValue().equals(activity.getActivityType()) - && activity.getTimeLimitedDiscount().getItems().stream().anyMatch(item0 -> item0.getSpuId().equals(item.getSpuId()))) - .findFirst().orElse(null); - if (timeLimitedDiscount == null) { - continue; - } - // 计算价格 - Integer newBuyPrice = calcSkuPriceByTimeLimitDiscount(item, timeLimitedDiscount); - if (newBuyPrice.equals(item.getBuyPrice())) { // 未优惠 - continue; - } - // 设置优惠 - item.setActivityId(timeLimitedDiscount.getId()); - // 设置价格 - item.setBuyPrice(newBuyPrice); - item.setBuyTotal(newBuyPrice * item.getBuyQuantity()); - item.setPresentTotal(item.getBuyTotal() - item.getDiscountTotal()); - item.setPresentPrice(item.getPresentTotal() / item.getBuyQuantity()); - } - } - - /** - * 计算指定 SKU 在限时折扣下的价格 - * - * @param sku SKU - * @param timeLimitedDiscount 限时折扣促销。 - * 传入的该活动,要保证该 SKU 在该促销下一定有优惠。 - * @return 计算后的价格 - */ - private Integer calcSkuPriceByTimeLimitDiscount(PriceProductCalcRespDTO.Item sku, PromotionActivityRespDTO timeLimitedDiscount) { - if (timeLimitedDiscount == null) { - return sku.getBuyPrice(); - } - // 获得对应的优惠项 - PromotionActivityRespDTO.TimeLimitedDiscount.Item item = timeLimitedDiscount.getTimeLimitedDiscount().getItems().stream() - .filter(item0 -> item0.getSpuId().equals(sku.getSpuId())) - .findFirst().orElse(null); - if (item == null) { - throw new IllegalArgumentException(String.format("折扣活动(%s) 不存在商品(%s) 的优惠配置", - timeLimitedDiscount.toString(), sku.toString())); - } - // 计算价格 - if (PreferentialTypeEnum.PRICE.getValue().equals(item.getPreferentialType())) { // 减价 - int presentPrice = sku.getBuyPrice() - item.getPreferentialValue(); - return presentPrice >= 0 ? presentPrice : sku.getBuyPrice(); // 如果计算优惠价格小于 0 ,则说明无法使用优惠。 - } - if (PreferentialTypeEnum.DISCOUNT.getValue().equals(item.getPreferentialType())) { // 打折 - return sku.getBuyPrice() * item.getPreferentialValue() / 100; - } - throw new IllegalArgumentException(String.format("折扣活动(%s) 的优惠类型不正确", timeLimitedDiscount.toString())); - } - - private List groupByFullPrivilege(List items, List activityList) { - List itemGroups = new ArrayList<>(); - // 获得所有满减送促销 - List fullPrivileges = activityList.stream() - .filter(activity -> PromotionActivityTypeEnum.FULL_PRIVILEGE.getValue().equals(activity.getActivityType())) - .collect(Collectors.toList()); - // 基于满减送促销,进行分组 - if (!fullPrivileges.isEmpty()) { - items = new ArrayList<>(items); // 因为下面会修改数组,进行浅拷贝,避免影响传入的 items 。 - for (PromotionActivityRespDTO fullPrivilege : fullPrivileges) { - // 创建 fullPrivilege 对应的分组 - PriceProductCalcRespDTO.ItemGroup itemGroup = new PriceProductCalcRespDTO.ItemGroup() - .setActivityId(fullPrivilege.getId()) - .setItems(new ArrayList<>()); - // 筛选商品到分组中 - for (Iterator iterator = items.iterator(); iterator.hasNext(); ) { - PriceProductCalcRespDTO.Item item = iterator.next(); - if (!isSpuMatchFullPrivilege(item.getSpuId(), fullPrivilege)) { - continue; - } - itemGroup.getItems().add(item); - iterator.remove(); - } - // 如果匹配到,则添加到 itemGroups 中 - if (!itemGroup.getItems().isEmpty()) { - itemGroups.add(itemGroup); - } - } - } - // 处理未参加活动的商品,形成一个分组 - if (!items.isEmpty()) { - itemGroups.add(new PriceProductCalcRespDTO.ItemGroup().setItems(items)); - } - // 计算每个分组的价格 - Map activityMap = CollectionUtils.convertMap(activityList, PromotionActivityRespDTO::getId); - for (PriceProductCalcRespDTO.ItemGroup itemGroup : itemGroups) { - itemGroup.setActivityDiscountTotal(calcSkuPriceByFullPrivilege(itemGroup, activityMap.get(itemGroup.getActivityId()))); - } - // 返回结果 - return itemGroups; - } - - private boolean isSpuMatchFullPrivilege(Integer spuId, PromotionActivityRespDTO activity) { - Assert.isTrue(PromotionActivityTypeEnum.FULL_PRIVILEGE.getValue().equals(activity.getActivityType()), - "传入的必须的促销活动必须是满减送"); - PromotionActivityRespDTO.FullPrivilege fullPrivilege = activity.getFullPrivilege(); - if (RangeTypeEnum.ALL.getValue().equals(fullPrivilege.getRangeType())) { - return true; - } else if (RangeTypeEnum.PRODUCT_INCLUDE_PART.getValue().equals(fullPrivilege.getRangeType())) { - return fullPrivilege.getRangeValues().contains(spuId); - } - throw new IllegalArgumentException(String.format("促销活动(%s) 可用范围的类型是不正确", activity.toString())); - } - - private Integer calcSkuPriceByFullPrivilege(PriceProductCalcRespDTO.ItemGroup itemGroup, PromotionActivityRespDTO activity) { - if (itemGroup.getActivityId() == null) { - return null; - } - Assert.isTrue(PromotionActivityTypeEnum.FULL_PRIVILEGE.getValue().equals(activity.getActivityType()), - "传入的必须的满减送活动必须是满减送"); - // 获得优惠信息 - List items = itemGroup.getItems().stream().filter(PriceProductCalcRespDTO.Item::getSelected) - .collect(Collectors.toList()); - Integer itemCnt = items.stream().mapToInt(PriceProductCalcRespDTO.Item::getBuyQuantity).sum(); - Integer originalTotal = items.stream().mapToInt(PriceProductCalcRespDTO.Item::getPresentTotal).sum(); - List privileges = activity.getFullPrivilege().getPrivileges().stream() - .filter(privilege -> { - if (MeetTypeEnum.PRICE.getValue().equals(privilege.getMeetType())) { - return originalTotal >= privilege.getMeetValue(); - } - if (MeetTypeEnum.QUANTITY.getValue().equals(privilege.getMeetType())) { - return itemCnt >= privilege.getMeetValue(); - } - throw new IllegalArgumentException(String.format("满减送活动(%s) 的匹配(%s)不正确", - activity.toString(), privilege.toString())); - }).collect(Collectors.toList()); - // 获得不到优惠信息,返回原始价格 - if (privileges.isEmpty()) { - return null; - } - // 获得到优惠信息,进行价格计算 - PromotionActivityRespDTO.FullPrivilege.Privilege privilege = privileges.get(privileges.size() - 1); - Integer presentTotal; - if (PreferentialTypeEnum.PRICE.getValue().equals(privilege.getPreferentialType())) { // 减价 - // 计算循环次数。这样,后续优惠的金额就是相乘了 - Integer cycleCount = 1; - if (activity.getFullPrivilege().getCycled()) { - if (MeetTypeEnum.PRICE.getValue().equals(privilege.getMeetType())) { - cycleCount = originalTotal / privilege.getMeetValue(); - } else if (MeetTypeEnum.QUANTITY.getValue().equals(privilege.getMeetType())) { - cycleCount = itemCnt / privilege.getMeetValue(); - } - } - presentTotal = originalTotal - cycleCount * privilege.getMeetValue(); - if (presentTotal < 0) { // 如果计算优惠价格小于 0 ,则说明无法使用优惠。 - presentTotal = originalTotal; - } - } else if (PreferentialTypeEnum.DISCOUNT.getValue().equals(privilege.getPreferentialType())) { // 打折 - presentTotal = originalTotal * privilege.getPreferentialValue() / 100; - } else { - throw new IllegalArgumentException(String.format("满减送促销(%s) 的优惠类型不正确", activity.toString())); - } - int discountTotal = originalTotal - presentTotal; - if (discountTotal == 0) { - return null; - } - // 按比例,拆分 presentTotal - splitDiscountPriceToItems(items, discountTotal, presentTotal); - // 返回优惠金额 - return originalTotal - presentTotal; - } - - private Integer modifyPriceByCouponCard(Integer userId, Integer couponCardId, List itemGroups) { - Assert.isTrue(couponCardId != null, "优惠劵编号不能为空"); - // 查询优惠劵 - CouponCardRespDTO couponCard = couponCardService.getCouponCard(userId, couponCardId); - if (couponCard == null) { - throw ServiceExceptionUtil.exception(COUPON_CARD_NOT_EXISTS); - } - CouponTemplateRespDTO couponTemplate = couponTemplateService.getCouponTemplate(couponCardId); - if (couponTemplate == null) { - throw ServiceExceptionUtil.exception(COUPON_TEMPLATE_NOT_EXISTS); - } - // 获得匹配的商品 - List items = new ArrayList<>(); - if (RangeTypeEnum.ALL.getValue().equals(couponTemplate.getRangeType())) { - itemGroups.forEach(itemGroup -> items.addAll(itemGroup.getItems())); - } else if (RangeTypeEnum.PRODUCT_INCLUDE_PART.getValue().equals(couponTemplate.getRangeType())) { - itemGroups.forEach(itemGroup -> items.forEach(item -> { - if (couponTemplate.getRangeValues().contains(item.getSpuId())) { - items.add(item); - } - })); - } else if (RangeTypeEnum.PRODUCT_EXCLUDE_PART.getValue().equals(couponTemplate.getRangeType())) { - itemGroups.forEach(itemGroup -> items.forEach(item -> { - if (!couponTemplate.getRangeValues().contains(item.getSpuId())) { - items.add(item); - } - })); - } else if (RangeTypeEnum.CATEGORY_INCLUDE_PART.getValue().equals(couponTemplate.getRangeType())) { - itemGroups.forEach(itemGroup -> items.forEach(item -> { - if (couponTemplate.getRangeValues().contains(item.getCid())) { - items.add(item); - } - })); - } else if (RangeTypeEnum.CATEGORY_EXCLUDE_PART.getValue().equals(couponTemplate.getRangeType())) { - itemGroups.forEach(itemGroup -> items.forEach(item -> { - if (!couponTemplate.getRangeValues().contains(item.getCid())) { - items.add(item); - } - })); - } - // 判断是否符合条件 - int originalTotal = items.stream().mapToInt(PriceProductCalcRespDTO.Item::getPresentTotal).sum(); // 此处,指的是以优惠劵视角的原价 - if (originalTotal == 0 || originalTotal < couponCard.getPriceAvailable()) { - throw ServiceExceptionUtil.exception(COUPON_CARD_NOT_MATCH); // TODO 芋艿,这种情况,会出现错误码的提示,无法格式化出来。另外,这块的最佳实践,找人讨论下。 - } - // 计算价格 - // 获得到优惠信息,进行价格计算 - int presentTotal; - if (PreferentialTypeEnum.PRICE.getValue().equals(couponCard.getPreferentialType())) { // 减价 - // 计算循环次数。这样,后续优惠的金额就是相乘了 - presentTotal = originalTotal - couponCard.getPriceOff(); - Assert.isTrue(presentTotal > 0, "计算后,价格为负数:" + presentTotal); - } else if (PreferentialTypeEnum.DISCOUNT.getValue().equals(couponCard.getPreferentialType())) { // 打折 - presentTotal = originalTotal * couponCard.getPercentOff() / 100; - if (couponCard.getDiscountPriceLimit() != null // 空,代表不限制优惠上限 - && originalTotal - presentTotal > couponCard.getDiscountPriceLimit()) { - presentTotal = originalTotal - couponCard.getDiscountPriceLimit(); - } - } else { - throw new IllegalArgumentException(String.format("优惠劵(%s) 的优惠类型不正确", couponCard.toString())); - } - int discountTotal = originalTotal - presentTotal; - Assert.isTrue(discountTotal > 0, "计算后,不产生优惠:" + discountTotal); - // 按比例,拆分 presentTotal - splitDiscountPriceToItems(items, discountTotal, presentTotal); - // 返回优惠金额 - return originalTotal - presentTotal; - } - - private void splitDiscountPriceToItems(List items, Integer discountTotal, Integer presentTotal) { - for (int i = 0; i < items.size(); i++) { - PriceProductCalcRespDTO.Item item = items.get(i); - Integer discountPart; - if (i < items.size() - 1) { // 减一的原因,是因为拆分时,如果按照比例,可能会出现.所以最后一个,使用反减 - discountPart = (int) (discountTotal * (1.0D * item.getPresentTotal() / presentTotal)); - discountTotal -= discountPart; - } else { - discountPart = discountTotal; - } - Assert.isTrue(discountPart > 0, "优惠金额必须大于 0"); - item.setDiscountTotal(item.getDiscountTotal() + discountPart); - item.setPresentTotal(item.getBuyTotal() - item.getDiscountTotal()); - item.setPresentPrice(item.getPresentTotal() / item.getBuyQuantity()); - } - } - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/banner/BannerService.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/banner/BannerService.java deleted file mode 100644 index cec3bac3d..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/banner/BannerService.java +++ /dev/null @@ -1,92 +0,0 @@ -package cn.iocoder.mall.promotionservice.service.banner; - -import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.banner.dto.*; -import cn.iocoder.mall.promotionservice.convert.banner.BannerConvert; -import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.banner.BannerDO; -import cn.iocoder.mall.promotionservice.dal.mysql.mapper.banner.BannerMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.validation.Valid; -import java.util.List; - -import static cn.iocoder.mall.promotion.api.enums.PromotionErrorCodeConstants.BANNER_NOT_EXISTS; - - -@Service -@Validated -public class BannerService { - - @Autowired - private BannerMapper bannerMapper; - - /** - * 获得 Banner 列表 - * - * @param listReqDTO Banner 列表查询 - * @return Banner 列表 - */ - public List listBanners(BannerListReqDTO listReqDTO) { - List banners = bannerMapper.selectList(listReqDTO); - return BannerConvert.INSTANCE.convertList(banners); - } - - /** - * 获得 Banner 分页 - * - * @param bannerPageDTO Banner 分页查询 - * @return Banner 分页结果 - */ - public PageResult pageBanner(BannerPageReqDTO bannerPageDTO) { - IPage bannerPage = bannerMapper.selectPage(bannerPageDTO); - return BannerConvert.INSTANCE.convertPage(bannerPage); - } - - /** - * 创建 Banner - * - * @param createReqDTO 创建 Banner 信息 - * @return banner - */ - public Integer createBanner(@Valid BannerCreateReqDTO createReqDTO) { - // 插入到数据库 - BannerDO bannerDO = BannerConvert.INSTANCE.convert(createReqDTO); - bannerMapper.insert(bannerDO); - // 返回 - return bannerDO.getId(); - } - - /** - * 更新 Banner - * - * @param updateReqDTO 更新 Banner 信息 - */ - public void updateBanner(@Valid BannerUpdateReqDTO updateReqDTO) { - // 校验更新的 Banner 是否存在 - if (bannerMapper.selectById(updateReqDTO.getId()) == null) { - throw ServiceExceptionUtil.exception(BANNER_NOT_EXISTS); - } - // 更新到数据库 - BannerDO updateObject = BannerConvert.INSTANCE.convert(updateReqDTO); - bannerMapper.updateById(updateObject); - } - - /** - * 删除 Banner - * - * @param bannerId Banner 编号 - */ - public void deleteBanner(Integer bannerId) { - // 校验 Banner 存在 - if (bannerMapper.selectById(bannerId) == null) { - throw ServiceExceptionUtil.exception(BANNER_NOT_EXISTS); - } - // 更新到数据库 - bannerMapper.deleteById(bannerId); - } - -} From c82274821a0026f5a2987bb5647e15e378233261 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 31 Oct 2022 23:44:43 +0800 Subject: [PATCH 06/29] =?UTF-8?q?=E6=B8=85=E7=90=86=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=8A=B5=E6=A8=A1=E6=9D=BF=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/enums/PreferentialTypeEnum.java | 46 ---- .../template/CouponTemplateDateTypeEnum.java | 46 ---- .../template/CouponTemplateStatusEnum.java | 45 ---- .../coupon/template/CouponTemplateTypeEnum.java | 38 --- .../controller/CouponTemplateController.java | 56 ----- .../controller/PriceController.java | 33 --- .../convert/coupon/CouponCardConvert.java | 26 -- .../convert/coupon/CouponTemplateConvert.java | 37 --- .../mysql/dataobject/coupon/CouponCodeDO.java | 43 ---- .../dataobject/coupon/CouponTemplateDO.java | 237 ------------------ .../mapper/coupon/CouponTemplateMapper.java | 8 - .../recommend/ProductRecommendMapper.java | 5 - .../service/coupon/CouponTemplateService.java | 173 ------------- .../src/main/resources/application-dev.yaml | 21 -- .../src/main/resources/application-local.yaml | 24 -- .../src/main/resources/application.yaml | 64 ----- 16 files changed, 902 deletions(-) delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PreferentialTypeEnum.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/template/CouponTemplateDateTypeEnum.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/template/CouponTemplateStatusEnum.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/template/CouponTemplateTypeEnum.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/CouponTemplateController.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/PriceController.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/CouponCardConvert.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/CouponTemplateConvert.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/coupon/CouponCodeDO.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/coupon/CouponTemplateDO.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponTemplateService.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/resources/application-dev.yaml delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/resources/application-local.yaml delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/resources/application.yaml diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PreferentialTypeEnum.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PreferentialTypeEnum.java deleted file mode 100644 index 9af2827cf..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PreferentialTypeEnum.java +++ /dev/null @@ -1,46 +0,0 @@ -package cn.iocoder.mall.promotion.api.enums; - -import cn.iocoder.common.framework.core.IntArrayValuable; - -import java.util.Arrays; - -/** - * 优惠类型枚举 - */ -public enum PreferentialTypeEnum implements IntArrayValuable { - - PRICE(1, "减价"), - DISCOUNT(2, "打折"), - ; - - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(PreferentialTypeEnum::getValue).toArray(); - - /** - * 值 - */ - private final Integer value; - /** - * 名字 - */ - private final String name; - - PreferentialTypeEnum(Integer value, String name) { - this.value = value; - this.name = name; - } - - public Integer getValue() { - return value; - } - - public String getName() { - return name; - } - - - @Override - public int[] array() { - return ARRAYS; - } - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/template/CouponTemplateDateTypeEnum.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/template/CouponTemplateDateTypeEnum.java deleted file mode 100644 index a23a0e956..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/template/CouponTemplateDateTypeEnum.java +++ /dev/null @@ -1,46 +0,0 @@ -package cn.iocoder.mall.promotion.api.enums.coupon.template; - -import cn.iocoder.common.framework.core.IntArrayValuable; - -import java.util.Arrays; - -/** - * 优惠劵(码)模板的时间类型的枚举 - */ -public enum CouponTemplateDateTypeEnum implements IntArrayValuable { - - FIXED_DATE(1, "固定日期"), - FIXED_TERM(2, "领取日期"), - ; - - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CouponTemplateDateTypeEnum::getValue).toArray(); - - /** - * 值 - */ - private final Integer value; - /** - * 名字 - */ - private final String name; - - CouponTemplateDateTypeEnum(Integer value, String name) { - this.value = value; - this.name = name; - } - - public Integer getValue() { - return value; - } - - public String getName() { - return name; - } - - - @Override - public int[] array() { - return ARRAYS; - } - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/template/CouponTemplateStatusEnum.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/template/CouponTemplateStatusEnum.java deleted file mode 100644 index 0dbfa3125..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/template/CouponTemplateStatusEnum.java +++ /dev/null @@ -1,45 +0,0 @@ -package cn.iocoder.mall.promotion.api.enums.coupon.template; - -import cn.iocoder.common.framework.core.IntArrayValuable; - -import java.util.Arrays; - -/** - * 优惠劵(码)模板的状态的枚举 - */ -public enum CouponTemplateStatusEnum implements IntArrayValuable { - - ENABLE(1, "生效中"), - DISABLE(2, "已失效"), -// EXPIRE(3, "已过期"), TODO 芋艿,暂时不考虑过期的 - ; - - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CouponTemplateStatusEnum::getValue).toArray(); - - /** - * 值 - */ - private final Integer value; - /** - * 名字 - */ - private final String name; - - CouponTemplateStatusEnum(Integer value, String name) { - this.value = value; - this.name = name; - } - - public Integer getValue() { - return value; - } - - public String getName() { - return name; - } - - @Override - public int[] array() { - return ARRAYS; - } -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/template/CouponTemplateTypeEnum.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/template/CouponTemplateTypeEnum.java deleted file mode 100644 index 7d86a6ed0..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/template/CouponTemplateTypeEnum.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.iocoder.mall.promotion.api.enums.coupon.template; - -import java.util.Arrays; - -/** - * 优惠劵(码)模板的类型的枚举 - */ -public enum CouponTemplateTypeEnum { - - CARD(1, "优惠劵"), - CODE(2, "折扣卷"), - ; - - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CouponTemplateTypeEnum::getValue).toArray(); - - /** - * 值 - */ - private final Integer value; - /** - * 名字 - */ - private final String name; - - CouponTemplateTypeEnum(Integer value, String name) { - this.value = value; - this.name = name; - } - - public Integer getValue() { - return value; - } - - public String getName() { - return name; - } - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/CouponTemplateController.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/CouponTemplateController.java deleted file mode 100644 index 01e46b769..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/CouponTemplateController.java +++ /dev/null @@ -1,56 +0,0 @@ -package cn.iocoder.mall.promotionservice.controller; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.*; -import cn.iocoder.mall.promotionservice.manager.coupon.CouponTemplateManager; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** - * Title: - * Description: - * - * @author zhuyang - * @version 1.0 2021/10/9 - */ -@RestController -@RequestMapping("/coupon/template") -public class CouponTemplateController { - - @Autowired - private CouponTemplateManager couponTemplateManager; - - // ========== 通用逻辑 ========= - - @GetMapping("getCouponTemplate") - public CommonResult getCouponTemplate(@RequestParam("couponTemplateId") Integer couponTemplateId) { - return success(couponTemplateManager.getCouponTemplate(couponTemplateId)); - } - - @PostMapping("pageCouponTemplate") - public CommonResult> pageCouponTemplate(@RequestBody CouponTemplatePageReqDTO pageDTO) { - return success(couponTemplateManager.pageCouponTemplate(pageDTO)); - } - - @PostMapping("updateCouponTemplateStatus") - public CommonResult updateCouponTemplateStatus(@RequestBody CouponCardTemplateUpdateStatusReqDTO updateStatusReqDTO) { - couponTemplateManager.updateCouponTemplateStatus(updateStatusReqDTO); - return success(true); - } - - // ========== 优惠劵模板 ========== - - @PostMapping("createCouponCardTemplate") - public CommonResult createCouponCardTemplate(@RequestBody CouponCardTemplateCreateReqDTO createDTO) { - return success(couponTemplateManager.createCouponCardTemplate(createDTO)); - } - - @PostMapping("updateCouponCardTemplate") - public CommonResult updateCouponCardTemplate(@RequestBody CouponCardTemplateUpdateReqDTO updateDTO) { - couponTemplateManager.updateCouponCardTemplate(updateDTO); - return success(true); - } -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/PriceController.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/PriceController.java deleted file mode 100644 index bfa596676..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/PriceController.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.iocoder.mall.promotionservice.controller; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.promotion.api.rpc.price.dto.PriceProductCalcReqDTO; -import cn.iocoder.mall.promotion.api.rpc.price.dto.PriceProductCalcRespDTO; -import cn.iocoder.mall.promotionservice.manager.price.PriceManager; -import org.springframework.beans.factory.annotation.Autowired; -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; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** - * Title: - * Description: - * - * @author zhuyang - * @version 1.0 2021/10/9 - */ -@RestController -@RequestMapping("/promotion/price") -public class PriceController { - - @Autowired - private PriceManager priceManager; - - @PostMapping("calcProductPrice") - public CommonResult calcProductPrice(@RequestBody PriceProductCalcReqDTO calcReqDTO) { - return success(priceManager.calcProductPrice(calcReqDTO)); - } -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/CouponCardConvert.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/CouponCardConvert.java deleted file mode 100644 index be9870bb3..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/CouponCardConvert.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.iocoder.mall.promotionservice.convert.coupon; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.card.CouponCardAvailableRespDTO; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.card.CouponCardRespDTO; -import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.coupon.CouponCardDO; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.Named; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface CouponCardConvert { - - CouponCardConvert INSTANCE = Mappers.getMapper(CouponCardConvert.class); - - CouponCardRespDTO convert(CouponCardDO bean); - - @Mapping(source = "records", target = "list") - PageResult convertPage(IPage page); - - @Named("convertCouponCardDOToCouponCardAvailableRespDTO") // 避免生成的方法名的冲突 - CouponCardAvailableRespDTO convert01(CouponCardDO bean); - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/CouponTemplateConvert.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/CouponTemplateConvert.java deleted file mode 100644 index 21a557d19..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/coupon/CouponTemplateConvert.java +++ /dev/null @@ -1,37 +0,0 @@ -package cn.iocoder.mall.promotionservice.convert.coupon; - -import cn.iocoder.common.framework.util.StringUtils; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateCreateReqDTO; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateUpdateReqDTO; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponTemplateRespDTO; -import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.coupon.CouponTemplateDO; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.Named; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface CouponTemplateConvert { - - CouponTemplateConvert INSTANCE = Mappers.getMapper(CouponTemplateConvert.class); - - @Mapping(source = "rangeValues", target = "rangeValues", qualifiedByName = "translateStringToIntList") - CouponTemplateRespDTO convert(CouponTemplateDO bean); - - CouponTemplateDO convert(CouponCardTemplateCreateReqDTO bean); - - CouponTemplateDO convert(CouponCardTemplateUpdateReqDTO bean); - - @Mapping(source = "records", target = "list") - PageResult convertPage(IPage couponTemplatePage); - - @Named("translateStringToIntList") - default List translateStringToIntList(String str) { - return StringUtils.splitToInt(str, ","); - } - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/coupon/CouponCodeDO.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/coupon/CouponCodeDO.java deleted file mode 100644 index b8651fe1b..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/coupon/CouponCodeDO.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.iocoder.mall.promotionservice.dal.mysql.dataobject.coupon; - -import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; - -/** - * 优惠码 - */ -@Data -@Accessors(chain = true) -public class CouponCodeDO extends BaseDO { - - /** - * 编号 - */ - private Integer id; - /** - * 模板编号 {@link CouponTemplateDO} 的 id - */ - private Integer templateId; - /** - * 优惠码 - */ - private Integer code; - /** - * 领取时间 - */ - private Date takeTime; - /** - * 领取用户编号 - */ - private Integer userId; - /** - * 领取的优惠劵编号 - */ - private Integer couponId; - - // TODO 芋艿,后续要考虑状态的追踪 - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/coupon/CouponTemplateDO.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/coupon/CouponTemplateDO.java deleted file mode 100644 index 666ed99a2..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/coupon/CouponTemplateDO.java +++ /dev/null @@ -1,237 +0,0 @@ -package cn.iocoder.mall.promotionservice.dal.mysql.dataobject.coupon; - -import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; -import cn.iocoder.mall.promotion.api.enums.PreferentialTypeEnum; -import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum; -import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateDateTypeEnum; -import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateStatusEnum; -import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateTypeEnum; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.util.Date; - -/** - * 优惠劵(码)模板 DO - * - * 当用户领取时,会生成 {@link CouponCardDO} 优惠劵(码)。 - */ -@TableName("coupon_template") -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class CouponTemplateDO extends BaseDO { - - // ========== 基本信息 BEGIN ========== - /** - * 模板编号,自增唯一。 - */ - private Integer id; - /** - * 标题 - */ - private String title; - /** - * 使用说明 - */ - private String description; - /** - * 类型 - * - * 枚举 {@link CouponTemplateTypeEnum} - * - * 1-优惠劵 - * 2-优惠码 - */ - private Integer type; - /** - * 优惠码状态 - * - * 枚举 {@link CouponTemplateStatusEnum} - * - * 当优惠劵(码)开启中,可以手动操作,设置禁用中。 - */ - private Integer status; -// /** -// * 是否可分享领取链接 -// */ -// private Boolean isShare; -// /** -// * 设置为失效时间 -// */ -// private Date invalidTime; -// /** -// * 删除时间 -// */ -// private Date deleteTime; - - // ========== 基本信息 END ========== - - // ========== 领取规则 BEGIN ========== -// /** -// * 是否限制领用者的等级 -// * -// * 0-不限制 -// * 大于0-领用者必须是这个等级编号 -// * -// * 【优惠劵独有】 -// */ -// private Integer needUserLevel; - /** - * 每人限领个数 - * - * null - 则表示不限制 - */ - private Integer quota; - /** - * 发行总量 - */ - private Integer total; - // ========== 领取规则 END ========== - - // ========== 使用规则 BEGIN ========== -// /** -// * 是否仅原价购买商品时可用 -// * -// * true-是 -// * false-否 -// */ -// private Boolean isForbidPreference; - /** - * 是否设置满多少金额可用,单位:分 - * - * 0-不限制 - * 大于0-多少金额可用 - */ - private Integer priceAvailable; - /** - * 可用范围的类型 - * - * 枚举 {@link RangeTypeEnum} - * - * 10-全部(ALL):所有可用 - * 20-部分(PART):部分商品可用,或指定商品可用 - * 21-部分(PART):部分商品不可用,或指定商品可用 - * 30-部分(PART):部分分类可用,或指定商品可用 - * 31-部分(PART):部分分类不可用,或指定商品可用 - */ - private Integer rangeType; - /** - * 指定商品 / 分类列表,使用逗号分隔商品编号 - */ - private String rangeValues; - /** - * 生效日期类型 - * - * 枚举 {@link CouponTemplateDateTypeEnum} - * - * 1-固定日期 - * 2-领取日期:领到券 {@link #fixedStartTerm} 日开始 N 天内有效 - */ - private Integer dateType; - /** - * 固定日期-生效开始时间 - */ - private Date validStartTime; - /** - * 固定日期-生效结束时间 - */ - private Date validEndTime; - /** - * 领取日期-开始天数 - * - * 例如,0-当天;1-次天 - */ - private Integer fixedStartTerm; - /** - * 领取日期-结束天数 - */ - private Integer fixedEndTerm; -// /** -// * 是否到期前4天发送提醒 -// * -// * true-发送 -// * false-不发送 -// */ -// private Boolean expireNotice; - // ========== 使用规则 END ========== - - // ========== 使用效果 BEGIN ========== - /** - * 优惠类型 - * - * 枚举 {@link PreferentialTypeEnum} - * - * 1-代金卷 - * 2-折扣卷 - */ - private Integer preferentialType; - /** - * 折扣百分比。 - * - * 例如,80% 为 80。 - * 当 100% 为 100 ,则代表免费。 - */ - private Integer percentOff; -// /** -// * 是否是随机优惠券 -// * -// * true-随机 -// * false-不随机 -// * -// * 【优惠劵独有】 -// */ -// private Boolean isRandom; - /** - * 优惠金额,单位:分 - */ -// * 当 {@link #isRandom} 为 true 时,代表随机优惠金额的下限 - private Integer priceOff; -// /** -// * 优惠金额上限 -// * -// * 【优惠劵独有】 -// */ -// private Integer valueRandomTo; - /** - * 折扣上限,仅在 {@link #preferentialType} 等于 2 时生效。 - * - * 例如,折扣上限为 20 元,当使用 8 折优惠券,订单金额为 1000 元时,最高只可折扣 20 元,而非 80 元。 - */ - private Integer discountPriceLimit; - // ========== 使用效果 END ========== - - // ========== 统计信息 BEGIN ========== -// /** -// * 领取优惠券的人数 -// */ -// private Integer statFetchUserNum; - /** - * 领取优惠券的次数 - */ - private Integer statFetchNum; -// /** -// * 使用优惠券的次数 -// */ -// private Integer statUseNum; - // ========== 统计信息 END ========== - - // ========== 优惠码 BEGIN ========== - /** - * 码类型 - * - * 1-一卡一码(UNIQUE) - * 2-通用码(GENERAL) - * - * 【优惠码独有】 @see CouponCodeDO - */ - private Integer codeType; - /** - * 通用码 - */ - private String commonCode; - // ========== 优惠码 BEGIN ========== - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/coupon/CouponTemplateMapper.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/coupon/CouponTemplateMapper.java index 913121c8e..32a0e6f7e 100644 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/coupon/CouponTemplateMapper.java +++ b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/coupon/CouponTemplateMapper.java @@ -12,14 +12,6 @@ import org.springframework.stereotype.Repository; @Repository public interface CouponTemplateMapper extends BaseMapper { - default IPage selectPage(CouponTemplatePageReqDTO pageReqDTO) { - return selectPage(new Page<>(pageReqDTO.getPageNo(), pageReqDTO.getPageSize()), - new QueryWrapperX().eqIfPresent("type", pageReqDTO.getType()) - .likeIfPresent("title", pageReqDTO.getTitle()) - .eqIfPresent("status", pageReqDTO.getStatus()) - .eqIfPresent("preferential_type", pageReqDTO.getPreferentialType())); - } - /** * 更新优惠劵模板已领取的数量 * diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/recommend/ProductRecommendMapper.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/recommend/ProductRecommendMapper.java index 46850b680..231442ce3 100644 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/recommend/ProductRecommendMapper.java +++ b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/recommend/ProductRecommendMapper.java @@ -20,11 +20,6 @@ public interface ProductRecommendMapper extends BaseMapper { .eq("type", type)); } - default List selectList(ProductRecommendListReqDTO listReqDTO) { - return selectList(new QueryWrapperX().eqIfPresent("type", listReqDTO.getType()) - .eqIfPresent("status", listReqDTO.getStatus())); - } - default IPage selectPage(ProductRecommendPageReqDTO pageReqDTO) { return selectPage(new Page<>(pageReqDTO.getPageNo(), pageReqDTO.getPageSize()), new QueryWrapperX().eqIfPresent("type", pageReqDTO.getType())); diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponTemplateService.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponTemplateService.java deleted file mode 100644 index e087459b5..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponTemplateService.java +++ /dev/null @@ -1,173 +0,0 @@ -package cn.iocoder.mall.promotionservice.service.coupon; - -import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.enums.PreferentialTypeEnum; -import cn.iocoder.mall.promotion.api.enums.PromotionErrorCodeConstants; -import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateDateTypeEnum; -import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateStatusEnum; -import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateTypeEnum; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateCreateReqDTO; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateUpdateReqDTO; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponTemplatePageReqDTO; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponTemplateRespDTO; -import cn.iocoder.mall.promotionservice.convert.coupon.CouponTemplateConvert; -import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.coupon.CouponTemplateDO; -import cn.iocoder.mall.promotionservice.dal.mysql.mapper.coupon.CouponTemplateMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import java.util.Date; - -import static cn.iocoder.common.framework.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; - -/** - * 优惠劵模板 Service - */ -@Service -@Validated -public class CouponTemplateService { - - @Autowired - private CouponTemplateMapper couponTemplateMapper; - - // ========== 通用逻辑 ========= - - /** - * 获得优惠劵(码)模板 - * - * @param couponCardId 优惠劵模板编号 - * @return 优惠劵(码)模板 - */ - public CouponTemplateRespDTO getCouponTemplate(Integer couponCardId) { - return CouponTemplateConvert.INSTANCE.convert(couponTemplateMapper.selectById(couponCardId)); - } - - /** - * 获得优惠劵(码)分页 - * - * @param pageDTO 分页条件 - * @return 优惠劵(码)分页 - */ - public PageResult pageCouponTemplate(CouponTemplatePageReqDTO pageDTO) { - IPage couponTemplatePage = couponTemplateMapper.selectPage(pageDTO); - return CouponTemplateConvert.INSTANCE.convertPage(couponTemplatePage); - } - - /** - * 更新优惠劵(码)模板的状态 - * - * @param couponTemplateId 优惠劵模板编号 - * @param status 状态 - */ - public void updateCouponTemplateStatus(Integer couponTemplateId, Integer status) { - // 校验 CouponCardTemplate 存在 - CouponTemplateDO template = couponTemplateMapper.selectById(couponTemplateId); - if (template == null) { - throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_TEMPLATE_NOT_EXISTS.getCode()); - } - // 更新到数据库 - CouponTemplateDO updateTemplateDO = new CouponTemplateDO().setId(couponTemplateId).setStatus(status); - couponTemplateMapper.updateById(updateTemplateDO); - } - - private Boolean checkCouponTemplateDateType(Integer dateType, Date validStartTime, Date validEndTime, Integer fixedStartTerm, Integer fixedEndTerm) { - // TODO 芋艿:后续这种类型的校验,看看怎么优化到对象里 - if (CouponTemplateDateTypeEnum.FIXED_DATE.getValue().equals(dateType)) { // 固定日期 - if (validStartTime == null) { - throw ServiceExceptionUtil.exception(BAD_REQUEST, "生效开始时间不能为空"); - } - if (validEndTime == null) { - throw ServiceExceptionUtil.exception(BAD_REQUEST, "生效结束时间不能为空"); - } - if (validStartTime.after(validEndTime)) { - throw ServiceExceptionUtil.exception(BAD_REQUEST, "生效开始时间不能大于生效结束时间"); - } - } else if (CouponTemplateDateTypeEnum.FIXED_TERM.getValue().equals(dateType)) { // 领取日期 - if (fixedStartTerm == null) { - throw ServiceExceptionUtil.exception(BAD_REQUEST, "领取日期开始时间不能为空"); - } - if (fixedEndTerm == null) { - throw ServiceExceptionUtil.exception(BAD_REQUEST, "领取日期结束时间不能为空"); - } - } else { - throw new IllegalArgumentException("未知的生效日期类型:" + dateType); - } - return true; - } - - private Boolean checkCouponTemplatePreferentialType(Integer preferentialType, Integer percentOff, - Integer priceOff, Integer priceAvailable) { - if (PreferentialTypeEnum.PRICE.getValue().equals(preferentialType)) { - if (priceOff == null) { - throw ServiceExceptionUtil.exception(BAD_REQUEST, "优惠金额不能为空"); - } - if (priceOff >= priceAvailable) { - throw ServiceExceptionUtil.exception(BAD_REQUEST, "优惠金额不能d大于等于使用金额门槛"); - } - } else if (PreferentialTypeEnum.DISCOUNT.getValue().equals(preferentialType)) { - if (percentOff == null) { - throw ServiceExceptionUtil.exception(BAD_REQUEST, "折扣百分比不能为空"); - } - } else { - throw new IllegalArgumentException("未知的优惠类型:" + preferentialType); - } - return true; - } - - // ========== 优惠劵模板 ========== - - /** - * 添加优惠劵模板 - * - * @param createReqDTO 优惠劵模板添加信息 - * @return 优惠劵模板编号 - */ - public Integer createCouponCardTemplate(CouponCardTemplateCreateReqDTO createReqDTO) { - // 校验生效日期相关 - checkCouponTemplateDateType(createReqDTO.getDateType(), - createReqDTO.getValidStartTime(), createReqDTO.getValidEndTime(), - createReqDTO.getFixedStartTerm(), createReqDTO.getFixedEndTerm()); - // 校验优惠类型 - checkCouponTemplatePreferentialType(createReqDTO.getPreferentialType(), createReqDTO.getPercentOff(), - createReqDTO.getPriceOff(), createReqDTO.getPriceAvailable()); - // 保存优惠劵模板到数据库 - CouponTemplateDO template = CouponTemplateConvert.INSTANCE.convert(createReqDTO) - .setType(CouponTemplateTypeEnum.CARD.getValue()) - .setStatus(CouponTemplateStatusEnum.ENABLE.getValue()) - .setStatFetchNum(0); - couponTemplateMapper.insert(template); - // 返回成功 - return template.getId(); - } - - /** - * 更新优惠劵模板 - * - * @param updateReqDTO 优惠劵模板修改信息 - */ - public void updateCouponCardTemplate(CouponCardTemplateUpdateReqDTO updateReqDTO) { - // 校验 CouponCardTemplate 存在 - CouponTemplateDO template = couponTemplateMapper.selectById(updateReqDTO.getId()); - if (template == null) { - throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_TEMPLATE_NOT_EXISTS.getCode()); - } - // 校验 CouponCardTemplate 是 CARD - if (!CouponTemplateTypeEnum.CARD.getValue().equals(template.getType())) { - throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_TEMPLATE_NOT_CARD.getCode()); - } - // 校验发放数量不能减少 - if (updateReqDTO.getTotal() < template.getTotal()) { - throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_TEMPLATE_TOTAL_CAN_NOT_REDUCE.getCode()); - } - // 更新优惠劵模板到数据库 - CouponTemplateDO updateTemplateDO = CouponTemplateConvert.INSTANCE.convert(updateReqDTO); - couponTemplateMapper.updateById(updateTemplateDO); - } - - // ========== 优惠码模板 TODO 芋艿:以后开发 ========== - - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/resources/application-dev.yaml b/归档/promotion-service-project/promotion-service-app/src/main/resources/application-dev.yaml deleted file mode 100644 index 946ea52b2..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/resources/application-dev.yaml +++ /dev/null @@ -1,21 +0,0 @@ -spring: - # 数据源配置项 - datasource: - url: jdbc:mysql://localhost:3306/mall_promotion?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT - driver-class-name: com.mysql.jdbc.Driver - username: root - password: zhuyang - # Spring Cloud 配置项 - cloud: - nacos: - # Spring Cloud Nacos Discovery 配置项 - discovery: - server-addr: localhost:8848 # Nacos 服务器地址 - namespace: dev # Nacos 命名空间 - -# Dubbo 配置项 -dubbo: - # Dubbo 注册中心 - registry: - # address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 diff --git a/归档/promotion-service-project/promotion-service-app/src/main/resources/application-local.yaml b/归档/promotion-service-project/promotion-service-app/src/main/resources/application-local.yaml deleted file mode 100644 index 43bff1671..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/resources/application-local.yaml +++ /dev/null @@ -1,24 +0,0 @@ -spring: - # 数据源配置项 - datasource: - url: jdbc:mysql://localhost:3306/mall_promotion?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT - driver-class-name: com.mysql.jdbc.Driver - username: root - password: zhuyang - # Spring Cloud 配置项 - cloud: - nacos: - # Spring Cloud Nacos Discovery 配置项 - discovery: - server-addr: localhost:8848 # Nacos 服务器地址 - namespace: dev # Nacos 命名空间 - -# Dubbo 配置项 -dubbo: - # Dubbo 注册中心 - registry: -# address: spring-cloud://localhost:8848 # 指定 Dubbo 服务注册中心的地址 - address: nacos://localhost:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址 - # Dubbo 服务提供者的配置 - provider: - tag: ${DUBBO_TAG} # Dubbo 路由分组 diff --git a/归档/promotion-service-project/promotion-service-app/src/main/resources/application.yaml b/归档/promotion-service-project/promotion-service-app/src/main/resources/application.yaml deleted file mode 100644 index 10d90e898..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/resources/application.yaml +++ /dev/null @@ -1,64 +0,0 @@ -spring: - # Application 的配置项 - application: - name: promotion-service - # Profile 的配置项 - profiles: - active: local - -# MyBatis Plus 配置项 -mybatis-plus: - configuration: - map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。 - global-config: - db-config: - id-type: auto - logic-delete-value: 1 # 逻辑已删除值(默认为 1) - logic-not-delete-value: 0 # 逻辑未删除值(默认为 0) - mapper-locations: classpath*:mapper/*.xml - type-aliases-package: cn.iocoder.mall.promotionservice.dal.mysql.dataobject - -# Dubbo 配置项 -dubbo: - # Spring Cloud Alibaba Dubbo 专属配置 - cloud: - subscribed-services: '' # 设置订阅的应用列表,默认为 * 订阅所有应用 - # Dubbo 提供者的协议 - protocol: - name: dubbo - port: -1 - # Dubbo 提供服务的扫描基础包 - scan: - base-packages: cn.iocoder.mall.promotionservice.rpc - # Dubbo 服务提供者的配置 - provider: - filter: -exception - validation: true # 开启 Provider 参数校验 - version: 1.0.0 # 服务的版本号 - # Dubbo 服务消费者的配置 - consumer: - ErrorCodeRpc: - version: 1.0.0 - ProductSkuRpc: - version: 1.0.0 - ProductSpuRpc: - version: 1.0.0 - -# RocketMQ 配置项 -rocketmq: - name-server: localhost:9876 - producer: - group: ${spring.application.name}-producer-group - -# Actuator 监控配置项 -management: - server.port: 38085 # 独立端口,避免被暴露出去 - endpoints.web.exposure.include: '*' # 暴露所有监控端点 -server.port: ${management.server.port} # 设置使用 Actuator 的服务器端口,因为 RPC 服务不需要 Web 端口 - -# Mall 配置项 -mall: - # 错误码配置项对应 ErrorCodeProperties 配置类 - error-code: - group: ${spring.application.name} - constants-class: cn.iocoder.mall.promotionservice.enums.PromotionErrorCodeConstants From fcea893ec9a2c336556d9e66765f8c50550aabd9 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 2 Nov 2022 23:01:53 +0800 Subject: [PATCH 07/29] =?UTF-8?q?=E6=B8=85=E7=90=86=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=8A=B5=E6=A8=A1=E6=9D=BF=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 归档/promotion-service-project/pom.xml | 44 ------ .../promotion-service-api/pom.xml | 64 --------- .../coupon/card/CouponCardTakeTypeEnum.java | 44 ------ .../api/rpc/coupon/CouponTemplateFeign.java | 39 ------ .../coupon/dto/card/CouponCardPageReqDTO.java | 25 ---- .../promotion-service-app/pom.xml | 125 ------------------ .../manager/coupon/CouponCardManager.java | 41 ------ .../manager/coupon/CouponTemplateManager.java | 43 ------ .../activity/PromotionActivityMapperTest.java | 28 ---- .../promotionservice/manager/package-info.java | 1 - .../manager/price/PriceManagerTest.java | 30 ----- 11 files changed, 484 deletions(-) delete mode 100644 归档/promotion-service-project/pom.xml delete mode 100644 归档/promotion-service-project/promotion-service-api/pom.xml delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/card/CouponCardTakeTypeEnum.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/CouponTemplateFeign.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardPageReqDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-app/pom.xml delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/coupon/CouponCardManager.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/coupon/CouponTemplateManager.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/test/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/activity/PromotionActivityMapperTest.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/test/java/cn/iocoder/mall/promotionservice/manager/package-info.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/test/java/cn/iocoder/mall/promotionservice/manager/price/PriceManagerTest.java diff --git a/归档/promotion-service-project/pom.xml b/归档/promotion-service-project/pom.xml deleted file mode 100644 index 7d36ed95e..000000000 --- a/归档/promotion-service-project/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - onemall - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - promotion-service-project - pom - - promotion-service-api - promotion-service-app - - - - - - - cn.iocoder.mall - mall-dependencies - 1.0-SNAPSHOT - pom - import - - - - cn.iocoder.mall - common-framework - 1.0-SNAPSHOT - - - - - cn.iocoder.mall - promotion-service-api - 1.0-SNAPSHOT - - - - \ No newline at end of file diff --git a/归档/promotion-service-project/promotion-service-api/pom.xml b/归档/promotion-service-project/promotion-service-api/pom.xml deleted file mode 100644 index 404f45568..000000000 --- a/归档/promotion-service-project/promotion-service-api/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - promotion-service-project - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - promotion-service-api - - - - - cn.iocoder.mall - common-framework - 1.0-SNAPSHOT - - - - - org.mapstruct - mapstruct - - - org.mapstruct - mapstruct-jdk8 - - - - org.projectlombok - lombok - - - - javax.validation - validation-api - - - - org.hibernate - hibernate-validator - true - - - org.springframework.cloud - spring-cloud-openfeign-core - RELEASE - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - - diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/card/CouponCardTakeTypeEnum.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/card/CouponCardTakeTypeEnum.java deleted file mode 100644 index d254af4b5..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/card/CouponCardTakeTypeEnum.java +++ /dev/null @@ -1,44 +0,0 @@ -package cn.iocoder.mall.promotion.api.enums.coupon.card; - -import cn.iocoder.common.framework.core.IntArrayValuable; - -import java.util.Arrays; - -/** - * 优惠劵领取方式 - */ -public enum CouponCardTakeTypeEnum implements IntArrayValuable { - - BY_USER(1, "用户主动领取"), - BY_ADMIN(2, "已使用"), - ; - - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CouponCardTakeTypeEnum::getValue).toArray(); - - /** - * 值 - */ - private final Integer value; - /** - * 名字 - */ - private final String name; - - CouponCardTakeTypeEnum(Integer value, String name) { - this.value = value; - this.name = name; - } - - public Integer getValue() { - return value; - } - - public String getName() { - return name; - } - - @Override - public int[] array() { - return ARRAYS; - } -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/CouponTemplateFeign.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/CouponTemplateFeign.java deleted file mode 100644 index 50a4955a9..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/CouponTemplateFeign.java +++ /dev/null @@ -1,39 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.coupon; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.*; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; - -/** - * Title: - * Description: - * - * @author zhuyang - * @version 1.0 2021/10/9 - */ -@FeignClient("promotion-service") -public interface CouponTemplateFeign { - // ========== 通用逻辑 ========= - - @GetMapping("/coupon/template/getCouponTemplate") - public CommonResult getCouponTemplate(@RequestParam("couponTemplateId") Integer couponTemplateId); - - @PostMapping("/coupon/template/pageCouponTemplate") - public CommonResult> pageCouponTemplate(@RequestBody CouponTemplatePageReqDTO pageDTO); - - @PostMapping("/coupon/template/updateCouponTemplateStatus") - public CommonResult updateCouponTemplateStatus(@RequestBody CouponCardTemplateUpdateStatusReqDTO updateStatusReqDTO) ; - - // ========== 优惠劵模板 ========== - - @PostMapping("/coupon/template/createCouponCardTemplate") - public CommonResult createCouponCardTemplate(@RequestBody CouponCardTemplateCreateReqDTO createDTO) ; - - @PostMapping("/coupon/template/updateCouponCardTemplate") - public CommonResult updateCouponCardTemplate(@RequestBody CouponCardTemplateUpdateReqDTO updateDTO) ; -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardPageReqDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardPageReqDTO.java deleted file mode 100644 index 4dcf5a23c..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardPageReqDTO.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.coupon.dto.card; - -import cn.iocoder.common.framework.vo.PageParam; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - * 优惠劵分页 DTO - */ -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class CouponCardPageReqDTO extends PageParam { - - /** - * 用户编号 - */ - private Integer userId; - /** - * 状态 - */ - private Integer status; - -} diff --git a/归档/promotion-service-project/promotion-service-app/pom.xml b/归档/promotion-service-project/promotion-service-app/pom.xml deleted file mode 100644 index 2542b5202..000000000 --- a/归档/promotion-service-project/promotion-service-app/pom.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - promotion-service-project - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - promotion-service-app - - - - - cn.iocoder.mall - mall-spring-boot-starter-dubbo - - - - - cn.iocoder.mall - system-service-api - ${project.version} - - - - - cn.iocoder.mall - product-service-api - 1.0-SNAPSHOT - - - - - cn.iocoder.mall - promotion-service-api - - - - - org.springframework.boot - spring-boot-starter-web - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - - - mysql - mysql-connector-java - - - - com.alibaba - druid-spring-boot-starter - - - - cn.iocoder.mall - mall-spring-boot-starter-mybatis - - - - - org.springframework.boot - spring-boot-starter-actuator - - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - org.springframework.boot - spring-boot-starter-validation - - - - org.projectlombok - lombok - - - - org.mapstruct - mapstruct - - - org.mapstruct - mapstruct-jdk8 - - - - org.aspectj - aspectjweaver - 1.9.6 - - - org.springframework.cloud - spring-cloud-starter-openfeign - - - - - - ${project.artifactId} - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/coupon/CouponCardManager.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/coupon/CouponCardManager.java deleted file mode 100644 index 75cd6c122..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/coupon/CouponCardManager.java +++ /dev/null @@ -1,41 +0,0 @@ -package cn.iocoder.mall.promotionservice.manager.coupon; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.card.*; -import cn.iocoder.mall.promotionservice.service.coupon.CouponCardService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import java.util.List; - -@Service -@Validated -public class CouponCardManager { - - @Autowired - private CouponCardService couponCardService; - - public PageResult pageCouponCard(CouponCardPageReqDTO pageReqDTO) { - return couponCardService.pageCouponCard(pageReqDTO); - } - - public Integer createCouponCard(CouponCardCreateReqDTO createReqDTO) { - return couponCardService.createCouponCard(createReqDTO.getUserId(), createReqDTO.getCouponTemplateId()); - } - - public Boolean useCouponCard(CouponCardUseReqDTO useReqDTO) { - couponCardService.useCouponCard(useReqDTO.getUserId(), useReqDTO.getCouponCardId()); - return true; - } - - public Boolean cancelUseCouponCard(CouponCardCancelUseReqDTO cancelUseReqDTO) { - couponCardService.cancelUseCouponCard(cancelUseReqDTO.getUserId(), cancelUseReqDTO.getCouponCardId()); - return true; - } - - public List listAvailableCouponCards(CouponCardAvailableListReqDTO listReqDTO) { - return couponCardService.listAvailableCouponCards(listReqDTO); - } - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/coupon/CouponTemplateManager.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/coupon/CouponTemplateManager.java deleted file mode 100644 index e10ecd494..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/coupon/CouponTemplateManager.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.iocoder.mall.promotionservice.manager.coupon; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.*; -import cn.iocoder.mall.promotionservice.service.coupon.CouponTemplateService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -/** - * 优惠劵(码)模板 Manager - */ -@Service -public class CouponTemplateManager { - - @Autowired - private CouponTemplateService couponTemplateService; - - // ========== 通用逻辑 ========= - - public CouponTemplateRespDTO getCouponTemplate(Integer couponTemplateId) { - return couponTemplateService.getCouponTemplate(couponTemplateId); - } - - public PageResult pageCouponTemplate(CouponTemplatePageReqDTO pageDTO) { - return couponTemplateService.pageCouponTemplate(pageDTO); - } - - public void updateCouponTemplateStatus(CouponCardTemplateUpdateStatusReqDTO updateStatusReqDTO) { - couponTemplateService.updateCouponTemplateStatus(updateStatusReqDTO.getId(), updateStatusReqDTO.getStatus()); - } - - // ========== 优惠劵模板 ========== - - public Integer createCouponCardTemplate(CouponCardTemplateCreateReqDTO createDTO) { - return couponTemplateService.createCouponCardTemplate(createDTO); - } - - - public void updateCouponCardTemplate(CouponCardTemplateUpdateReqDTO updateDTO) { - couponTemplateService.updateCouponCardTemplate(updateDTO); - } - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/test/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/activity/PromotionActivityMapperTest.java b/归档/promotion-service-project/promotion-service-app/src/test/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/activity/PromotionActivityMapperTest.java deleted file mode 100644 index 3a5596b0d..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/test/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/activity/PromotionActivityMapperTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.promotionservice.dal.mysql.mapper.activity; - -import cn.iocoder.mall.promotion.api.enums.activity.PromotionActivityStatusEnum; -import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.activity.PromotionActivityDO; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import java.util.Collections; -import java.util.List; - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -public class PromotionActivityMapperTest { - - @Autowired - private PromotionActivityMapper promotionActivityMapper; - - @Test - public void testSelectListByStatus() { - List result = promotionActivityMapper.selectListByStatus( - Collections.singleton(PromotionActivityStatusEnum.RUN.getValue())); - System.out.println(result.size()); - } - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/test/java/cn/iocoder/mall/promotionservice/manager/package-info.java b/归档/promotion-service-project/promotion-service-app/src/test/java/cn/iocoder/mall/promotionservice/manager/package-info.java deleted file mode 100644 index d21a6c1f3..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/test/java/cn/iocoder/mall/promotionservice/manager/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package cn.iocoder.mall.promotionservice.manager; diff --git a/归档/promotion-service-project/promotion-service-app/src/test/java/cn/iocoder/mall/promotionservice/manager/price/PriceManagerTest.java b/归档/promotion-service-project/promotion-service-app/src/test/java/cn/iocoder/mall/promotionservice/manager/price/PriceManagerTest.java deleted file mode 100644 index 614dd6a77..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/test/java/cn/iocoder/mall/promotionservice/manager/price/PriceManagerTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.mall.promotionservice.manager.price; - -import cn.iocoder.mall.promotion.api.rpc.price.dto.PriceProductCalcReqDTO; -import cn.iocoder.mall.promotion.api.rpc.price.dto.PriceProductCalcRespDTO; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import java.util.Arrays; - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -public class PriceManagerTest { - - @Autowired - private PriceManager priceManager; - - @Test - public void testCalcProductPrice() { - PriceProductCalcReqDTO calcReqDTO = new PriceProductCalcReqDTO(); - PriceProductCalcReqDTO.Item item01 = new PriceProductCalcReqDTO.Item(33, 2, true); // 满足满减送的商品 - PriceProductCalcReqDTO.Item item02 = new PriceProductCalcReqDTO.Item(34, 2, true); // 满足限时折扣的商品 - calcReqDTO.setItems(Arrays.asList(item01, item02)); - PriceProductCalcRespDTO calcRespDTO = priceManager.calcProductPrice(calcReqDTO); - System.out.println(calcRespDTO); - } - -} From 479a05b5d775265dda8f160afcdec1bccb523b7a Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 5 Nov 2022 01:19:25 +0800 Subject: [PATCH 08/29] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=95=86=E5=93=81?= =?UTF-8?q?=E6=8E=A8=E8=8D=90=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity/PromotionActivityController.java | 36 ---- .../activity/vo/PromotionActivityPageReqVO.java | 26 --- .../promotion/brand/BannerController.java | 65 ------ .../promotion/brand/vo/BannerCreateReqVO.java | 43 ---- .../promotion/brand/vo/BannerPageReqVO.java | 17 -- .../promotion/brand/vo/BannerRespVO.java | 32 --- .../promotion/brand/vo/BannerUpdateReqVO.java | 43 ---- .../coupon/CouponTemplateController.java | 71 ------- .../template/CouponTemplateCardCreateReqVO.java | 84 -------- .../template/CouponTemplateCardUpdateReqVO.java | 47 ----- .../vo/template/CouponTemplatePageReqVO.java | 23 -- .../vo/template/CouponTemplateRespVO.java | 80 ------- .../recommend/ProductRecommendController.java | 60 ------ .../vo/ProductRecommendCreateReqVO.java | 33 --- .../recommend/vo/ProductRecommendDetailVO.java | 43 ---- .../recommend/vo/ProductRecommendPageReqVO.java | 20 -- .../vo/ProductRecommendUpdateReqVO.java | 36 ---- .../promotion/CouponTemplateConvert.java | 28 --- .../promotion/ProductRecommendConvert.java | 31 --- .../promotion/PromotionActivityConvert.java | 15 -- .../activity/PromotionActivityManager.java | 31 --- .../promotion/coupon/CouponTemplateManager.java | 54 ----- .../recommend/ProductRecommendManager.java | 90 -------- .../mall/promotion/api/enums/MeetTypeEnum.java | 33 --- .../api/enums/PromotionErrorCodeConstants.java | 12 -- .../mall/promotion/api/enums/RangeTypeEnum.java | 49 ----- .../enums/coupon/card/CouponCardStatusEnum.java | 45 ---- .../recommend/ProductRecommendTypeEnum.java | 53 ----- .../dto/PromotionActivityPageReqDTO.java | 33 --- .../activity/dto/PromotionActivityRespDTO.java | 160 -------------- .../CouponCardTemplateCreateReqDTO.java | 143 ------------- .../CouponCardTemplateUpdateReqDTO.java | 142 ------------- .../CouponCardTemplateUpdateStatusReqDTO.java | 30 --- .../dto/template/CouponTemplatePageReqDTO.java | 33 --- .../dto/template/CouponTemplateRespDTO.java | 156 -------------- .../rpc/recommend/ProductRecommendFeign.java | 38 ---- .../dto/ProductRecommendCreateReqDTO.java | 48 ----- .../dto/ProductRecommendListReqDTO.java | 29 --- .../dto/ProductRecommendPageReqDTO.java | 24 --- .../recommend/dto/ProductRecommendRespDTO.java | 50 ----- .../dto/ProductRecommendUpdateReqDTO.java | 53 ----- .../controller/ProductRecommendController.java | 55 ----- .../controller/PromotionActivityController.java | 40 ---- .../activity/PromotionActivityConvert.java | 23 -- .../recommend/ProductRecommendConvert.java | 29 --- .../activity/PromotionActivityDO.java | 197 ------------------ .../recommend/ProductRecommendDO.java | 48 ----- .../recommend/ProductRecommendMapper.java | 28 --- .../activity/PromotionActivityManager.java | 32 --- .../recommend/ProductRecommendManager.java | 65 ------ .../recommend/ProductRecommendService.java | 93 --------- .../promotion/ProductRecommendController.java | 34 --- 52 files changed, 2783 deletions(-) delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/activity/PromotionActivityController.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/activity/vo/PromotionActivityPageReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/BannerController.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerCreateReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerPageReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerRespVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerUpdateReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/CouponTemplateController.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateCardCreateReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateCardUpdateReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplatePageReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateRespVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/ProductRecommendController.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendCreateReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendDetailVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendPageReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendUpdateReqVO.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/CouponTemplateConvert.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/ProductRecommendConvert.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/PromotionActivityConvert.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/activity/PromotionActivityManager.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/coupon/CouponTemplateManager.java delete mode 100644 归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/recommend/ProductRecommendManager.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/MeetTypeEnum.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/RangeTypeEnum.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/card/CouponCardStatusEnum.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/recommend/ProductRecommendTypeEnum.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageReqDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityRespDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateCreateReqDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateUpdateReqDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateUpdateStatusReqDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponTemplatePageReqDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponTemplateRespDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/ProductRecommendFeign.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendCreateReqDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendListReqDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendPageReqDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendRespDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendUpdateReqDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/ProductRecommendController.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/PromotionActivityController.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/activity/PromotionActivityConvert.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/recommend/ProductRecommendConvert.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/activity/PromotionActivityDO.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/recommend/ProductRecommendDO.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/recommend/ProductRecommendMapper.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/activity/PromotionActivityManager.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/recommend/ProductRecommendManager.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/recommend/ProductRecommendService.java delete mode 100644 归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/promotion/ProductRecommendController.java diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/activity/PromotionActivityController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/activity/PromotionActivityController.java deleted file mode 100644 index b1baaea9a..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/activity/PromotionActivityController.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.promotion.activity; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.promotion.activity.vo.PromotionActivityPageReqVO; -import cn.iocoder.mall.managementweb.manager.promotion.activity.PromotionActivityManager; -import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO; -import cn.iocoder.security.annotations.RequiresPermissions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -@RestController -@RequestMapping("/promotion/activity") -@Api(tags = "促销活动 API") -@Validated -public class PromotionActivityController { - - @Autowired - private PromotionActivityManager promotionActivityManager; - - // TODO 芋艿:DTO => VO - @GetMapping("/page") - @ApiOperation("获得促销活动分页") - @RequiresPermissions("promotion:activity:page") - public CommonResult> pagePromotionActivity(PromotionActivityPageReqVO pageReqVO) { - return success(promotionActivityManager.pagePromotionActivity(pageReqVO)); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/activity/vo/PromotionActivityPageReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/activity/vo/PromotionActivityPageReqVO.java deleted file mode 100644 index c784119ad..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/activity/vo/PromotionActivityPageReqVO.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.promotion.activity.vo; - -import cn.iocoder.common.framework.vo.PageParam; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.util.Collection; - -/** - * 促销活动分页 Request DTO - */ -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class PromotionActivityPageReqVO extends PageParam { - - @ApiModelProperty(value = "标题", example = "优惠劵牛逼") - private String title; - @ApiModelProperty(value = "活动类型", example = "1", notes = "参见 PromotionActivityTypeEnum 枚举") - private Integer activityType; - @ApiModelProperty(value = "状态数组", example = "1,2", notes = "参考 PromotionActivityStatusEnum 枚举") - private Collection statuses; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/BannerController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/BannerController.java deleted file mode 100644 index 714dcbc72..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/BannerController.java +++ /dev/null @@ -1,65 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.promotion.brand; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerCreateReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerPageReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerRespVO; -import cn.iocoder.mall.managementweb.controller.promotion.brand.vo.BannerUpdateReqVO; -import cn.iocoder.mall.managementweb.manager.promotion.brand.BannerManager; -import cn.iocoder.security.annotations.RequiresPermissions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** - * Banner Controller - */ -@RestController -@RequestMapping("/promotion/banner") -@Api(tags = "Banner API") -@Validated -public class BannerController { - - @Autowired - private BannerManager bannerManager; - - @PostMapping("/create") - @ApiOperation("创建 Banner") - @RequiresPermissions("promotion:banner:create") - public CommonResult createBanner(@Valid BannerCreateReqVO createVO) { - return success(bannerManager.createBanner(createVO)); - } - - @PostMapping("/update") - @ApiOperation("更新 Banner") - @RequiresPermissions("promotion:banner:update") - public CommonResult updateBanner(@Valid BannerUpdateReqVO updateVO) { - bannerManager.updateBanner(updateVO); - return success(true); - } - - @PostMapping("/delete") - @ApiOperation("删除 Banner") - @ApiImplicitParam(name = "bannerId", value = " Banner 编号", required = true) - @RequiresPermissions("promotion:banner:delete") - public CommonResult deleteBanner(@RequestParam("bannerId") Integer bannerId) { - bannerManager.deleteBanner(bannerId); - return success(true); - } - - @GetMapping("/page") - @ApiOperation("获得 Banner 分页") - @RequiresPermissions("promotion:banner:page") - public CommonResult> pageBanner(BannerPageReqVO pageVO) { - return success(bannerManager.pageBanner(pageVO)); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerCreateReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerCreateReqVO.java deleted file mode 100644 index 99a4e0c45..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerCreateReqVO.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.promotion.brand.vo; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.hibernate.validator.constraints.Length; -import org.hibernate.validator.constraints.URL; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("Banner 创建 Request VO") -@Data -public class BannerCreateReqVO { - - @ApiModelProperty(value = "标题", required = true, example = "活动 A") - @NotEmpty(message = "标题不能为空") - @Length(min = 2, max = 32, message = "标题长度为 2-32 位") - private String title; - @ApiModelProperty(value = "跳转链接", required = true, example = "http://www.baidu.com") - @NotEmpty(message = "跳转链接不能为空") - @URL(message = "跳转链接格式不正确") - @Length(max = 255, message = "跳转链接最大长度为 255 位") - private String url; - @ApiModelProperty(value = "跳转链接", required = true, example = "http://www.iocoder.cn/01.jpg") - @NotEmpty(message = "跳转链接不能为空") - @URL(message = "图片链接格式不正确") - @Length(max = 255, message = "图片链接最大长度为 255 位") - private String picUrl; - @ApiModelProperty(value = "排序", required = true, example = "10") - @NotNull(message = "排序不能为空") - private Integer sort; - @ApiModelProperty(value = "状态", required = true, example = "1") - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - @ApiModelProperty(value = "备注", example = "这个活动很牛逼") - @Length(max = 255, message = "备注最大长度为 255 位") - private String memo; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerPageReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerPageReqVO.java deleted file mode 100644 index ea78dd3e6..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerPageReqVO.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.promotion.brand.vo; - -import cn.iocoder.common.framework.vo.PageParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@ApiModel("Banner 分页 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -public class BannerPageReqVO extends PageParam { - - @ApiModelProperty(value = "标题", required = true, example = "活动 A") - private String title; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerRespVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerRespVO.java deleted file mode 100644 index 536289705..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerRespVO.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.promotion.brand.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; - -@ApiModel("Banner VO") -@Data -@Accessors(chain = true) -public class BannerRespVO { - - @ApiModelProperty(value = "Banner 编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "标题", required = true, example = "活动 A") - private String title; - @ApiModelProperty(value = "跳转链接", required = true, example = "http://www.baidu.com") - private String url; - @ApiModelProperty(value = "图片链接", required = true, example = "http://www.iocoder.cn/01.jpg") - private String picUrl; - @ApiModelProperty(value = "排序", required = true, example = "10") - private Integer sort; - @ApiModelProperty(value = "状态", required = true, example = "1") - private Integer status; - @ApiModelProperty(value = "备注", example = "这个活动很牛逼") - private String memo; - @ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式") - private Date createTime; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerUpdateReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerUpdateReqVO.java deleted file mode 100644 index fa8d3a8c9..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/brand/vo/BannerUpdateReqVO.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.promotion.brand.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import org.hibernate.validator.constraints.Length; -import org.hibernate.validator.constraints.URL; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("Banner 更新 Request VO") -@Data -public class BannerUpdateReqVO { - - @ApiModelProperty(value = "Banner 编号", required = true, example = "1") - @NotNull(message = "编号不能为空") - private Integer id; - @ApiModelProperty(value = "标题", required = true, example = "活动 A") - @NotEmpty(message = "标题不能为空") - @Length(min = 2, max = 32, message = "标题长度为 2-32 位") - private String title; - @ApiModelProperty(value = "跳转链接", required = true, example = "http://www.baidu.com") - @NotEmpty(message = "跳转链接不能为空") - @URL(message = "跳转链接格式不正确") - @Length(max = 255, message = "跳转链接最大长度为 255 位") - private String url; - @ApiModelProperty(value = "跳转链接", required = true, example = "http://www.iocoder.cn/01.jpg") - @NotEmpty(message = "跳转链接不能为空") - @URL(message = "图片链接格式不正确") - @Length(max = 255, message = "图片链接最大长度为 255 位") - private String picUrl; - @ApiModelProperty(value = "排序", required = true, example = "10") - @NotNull(message = "排序不能为空") - private Integer sort; - @ApiModelProperty(value = "状态", required = true, example = "1") - @NotNull(message = "状态不能为空") - private Integer status; - @ApiModelProperty(value = "备注", example = "这个活动很牛逼") - @Length(max = 255, message = "备注最大长度为 255 位") - private String memo; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/CouponTemplateController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/CouponTemplateController.java deleted file mode 100644 index c88d3c4a7..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/CouponTemplateController.java +++ /dev/null @@ -1,71 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.promotion.coupon; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardCreateReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardUpdateReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplatePageReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateRespVO; -import cn.iocoder.mall.managementweb.manager.promotion.coupon.CouponTemplateManager; -import cn.iocoder.security.annotations.RequiresPermissions; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -@RestController -@RequestMapping("/promotion/coupon-template") -@Api(tags = "优惠劵(码)模板 API") -@Validated -public class CouponTemplateController { - - @Autowired - private CouponTemplateManager couponTemplateManager; - - // ========== 通用逻辑 ========= - - @GetMapping("/page") - @ApiOperation("获得优惠劵模板分页") - @RequiresPermissions("promotion:coupon-template:page") - public CommonResult> pageCouponTemplate(CouponTemplatePageReqVO pageVO) { - return success(couponTemplateManager.pageCouponTemplate(pageVO)); - } - - @PostMapping("/update-status") - @ApiOperation("更新优惠劵(码)模板的状态") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "优惠劵(码)模板编号", required = true, example = "1"), - @ApiImplicitParam(name = "status", value = "状态。1 - 开启;2 - 禁用", required = true, example = "1"), - }) - @RequiresPermissions("promotion:coupon-template:update-status") - public CommonResult updateCouponTemplateStatus(@RequestParam("id") Integer id, - @RequestParam("status") Integer status) { - couponTemplateManager.updateCouponTemplateStatus(id, status); - return success(true); - } - - // ========== 优惠劵模板 ========== - - @PostMapping("/create-card") - @ApiOperation("创建优惠劵模板") - @RequiresPermissions("promotion:coupon-template:create-card") - public CommonResult createCouponCardTemplate(@Valid CouponTemplateCardCreateReqVO createVO) { - return success(couponTemplateManager.createCouponCardTemplate(createVO)); - } - - @PostMapping("/update-card") - @ApiOperation("更新优惠劵模板") - @RequiresPermissions("promotion:coupon-template:update-card") - public CommonResult updateCouponCardTemplate(@Valid CouponTemplateCardUpdateReqVO updateVO) { - couponTemplateManager.updateCouponCardTemplate(updateVO); - return success(true); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateCardCreateReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateCardCreateReqVO.java deleted file mode 100644 index 3c17e9f45..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateCardCreateReqVO.java +++ /dev/null @@ -1,84 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template; - -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.promotion.api.enums.PreferentialTypeEnum; -import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum; -import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateDateTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; -import org.hibernate.validator.constraints.Length; -import org.springframework.format.annotation.DateTimeFormat; - -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.Date; - -@ApiModel("优惠劵模板创建 Request VO") -@Data -@Accessors(chain = true) -public class CouponTemplateCardCreateReqVO { - - // ========== 基本信息 BEGIN ========== - @ApiModelProperty(value = "标题", required = true, example = "优惠劵牛逼") - @NotEmpty(message = "标题不能为空") - @Length(min = 2, max = 16, message = "标题长度为 {min}-{max} 位") - private String title; - @ApiModelProperty(value = "使用说明", required = true, example = "我只是描述") - @Length(max = 255, message = "使用说明最大长度为 {max} 位") - private String description; - @ApiModelProperty(value = "每人限领个数", example = "1", notes = "null - 则表示不限制") - @Min(value = 1, message = "每人限领个数最小为 {value}") - private Integer quota; - @ApiModelProperty(value = "发放总量", example = "100") - @Min(value = 1, message = "每人限领个数最小为 {value}") - private Integer total; - // ========== 领取规则 END ========== - - // ========== 使用规则 BEGIN ========== - @ApiModelProperty(value = "是否设置满多少金额可用,单位:分", required = true, example = "0", notes = "0-不限制;大于0-多少金额可用") - @Min(value = 0L, message = "使用金额门槛最低为 {value}") - private Integer priceAvailable; - @ApiModelProperty(value = "可用范围的类型", required = true, example = "10", notes = "参见 RangeTypeEnum 枚举") - @NotNull(message = "可用范围的类型不能为空") - @InEnum(value = RangeTypeEnum.class, message = "可用范围的类型必须在 {value}") - private Integer rangeType; - @ApiModelProperty(value = "指定商品 / 分类列表,使用逗号分隔商品编号", example = "1,3,5") - private String rangeValues; - @ApiModelProperty(value = "生效日期类型", example = "1", notes = "参见 CouponTemplateDateTypeEnum 枚举") - @NotNull(message = "生效日期类型不能为空") - @InEnum(value = CouponTemplateDateTypeEnum.class, message = "生效日期类型必须在 {value}") - private Integer dateType; - @ApiModelProperty(value = "固定日期-生效开始时间", notes = "当 dateType 为固定日期时,非空") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date validStartTime; - @ApiModelProperty(value = "固定日期-生效结束时间", notes = "当 dateType 为固定日期时,非空") - @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date validEndTime; - @ApiModelProperty(value = "领取日期-开始天数", example = "0", notes = "例如,0-当天;1-次天") - @Min(value = 0L, message = "领取日期开始时间最小为 {value}") - private Integer fixedStartTerm; - @ApiModelProperty(value = "领取日期-结束天数", example = "1", notes = "当 dateType 为领取日期时,非空") - @Min(value = 1L, message = "领取日期结束时间最小为 {value}") - private Integer fixedEndTerm; - - // ========== 使用效果 BEGIN ========== - @ApiModelProperty(value = "优惠类型", required = true, example = "1", notes = "参见 PreferentialTypeEnum 枚举") - @NotNull(message = "优惠类型不能为空") - @InEnum(value = PreferentialTypeEnum.class, message = "优惠类型必须在 {value}") - private Integer preferentialType; - @ApiModelProperty(value = "折扣百分比", example = "80", notes = "当 preferentialType 为现金券时,非空") - @Max(value = 100, message = "折扣比最大值为 {value}") - private Integer percentOff; - @ApiModelProperty(value = "优惠金额,单位:分", example = "100", notes = "当 preferentialType 为折扣卷时,非空") - @Min(value = 1, message = "优惠金额最小值为 {value}") - private Integer priceOff; - @ApiModelProperty(value = "折扣上限", example = "100", notes = "当 preferentialType 为折扣卷时,非空") - @Min(value = 1, message = "折扣上限最小值为 {value}") - private Integer discountPriceLimit; - // ========== 使用效果 END ========== - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateCardUpdateReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateCardUpdateReqVO.java deleted file mode 100644 index ffcea26b6..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateCardUpdateReqVO.java +++ /dev/null @@ -1,47 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template; - -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.Min; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -@ApiModel("优惠劵模板更新 Request VO") -@Data -@Accessors(chain = true) -public class CouponTemplateCardUpdateReqVO { - - // ========== 基本信息 BEGIN ========== - @ApiModelProperty(value = "模板编号,自增唯一", required = true, example = "1") - @NotNull(message = "编号不能为空") - private Integer id; - @ApiModelProperty(value = "标题", required = true, example = "优惠劵牛逼") - @NotEmpty(message = "标题不能为空") - @Length(min = 2, max = 16, message = "标题长度为 {min}-{max} 位") - private String title; - @ApiModelProperty(value = "使用说明", required = true, example = "我只是描述") - @Length(max = 255, message = "使用说明最大长度为 {max} 位") - private String description; - @ApiModelProperty(value = "每人限领个数", example = "1", notes = "null - 则表示不限制") - @Min(value = 1, message = "每人限领个数最小为 {value}") - private Integer quota; - @ApiModelProperty(value = "发放总量", example = "100") - @Min(value = 1, message = "每人限领个数最小为 {value}") - private Integer total; - // ========== 领取规则 END ========== - - // ========== 使用规则 BEGIN ========== - @NotNull(message = "可用范围的类型不能为空") - @InEnum(value = RangeTypeEnum.class, message = "可用范围的类型必须在 {value}") - private Integer rangeType; - @ApiModelProperty(value = "指定商品 / 分类列表,使用逗号分隔商品编号", example = "1,3,5") - private String rangeValues; - // ========== 使用规则 END ========== - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplatePageReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplatePageReqVO.java deleted file mode 100644 index 7c3550610..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplatePageReqVO.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template; - -import cn.iocoder.common.framework.vo.PageParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@ApiModel("优惠劵(码)模板分页 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -public class CouponTemplatePageReqVO extends PageParam { - - @ApiModelProperty(value = "类型", example = "1", notes = "参考 CouponTemplateTypeEnum 枚举") - private Integer type; - @ApiModelProperty(value = "标题", example = "优惠劵牛逼") - private String title; - @ApiModelProperty(value = "状态", example = "1", notes = "参考 CouponTemplateStatusEnum 枚举") - private Integer status; - @ApiModelProperty(value = "优惠类型", example = "1", notes = "参见 PreferentialTypeEnum 枚举") - private Integer preferentialType; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateRespVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateRespVO.java deleted file mode 100644 index 47be80f77..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/vo/template/CouponTemplateRespVO.java +++ /dev/null @@ -1,80 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; -import java.util.List; - -@ApiModel("优惠劵(码)模板 VO") -@Data -@Accessors(chain = true) -public class CouponTemplateRespVO { - - // ========== 基本信息 BEGIN ========== - @ApiModelProperty(value = "模板编号,自增唯一", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "标题", required = true, example = "优惠劵牛逼") - private String title; - @ApiModelProperty(value = "使用说明", required = true, example = "我只是描述") - private String description; - @ApiModelProperty(value = "优惠劵类型", required = true, example = "1", notes = "参见 CouponTemplateTypeEnum 枚举") - private Integer type; - /** - * 码类型 - * - * 1-一卡一码(UNIQUE) - * 2-通用码(GENERAL) - * - * 【优惠码独有】 @see CouponCodeDO - */ - private Integer codeType; - @ApiModelProperty(value = "优惠码状态", required = true, example = "1", notes = "参见 CouponTemplateStatusEnum 枚举") - private Integer status; - @ApiModelProperty(value = "每人限领个数", example = "1", notes = "null - 则表示不限制") - private Integer quota; - @ApiModelProperty(value = "发放总量", example = "100") - private Integer total; - // ========== 领取规则 END ========== - - // ========== 使用规则 BEGIN ========== - @ApiModelProperty(value = "是否设置满多少金额可用,单位:分", required = true, example = "0", notes = "0-不限制;大于0-多少金额可用") - private Integer priceAvailable; - @ApiModelProperty(value = "可用范围的类型", required = true, example = "10", notes = "参见 RangeTypeEnum 枚举") - private Integer rangeType; - @ApiModelProperty(value = "指定商品 / 分类列表,使用逗号分隔商品编号", example = "1,3,5") - private List rangeValues; - @ApiModelProperty(value = "生效日期类型", example = "1", notes = "参见 CouponTemplateDateTypeEnum 枚举") - private Integer dateType; - @ApiModelProperty(value = "固定日期-生效开始时间", notes = "当 dateType 为固定日期时,非空") - private Date validStartTime; - @ApiModelProperty(value = "固定日期-生效结束时间", notes = "当 dateType 为固定日期时,非空") - private Date validEndTime; - @ApiModelProperty(value = "领取日期-开始天数", example = "0", notes = "例如,0-当天;1-次天") - private Integer fixedStartTerm; - @ApiModelProperty(value = "领取日期-结束天数", example = "1", notes = "当 dateType 为领取日期时,非空") - private Integer fixedEndTerm; - // ========== 使用规则 END ========== - - // ========== 使用效果 BEGIN ========== - @ApiModelProperty(value = "优惠类型", required = true, example = "1", notes = "参见 PreferentialTypeEnum 枚举") - private Integer preferentialType; - @ApiModelProperty(value = "折扣百分比", example = "80", notes = "当 preferentialType 为现金券时,非空") - private Integer percentOff; - @ApiModelProperty(value = "优惠金额,单位:分", example = "100", notes = "当 preferentialType 为折扣卷时,非空") - private Integer priceOff; - @ApiModelProperty(value = "折扣上限", example = "100", notes = "当 preferentialType 为折扣卷时,非空") - private Integer discountPriceLimit; - // ========== 使用效果 END ========== - - // ========== 统计信息 BEGIN ========== - @ApiModelProperty(value = "领取优惠券的次数", required = true) - private Integer statFetchNum; - // ========== 统计信息 END ========== - - @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/ProductRecommendController.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/ProductRecommendController.java deleted file mode 100644 index 8505ba65d..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/ProductRecommendController.java +++ /dev/null @@ -1,60 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.promotion.recommend; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendCreateReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendDetailVO; -import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendPageReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendUpdateReqVO; -import cn.iocoder.mall.managementweb.manager.promotion.recommend.ProductRecommendManager; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** - * 商品推荐 Controller - */ -@RestController -@RequestMapping("/promotion/product-recommend") -@Api(tags = "商品推荐") -@Validated -public class ProductRecommendController { - - @Autowired - private ProductRecommendManager productRecommendManager; - - @PostMapping("/create") - @ApiOperation("创建商品推荐") - public CommonResult createProductRecommend(@Valid ProductRecommendCreateReqVO createVO) { - return success(productRecommendManager.createProductRecommend(createVO)); - } - - @PostMapping("/update") - @ApiOperation("更新商品推荐") - public CommonResult updateProductRecommend(@Valid ProductRecommendUpdateReqVO updateVO) { - productRecommendManager.updateProductRecommend(updateVO); - return success(true); - } - - @PostMapping("/delete") - @ApiOperation("删除商品推荐") - @ApiImplicitParam(name = "productRecommendId", value = "商品推荐编号", required = true) - public CommonResult deleteProductRecommend(@RequestParam("productRecommendId") Integer productRecommendId) { - productRecommendManager.deleteProductRecommend(productRecommendId); - return success(true); - } - - @GetMapping("/page") - @ApiOperation("获得商品推荐分页") - public CommonResult> pageProductRecommend(ProductRecommendPageReqVO pageVO) { - return success(productRecommendManager.pageProductRecommend(pageVO)); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendCreateReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendCreateReqVO.java deleted file mode 100644 index 83ff2d8c2..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendCreateReqVO.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.promotion.recommend.vo; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; - -@ApiModel("商品推荐创建 Request VO") -@Data -public class ProductRecommendCreateReqVO { - - @ApiModelProperty(value = "类型", example = "1", required = true, notes = "参见 ProductRecommendTypeEnum 枚举") - @NotNull(message = "类型不能为空") - @InEnum(value = ProductRecommendTypeEnum.class, message = "推荐类型必须是 {value}") - private Integer type; - @ApiModelProperty(value = "商品 Spu 编号", required = true, example = "1") - @NotNull(message = "商品 Spu 编号不能为空") - private Integer productSpuId; - @ApiModelProperty(value = "排序", required = true, example = "1") - @NotNull(message = "排序不能为空") - private Integer sort; - @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举") - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - @ApiModelProperty(value = "备注", example = "我是备注") - private String memo; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendDetailVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendDetailVO.java deleted file mode 100644 index d79ce6609..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendDetailVO.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.promotion.recommend.vo; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; - -@ApiModel("商品推荐明细 VO") -@Data -@Accessors(chain = true) -public class ProductRecommendDetailVO { - - @ApiModelProperty(value = "编号", required = true, example = "1") - private Integer id; - @ApiModelProperty(value = "推荐类型", required = true, example = "1", notes = "参见 ProductRecommendTypeEnum 枚举") - private Integer type; - @ApiModelProperty(value = "商品编号", required = true, example = "1") - private Integer productSpuId; - @ApiModelProperty(value = "排序", required = true, example = "10") - private Integer sort; - @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举") - private Integer status; - @ApiModelProperty(value = "备注", required = true, example = "这个活动很牛逼") - private String memo; - @ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式") - private Date createTime; - /** - * 商品信息 - */ - private Spu spu; - - @ApiModel("商品信息") - @Data - public static class Spu { - - @ApiModelProperty(value = "SPU 名字", required = true, example = "厮大牛逼") - private String name; - - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendPageReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendPageReqVO.java deleted file mode 100644 index f6873b847..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendPageReqVO.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.promotion.recommend.vo; - -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.common.framework.vo.PageParam; -import cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; - -@ApiModel("商品推荐分页 Request VO") -@Data -@EqualsAndHashCode(callSuper = true) -public class ProductRecommendPageReqVO extends PageParam { - - @ApiModelProperty(value = "类型", example = "1", notes = "参见 ProductRecommendTypeEnum 枚举") - @InEnum(value = ProductRecommendTypeEnum.class, message = "推荐类型必须是 {value}") - private Integer type; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendUpdateReqVO.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendUpdateReqVO.java deleted file mode 100644 index b547afa0a..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/recommend/vo/ProductRecommendUpdateReqVO.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.iocoder.mall.managementweb.controller.promotion.recommend.vo; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -import javax.validation.constraints.NotNull; - -@ApiModel("商品推荐更新 Request VO") -@Data -public class ProductRecommendUpdateReqVO { - - @ApiModelProperty(value = "编号", required = true, example = "1") - @NotNull(message = "编号不能为空") - private Integer id; - @ApiModelProperty(value = "类型", example = "1", required = true, notes = "参见 ProductRecommendTypeEnum 枚举") - @NotNull(message = "类型不能为空") - @InEnum(value = ProductRecommendTypeEnum.class, message = "推荐类型必须是 {value}") - private Integer type; - @ApiModelProperty(value = "商品 Spu 编号", required = true, example = "1") - @NotNull(message = "商品 Spu 编号不能为空") - private Integer productSpuId; - @ApiModelProperty(value = "排序", required = true, example = "1") - @NotNull(message = "排序不能为空") - private Integer sort; - @ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举") - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - @ApiModelProperty(value = "备注", example = "我是备注") - private String memo; - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/CouponTemplateConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/CouponTemplateConvert.java deleted file mode 100644 index eaed998fe..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/CouponTemplateConvert.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.promotion; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardCreateReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardUpdateReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplatePageReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateRespVO; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateCreateReqDTO; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateUpdateReqDTO; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponTemplatePageReqDTO; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponTemplateRespDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface CouponTemplateConvert { - - CouponTemplateConvert INSTANCE = Mappers.getMapper(CouponTemplateConvert.class); - - CouponCardTemplateUpdateReqDTO convert(CouponTemplateCardUpdateReqVO bean); - - CouponTemplatePageReqDTO convert(CouponTemplatePageReqVO bean); - - PageResult convertPage(PageResult page); - - CouponCardTemplateCreateReqDTO convert(CouponTemplateCardCreateReqVO bean); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/ProductRecommendConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/ProductRecommendConvert.java deleted file mode 100644 index 7044ff0b3..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/ProductRecommendConvert.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.promotion; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendCreateReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendDetailVO; -import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendPageReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendUpdateReqVO; -import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO; -import cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendCreateReqDTO; -import cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendPageReqDTO; -import cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendRespDTO; -import cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendUpdateReqDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface ProductRecommendConvert { - - ProductRecommendConvert INSTANCE = Mappers.getMapper(ProductRecommendConvert.class); - - ProductRecommendCreateReqDTO convert(ProductRecommendCreateReqVO bean); - - ProductRecommendUpdateReqDTO convert(ProductRecommendUpdateReqVO bean); - - ProductRecommendPageReqDTO convert(ProductRecommendPageReqVO bean); - - PageResult convertPage(PageResult page); - - ProductRecommendDetailVO.Spu convert(ProductSpuRespDTO bean); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/PromotionActivityConvert.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/PromotionActivityConvert.java deleted file mode 100644 index 708ed4566..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/PromotionActivityConvert.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.iocoder.mall.managementweb.convert.promotion; - -import cn.iocoder.mall.managementweb.controller.promotion.activity.vo.PromotionActivityPageReqVO; -import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityPageReqDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface PromotionActivityConvert { - - PromotionActivityConvert INSTANCE = Mappers.getMapper(PromotionActivityConvert.class); - - PromotionActivityPageReqDTO convert(PromotionActivityPageReqVO bean); - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/activity/PromotionActivityManager.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/activity/PromotionActivityManager.java deleted file mode 100644 index 2c4f8aacd..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/activity/PromotionActivityManager.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.iocoder.mall.managementweb.manager.promotion.activity; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.promotion.activity.vo.PromotionActivityPageReqVO; -import cn.iocoder.mall.managementweb.convert.promotion.PromotionActivityConvert; -import cn.iocoder.mall.promotion.api.rpc.activity.PromotionActivityFeign; -import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -/** - * 促销活动 Manager - */ -@Service -@Validated -public class PromotionActivityManager { - - - @Autowired - private PromotionActivityFeign promotionActivityFeign; - - public PageResult pagePromotionActivity(PromotionActivityPageReqVO pageReqVO) { - CommonResult> pagePromotionActivityResult = promotionActivityFeign.pagePromotionActivity( - PromotionActivityConvert.INSTANCE.convert(pageReqVO)); - pagePromotionActivityResult.checkError(); - return pagePromotionActivityResult.getData(); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/coupon/CouponTemplateManager.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/coupon/CouponTemplateManager.java deleted file mode 100644 index 29a42ee4e..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/coupon/CouponTemplateManager.java +++ /dev/null @@ -1,54 +0,0 @@ -package cn.iocoder.mall.managementweb.manager.promotion.coupon; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardCreateReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateCardUpdateReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplatePageReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.coupon.vo.template.CouponTemplateRespVO; -import cn.iocoder.mall.managementweb.convert.promotion.CouponTemplateConvert; -import cn.iocoder.mall.promotion.api.rpc.coupon.CouponTemplateFeign; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponCardTemplateUpdateStatusReqDTO; -import cn.iocoder.mall.promotion.api.rpc.coupon.dto.template.CouponTemplateRespDTO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -@Service -@Validated -public class CouponTemplateManager { - - - @Autowired - private CouponTemplateFeign couponTemplateFeign; - // ========== 通用逻辑 ========= - - public PageResult pageCouponTemplate(CouponTemplatePageReqVO pageVO) { - CommonResult> pageCouponTemplateResult = - couponTemplateFeign.pageCouponTemplate(CouponTemplateConvert.INSTANCE.convert(pageVO)); - pageCouponTemplateResult.checkError(); - return CouponTemplateConvert.INSTANCE.convertPage(pageCouponTemplateResult.getData()); - } - - public void updateCouponTemplateStatus(Integer id, Integer status) { - CommonResult updateCouponTemplateStatusResult = couponTemplateFeign.updateCouponTemplateStatus( - new CouponCardTemplateUpdateStatusReqDTO().setId(id).setStatus(status)); - updateCouponTemplateStatusResult.checkError(); - } - - // ========== 优惠劵模板 ========== - - public Integer createCouponCardTemplate(CouponTemplateCardCreateReqVO createVO) { - CommonResult createCouponCardTemplateResult = couponTemplateFeign.createCouponCardTemplate( - CouponTemplateConvert.INSTANCE.convert(createVO)); - createCouponCardTemplateResult.checkError(); - return createCouponCardTemplateResult.getData(); - } - - public void updateCouponCardTemplate(CouponTemplateCardUpdateReqVO updateVO) { - CommonResult updateCouponCardTemplateResult = couponTemplateFeign.updateCouponCardTemplate( - CouponTemplateConvert.INSTANCE.convert(updateVO)); - updateCouponCardTemplateResult.checkError(); - } - -} diff --git a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/recommend/ProductRecommendManager.java b/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/recommend/ProductRecommendManager.java deleted file mode 100644 index 8921e29d8..000000000 --- a/归档/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/recommend/ProductRecommendManager.java +++ /dev/null @@ -1,90 +0,0 @@ -package cn.iocoder.mall.managementweb.manager.promotion.recommend; - -import cn.iocoder.common.framework.util.CollectionUtils; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendCreateReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendDetailVO; -import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendPageReqVO; -import cn.iocoder.mall.managementweb.controller.promotion.recommend.vo.ProductRecommendUpdateReqVO; -import cn.iocoder.mall.managementweb.convert.promotion.ProductRecommendConvert; -import cn.iocoder.mall.productservice.rpc.spu.ProductSpuFeign; -import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO; -import cn.iocoder.mall.promotion.api.rpc.recommend.ProductRecommendFeign; -import cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendRespDTO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import java.util.List; -import java.util.Map; - -/** - * 商品推荐 Manager - */ -@Service -@Validated -public class ProductRecommendManager { - - @Autowired - private ProductRecommendFeign productRecommendFeign; - @Autowired - private ProductSpuFeign productSpuFeign; - /** - * 创建商品推荐 - * - * @param createVO 创建商品推荐 VO - * @return 商品推荐 - */ - public Integer createProductRecommend(ProductRecommendCreateReqVO createVO) { - CommonResult createProductRecommendResult = productRecommendFeign.createProductRecommend( - ProductRecommendConvert.INSTANCE.convert(createVO)); - createProductRecommendResult.checkError(); - return createProductRecommendResult.getData(); - } - - /** - * 更新商品推荐 - * - * @param updateVO 更新商品推荐 VO - */ - public void updateProductRecommend(ProductRecommendUpdateReqVO updateVO) { - CommonResult updateProductRecommendResult = productRecommendFeign.updateProductRecommend( - ProductRecommendConvert.INSTANCE.convert(updateVO)); - updateProductRecommendResult.checkError(); - } - - /** - * 删除商品推荐 - * - * @param productRecommendId 商品推荐编号 - */ - public void deleteProductRecommend(Integer productRecommendId) { - CommonResult deleteProductRecommendResult = productRecommendFeign.deleteProductRecommend(productRecommendId); - deleteProductRecommendResult.checkError(); - } - - /** - * 获得商品推荐分页 - * - * @param pageVO 商品推荐分页查询 - * @return 商品推荐分页结果 - */ - public PageResult pageProductRecommend(ProductRecommendPageReqVO pageVO) { - CommonResult> pageProductRecommendResult = productRecommendFeign.pageProductRecommend(ProductRecommendConvert.INSTANCE.convert(pageVO)); - pageProductRecommendResult.checkError(); - // 拼接结果 - PageResult pageResult = ProductRecommendConvert.INSTANCE.convertPage(pageProductRecommendResult.getData()); - if (!CollectionUtils.isEmpty(pageResult.getList())) { - // 获取商品信息,并进行拼接 - CommonResult> listProductSpusResult = productSpuFeign.listProductSpus( - CollectionUtils.convertSet(pageResult.getList(), ProductRecommendDetailVO::getProductSpuId)); - listProductSpusResult.checkError(); - Map productSpuMap = CollectionUtils.convertMap(listProductSpusResult.getData(), ProductSpuRespDTO::getId); - pageResult.getList().forEach(detailVO -> - detailVO.setSpu(ProductRecommendConvert.INSTANCE.convert(productSpuMap.get(detailVO.getProductSpuId())))); - } - return pageResult; - } - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/MeetTypeEnum.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/MeetTypeEnum.java deleted file mode 100644 index 85a194625..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/MeetTypeEnum.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.iocoder.mall.promotion.api.enums; - -/** - * 匹配类型枚举 - */ -public enum MeetTypeEnum { - - PRICE(1, "金额"), - QUANTITY(2, "数量"),; - - /** - * 值 - */ - private final Integer value; - /** - * 名字 - */ - private final String name; - - MeetTypeEnum(Integer value, String name) { - this.value = value; - this.name = name; - } - - public Integer getValue() { - return value; - } - - public String getName() { - return name; - } - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PromotionErrorCodeConstants.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PromotionErrorCodeConstants.java index 813a56432..d8834727b 100644 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PromotionErrorCodeConstants.java +++ b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PromotionErrorCodeConstants.java @@ -9,15 +9,6 @@ import cn.iocoder.common.framework.exception.ErrorCode; */ public interface PromotionErrorCodeConstants { - // ========== Banner 模块 ========== - ErrorCode BANNER_NOT_EXISTS = new ErrorCode(1006000000, "账号不存在"); - - // ========== PRODUCT RECOMMEND 模块 ========== - ErrorCode PRODUCT_RECOMMEND_NOT_EXISTS = new ErrorCode(1006001000, "商品推荐不存在"); - ErrorCode PRODUCT_RECOMMEND_PRODUCT_NOT_EXISTS = new ErrorCode(1006001001, "商品不存在"); - ErrorCode PRODUCT_RECOMMEND_EXISTS = new ErrorCode(1006001002, "该商品推荐已经存在"); - - // ========== COUPON TEMPLATE 模块 ========== ErrorCode COUPON_TEMPLATE_NOT_EXISTS = new ErrorCode(1006002000, "优惠劵模板(码)不存在"); ErrorCode COUPON_TEMPLATE_NOT_CARD = new ErrorCode(1006002001, "不是优惠劵模板"); @@ -34,7 +25,4 @@ public interface PromotionErrorCodeConstants { ErrorCode COUPON_CARD_STATUS_NOT_UNUSED = new ErrorCode(1006003003, "优惠劵不处于待使用状态"); ErrorCode COUPON_CARD_STATUS_NOT_USED = new ErrorCode( 1006003004, "优惠劵不处于已使用状态"); - // ========== PRICE 模块 ========== - ErrorCode PRICE_PRODUCT_SKU_NOT_EXISTS = new ErrorCode(1006004000, "有不存在的商品!"); - } diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/RangeTypeEnum.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/RangeTypeEnum.java deleted file mode 100644 index bfdb437bc..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/RangeTypeEnum.java +++ /dev/null @@ -1,49 +0,0 @@ -package cn.iocoder.mall.promotion.api.enums; - -import cn.iocoder.common.framework.core.IntArrayValuable; - -import java.util.Arrays; - -/** - * 可用范围的类型枚举 - */ -public enum RangeTypeEnum implements IntArrayValuable { - - ALL(10, "所有可用"), - PRODUCT_INCLUDE_PART(20, "部分商品可用,或指定商品可用"), - PRODUCT_EXCLUDE_PART(21, "部分商品不可用,或指定商品不可用"), - CATEGORY_INCLUDE_PART(30, "部分分类可用,或指定分类可用"), - CATEGORY_EXCLUDE_PART(31, "部分分类不可用,或指定分类不可用"), - ; - - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(RangeTypeEnum::getValue).toArray(); - - /** - * 值 - */ - private final Integer value; - /** - * 名字 - */ - private final String name; - - RangeTypeEnum(Integer value, String name) { - this.value = value; - this.name = name; - } - - public Integer getValue() { - return value; - } - - public String getName() { - return name; - } - - - @Override - public int[] array() { - return ARRAYS; - } - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/card/CouponCardStatusEnum.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/card/CouponCardStatusEnum.java deleted file mode 100644 index 50557f606..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/coupon/card/CouponCardStatusEnum.java +++ /dev/null @@ -1,45 +0,0 @@ -package cn.iocoder.mall.promotion.api.enums.coupon.card; - -import cn.iocoder.common.framework.core.IntArrayValuable; - -import java.util.Arrays; - -/** - * 优惠劵状态枚举 - */ -public enum CouponCardStatusEnum implements IntArrayValuable { - - UNUSED(1, "未使用"), - USED(2, "已使用"), - EXPIRE(3, "已过期"), - ; - - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CouponCardStatusEnum::getValue).toArray(); - - /** - * 值 - */ - private final Integer value; - /** - * 名字 - */ - private final String name; - - CouponCardStatusEnum(Integer value, String name) { - this.value = value; - this.name = name; - } - - public Integer getValue() { - return value; - } - - public String getName() { - return name; - } - - @Override - public int[] array() { - return ARRAYS; - } -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/recommend/ProductRecommendTypeEnum.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/recommend/ProductRecommendTypeEnum.java deleted file mode 100644 index 359f0861d..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/recommend/ProductRecommendTypeEnum.java +++ /dev/null @@ -1,53 +0,0 @@ -package cn.iocoder.mall.promotion.api.enums.recommend; - -import cn.iocoder.common.framework.core.IntArrayValuable; - -import java.util.Arrays; - -/** - * 商品推荐类型 - */ -public enum ProductRecommendTypeEnum implements IntArrayValuable { - - HOT(1, "热卖推荐"), - NEW(2, "新品推荐"), - ; - - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ProductRecommendTypeEnum::getValue).toArray(); - - /** - * 状态值 - */ - private final Integer value; - /** - * 状态名 - */ - private final String name; - - ProductRecommendTypeEnum(Integer value, String name) { - this.value = value; - this.name = name; - } - - public Integer getValue() { - return value; - } - - public String getName() { - return name; - } - - public static boolean isValid(Integer status) { - if (status == null) { - return false; - } - return HOT.value.equals(status) - || NEW.value.equals(status); - } - - @Override - public int[] array() { - return ARRAYS; - } - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageReqDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageReqDTO.java deleted file mode 100644 index 127d7b0dd..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageReqDTO.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.activity.dto; - -import cn.iocoder.common.framework.vo.PageParam; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.util.Collection; - -/** - * 促销活动分页 Request DTO - */ -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class PromotionActivityPageReqDTO extends PageParam { - - /** - * 标题 - * - * 模糊匹配 - */ - private String title; - /** - * 活动类型 - */ - private Integer activityType; - /** - * 状态 - */ - private Collection statuses; - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityRespDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityRespDTO.java deleted file mode 100644 index e4c1c8120..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityRespDTO.java +++ /dev/null @@ -1,160 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.activity.dto; - -import cn.iocoder.mall.promotion.api.enums.activity.PromotionActivityStatusEnum; -import cn.iocoder.mall.promotion.api.enums.activity.PromotionActivityTypeEnum; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -/** - * 促销活动 Response DTO - */ -@Data -@Accessors(chain = true) -public class PromotionActivityRespDTO implements Serializable { - - /** - * 活动编号 - */ - private Integer id; - /** - * 活动标题 - */ - private String title; - /** - * 活动类型 - * - * 参见 {@link PromotionActivityTypeEnum} 枚举 - */ - private Integer activityType; - /** - * 活动状态 - * - * 参见 {@link PromotionActivityStatusEnum} 枚举 - */ - private Integer status; - /** - * 开始时间 - */ - private Date startTime; - /** - * 结束时间 - */ - private Date endTime; - /** - * 限制折扣 - */ - private TimeLimitedDiscount timeLimitedDiscount; - /** - * 满减送 - */ - private FullPrivilege fullPrivilege; - /** - * 创建时间 - */ - private Date createTime; - - /** - * 限时折扣 - */ - @Data - @Accessors(chain = true) - public static class TimeLimitedDiscount implements Serializable { - - /** - * 商品折扣 - */ - @Data - @Accessors(chain = true) - public static class Item implements Serializable { - - /** - * 商品 SPU 编号 - */ - private Integer spuId; - /** - * 优惠类型 - */ - private Integer preferentialType; - /** - * 优惠值 - */ - private Integer preferentialValue; - - } - - /** - * 每人每种限购多少 - * - * 当 quota = 0 时,表示不限购 - */ - private Integer quota; - /** - * 商品折扣数组 - */ - private List items; - - } - - /** - * 满减送 - */ - @Data - @Accessors(chain = true) - public static class FullPrivilege implements Serializable { - - /** - * 优惠 - */ - @Data - @Accessors(chain = true) - public static class Privilege implements Serializable { - - /** - * 满足类型 - * - * 1 - 金额 - * 2 - 件数 - */ - private Integer meetType; - /** - * 满足值 - */ - private Integer meetValue; - /** - * 优惠类型 - */ - private Integer preferentialType; - /** - * 优惠值 - */ - private Integer preferentialValue; - - } - - /** - * 可用范围的类型 - * - * 参见 {@link cn.iocoder.mall.promotion.api.enums.RangeTypeEnum} 枚举 - * 暂时只用 “所有可用” + “PRODUCT_INCLUDE_PRT” - */ - private Integer rangeType; - /** - * 指定可用商品列表 - */ - private List rangeValues; - /** - * 是否循环 - */ - private Boolean cycled; - /** - * 优惠数组 - */ - private List privileges; - - } - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateCreateReqDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateCreateReqDTO.java deleted file mode 100644 index 60d3cd775..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateCreateReqDTO.java +++ /dev/null @@ -1,143 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.coupon.dto.template; - -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateDateTypeEnum; -import cn.iocoder.mall.promotion.api.enums.PreferentialTypeEnum; -import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum; -import lombok.Data; -import lombok.experimental.Accessors; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.Date; - -/** - * 优惠劵模板创建 Request DTO - */ -@Data -@Accessors(chain = true) -public class CouponCardTemplateCreateReqDTO implements Serializable { - - // ========== 基本信息 BEGIN ========== - /** - * 标题 - */ - @NotEmpty(message = "标题不能为空") - @Length(min = 2, max = 16, message = "标题长度为 {min}-{max} 位") - private String title; - /** - * 使用说明 - */ - @Length(max = 255, message = "使用说明最大长度为 {max} 位") - private String description; - // ========== 基本信息 END ========== - - // ========== 领取规则 BEGIN ========== - /** - * 每人限领个数 - */ - @NotNull(message = "每人限领个数不能为空") - @Min(value = 1, message = "每人限领个数最小为 {value}") - private Integer quota; - /** - * 发放总量 - */ - @NotNull(message = "发放总量不能为空") - @Min(value = 1, message = "每人限领个数最小为 {value}") - private Integer total; - // ========== 领取规则 END ========== - - // ========== 使用规则 BEGIN ========== - /** - * 是否设置满多少金额可用,单位:分 - * - * 0-不限制 - * 大于0-多少金额可用 - */ - @NotNull(message = "使用金额门槛不能为空") - @Min(value = 0L, message = "使用金额门槛最低为 {value}") - private Integer priceAvailable; - /** - * 可用范围的类型 - * - * 10-全部(ALL):所有可用 - * 20-部分(PART):部分商品可用,或指定商品可用 - * 21-部分(PART):部分商品不可用,或指定商品可用 - * 30-部分(PART):部分分类可用,或指定分类可用 - * 31-部分(PART):部分分类不可用,或指定分类可用 - */ - @NotNull(message = "可用范围的类型不能为空") - @InEnum(value = RangeTypeEnum.class, message = "可用范围的类型必须在 {value}") - private Integer rangeType; - /** - * 指定商品 / 分类列表,使用逗号分隔商品编号 - */ - private String rangeValues; - /** - * 生效日期类型 - * - * 1-固定日期 - * 2-领取日期:领到券 {@link #fixedEndTerm} 日开始 N 天内有效 - */ - @NotNull(message = "生效日期类型不能为空") - @InEnum(value = CouponTemplateDateTypeEnum.class, message = "生效日期类型必须在 {value}") - private Integer dateType; - /** - * 固定日期-生效开始时间 - */ - private Date validStartTime; - /** - * 固定日期-生效结束时间 - */ - private Date validEndTime; - /** - * 领取日期-开始天数 - * - * 例如,0-当天;1-次天 - */ - @Min(value = 0L, message = "领取日期开始时间最小为 {value}") - private Integer fixedStartTerm; - /** - * 领取日期-结束天数 - */ - @Min(value = 1L, message = "领取日期结束时间最小为 {value}") - private Integer fixedEndTerm; - // ========== 使用规则 END ========== - - // ========== 使用效果 BEGIN ========== - /** - * 优惠类型 - * - * 1-代金卷 - * 2-折扣卷 - */ - @NotNull(message = "优惠类型不能为空") - @InEnum(value = PreferentialTypeEnum.class, message = "优惠类型必须在 {value}") - private Integer preferentialType; - /** - * 优惠金额,单位:分 - */ - @Min(value = 1, message = "优惠金额最小值为 {value}") - private Integer priceOff; - /** - * 折扣百分比。 - * - * 例如,80% 为 80。 - * 当 100% 为 100 ,则代表免费。 - */ - @Max(value = 100, message = "折扣比最大值为 {value}") - private Integer percentOff; - /** - * 折扣上限,仅在 {@link #preferentialType} 等于 2 时生效。 - * - * 例如,折扣上限为 20 元,当使用 8 折优惠券,订单金额为 1000 元时,最高只可折扣 20 元,而非 80 元。 - */ - @Min(value = 1, message = "折扣上限最小值为 {value}") - private Integer discountPriceLimit; - // ========== 使用效果 END ========== - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateUpdateReqDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateUpdateReqDTO.java deleted file mode 100644 index 67289428b..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateUpdateReqDTO.java +++ /dev/null @@ -1,142 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.coupon.dto.template; - -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum; -import lombok.Data; -import lombok.experimental.Accessors; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.Min; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - * 优惠劵模板更新 Request DTO - */ -@Data -@Accessors(chain = true) -public class CouponCardTemplateUpdateReqDTO implements Serializable { - - @NotNull(message = "编号不能为空") - private Integer id; - - // ========== 基本信息 BEGIN ========== - /** - * 标题 - */ - @NotEmpty(message = "标题不能为空") - @Length(min = 2, max = 16, message = "标题长度为 {min}-{max} 位") - private String title; - /** - * 使用说明 - */ - @Length(max = 255, message = "使用说明最大长度为 {max} 位") - private String description; - // ========== 基本信息 END ========== - - // ========== 领取规则 BEGIN ========== - /** - * 每人限领个数 - */ - @NotNull(message = "每人限领个数不能为空") - @Min(value = 1, message = "每人限领个数最小为 {value}") - private Integer quota; - /** - * 发放总量 - */ - @NotNull(message = "发放总量不能为空") - @Min(value = 1, message = "每人限领个数最小为 {value}") - private Integer total; - // ========== 领取规则 END ========== - - // ========== 使用规则 BEGIN ========== -// /** -// * 是否设置满多少金额可用,单位:分 -// * -// * 0-不限制 -// * 大于0-多少金额可用 -// */ -// @NotNull(message = "使用金额门槛不能为空") -// @Min(value = 0L, message = "使用金额门槛最低为 {value}") -// private Integer priceAvailable; - /** - * 可用范围的类型 - * - * 10-全部(ALL):所有可用 - * 20-部分(PART):部分商品可用,或指定商品可用 - * 21-部分(PART):部分商品不可用,或指定商品可用 - * 30-部分(PART):部分分类可用,或指定分类可用 - * 31-部分(PART):部分分类不可用,或指定分类可用 - */ - @NotNull(message = "可用范围的类型不能为空") - @InEnum(value = RangeTypeEnum.class, message = "可用范围的类型必须在 {value}") - private Integer rangeType; - /** - * 指定商品 / 分类列表,使用逗号分隔商品编号 - */ - private String rangeValues; -// /** -// * 生效日期类型 -// * -// * 1-固定日期 -// * 2-领取日期:领到券 {@link #fixedEndTerm} 日开始 N 天内有效 -// */ -// @NotNull(message = "生效日期类型不能为空") -// @InEnum(value = CouponTemplateDateTypeEnum.class, message = "生效日期类型必须在 {value}") -// private Integer dateType; -// /** -// * 固定日期-生效开始时间 -// */ -// private Date validStartTime; -// /** -// * 固定日期-生效结束时间 -// */ -// private Date validEndTime; -// /** -// * 领取日期-开始天数 -// * -// * 例如,0-当天;1-次天 -// */ -// @Min(value = 0L, message = "领取日期开始时间最小为 {value}") -// private Integer fixedStartTerm; -// /** -// * 领取日期-结束天数 -// */ -// @Min(value = 1L, message = "领取日期结束时间最小为 {value}") -// private Integer fixedEndTerm; - // ========== 使用规则 END ========== - - // ========== 使用效果 BEGIN ========== -// /** -// * 优惠类型 -// * -// * 1-代金卷 -// * 2-折扣卷 -// */ -// @NotNull(message = "优惠类型不能为空") -// @InEnum(value = CouponTemplatePreferentialTypeEnum.class, message = "优惠类型必须在 {value}") -// private Integer preferentialType; -// /** -// * 优惠金额,单位:分 -// */ -// @Min(value = 1, message = "优惠金额最小值为 {value}") -// private Integer priceOff; -// /** -// * 折扣百分比。 -// * -// * 例如,80% 为 80。 -// * 当 100% 为 100 ,则代表免费。 -// */ -// @Max(value = 100, message = "折扣比最大值为 {value}") -// private Integer percentOff; -// /** -// * 折扣上限,仅在 {@link #preferentialType} 等于 2 时生效。 -// * -// * 例如,折扣上限为 20 元,当使用 8 折优惠券,订单金额为 1000 元时,最高只可折扣 20 元,而非 80 元。 -// */ -// @Min(value = 1, message = "折扣上限最小值为 {value}") -// private Integer discountPriceLimit; - // ========== 使用效果 END ========== - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateUpdateStatusReqDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateUpdateStatusReqDTO.java deleted file mode 100644 index 13fefd72c..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponCardTemplateUpdateStatusReqDTO.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.coupon.dto.template; - -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.promotion.api.enums.coupon.template.CouponTemplateStatusEnum; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - * 优惠劵(码)模板更新状态 Request DTO - */ -@Data -@Accessors(chain = true) -public class CouponCardTemplateUpdateStatusReqDTO implements Serializable { - - /** - * 编号 - */ - @NotNull(message = "编号不能为空") - private Integer id; - /** - * 状态 - */ - @NotNull(message = "状态不能为空") - @InEnum(value = CouponTemplateStatusEnum.class, message = "状态必须是 {value}") - private Integer status; - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponTemplatePageReqDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponTemplatePageReqDTO.java deleted file mode 100644 index 080c98514..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponTemplatePageReqDTO.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.coupon.dto.template; - -import cn.iocoder.common.framework.vo.PageParam; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - * 优惠劵模板分页 Request DTO - */ -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class CouponTemplatePageReqDTO extends PageParam { - - /** - * 类型 - */ - private Integer type; - /** - * 标题 - */ - private String title; - /** - * 状态 - */ - private Integer status; - /** - * 优惠类型 - */ - private Integer preferentialType; - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponTemplateRespDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponTemplateRespDTO.java deleted file mode 100644 index 359b6431a..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/template/CouponTemplateRespDTO.java +++ /dev/null @@ -1,156 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.coupon.dto.template; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -/** - * 优惠劵(码)模板 BO - */ -@Data -@Accessors(chain = true) -public class CouponTemplateRespDTO implements Serializable { - - // ========== 基本信息 BEGIN ========== - /** - * 模板编号,自增唯一。 - */ - private Integer id; - /** - * 标题 - */ - private String title; - /** - * 使用说明 - */ - private String description; - /** - * 类型 - * - * 1-优惠劵 - * 2-优惠码 - */ - private Integer type; - /** - * 码类型 - * - * 1-一卡一码(UNIQUE) - * 2-通用码(GENERAL) - * - * 【优惠码独有】 @see CouponCodeDO - */ - private Integer codeType; - /** - * 优惠码状态 - * - * 1-开启中 - * 2-禁用中 - * 3-已过期 - * - * 当优惠劵(码)开启中,可以手动操作,设置禁用中。 - */ - private Integer status; - /** - * 每人限领个数 - * - * null - 则表示不限制 - */ - private Integer quota; - /** - * 发放总量 - */ - private Integer total; - // ========== 领取规则 END ========== - - // ========== 使用规则 BEGIN ========== - /** - * 是否设置满多少金额可用,单位:分 - * - * 0-不限制 - * 大于0-多少金额可用 - */ - private Integer priceAvailable; - /** - * 可用范围的类型 - * - * 10-全部(ALL):所有可用 - * 20-部分(PART):部分商品可用,或指定商品可用 - * 21-部分(PART):部分商品不可用,或指定商品可用 - * 30-部分(PART):部分分类可用,或指定商品可用 - * 31-部分(PART):部分分类不可用,或指定商品可用 - */ - private Integer rangeType; - /** - * 指定商品 / 分类列表,使用逗号分隔商品编号 - */ - private List rangeValues; - /** - * 生效日期类型 - * - * 1-固定日期 - * 2-领取日期:领到券 {@link #fixedStartTerm} 日开始 N 天内有效 - */ - private Integer dateType; - /** - * 固定日期-生效开始时间 - */ - private Date validStartTime; - /** - * 固定日期-生效结束时间 - */ - private Date validEndTime; - /** - * 领取日期-开始天数 - * - * 例如,0-当天;1-次天 - */ - private Integer fixedStartTerm; - /** - * 领取日期-结束天数 - */ - private Integer fixedEndTerm; - // ========== 使用规则 END ========== - - // ========== 使用效果 BEGIN ========== - /** - * 优惠类型 - * - * 1-代金卷 - * 2-折扣卷 - */ - private Integer preferentialType; - /** - * 折扣百分比。 - * - * 例如,80% 为 80。 - * 当 100% 为 100 ,则代表免费。 - */ - private Integer percentOff; - /** - * 优惠金额,单位:分 - */ - private Integer priceOff; - /** - * 折扣上限,仅在 {@link #preferentialType} 等于 2 时生效。 - * - * 例如,折扣上限为 20 元,当使用 8 折优惠券,订单金额为 1000 元时,最高只可折扣 20 元,而非 80 元。 - */ - private Integer discountPriceLimit; - // ========== 使用效果 END ========== - - // ========== 统计信息 BEGIN ========== - /** - * 领取优惠券的次数 - */ - private Integer statFetchNum; - // ========== 统计信息 END ========== - - /** - * 创建时间 - */ - private Date createTime; - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/ProductRecommendFeign.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/ProductRecommendFeign.java deleted file mode 100644 index 8925fcff0..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/ProductRecommendFeign.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.recommend; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.recommend.dto.*; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestParam; - -import java.util.List; - -/** - * Title: - * Description: - * - * @author zhuyang - * @version 1.0 2021/10/9 - */ -@FeignClient("promotion-service") -public interface ProductRecommendFeign { - - @PostMapping("/promotion/prod/recommend/createProductRecommend") - public CommonResult createProductRecommend(@RequestBody ProductRecommendCreateReqDTO createDTO) ; - - @PostMapping("/promotion/prod/recommend/updateProductRecommend") - public CommonResult updateProductRecommend(@RequestBody ProductRecommendUpdateReqDTO updateDTO); - - @GetMapping("/promotion/prod/recommend/deleteProductRecommend") - public CommonResult deleteProductRecommend(@RequestParam("productRecommendId") Integer productRecommendId) ; - - @PostMapping("/promotion/prod/recommend/listProductRecommends") - public CommonResult> listProductRecommends(@RequestBody ProductRecommendListReqDTO listReqDTO) ; - - @PostMapping("/promotion/prod/recommend/pageProductRecommend") - public CommonResult> pageProductRecommend(@RequestBody ProductRecommendPageReqDTO pageDTO) ; -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendCreateReqDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendCreateReqDTO.java deleted file mode 100644 index 44473b03c..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendCreateReqDTO.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.recommend.dto; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum; -import lombok.Data; -import lombok.experimental.Accessors; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - * 商品推荐创建 Request DTO - */ -@Data -@Accessors(chain = true) -public class ProductRecommendCreateReqDTO implements Serializable { - - /** - * 推荐类型 - */ - @InEnum(value = ProductRecommendTypeEnum.class, message = "修改推荐类型必须是 {value}") - @NotNull(message = "推荐类型不能为空") - private Integer type; - /** - * 商品编号 - */ - @NotNull(message = "商品编号不能为空") - private Integer productSpuId; - /** - * 排序 - */ - @NotNull(message = "排序不能为空") - private Integer sort; - /** - * 状态 - */ - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - /** - * 备注 - */ - @Length(max = 255, message = "备注最大长度为 255 位") - private String memo; - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendListReqDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendListReqDTO.java deleted file mode 100644 index fcd5ba606..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendListReqDTO.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.recommend.dto; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** - * 商品推荐列表 Req DTO - */ -@Data -@Accessors(chain = true) -public class ProductRecommendListReqDTO implements Serializable { - - /** - * 类型 - */ - @InEnum(value = ProductRecommendTypeEnum.class, message = "推荐类型必须是 {value}") - private Integer type; - /** - * 状态 - */ - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendPageReqDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendPageReqDTO.java deleted file mode 100644 index dd58085da..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendPageReqDTO.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.recommend.dto; - -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.common.framework.vo.PageParam; -import cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - * 商品推荐分页 Request DTO - */ -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class ProductRecommendPageReqDTO extends PageParam { - - /** - * 推荐类型 - */ - @InEnum(value = ProductRecommendTypeEnum.class, message = "推荐类型必须是 {value}") - private Integer type; - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendRespDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendRespDTO.java deleted file mode 100644 index e0a02f6f1..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendRespDTO.java +++ /dev/null @@ -1,50 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.recommend.dto; - -import cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; - -/** - * 商品推荐 BO - */ -@Data -@Accessors(chain = true) -public class ProductRecommendRespDTO implements Serializable { - - /** - * 编号 - */ - private Integer id; - /** - * 类型 - * - * {@link ProductRecommendTypeEnum} - */ - private Integer type; - /** - * 商品 Spu 编号 - */ - private Integer productSpuId; - /** - * 排序 - */ - private Integer sort; - /** - * 状态 - * - * {@link cn.iocoder.common.framework.enums.CommonStatusEnum} - */ - private Integer status; - /** - * 备注 - */ - private String memo; - /** - * 创建时间 - */ - private Date createTime; - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendUpdateReqDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendUpdateReqDTO.java deleted file mode 100644 index fbc3906ce..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/recommend/dto/ProductRecommendUpdateReqDTO.java +++ /dev/null @@ -1,53 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.recommend.dto; - -import cn.iocoder.common.framework.enums.CommonStatusEnum; -import cn.iocoder.common.framework.validator.InEnum; -import cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum; -import lombok.Data; -import lombok.experimental.Accessors; -import org.hibernate.validator.constraints.Length; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - * 商品推荐更新 Request DTO - */ -@Data -@Accessors(chain = true) -public class ProductRecommendUpdateReqDTO implements Serializable { - - /** - * 编号 - */ - @NotNull(message = "编号不能为空") - private Integer id; - /** - * 推荐类型 - */ - @InEnum(value = ProductRecommendTypeEnum.class, message = "修改推荐类型必须是 {value}") - @NotNull(message = "推荐类型不能为空") - private Integer type; - /** - * 商品编号 - */ - @NotNull(message = "商品编号不能为空") - private Integer productSpuId; - /** - * 排序 - */ - @NotNull(message = "排序不能为空") - private Integer sort; - /** - * 状态 - */ - @NotNull(message = "状态不能为空") - @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}") - private Integer status; - /** - * 备注 - */ - @Length(max = 255, message = "备注最大长度为 255 位") - private String memo; - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/ProductRecommendController.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/ProductRecommendController.java deleted file mode 100644 index 497a14adc..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/ProductRecommendController.java +++ /dev/null @@ -1,55 +0,0 @@ -package cn.iocoder.mall.promotionservice.controller; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.recommend.dto.*; -import cn.iocoder.mall.promotionservice.manager.recommend.ProductRecommendManager; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** - * Title: - * Description: - * - * @author zhuyang - * @version 1.0 2021/10/9 - */ -@RestController -@RequestMapping("/promotion/prod/recommend") -public class ProductRecommendController { - - @Autowired - private ProductRecommendManager productRecommendManager; - - - @PostMapping("createProductRecommend") - public CommonResult createProductRecommend(@RequestBody ProductRecommendCreateReqDTO createDTO) { - return success(productRecommendManager.createProductRecommend(createDTO)); - } - - @PostMapping("updateProductRecommend") - public CommonResult updateProductRecommend(@RequestBody ProductRecommendUpdateReqDTO updateDTO) { - productRecommendManager.updateProductRecommend(updateDTO); - return success(true); - } - - @GetMapping("deleteProductRecommend") - public CommonResult deleteProductRecommend(@RequestParam("productRecommendId") Integer productRecommendId) { - productRecommendManager.deleteProductRecommend(productRecommendId); - return success(true); - } - - @PostMapping("listProductRecommends") - public CommonResult> listProductRecommends(@RequestBody ProductRecommendListReqDTO listReqDTO) { - return success(productRecommendManager.listProductRecommends(listReqDTO)); - } - - @PostMapping("pageProductRecommend") - public CommonResult> pageProductRecommend(@RequestBody ProductRecommendPageReqDTO pageDTO) { - return success(productRecommendManager.pageProductRecommend(pageDTO)); - } -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/PromotionActivityController.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/PromotionActivityController.java deleted file mode 100644 index 8e33ad5f3..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/controller/PromotionActivityController.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.iocoder.mall.promotionservice.controller; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityListReqDTO; -import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityPageReqDTO; -import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO; -import cn.iocoder.mall.promotionservice.manager.activity.PromotionActivityManager; -import org.springframework.beans.factory.annotation.Autowired; -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; - -import java.util.List; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -/** - * Title: - * Description: - * - * @author zhuyang - * @version 1.0 2021/10/9 - */ -@RestController -@RequestMapping("/promotion/activity") -public class PromotionActivityController { - @Autowired - private PromotionActivityManager promotionActivityManager; - - @PostMapping("pagePromotionActivity") - public CommonResult> pagePromotionActivity(@RequestBody PromotionActivityPageReqDTO pageReqDTO) { - return success(promotionActivityManager.pagePromotionActivity(pageReqDTO)); - } - @PostMapping("listPromotionActivities") - public CommonResult> listPromotionActivities(@RequestBody PromotionActivityListReqDTO listReqDTO) { - return success(promotionActivityManager.listPromotionActivities(listReqDTO)); - } -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/activity/PromotionActivityConvert.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/activity/PromotionActivityConvert.java deleted file mode 100644 index b3f9e8a56..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/activity/PromotionActivityConvert.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.iocoder.mall.promotionservice.convert.activity; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO; -import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.activity.PromotionActivityDO; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface PromotionActivityConvert { - - PromotionActivityConvert INSTANCE = Mappers.getMapper(PromotionActivityConvert.class); - - List convertList(List list); - - @Mapping(source = "records", target = "list") - PageResult convertPage(IPage page); - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/recommend/ProductRecommendConvert.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/recommend/ProductRecommendConvert.java deleted file mode 100644 index 60cf3f727..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/recommend/ProductRecommendConvert.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.mall.promotionservice.convert.recommend; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendCreateReqDTO; -import cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendRespDTO; -import cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendUpdateReqDTO; -import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.recommend.ProductRecommendDO; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface ProductRecommendConvert { - - ProductRecommendConvert INSTANCE = Mappers.getMapper(ProductRecommendConvert.class); - - List convertList(List list); - - @Mapping(source = "records", target = "list") - PageResult convertPage(IPage page); - - ProductRecommendDO convert(ProductRecommendCreateReqDTO bean); - - ProductRecommendDO convert(ProductRecommendUpdateReqDTO bean); - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/activity/PromotionActivityDO.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/activity/PromotionActivityDO.java deleted file mode 100644 index d570d5daa..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/activity/PromotionActivityDO.java +++ /dev/null @@ -1,197 +0,0 @@ -package cn.iocoder.mall.promotionservice.dal.mysql.dataobject.activity; - -import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; -import cn.iocoder.mall.promotion.api.enums.activity.PromotionActivityStatusEnum; -import cn.iocoder.mall.promotion.api.enums.activity.PromotionActivityTypeEnum; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.util.Date; -import java.util.List; - -/** - * 促销活动 DO - */ -@TableName(value = "promotion_activity", autoResultMap = true) -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class PromotionActivityDO extends BaseDO { - - /** - * 活动编号 - */ - private Integer id; - /** - * 活动标题 - */ - private String title; - /** - * 活动类型 - * - * 参见 {@link PromotionActivityTypeEnum} 枚举 - */ - private Integer activityType; -// /** -// * 促销类型 -// * // TODO 芋艿 https://jos.jd.com/api/complexTemplate.htm?webPamer=promotion_v_o&groupName=%E4%BF%83%E9%94%80API&id=54&restName=jingdong.seller.promotion.list&isMulti=false 促销类型,可选值:单品促销(1),赠品促销(4),套装促销(6),总价促销(10) -// */ -// private Integer promotionType; - /** - * 活动状态 - * - * 参见 {@link PromotionActivityStatusEnum} 枚举 - */ - private Integer status; - /** - * 开始时间 - */ - private Date startTime; - /** - * 结束时间 - */ - private Date endTime; - /** - * 失效时间 - */ - private Date invalidTime; - /** - * 删除时间 - */ - private Date deleteTime; - /** - * 限制折扣字符串,使用 JSON 序列化成字符串存储 - */ - @TableField(typeHandler = FastjsonTypeHandler.class) - private TimeLimitedDiscount timeLimitedDiscount; - /** - * 满减送字符串,使用 JSON 序列化成字符串存储 - */ - @TableField(typeHandler = FastjsonTypeHandler.class) - private FullPrivilege fullPrivilege; - - /** - * 限制折扣 - */ - @Data - @Accessors(chain = true) - public static class TimeLimitedDiscount { - - /** - * 商品折扣 - */ - @Data - @Accessors(chain = true) - public static class Item { - - /** - * 商品 SPU 编号 - */ - private Integer spuId; - /** - * 优惠类型 - */ - private Integer preferentialType; - /** - * 优惠值 - */ - private Integer preferentialValue; - - } - - /** - * 每人每种限购多少 - * - * 当 quota = 0 时,表示不限购 - */ - private Integer quota; - /** - * 商品折扣数组 - */ - private List items; - - } - - /** - * 满减送 - */ - @Data - @Accessors(chain = true) - public static class FullPrivilege { - - /** - * 优惠 - */ - @Data - @Accessors(chain = true) - public static class Privilege { - - /** - * 满足类型 - * - * 1 - 金额 - * 2 - 件数 - */ - private Integer meetType; - /** - * 满足值 - */ - private Integer meetValue; - /** - * 优惠类型 - */ - private Integer preferentialType; - /** - * 优惠值 - */ - private Integer preferentialValue; -// /** -// * 是否包邮 -// */ -// private Boolean isPostage; -// /** -// * 积分 -// */ -// private Integer score; -// /** -// * 优惠劵(码)分组编号 -// */ -// private Integer couponTemplateId; -// /** -// * 优惠劵(码)数量 -// */ -// private Integer couponNum; -// /** -// * 赠品编号 -// */ -// private Integer presentId; - - } - - /** - * 可用范围的类型 - * - * 参见 {@link cn.iocoder.mall.promotion.api.enums.RangeTypeEnum} 枚举 - * 暂时只用 “所有可用” + “PRODUCT_INCLUDE_PRT” - */ - private Integer rangeType; - /** - * 指定可用商品列表 - */ - private List rangeValues; - /** - * 是否循环 - */ - private Boolean cycled; - /** - * 优惠数组 - */ - private List privileges; - - } - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/recommend/ProductRecommendDO.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/recommend/ProductRecommendDO.java deleted file mode 100644 index f801439f8..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/recommend/ProductRecommendDO.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.iocoder.mall.promotionservice.dal.mysql.dataobject.recommend; - - -import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; -import cn.iocoder.mall.promotion.api.enums.recommend.ProductRecommendTypeEnum; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * 商品推荐 DO - */ -@TableName("product_recommend") -@Data -@Accessors(chain = true) -public class ProductRecommendDO extends DeletableDO { - - /** - * 编号 - */ - private Integer id; - /** - * 类型 - * - * {@link ProductRecommendTypeEnum} - */ - private Integer type; - /** - * 商品 Spu 编号 - */ - private Integer productSpuId; - // TODO 芋艿,商品 spu 名 - /** - * 排序 - */ - private Integer sort; - /** - * 状态 - * - * {@link cn.iocoder.common.framework.enums.CommonStatusEnum} - */ - private Integer status; - /** - * 备注 - */ - private String memo; - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/recommend/ProductRecommendMapper.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/recommend/ProductRecommendMapper.java deleted file mode 100644 index 231442ce3..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/recommend/ProductRecommendMapper.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.promotionservice.dal.mysql.mapper.recommend; - -import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; -import cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendListReqDTO; -import cn.iocoder.mall.promotion.api.rpc.recommend.dto.ProductRecommendPageReqDTO; -import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.recommend.ProductRecommendDO; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Repository -public interface ProductRecommendMapper extends BaseMapper { - - default ProductRecommendDO selectByProductSpuIdAndType(Integer productSpuId, Integer type) { - return selectOne(new QueryWrapper().eq("product_spu_id", productSpuId) - .eq("type", type)); - } - - default IPage selectPage(ProductRecommendPageReqDTO pageReqDTO) { - return selectPage(new Page<>(pageReqDTO.getPageNo(), pageReqDTO.getPageSize()), - new QueryWrapperX().eqIfPresent("type", pageReqDTO.getType())); - } - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/activity/PromotionActivityManager.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/activity/PromotionActivityManager.java deleted file mode 100644 index 34dbd6eee..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/activity/PromotionActivityManager.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.iocoder.mall.promotionservice.manager.activity; - -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityListReqDTO; -import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityPageReqDTO; -import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO; -import cn.iocoder.mall.promotionservice.service.activity.PromotionActivityService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import java.util.List; - -/** - * 促销活动 Manager - */ -@Service -@Validated -public class PromotionActivityManager { - - @Autowired - private PromotionActivityService promotionActivityService; - - public List listPromotionActivities(PromotionActivityListReqDTO listReqDTO) { - return promotionActivityService.listPromotionActivities(listReqDTO); - } - - public PageResult pagePromotionActivity(PromotionActivityPageReqDTO pageReqDTO) { - return promotionActivityService.pagePromotionActivity(pageReqDTO); - } - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/recommend/ProductRecommendManager.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/recommend/ProductRecommendManager.java deleted file mode 100644 index 4467dcc4a..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/recommend/ProductRecommendManager.java +++ /dev/null @@ -1,65 +0,0 @@ -package cn.iocoder.mall.promotionservice.manager.recommend; - -import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.productservice.rpc.spu.ProductSpuFeign; -import cn.iocoder.mall.productservice.rpc.spu.dto.ProductSpuRespDTO; -import cn.iocoder.mall.promotion.api.rpc.recommend.dto.*; -import cn.iocoder.mall.promotionservice.service.recommend.ProductRecommendService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import java.util.List; - -import static cn.iocoder.mall.promotion.api.enums.PromotionErrorCodeConstants.PRODUCT_RECOMMEND_PRODUCT_NOT_EXISTS; - -/** - * 商品推荐 Manager - */ -@Service -@Validated -public class ProductRecommendManager { - - @Autowired - private ProductSpuFeign productSpuFeign; - - @Autowired - private ProductRecommendService productRecommendService; - - public List listProductRecommends(ProductRecommendListReqDTO listReqDTO) { - return productRecommendService.listProductRecommends(listReqDTO); - } - - public PageResult pageProductRecommend(ProductRecommendPageReqDTO pageReqDTO) { - return productRecommendService.pageProductRecommend(pageReqDTO); - } - - public Integer createProductRecommend(ProductRecommendCreateReqDTO createReqDTO) { - // 校验商品不存在 - checkProductSpu(createReqDTO.getProductSpuId()); - // 创建商品推荐 - return productRecommendService.createProductRecommend(createReqDTO); - } - - public void updateProductRecommend(ProductRecommendUpdateReqDTO updateReqDTO) { - // 校验商品不存在 - checkProductSpu(updateReqDTO.getProductSpuId()); - // 更新商品推荐 - productRecommendService.updateProductRecommend(updateReqDTO); - } - - public void deleteProductRecommend(Integer productRecommendId) { - productRecommendService.deleteProductRecommend(productRecommendId); - } - - private void checkProductSpu(Integer productSpuId) { - CommonResult getProductSpuResult = productSpuFeign.getProductSpu(productSpuId); - getProductSpuResult.checkError(); - if (getProductSpuResult.getData() == null) { - throw ServiceExceptionUtil.exception(PRODUCT_RECOMMEND_PRODUCT_NOT_EXISTS); - } - } - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/recommend/ProductRecommendService.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/recommend/ProductRecommendService.java deleted file mode 100644 index defeda9e9..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/recommend/ProductRecommendService.java +++ /dev/null @@ -1,93 +0,0 @@ -package cn.iocoder.mall.promotionservice.service.recommend; - -import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.recommend.dto.*; -import cn.iocoder.mall.promotionservice.convert.recommend.ProductRecommendConvert; -import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.recommend.ProductRecommendDO; -import cn.iocoder.mall.promotionservice.dal.mysql.mapper.recommend.ProductRecommendMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import java.util.List; - -import static cn.iocoder.mall.promotion.api.enums.PromotionErrorCodeConstants.PRODUCT_RECOMMEND_EXISTS; -import static cn.iocoder.mall.promotion.api.enums.PromotionErrorCodeConstants.PRODUCT_RECOMMEND_NOT_EXISTS; - -/** - * 商品推荐 Service - */ -@Service -@Validated -public class ProductRecommendService { - - @Autowired - private ProductRecommendMapper productRecommendMapper; - - /** - * 获得商品推荐列表 - * - * @param listReqDTO 列表查询 DTO - * @return 商品推荐列表 - */ - public List listProductRecommends(ProductRecommendListReqDTO listReqDTO) { - List productRecommends = productRecommendMapper.selectList(listReqDTO); - return ProductRecommendConvert.INSTANCE.convertList(productRecommends); - } - - /** - * 获得商品推荐分页 - * - * @param pageReqDTO 分页查询 DTO - * @return 商品推荐分页 - */ - public PageResult pageProductRecommend(ProductRecommendPageReqDTO pageReqDTO) { - IPage productRecommendPage = productRecommendMapper.selectPage(pageReqDTO); - return ProductRecommendConvert.INSTANCE.convertPage(productRecommendPage); - } - - /** - * 创建商品推荐 - * - * @param createReqDTO 商品推荐信息 - * @return 商品推荐编号 - */ - public Integer createProductRecommend(ProductRecommendCreateReqDTO createReqDTO) { - // 校验商品是否已经推荐 - if (productRecommendMapper.selectByProductSpuIdAndType(createReqDTO.getProductSpuId(), createReqDTO.getType()) != null) { - throw ServiceExceptionUtil.exception(PRODUCT_RECOMMEND_EXISTS); - } - // 保存到数据库 - ProductRecommendDO productRecommend = ProductRecommendConvert.INSTANCE.convert(createReqDTO); - productRecommendMapper.insert(productRecommend); - // 返回成功 - return productRecommend.getId(); - } - - public void updateProductRecommend(ProductRecommendUpdateReqDTO updateReqDTO) { - // 校验更新的商品推荐存在 - if (productRecommendMapper.selectById(updateReqDTO.getId()) == null) { - throw ServiceExceptionUtil.exception(PRODUCT_RECOMMEND_NOT_EXISTS); - } - // 校验商品是否已经推荐 - ProductRecommendDO existProductRecommend = productRecommendMapper.selectByProductSpuIdAndType(updateReqDTO.getProductSpuId(), updateReqDTO.getType()); - if (existProductRecommend != null && !existProductRecommend.getId().equals(updateReqDTO.getId())) { - throw ServiceExceptionUtil.exception(PRODUCT_RECOMMEND_EXISTS.getCode()); - } - // 更新到数据库 - ProductRecommendDO updateProductRecommend = ProductRecommendConvert.INSTANCE.convert(updateReqDTO); - productRecommendMapper.updateById(updateProductRecommend); - } - - public void deleteProductRecommend(Integer productRecommendId) { - // 校验更新的商品推荐存在 - if (productRecommendMapper.selectById(productRecommendId) == null) { - throw ServiceExceptionUtil.exception(PRODUCT_RECOMMEND_NOT_EXISTS); - } - // 更新到数据库 - productRecommendMapper.deleteById(productRecommendId); - } - -} diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/promotion/ProductRecommendController.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/promotion/ProductRecommendController.java deleted file mode 100644 index df5b4f2a4..000000000 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/controller/promotion/ProductRecommendController.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.mall.shopweb.controller.promotion; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.mall.shopweb.controller.product.vo.product.ProductSpuRespVO; -import cn.iocoder.mall.shopweb.service.promotion.ProductRecommendManager; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.Collection; -import java.util.Map; - -import static cn.iocoder.common.framework.vo.CommonResult.success; - -@RestController -@RequestMapping("/promotion/product-recommend") -@Api(tags = "商品推荐 API") -@Validated -public class ProductRecommendController { - - @Autowired - private ProductRecommendManager productRecommendManager; - - @GetMapping("/list") - @ApiOperation("获得所有商品推荐列表") - public CommonResult>> list() { - return success(productRecommendManager.listProductRecommends()); - } - -} From 488458b631f1a19aabcf0d726c93e7bfcbb0289c Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 10 Nov 2022 13:02:50 +0800 Subject: [PATCH 09/29] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=8A=B5=E7=9A=84=E4=BD=BF=E7=94=A8=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/biz/service/OrderCommentJobTest.java | 45 --------- .../src/test/java/PayRefundServiceImplTest.java | 29 ------ .../api/enums/PromotionErrorCodeConstants.java | 6 -- .../rpc/activity/PromotionActivityFeign.java | 28 ------ .../dto/PromotionActivityListReqDTO.java | 21 ---- .../api/rpc/coupon/CouponCardFeign.java | 13 +-- .../dto/card/CouponCardAvailableListReqDTO.java | 68 ------------- .../dto/card/CouponCardAvailableRespDTO.java | 26 ----- .../coupon/dto/card/CouponCardCreateReqDTO.java | 27 ----- .../coupon/dto/card/CouponCardUseReqDTO.java | 27 ----- .../activity/PromotionActivityMapper.java | 34 ------- .../mysql/mapper/coupon/CouponCardMapper.java | 10 -- .../activity/PromotionActivityService.java | 5 - .../service/coupon/CouponCardService.java | 98 ------------------- .../shopweb/client/trade/TradeOrderClient.java | 2 +- .../rpc/order/dto/TradeOrderCreateReqDTO.java | 69 ------------- .../controller/TradeOrderController.java | 5 +- 17 files changed, 5 insertions(+), 508 deletions(-) delete mode 100644 归档/moved/order/order-service-impl/src/test/java/cn/iocoder/mall/order/biz/service/OrderCommentJobTest.java delete mode 100644 归档/moved/pay/pay-application/src/test/java/PayRefundServiceImplTest.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/PromotionActivityFeign.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityListReqDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardAvailableListReqDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardAvailableRespDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardCreateReqDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardUseReqDTO.java delete mode 100644 归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/activity/PromotionActivityMapper.java delete mode 100644 归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/dto/TradeOrderCreateReqDTO.java diff --git a/归档/moved/order/order-service-impl/src/test/java/cn/iocoder/mall/order/biz/service/OrderCommentJobTest.java b/归档/moved/order/order-service-impl/src/test/java/cn/iocoder/mall/order/biz/service/OrderCommentJobTest.java deleted file mode 100644 index cca14c8b1..000000000 --- a/归档/moved/order/order-service-impl/src/test/java/cn/iocoder/mall/order/biz/service/OrderCommentJobTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package cn.iocoder.mall.order.biz.service; - -import cn.iocoder.mall.order.api.OrderCommentService; -import cn.iocoder.mall.order.api.bo.OrderCommentTimeOutBO; -import cn.iocoder.mall.order.api.dto.OrderCommentTimeOutPageDTO; -import cn.iocoder.mall.order.biz.OrderApplicationTest; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.junit4.SpringRunner; - -import java.util.List; -import java.util.stream.Collectors; - -/** - * 订单评论自动好评任务测试 - * - * @author wtz - * @time 2019-06-17 19:09 - */ -@RunWith(SpringRunner.class) -@SpringBootTest(classes = OrderApplicationTest.class) -@ActiveProfiles("dev") -public class OrderCommentJobTest { - - @Autowired - private OrderCommentService orderCommentService; - - @Test - public void createOrderCommentJob(){ - OrderCommentTimeOutPageDTO orderCommentTimeOutPageDTO=new OrderCommentTimeOutPageDTO(); - orderCommentTimeOutPageDTO.setCommentState(0); - orderCommentTimeOutPageDTO.setPageNo(0); - orderCommentTimeOutPageDTO.setPageSize(10); - orderCommentTimeOutPageDTO.setOverDay(7); - List orderCommentTimeOutBOList = orderCommentService.getOrderCommentTimeOutPage(orderCommentTimeOutPageDTO); - - - orderCommentService.updateBatchOrderCommentState(orderCommentTimeOutBOList); - - } - -} diff --git a/归档/moved/pay/pay-application/src/test/java/PayRefundServiceImplTest.java b/归档/moved/pay/pay-application/src/test/java/PayRefundServiceImplTest.java deleted file mode 100644 index 35c18810b..000000000 --- a/归档/moved/pay/pay-application/src/test/java/PayRefundServiceImplTest.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.mall.pay.biz.service; - -import cn.iocoder.mall.pay.api.PayRefundService; -import cn.iocoder.mall.pay.api.dto.refund.PayRefundSubmitDTO; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) -public class PayRefundServiceImplTest { - - @Autowired - private PayRefundService payRefundService; - - @Test - public void testSubmitRefund() { - PayRefundSubmitDTO payRefundSubmitDTO = new PayRefundSubmitDTO() - .setAppId("POd4RC6a") - .setCreateIp("127.0.0.1") - .setOrderId("13500000") - .setOrderDescription("测试下退款") - .setPrice(1); - payRefundService.submitRefund(payRefundSubmitDTO); - } - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PromotionErrorCodeConstants.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PromotionErrorCodeConstants.java index d8834727b..24cfb762e 100644 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PromotionErrorCodeConstants.java +++ b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/PromotionErrorCodeConstants.java @@ -11,18 +11,12 @@ public interface PromotionErrorCodeConstants { // ========== COUPON TEMPLATE 模块 ========== ErrorCode COUPON_TEMPLATE_NOT_EXISTS = new ErrorCode(1006002000, "优惠劵模板(码)不存在"); - ErrorCode COUPON_TEMPLATE_NOT_CARD = new ErrorCode(1006002001, "不是优惠劵模板"); - ErrorCode COUPON_TEMPLATE_NOT_CODE = new ErrorCode(1006002002, "不是优惠码模板"); - ErrorCode COUPON_TEMPLATE_TOTAL_CAN_NOT_REDUCE = new ErrorCode(1006002003, "优惠劵(码)模板的发放数量不能减小"); ErrorCode COUPON_TEMPLATE_STATUS_NOT_ENABLE = new ErrorCode(1006002004, "优惠劵模板(码)未开启"); ErrorCode COUPON_TEMPLATE_TOTAL_NOT_ENOUGH = new ErrorCode(1006002005, "优惠劵(码)模板的发放量不足"); ErrorCode COUPON_TEMPLATE_CARD_ADD_EXCEED_QUOTA = new ErrorCode(1006002006, "优惠劵领取到达上限"); // ========== COUPON CARD 模块 ========== ErrorCode COUPON_CARD_NOT_EXISTS = new ErrorCode(1006003000, "优惠劵不存在"); - ErrorCode COUPON_CARD_ERROR_USER = new ErrorCode(1006003001, "优惠劵不属于当前用户"); - ErrorCode COUPON_CARD_NOT_MATCH = new ErrorCode(1006003002, "优惠劵不匹配,无法使用"); - ErrorCode COUPON_CARD_STATUS_NOT_UNUSED = new ErrorCode(1006003003, "优惠劵不处于待使用状态"); ErrorCode COUPON_CARD_STATUS_NOT_USED = new ErrorCode( 1006003004, "优惠劵不处于已使用状态"); } diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/PromotionActivityFeign.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/PromotionActivityFeign.java deleted file mode 100644 index f7b197b5d..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/PromotionActivityFeign.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.activity; - -import cn.iocoder.common.framework.vo.CommonResult; -import cn.iocoder.common.framework.vo.PageResult; -import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityListReqDTO; -import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityPageReqDTO; -import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; - -import java.util.List; - -/** - * Title: - * Description: - * - * @author zhuyang - * @version 1.0 2021/10/9 - */ -@FeignClient("promotion-service") -public interface PromotionActivityFeign { - - @PostMapping("/promotion/activity/pagePromotionActivity") - CommonResult> pagePromotionActivity(@RequestBody PromotionActivityPageReqDTO pageReqDTO) ; - @PostMapping("/promotion/activity/listPromotionActivities") - CommonResult> listPromotionActivities(@RequestBody PromotionActivityListReqDTO listReqDTO) ; -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityListReqDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityListReqDTO.java deleted file mode 100644 index dce76f1d3..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityListReqDTO.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.activity.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Collection; - -/** - * 促销活动列表查询的 Request DTO - */ -@Data -@Accessors(chain = true) -public class PromotionActivityListReqDTO implements Serializable { - - /** - * 活动编号数组 - */ - private Collection activeIds; - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/CouponCardFeign.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/CouponCardFeign.java index 7ff4a14ff..118a4c149 100644 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/CouponCardFeign.java +++ b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/CouponCardFeign.java @@ -9,27 +9,16 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.List; -/** - * Title: - * Description: - * - * @author zhuyang - * @version 1.0 2021/10/9 - */ @FeignClient("promotion-service") public interface CouponCardFeign { + @PostMapping("/coupon/card/pageCouponCard") public CommonResult> pageCouponCard(@RequestBody CouponCardPageReqDTO pageReqDTO) ; @PostMapping("/coupon/card/createCouponCard") public CommonResult createCouponCard(@RequestBody CouponCardCreateReqDTO createReqDTO); - @PostMapping("/coupon/card/useCouponCard") - public CommonResult useCouponCard(@RequestBody CouponCardUseReqDTO useReqDTO) ; - @PostMapping("/coupon/card/cancelUseCouponCard") public CommonResult cancelUseCouponCard(@RequestBody CouponCardCancelUseReqDTO cancelUseReqDTO) ; - @PostMapping("/coupon/card/listAvailableCouponCards") - public CommonResult> listAvailableCouponCards(@RequestBody CouponCardAvailableListReqDTO listReqDTO); } diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardAvailableListReqDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardAvailableListReqDTO.java deleted file mode 100644 index a8bc17345..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardAvailableListReqDTO.java +++ /dev/null @@ -1,68 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.coupon.dto.card; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.Min; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.List; - -/** - * 优惠劵可用信息列表 Request DTO - */ -@Data -@Accessors(chain = true) -public class CouponCardAvailableListReqDTO implements Serializable { - - /** - * 用户编号 - */ - @NotNull(message = "用户编号不能为空") - private Integer userId; - /** - * 商品数组 - */ - @NotEmpty(message = "商品数组不能为空") - private List items; - - /** - * 商品 - */ - @Data - @Accessors(chain = true) - public static class Item implements Serializable { - - /** - * 商品 SPU 编号 - */ - @NotNull(message = "商品 SPU 编号不能为空") - private Integer spuId; - /** - * 商品 SKU 编号 - */ - @NotNull(message = "商品 SKU 编号不能为空") - private Integer skuId; - /** - * 商品 SKU 编号 - */ - @NotNull(message = "商品 Category 编号不能为空") - private Integer cid; - /** - * 商品数量 - */ - @NotNull(message = "商品数量不能为空") - @Min(value = 1L, message = "最小商品数量 1") - private Integer quantity; - /** - * 商品价格,单位:分 - * - * 为什么需要传递价格?因为商品的价格是经过计算,部署商品原始价格 - */ - @NotNull(message = "商品价格不能为空") - private Integer price; - - } - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardAvailableRespDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardAvailableRespDTO.java deleted file mode 100644 index cd09bbebd..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardAvailableRespDTO.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.coupon.dto.card; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - * 可用优惠劵 BO - * - * 注意,如果优惠劵不可用,标记 available = false ,并写明 unavailableReason 原因 - */ -@Data -@EqualsAndHashCode(callSuper = true) -@Accessors(chain = true) -public class CouponCardAvailableRespDTO extends CouponCardRespDTO { - - /** - * 是否可用 - */ - private Boolean available; - /** - * 不可用原因 - */ - private String unavailableReason; - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardCreateReqDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardCreateReqDTO.java deleted file mode 100644 index 8b7cdf2ab..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardCreateReqDTO.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.coupon.dto.card; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - * 优惠劵创建 Request DTO - */ -@Data -@Accessors(chain = true) -public class CouponCardCreateReqDTO implements Serializable { - - /** - * 用户编号 - */ - @NotNull(message = "用户编号不能为空") - private Integer userId; - /** - * 优惠劵模板编号 - */ - @NotNull(message = "优惠劵模板编号不能为空") - private Integer couponTemplateId; - -} diff --git a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardUseReqDTO.java b/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardUseReqDTO.java deleted file mode 100644 index 534b7fc0b..000000000 --- a/归档/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/coupon/dto/card/CouponCardUseReqDTO.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.coupon.dto.card; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** - * 优惠劵使用 Request DTO - */ -@Data -@Accessors(chain = true) -public class CouponCardUseReqDTO implements Serializable { - - /** - * 用户编号 - */ - @NotNull(message = "用户编号不能为空") - private Integer userId; - /** - * 优惠劵编号 - */ - @NotNull(message = "优惠劵编号不能为空") - private Integer couponCardId; - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/activity/PromotionActivityMapper.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/activity/PromotionActivityMapper.java deleted file mode 100644 index c23c0be23..000000000 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/activity/PromotionActivityMapper.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.iocoder.mall.promotionservice.dal.mysql.mapper.activity; - -import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; -import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityListReqDTO; -import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityPageReqDTO; -import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.activity.PromotionActivityDO; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.springframework.stereotype.Repository; - -import java.util.Collection; -import java.util.List; - -@Repository -public interface PromotionActivityMapper extends BaseMapper { - - default List selectListByStatus(Collection statuses) { - return selectList(new QueryWrapper().in("status", statuses)); - } - - default IPage selectPage(PromotionActivityPageReqDTO pageReqDTO) { - return selectPage(new Page<>(pageReqDTO.getPageNo(), pageReqDTO.getPageSize()), - new QueryWrapperX().likeIfPresent("title", pageReqDTO.getTitle()) - .eqIfPresent("activity_type", pageReqDTO.getActivityType()) - .inIfPresent("status", pageReqDTO.getStatuses())); - } - - default List selectList(PromotionActivityListReqDTO listReqDTO) { - return selectList(new QueryWrapperX().inIfPresent("id", listReqDTO.getActiveIds())); - } - -} diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/coupon/CouponCardMapper.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/coupon/CouponCardMapper.java index cea36848b..63158619d 100644 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/coupon/CouponCardMapper.java +++ b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/coupon/CouponCardMapper.java @@ -19,16 +19,6 @@ public interface CouponCardMapper extends BaseMapper { .eq("status", status)); } - default int selectCountByUserIdAndTemplateId(Integer userId, Integer templateId) { - return selectCount(new QueryWrapper().eq("user_id", userId) - .eq("template_id", templateId)); - } - - default int updateByIdAndStatus(Integer id, Integer status, CouponCardDO updateObj) { - return update(updateObj, new QueryWrapper().eq("id", id) - .eq("status", status)); - } - default IPage selectPage(CouponCardPageReqDTO pageReqDTO) { return selectPage(new Page<>(pageReqDTO.getPageNo(), pageReqDTO.getPageSize()), new QueryWrapperX().eqIfPresent("user_id", pageReqDTO.getUserId()) diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/activity/PromotionActivityService.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/activity/PromotionActivityService.java index 7150c6b3e..36d4f9d9c 100644 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/activity/PromotionActivityService.java +++ b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/activity/PromotionActivityService.java @@ -70,11 +70,6 @@ public class PromotionActivityService { return PromotionActivityConvert.INSTANCE.convertList(activityList); } - public PageResult pagePromotionActivity(PromotionActivityPageReqDTO pageReqDTO) { - IPage promotionActivityPage = promotionActivityMapper.selectPage(pageReqDTO); - return PromotionActivityConvert.INSTANCE.convertPage(promotionActivityPage); - } - private boolean isSpuMatchTimeLimitDiscount(Integer spuId, PromotionActivityDO activity) { Assert.isTrue(PromotionActivityTypeEnum.TIME_LIMITED_DISCOUNT.getValue().equals(activity.getActivityType()), "传入的必须的促销活动必须是限时折扣"); diff --git a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponCardService.java b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponCardService.java index c95425bc2..e3bddcd5e 100644 --- a/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponCardService.java +++ b/归档/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/coupon/CouponCardService.java @@ -37,11 +37,6 @@ import java.util.stream.Collectors; @Validated public class CouponCardService { - @Autowired - private CouponCardMapper couponCardMapper; - @Autowired - private CouponTemplateMapper couponTemplateMapper; - /** * 获得用户的优惠劵 * @@ -127,35 +122,6 @@ public class CouponCardService { return card.getId(); } - /** - * 用户使用优惠劵 - * - * @param userId 用户编号 - * @param couponCardId 优惠劵编号 - */ - public void useCouponCard(Integer userId, Integer couponCardId) { - // 查询优惠劵 - CouponCardDO card = couponCardMapper.selectById(couponCardId); - if (card == null) { - throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_CARD_NOT_EXISTS.getCode()); - } - if (!userId.equals(card.getUserId())) { - throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_CARD_ERROR_USER.getCode()); - } - if (!CouponCardStatusEnum.UNUSED.getValue().equals(card.getStatus())) { - throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_CARD_STATUS_NOT_UNUSED.getCode()); - } - if (DateUtil.isBetween(card.getValidStartTime(), card.getValidEndTime())) { // 为避免定时器没跑,实际优惠劵已经过期 - throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_CARD_STATUS_NOT_UNUSED.getCode()); - } - // 更新优惠劵已使用 - int updateCount = couponCardMapper.updateByIdAndStatus(card.getId(), CouponCardStatusEnum.UNUSED.getValue(), - new CouponCardDO().setStatus(CouponCardStatusEnum.USED.getValue()).setUsedTime(new Date())); - if (updateCount == 0) { - throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_CARD_STATUS_NOT_UNUSED.getCode()); - } - } - /** * 用户取消使用优惠劵 * @@ -168,9 +134,6 @@ public class CouponCardService { if (card == null) { throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_CARD_NOT_EXISTS.getCode()); } - if (!userId.equals(card.getUserId())) { - throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_CARD_ERROR_USER.getCode()); - } if (!CouponCardStatusEnum.USED.getValue().equals(card.getStatus())) { throw ServiceExceptionUtil.exception(PromotionErrorCodeConstants.COUPON_CARD_STATUS_NOT_USED.getCode()); } @@ -183,67 +146,6 @@ public class CouponCardService { // 有一点要注意,更新会未使用时,优惠劵可能已经过期了,直接让定时器跑过期,这里不做处理。 } - /** - * 获得用户优惠劵的可用信息列表 - * - * @param listReqDTO 查询信息 - * @return 优惠劵的可用信息列表 - */ - public List listAvailableCouponCards(CouponCardAvailableListReqDTO listReqDTO) { - // 查询用户未使用的优惠劵列表 - List cards = couponCardMapper.selectListByUserIdAndStatus(listReqDTO.getUserId(), CouponCardStatusEnum.UNUSED.getValue()); - if (cards.isEmpty()) { - return Collections.emptyList(); - } - // 查询优惠劵模板集合 - Map templates = CollectionUtils.convertMap( - couponTemplateMapper.selectBatchIds(CollectionUtils.convertSet(cards, CouponCardDO::getTemplateId)), - CouponTemplateDO::getId); - // 逐个判断是否可用 - return cards.stream().map(card -> { - CouponCardAvailableRespDTO availableCard = CouponCardConvert.INSTANCE.convert01(card); - availableCard.setUnavailableReason(isMatch(card, templates.get(card.getTemplateId()), listReqDTO.getItems())); - availableCard.setAvailable(availableCard.getUnavailableReason() == null); - return availableCard; - }).collect(Collectors.toList()); - } - - /** - * 匹配商品是否可以使用指定优惠劵 - * - * @param card 优惠劵 - * @param template 优惠劵模板 - * @param items 商品 SKU 数组 - * @return 如果不匹配,返回原因 - */ - private String isMatch(CouponCardDO card, CouponTemplateDO template, List items) { - int totalPrice = 0; - if (RangeTypeEnum.ALL.getValue().equals(template.getRangeType())) { - totalPrice = items.stream().mapToInt(spu -> spu.getPrice() * spu.getQuantity()).sum(); - } else if (RangeTypeEnum.PRODUCT_INCLUDE_PART.getValue().equals(template.getRangeType())) { - List spuIds = StringUtils.splitToInt(template.getRangeValues(), ","); - totalPrice = items.stream().mapToInt(spu -> spuIds.contains(spu.getSpuId()) ? spu.getPrice() * spu.getQuantity() : 0).sum(); - } else if (RangeTypeEnum.PRODUCT_EXCLUDE_PART.getValue().equals(template.getRangeType())) { - List spuIds = StringUtils.splitToInt(template.getRangeValues(), ","); - totalPrice = items.stream().mapToInt(spu -> !spuIds.contains(spu.getSpuId()) ? spu.getPrice() * spu.getQuantity() : 0).sum(); - } else if (RangeTypeEnum.CATEGORY_INCLUDE_PART.getValue().equals(template.getRangeType())) { - List spuIds = StringUtils.splitToInt(template.getRangeValues(), ","); - totalPrice = items.stream().mapToInt(spu -> spuIds.contains(spu.getCid()) ? spu.getPrice() * spu.getQuantity() : 0).sum(); - } else if (RangeTypeEnum.CATEGORY_EXCLUDE_PART.getValue().equals(template.getRangeType())) { - List spuIds = StringUtils.splitToInt(template.getRangeValues(), ","); - totalPrice = items.stream().mapToInt(spu -> !spuIds.contains(spu.getCid()) ? spu.getPrice() * spu.getQuantity() : 0).sum(); - } - // 总价为 0 时,说明优惠劵丫根不匹配 - if (totalPrice == 0) { - return "优惠劵不匹配"; - } - // 如果不满足金额 - if (totalPrice < card.getPriceAvailable()) { - return String.format("差 %1$,.2f 元可用优惠劵", (card.getPriceAvailable() - totalPrice) / 100D); - } - return null; - } - private void setCouponCardValidTime(CouponCardDO card, CouponTemplateDO template) { if (CouponTemplateDateTypeEnum.FIXED_DATE.getValue().equals(template.getDateType())) { card.setValidStartTime(template.getValidStartTime()).setValidEndTime(template.getValidEndTime()); diff --git a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/client/trade/TradeOrderClient.java b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/client/trade/TradeOrderClient.java index 1029f1fa6..9989d82b0 100644 --- a/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/client/trade/TradeOrderClient.java +++ b/归档/shop-web-app/src/main/java/cn/iocoder/mall/shopweb/client/trade/TradeOrderClient.java @@ -14,9 +14,9 @@ import java.util.Arrays; @Service public class TradeOrderClient { - @Autowired private TradeOrderFeign tradeOrderFeign; + public Integer createTradeOrder(TradeOrderCreateReqDTO createReqDTO) { CommonResult createTradeOrderResult = tradeOrderFeign.createTradeOrder(createReqDTO); createTradeOrderResult.checkError(); diff --git a/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/dto/TradeOrderCreateReqDTO.java b/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/dto/TradeOrderCreateReqDTO.java deleted file mode 100644 index 78f7f0deb..000000000 --- a/归档/trade-service-project/trade-service-api/src/main/java/cn/iocoder/mall/tradeservice/rpc/order/dto/TradeOrderCreateReqDTO.java +++ /dev/null @@ -1,69 +0,0 @@ -package cn.iocoder.mall.tradeservice.rpc.order.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.List; - -/** - * 交易订单创建 Request DTO - * - * @author Sin - * @time 2019-03-16 14:42 - */ -@Data -@Accessors(chain = true) -public class TradeOrderCreateReqDTO implements Serializable { - - /** - * 用户编号 - */ - @NotNull(message = "用户编号不能为空") - private Integer userId; - /** - * 用户 IP - */ - @NotNull(message = "用户 IP 不能为空") - private String ip; - /** - * 收件地址编号 - */ - @NotNull(message = "用户地址不能为空") - private Integer userAddressId; - /** - * 优惠劵编号 - */ - private Integer couponCardId; - /** - * 备注 - */ - private String remark; - - /** - * 订单商品项列表 - */ - @NotNull(message = "必须选择购买的商品") - private List orderItems; - - - @Data - @Accessors(chain = true) - public static class OrderItem implements Serializable { - - /** - * 商品编号 - */ - @NotNull(message = "商品 SKU 编号不能为空") - private Integer skuId; - /** - * 数量 - */ - @NotNull(message = "商品 SKU 购买数量不能为空") - @Min(value = 1, message = "商品 SKU 购买数量必须大于 0") - private Integer quantity; - } - -} diff --git a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/controller/TradeOrderController.java b/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/controller/TradeOrderController.java index f27e4d35e..98b0fd84b 100644 --- a/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/controller/TradeOrderController.java +++ b/归档/trade-service-project/trade-service-app/src/main/java/cn/iocoder/mall/tradeservice/controller/TradeOrderController.java @@ -23,8 +23,10 @@ import static cn.iocoder.common.framework.vo.CommonResult.success; @RestController @RequestMapping("/trade/order") public class TradeOrderController { + @Autowired private TradeOrderService tradeOrderService; + /** * 创建交易订单 * @@ -59,8 +61,6 @@ public class TradeOrderController { return success(tradeOrderService.pageTradeOrder(pageDTO)); } - // TODO 芋艿:需要重构成入参是 DTO,方便后续升级;返回是 CommonResult,用于返回失败的原因 - /** * 更新交易订单支付成功 * @@ -75,4 +75,5 @@ public class TradeOrderController { tradeOrderService.updateTradeOrderPaySuccess(Integer.valueOf(tradeOrderId), payAmount); return success(true); } + } From 26dee4026beb265f03aec63344010a18340f4d6e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 10 Nov 2022 13:24:37 +0800 Subject: [PATCH 10/29] =?UTF-8?q?=E5=90=8C=E6=AD=A5=20ruoyi-vue-pro=20?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E7=9A=84=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- yudao-dependencies/pom.xml | 10 +++++----- yudao-gateway/pom.xml | 2 +- 归档/mall-dependencies/pom.xml | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 046585f27..7e7fd216c 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,7 @@ 3.8.0 1.18.24 - 1.5.2.Final + 1.5.3.Final UTF-8 diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml index 1ae17d7e6..12528e327 100644 --- a/yudao-dependencies/pom.xml +++ b/yudao-dependencies/pom.xml @@ -16,7 +16,7 @@ 1.6.2-snapshot - 2.6.12 + 2.6.13 2021.0.1 2021.0.1.0 @@ -24,7 +24,7 @@ 1.6.7 2.5 - 1.2.13 + 1.2.14 3.5.2 3.5.2 3.5.2 @@ -51,9 +51,9 @@ 3.0.4 1.18.24 - 1.5.2.Final - 5.8.8 - 3.1.1 + 1.5.3.Final + 5.8.9 + 3.1.2 2.3 1.0.5 1.2.83 diff --git a/yudao-gateway/pom.xml b/yudao-gateway/pom.xml index 2d68e1c48..34926cbc7 100644 --- a/yudao-gateway/pom.xml +++ b/yudao-gateway/pom.xml @@ -72,7 +72,7 @@ org.springframework.boot spring-boot-maven-plugin - 2.6.7 + 2.6.13 true diff --git a/归档/mall-dependencies/pom.xml b/归档/mall-dependencies/pom.xml index 9795ddac5..290336ba9 100644 --- a/归档/mall-dependencies/pom.xml +++ b/归档/mall-dependencies/pom.xml @@ -63,7 +63,7 @@ 5.2.5 27.0.1-jre 1.16.14 - 1.3.0.Final + 1.5.3.Final From 46d16c45e62ec27bf94d0e6665ada2ba99b0ade7 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 10 Nov 2022 21:18:22 +0800 Subject: [PATCH 11/29] =?UTF-8?q?280=20=E3=80=90=E8=BD=BB=E9=87=8F?= =?UTF-8?q?=E7=BA=A7=20PR=E3=80=91=EF=BC=9A=E7=9F=AD=E4=BF=A1=E6=8E=A5?= =?UTF-8?q?=E6=94=B6=E6=8A=A5=E5=91=8A=E5=9B=9E=E8=B0=83=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=B0=8FBug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/system/service/sms/SmsSendServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsSendServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsSendServiceImpl.java index bd2f1d409..114642729 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsSendServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsSendServiceImpl.java @@ -180,7 +180,7 @@ public class SmsSendServiceImpl implements SmsSendService { } // 更新短信日志的接收结果. 因为量一般不大,所以先使用 for 循环更新 receiveResults.forEach(result -> smsLogService.updateSmsReceiveResult(result.getLogId(), - result.getSuccess(), result.getReceiveTime(), result.getErrorCode(), result.getErrorCode())); + result.getSuccess(), result.getReceiveTime(), result.getErrorCode(), result.getErrorMsg())); } } From 2460e492cf108ebea468ceccac030bb526800de4 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 10 Nov 2022 22:37:37 +0800 Subject: [PATCH 12/29] =?UTF-8?q?281=20=E3=80=90=E8=BD=BB=E9=87=8F?= =?UTF-8?q?=E7=BA=A7=20PR=E3=80=91=EF=BC=9Afix=20WXLitePayClient.java=20?= =?UTF-8?q?=E4=B8=ADcopy=E5=BA=94=E5=BF=BD=E7=95=A5=E7=9A=84=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/pay/core/client/impl/wx/WXLitePayClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXLitePayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXLitePayClient.java index c9b81ace0..c4fda5d12 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXLitePayClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXLitePayClient.java @@ -49,7 +49,7 @@ public class WXLitePayClient extends AbstractPayClient { @Override protected void doInit() { WxPayConfig payConfig = new WxPayConfig(); - BeanUtil.copyProperties(config, payConfig, "keyContent"); + BeanUtil.copyProperties(config, payConfig, "privateKeyContent", "privateCertContent"); payConfig.setTradeType(WxPayConstants.TradeType.JSAPI); // 设置使用 JS API 支付方式 // if (StrUtil.isNotEmpty(config.getKeyContent())) { // payConfig.setKeyContent(config.getKeyContent().getBytes(StandardCharsets.UTF_8)); From 19d9d66a38429af28abb277b9660606c349dde9c Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 11 Nov 2022 00:20:57 +0800 Subject: [PATCH 13/29] =?UTF-8?q?=E5=90=8C=E6=AD=A5=20Date=20=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=20LocalDateTime=20=E7=9A=84=E4=BF=AE=E6=94=B9~?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/common/util/date/DateUtils.java | 82 ++++- .../core/loader/ErrorCodeLoaderImpl.java | 4 +- .../operatelog/core/aop/OperateLogAspect.java | 12 +- .../operatelog/core/service/OperateLog.java | 4 +- .../client/dto/PayOrderNotifyRespDTO.java | 4 +- .../client/dto/PayOrderUnifiedReqDTO.java | 4 +- .../core/client/dto/PayRefundNotifyDTO.java | 4 +- .../main/java/pay/config/PayProperties.java | 38 +++ .../pay/config/YudaoPayAutoConfiguration.java | 24 ++ .../core/client/AbstractPayCodeMapping.java | 34 ++ .../main/java/pay/core/client/PayClient.java | 74 +++++ .../java/pay/core/client/PayClientConfig.java | 42 +++ .../pay/core/client/PayClientFactory.java | 31 ++ .../java/pay/core/client/PayCommonResult.java | 58 ++++ .../pay/core/client/dto/PayNotifyDataDTO.java | 29 ++ .../client/dto/PayOrderNotifyRespDTO.java | 54 ++++ .../client/dto/PayOrderUnifiedReqDTO.java | 81 +++++ .../core/client/dto/PayRefundNotifyDTO.java | 63 ++++ .../client/dto/PayRefundUnifiedReqDTO.java | 74 +++++ .../client/dto/PayRefundUnifiedRespDTO.java | 24 ++ .../core/client/impl/AbstractPayClient.java | 115 +++++++ .../client/impl/PayClientFactoryImpl.java | 81 +++++ .../impl/alipay/AbstractAlipayClient.java | 157 ++++++++++ .../impl/alipay/AlipayPayClientConfig.java | 117 +++++++ .../impl/alipay/AlipayPayCodeMapping.java | 28 ++ .../client/impl/alipay/AlipayPcPayClient.java | 63 ++++ .../client/impl/alipay/AlipayQrPayClient.java | 55 ++++ .../impl/alipay/AlipayWapPayClient.java | 78 +++++ .../core/client/impl/wx/WXCodeMapping.java | 56 ++++ .../core/client/impl/wx/WXLitePayClient.java | 206 ++++++++++++ .../client/impl/wx/WXNativePayClient.java | 189 +++++++++++ .../client/impl/wx/WXPayClientConfig.java | 111 +++++++ .../core/client/impl/wx/WXPubPayClient.java | 199 ++++++++++++ .../java/pay/core/enums/PayChannelEnum.java | 60 ++++ .../core/enums/PayChannelRefundRespEnum.java | 23 ++ .../enums/PayFrameworkErrorCodeConstants.java | 27 ++ .../core/enums/PayNotifyRefundStatusEnum.java | 20 ++ .../core/client/dto/SmsReceiveRespDTO.java | 4 +- .../client/impl/aliyun/AliyunSmsClient.java | 10 +- .../client/impl/tencent/TencentSmsClient.java | 4 +- .../client/impl/yunpian/YunpianSmsClient.java | 5 +- .../mybatis/core/dataobject/BaseDO.java | 6 +- .../core/handler/DefaultDBFieldHandler.java | 6 +- .../framework/test/core/util/RandomUtils.java | 6 + .../core/filter/ApiAccessLogFilter.java | 19 +- .../apilog/core/service/ApiAccessLog.java | 6 +- .../apilog/core/service/ApiErrorLog.java | 4 +- .../core/handler/GlobalExceptionHandler.java | 5 +- .../gateway/filter/logging/AccessLog.java | 7 +- .../filter/logging/AccessLogFilter.java | 15 +- .../definition/vo/form/BpmFormRespVO.java | 4 +- .../vo/group/BpmUserGroupPageReqVO.java | 4 +- .../vo/group/BpmUserGroupRespVO.java | 4 +- .../vo/model/BpmModelPageItemRespVO.java | 6 +- .../definition/vo/model/BpmModelRespVO.java | 4 +- .../BpmProcessDefinitionPageItemRespVO.java | 4 +- .../admin/oa/vo/BpmOALeaveBaseVO.java | 13 +- .../admin/oa/vo/BpmOALeaveCreateReqVO.java | 3 +- .../admin/oa/vo/BpmOALeaveRespVO.java | 4 +- .../task/vo/activity/BpmActivityRespVO.java | 6 +- .../BpmProcessInstanceMyPageReqVO.java | 4 +- .../BpmProcessInstancePageItemRespVO.java | 6 +- .../vo/instance/BpmProcessInstanceRespVO.java | 6 +- .../vo/task/BpmTaskDonePageItemRespVO.java | 4 +- .../task/vo/task/BpmTaskDonePageReqVO.java | 6 +- .../vo/task/BpmTaskTodoPageItemRespVO.java | 6 +- .../task/vo/task/BpmTaskTodoPageReqVO.java | 6 +- .../convert/definition/BpmFormConvert.java | 2 +- .../convert/definition/BpmModelConvert.java | 7 +- .../BpmProcessDefinitionConvert.java | 3 +- .../definition/BpmUserGroupConvert.java | 7 +- .../convert/message/BpmMessageConvert.java | 1 + .../bpm/convert/oa/BpmOALeaveConvert.java | 2 +- .../bpm/convert/task/BpmTaskConvert.java | 3 +- .../bpm/dal/dataobject/oa/BpmOALeaveDO.java | 6 +- .../dal/dataobject/task/BpmActivityDO.java | 6 +- .../task/BpmProcessInstanceExtDO.java | 4 +- .../bpm/dal/dataobject/task/BpmTaskExtDO.java | 4 +- .../bpm/service/oa/BpmOALeaveServiceImpl.java | 3 +- .../task/BpmProcessInstanceServiceImpl.java | 2 +- .../bpm/service/task/BpmTaskServiceImpl.java | 16 +- .../src/main/resources/application.yaml | 2 +- .../definition/BpmUserGroupServiceTest.java | 10 +- .../logger/dto/ApiAccessLogCreateReqDTO.java | 6 +- .../logger/dto/ApiErrorLogCreateReqDTO.java | 4 +- .../vo/column/CodegenColumnRespVO.java | 4 +- .../vo/table/CodegenTablePageReqVO.java | 4 +- .../codegen/vo/table/CodegenTableRespVO.java | 6 +- .../admin/db/vo/DataSourceConfigRespVO.java | 4 +- .../file/vo/config/FileConfigPageReqVO.java | 4 +- .../file/vo/config/FileConfigRespVO.java | 4 +- .../admin/file/vo/file/FilePageReqVO.java | 4 +- .../admin/file/vo/file/FileRespVO.java | 4 +- .../vo/apiaccesslog/ApiAccessLogBaseVO.java | 6 +- .../vo/apiaccesslog/ApiAccessLogExcelVO.java | 6 +- .../apiaccesslog/ApiAccessLogExportReqVO.java | 4 +- .../apiaccesslog/ApiAccessLogPageReqVO.java | 4 +- .../vo/apiaccesslog/ApiAccessLogRespVO.java | 4 +- .../vo/apierrorlog/ApiErrorLogBaseVO.java | 4 +- .../vo/apierrorlog/ApiErrorLogExcelVO.java | 8 +- .../apierrorlog/ApiErrorLogExportReqVO.java | 4 +- .../vo/apierrorlog/ApiErrorLogPageReqVO.java | 4 +- .../vo/apierrorlog/ApiErrorLogRespVO.java | 6 +- .../admin/test/vo/TestDemoExcelVO.java | 4 +- .../admin/test/vo/TestDemoExportReqVO.java | 4 +- .../admin/test/vo/TestDemoPageReqVO.java | 4 +- .../admin/test/vo/TestDemoRespVO.java | 12 +- .../dal/dataobject/logger/ApiAccessLogDO.java | 6 +- .../dal/dataobject/logger/ApiErrorLogDO.java | 6 +- .../dal/mysql/file/FileConfigMapper.java | 4 +- .../service/db/DatabaseTableServiceImpl.java | 2 +- .../service/file/FileConfigServiceImpl.java | 6 +- .../logger/ApiErrorLogServiceImpl.java | 4 +- .../src/main/resources/application.yaml | 2 +- .../codegen/java/controller/vo/_column.vm | 2 +- .../codegen/java/controller/vo/baseVO.vm | 6 +- .../codegen/java/controller/vo/createReqVO.vm | 2 +- .../codegen/java/controller/vo/excelVO.vm | 4 +- .../codegen/java/controller/vo/exportReqVO.vm | 3 +- .../codegen/java/controller/vo/pageReqVO.vm | 3 +- .../codegen/java/controller/vo/updateReqVO.vm | 4 +- .../src/main/resources/codegen/java/dal/do.vm | 4 +- .../codegen/java/test/serviceTest.vm | 3 +- .../resources/codegen/vue/views/index.vue.vm | 8 +- .../main/resources/codegen/vue3/api/api.ts.vm | 30 +- .../resources/codegen/vue3/api/types.ts.vm | 18 +- .../resources/codegen/vue3/views/data.ts.vm | 170 +++++----- .../resources/codegen/vue3/views/index.vue.vm | 294 +++++++++--------- .../file/FileConfigServiceImplTest.java | 62 ++-- .../infra/service/file/FileServiceTest.java | 11 +- .../logger/ApiAccessLogServiceImplTest.java | 17 +- .../logger/ApiErrorLogServiceImplTest.java | 16 +- .../service/test/TestDemoServiceImplTest.java | 16 +- .../system/api/errorcode/ErrorCodeApi.java | 5 +- .../api/errorcode/dto/ErrorCodeRespDTO.java | 4 +- .../logger/dto/OperateLogCreateReqDTO.java | 4 +- .../oauth2/dto/OAuth2AccessTokenRespDTO.java | 4 +- .../api/errorcode/ErrorCodeApiImpl.java | 4 +- .../admin/auth/vo/AuthLoginRespVO.java | 4 +- .../admin/dept/vo/dept/DeptRespVO.java | 4 +- .../admin/dept/vo/post/PostRespVO.java | 4 +- .../admin/dict/vo/data/DictDataRespVO.java | 4 +- .../dict/vo/type/DictTypeExportReqVO.java | 4 +- .../admin/dict/vo/type/DictTypePageReqVO.java | 4 +- .../admin/dict/vo/type/DictTypeRespVO.java | 4 +- .../admin/errorcode/vo/ErrorCodeExcelVO.java | 4 +- .../errorcode/vo/ErrorCodeExportReqVO.java | 4 +- .../errorcode/vo/ErrorCodePageReqVO.java | 4 +- .../admin/errorcode/vo/ErrorCodeRespVO.java | 4 +- .../logger/vo/loginlog/LoginLogExcelVO.java | 4 +- .../vo/loginlog/LoginLogExportReqVO.java | 4 +- .../logger/vo/loginlog/LoginLogPageReqVO.java | 4 +- .../logger/vo/loginlog/LoginLogRespVO.java | 4 +- .../vo/operatelog/OperateLogBaseVO.java | 4 +- .../vo/operatelog/OperateLogExcelVO.java | 4 +- .../vo/operatelog/OperateLogExportReqVO.java | 4 +- .../vo/operatelog/OperateLogPageReqVO.java | 4 +- .../admin/notice/vo/NoticeRespVO.java | 4 +- .../oauth2/vo/client/OAuth2ClientRespVO.java | 4 +- .../vo/token/OAuth2AccessTokenRespVO.java | 6 +- .../admin/permission/vo/menu/MenuRespVO.java | 4 +- .../permission/vo/role/RoleExportReqVO.java | 4 +- .../permission/vo/role/RolePageReqVO.java | 4 +- .../admin/permission/vo/role/RoleRespVO.java | 4 +- .../vo/SensitiveWordExcelVO.java | 4 +- .../vo/SensitiveWordExportReqVO.java | 4 +- .../vo/SensitiveWordPageReqVO.java | 4 +- .../sensitiveword/vo/SensitiveWordRespVO.java | 4 +- .../sms/vo/channel/SmsChannelPageReqVO.java | 4 +- .../sms/vo/channel/SmsChannelRespVO.java | 4 +- .../admin/sms/vo/log/SmsLogExcelVO.java | 8 +- .../admin/sms/vo/log/SmsLogExportReqVO.java | 6 +- .../admin/sms/vo/log/SmsLogPageReqVO.java | 6 +- .../admin/sms/vo/log/SmsLogRespVO.java | 8 +- .../sms/vo/template/SmsTemplateExcelVO.java | 4 +- .../vo/template/SmsTemplateExportReqVO.java | 4 +- .../sms/vo/template/SmsTemplatePageReqVO.java | 4 +- .../sms/vo/template/SmsTemplateRespVO.java | 4 +- .../vo/packages/TenantPackagePageReqVO.java | 4 +- .../vo/packages/TenantPackageRespVO.java | 4 +- .../admin/tenant/vo/tenant/TenantBaseVO.java | 4 +- .../admin/tenant/vo/tenant/TenantExcelVO.java | 12 +- .../tenant/vo/tenant/TenantExportReqVO.java | 4 +- .../tenant/vo/tenant/TenantPageReqVO.java | 4 +- .../admin/tenant/vo/tenant/TenantRespVO.java | 12 +- .../user/vo/profile/UserProfileRespVO.java | 6 +- .../admin/user/vo/user/UserExcelVO.java | 4 +- .../admin/user/vo/user/UserExportReqVO.java | 4 +- .../admin/user/vo/user/UserPageReqVO.java | 4 +- .../admin/user/vo/user/UserRespVO.java | 6 +- .../convert/oauth2/OAuth2OpenConvert.java | 3 +- .../dal/dataobject/logger/OperateLogDO.java | 4 +- .../oauth2/OAuth2AccessTokenDO.java | 4 +- .../dataobject/oauth2/OAuth2ApproveDO.java | 4 +- .../dal/dataobject/oauth2/OAuth2CodeDO.java | 4 +- .../oauth2/OAuth2RefreshTokenDO.java | 4 +- .../system/dal/dataobject/sms/SmsCodeDO.java | 4 +- .../system/dal/dataobject/sms/SmsLogDO.java | 6 +- .../dal/dataobject/tenant/TenantDO.java | 4 +- .../dal/dataobject/user/AdminUserDO.java | 4 +- .../system/dal/mysql/dept/DeptMapper.java | 5 +- .../system/dal/mysql/dict/DictDataMapper.java | 2 +- .../dal/mysql/errorcode/ErrorCodeMapper.java | 4 +- .../mysql/oauth2/OAuth2AccessTokenMapper.java | 4 +- .../dal/mysql/oauth2/OAuth2ClientMapper.java | 5 +- .../dal/mysql/permission/MenuMapper.java | 4 +- .../dal/mysql/permission/RoleMapper.java | 4 +- .../dal/mysql/permission/RoleMenuMapper.java | 4 +- .../dal/mysql/permission/UserRoleMapper.java | 4 +- .../sensitiveword/SensitiveWordMapper.java | 4 +- .../dal/mysql/sms/SmsChannelMapper.java | 4 +- .../dal/mysql/sms/SmsTemplateMapper.java | 4 +- .../system/dal/mysql/tenant/TenantMapper.java | 4 +- .../oauth2/OAuth2AccessTokenRedisDAO.java | 7 +- .../system/service/dept/DeptServiceImpl.java | 5 +- .../service/errorcode/ErrorCodeService.java | 4 +- .../errorcode/ErrorCodeServiceImpl.java | 4 +- .../oauth2/OAuth2ApproveServiceImpl.java | 9 +- .../oauth2/OAuth2ClientServiceImpl.java | 10 +- .../service/oauth2/OAuth2CodeServiceImpl.java | 4 +- .../oauth2/OAuth2TokenServiceImpl.java | 5 +- .../service/permission/MenuServiceImpl.java | 5 +- .../permission/PermissionServiceImpl.java | 9 +- .../service/permission/RoleServiceImpl.java | 7 +- .../SensitiveWordServiceImpl.java | 5 +- .../service/sms/SmsChannelServiceImpl.java | 6 +- .../service/sms/SmsCodeServiceImpl.java | 15 +- .../system/service/sms/SmsLogService.java | 4 +- .../system/service/sms/SmsLogServiceImpl.java | 6 +- .../service/sms/SmsTemplateServiceImpl.java | 5 +- .../service/user/AdminUserServiceImpl.java | 3 +- .../system/util/oauth2/OAuth2Utils.java | 9 +- .../src/main/resources/application.yaml | 2 +- .../oauth2/OAuth2OpenControllerTest.java | 16 +- .../system/service/dept/DeptServiceTest.java | 62 ++-- .../service/dict/DictTypeServiceTest.java | 16 +- .../errorcode/ErrorCodeServiceTest.java | 13 +- .../logger/LoginLogServiceImplTest.java | 16 +- .../logger/OperateLogServiceImplTest.java | 16 +- .../oauth2/OAuth2ApproveServiceImplTest.java | 18 +- .../oauth2/OAuth2CodeServiceImplTest.java | 7 +- .../oauth2/OAuth2TokenServiceImplTest.java | 21 +- .../permission/PermissionServiceTest.java | 5 +- .../service/permission/RoleServiceTest.java | 15 +- .../SensitiveWordServiceImplTest.java | 16 +- .../service/sms/SmsChannelServiceTest.java | 12 +- .../system/service/sms/SmsLogServiceTest.java | 31 +- .../service/sms/SmsTemplateServiceTest.java | 19 +- .../tenant/TenantPackageServiceImplTest.java | 10 +- .../service/tenant/TenantServiceImplTest.java | 22 +- .../user/AdminUserServiceImplTest.java | 14 +- .../controller/user/vo/UserRespVO.java | 2 +- .../order/biz/dataobject/OrderExchangeDO.java | 12 +- .../biz/dataobject/OrderLogisticsDetailDO.java | 4 +- .../order/biz/dataobject/OrderReturnDO.java | 12 +- .../dto/comment/OrderCommentReplyPageDTO.java | 2 +- .../mall/order/biz/dto/order/OrderQueryDTO.java | 10 +- .../biz/dto/order/OrderReturnApplyDTO.java | 2 +- .../biz/dto/order/OrderReturnQueryDTO.java | 6 +- .../order/biz/dto/order/OrderUserPageDTO.java | 10 +- .../admin/AdminsOrderPageQueryRequest.java | 14 +- .../admin/AdminsOrderReturnQueryRequest.java | 6 +- .../comment/UsersOrderCommentPageResponse.java | 4 +- .../mall/order/api/bo/OrderCommentBO.java | 4 +- .../mall/order/api/bo/OrderCommentInfoBO.java | 4 +- .../mall/order/api/bo/OrderCommentPageBO.java | 4 +- .../order/api/bo/OrderCommentReplyPageBO.java | 4 +- .../api/bo/OrderCommentStateInfoPageBO.java | 4 +- .../order/api/bo/OrderLastLogisticsInfoBO.java | 4 +- .../mall/order/api/bo/OrderLogisticsInfoBO.java | 4 +- .../api/bo/OrderLogisticsInfoWithOrderBO.java | 4 +- .../mall/order/api/bo/OrderReturnInfoBO.java | 10 +- .../mall/order/api/bo/OrderReturnListBO.java | 14 +- .../order/api/dto/OrderCommentReplyPageDTO.java | 2 +- .../mall/order/api/dto/OrderQueryDTO.java | 10 +- .../mall/order/api/dto/OrderReturnApplyDTO.java | 2 +- .../mall/order/api/dto/OrderReturnQueryDTO.java | 6 +- .../mall/order/api/dto/OrderUserPageDTO.java | 10 +- .../order/biz/dataobject/OrderExchangeDO.java | 12 +- .../biz/dataobject/OrderLogisticsDetailDO.java | 4 +- .../order/biz/dataobject/OrderReturnDO.java | 12 +- .../service/OrderCommentReplyServiceImpl.java | 2 +- .../biz/service/OrderCommentServiceImpl.java | 2 +- .../biz/service/OrderReturnServiceImpl.java | 2 +- .../mall/pay/api/bo/refund/PayRefundBO.java | 10 +- .../pay/api/dto/refund/PayRefundPageDTO.java | 10 +- .../admins/AdminsPayRefundController.java | 10 +- .../pay/biz/service/PayRefundServiceImpl.java | 2 +- .../biz/service/PayTransactionServiceImpl.java | 2 +- .../product/biz/bo/product/ProductAttrBO2.java | 4 +- .../biz/bo/product/ProductAttrValueBO.java | 4 +- .../bo/product/ProductAttrValueDetailBO.java | 4 +- .../bo/product/UserProductSpuCollectionsBO.java | 6 +- .../spu/UserProductSpuCollectionsDO.java | 6 +- .../biz/dataobject/stock/ProductStockDO.java | 6 +- .../UserProductSpuCollectionsAddDTO.java | 6 +- .../mall/product/api/bo/ProductAttrBO.java | 4 +- .../mall/product/api/bo/ProductAttrValueBO.java | 4 +- .../api/bo/ProductAttrValueDetailBO.java | 4 +- .../api/bo/UserProductSpuCollectionsBO.java | 6 +- .../dto/UserProductSpuCollectionsAddDTO.java | 6 +- .../dto/UserProductSpuCollectionsUpdateDTO.java | 4 +- .../UserProductSpuCollectionsConsumer.java | 2 +- .../UserProductSpuCollectionsServiceImpl.java | 2 +- .../vo/admins/AdminsProductAttrDetailVO.java | 4 +- .../vo/admins/AdminsProductAttrVO.java | 4 +- .../admins/AdminsProductAttrValueDetailVO.java | 4 +- .../vo/admins/AdminsProductAttrValueVO.java | 4 +- .../dto/PayTransactionCreateReqDTO.java | 4 +- .../dto/PayTransactionPageReqDTO.java | 10 +- .../transaction/dto/PayTransactionRespDTO.java | 12 +- .../client/thirdpay/PingxxThirdPayClient.java | 2 +- .../dto/ThirdPayRefundSuccessRespDTO.java | 4 +- .../dto/ThirdPayTransactionSuccessRespDTO.java | 4 +- .../dataobject/notify/PayNotifyTaskDO.java | 6 +- .../mysql/dataobject/refund/PayRefundDO.java | 8 +- .../transaction/PayTransactionDO.java | 10 +- .../mysql/mapper/refund/PayRefundMapper.java | 16 +- .../AbstractPayNotifySuccessMQConsumer.java | 2 +- .../mq/consumer/PayRefundSuccessMQConsumer.java | 2 +- .../PayTransactionSuccessMQConsumer.java | 2 +- .../impl/PayTransactionServiceImpl.java | 2 +- .../rpc/attr/dto/ProductAttrKeyRespDTO.java | 4 +- .../rpc/attr/dto/ProductAttrValueRespDTO.java | 4 +- .../rpc/sku/dto/ProductSkuRespDTO.java | 4 +- .../service/attr/bo/ProductAttrKeyBO.java | 4 +- .../service/attr/bo/ProductAttrValueBO.java | 4 +- .../rpc/coupon/dto/card/CouponCardRespDTO.java | 10 +- .../service/coupon/CouponCardService.java | 4 +- .../vo/transaction/PayTransactionRespVO.java | 4 +- .../vo/coupon/card/CouponCardRespVO.java | 6 +- .../coupon/template/CouponTemplateRespVO.java | 8 +- .../rpc/order/dto/TradeOrderItemRespDTO.java | 6 +- .../rpc/order/dto/TradeOrderRespDTO.java | 12 +- .../dataobject/aftersale/AfterSaleOrderDO.java | 6 +- .../mysql/dataobject/order/TradeOrderDO.java | 10 +- 336 files changed, 3536 insertions(+), 1176 deletions(-) create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/config/PayProperties.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/config/YudaoPayAutoConfiguration.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/AbstractPayCodeMapping.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/PayClient.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/PayClientConfig.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/PayClientFactory.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/PayCommonResult.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayNotifyDataDTO.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayOrderNotifyRespDTO.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayOrderUnifiedReqDTO.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayRefundNotifyDTO.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayRefundUnifiedReqDTO.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayRefundUnifiedRespDTO.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/AbstractPayClient.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/PayClientFactoryImpl.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AbstractAlipayClient.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayPayClientConfig.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayPayCodeMapping.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayPcPayClient.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayQrPayClient.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayWapPayClient.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXCodeMapping.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXLitePayClient.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXNativePayClient.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXPayClientConfig.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXPubPayClient.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/enums/PayChannelEnum.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/enums/PayChannelRefundRespEnum.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/enums/PayFrameworkErrorCodeConstants.java create mode 100644 yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/enums/PayNotifyRefundStatusEnum.java diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java index 97fe67f61..a1d96464b 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java @@ -1,8 +1,9 @@ package cn.iocoder.yudao.framework.common.util.date; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.date.LocalDateTimeUtil; -import java.time.Duration; +import java.time.*; import java.util.Calendar; import java.util.Date; @@ -25,6 +26,34 @@ public class DateUtils { public static final String FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND = "yyyy-MM-dd HH:mm:ss"; + /** + * 将 LocalDateTime 转换成 Date + * + * @param date LocalDateTime + * @return LocalDateTime + */ + public static Date of(LocalDateTime date) { + // 将此日期时间与时区相结合以创建 ZonedDateTime + ZonedDateTime zonedDateTime = date.atZone(ZoneId.systemDefault()); + // 本地时间线 LocalDateTime 到即时时间线 Instant 时间戳 + Instant instant = zonedDateTime.toInstant(); + // UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间 + return Date.from(instant); + } + + /** + * 将 Date 转换成 LocalDateTime + * + * @param date Date + * @return LocalDateTime + */ + public static LocalDateTime of(Date date) { + // 转为时间戳 + Instant instant = date.toInstant(); + // UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间 + return LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); + } + public static Date addTime(Duration duration) { return new Date(System.currentTimeMillis() + duration.toMillis()); } @@ -33,6 +62,11 @@ public class DateUtils { return System.currentTimeMillis() > time.getTime(); } + public static boolean isExpired(LocalDateTime time) { + LocalDateTime now = LocalDateTime.now(); + return now.isAfter(time); + } + public static long diff(Date endTime, Date startTime) { return endTime.getTime() - startTime.getTime(); } @@ -40,24 +74,28 @@ public class DateUtils { /** * 创建指定时间 * - * @param year 年 - * @param mouth 月 - * @param day 日 + * @param year 年 + * @param mouth 月 + * @param day 日 * @return 指定时间 */ public static Date buildTime(int year, int mouth, int day) { return buildTime(year, mouth, day, 0, 0, 0); } + public static LocalDateTime buildLocalDateTime(int year, int mouth, int day) { + return LocalDateTime.of(year, mouth, day, 0, 0, 0); + } + /** * 创建指定时间 * - * @param year 年 - * @param mouth 月 - * @param day 日 - * @param hour 小时 - * @param minute 分钟 - * @param second 秒 + * @param year 年 + * @param mouth 月 + * @param day 日 + * @param hour 小时 + * @param minute 分钟 + * @param second 秒 * @return 指定时间 */ public static Date buildTime(int year, int mouth, int day, @@ -83,6 +121,16 @@ public class DateUtils { return a.compareTo(b) > 0 ? a : b; } + public static LocalDateTime max(LocalDateTime a, LocalDateTime b) { + if (a == null) { + return b; + } + if (b == null) { + return a; + } + return a.isAfter(b) ? a : b; + } + public static boolean beforeNow(Date date) { return date.getTime() < System.currentTimeMillis(); } @@ -91,6 +139,10 @@ public class DateUtils { return date.getTime() >= System.currentTimeMillis(); } + public static boolean afterNow(LocalDateTime localDateTime) { + return localDateTime.isAfter(LocalDateTime.now()); + } + /** * 计算当期时间相差的日期 * @@ -135,4 +187,14 @@ public class DateUtils { return DateUtil.isSameDay(date, new Date()); } + /** + * 是否今天 + * + * @param date 日期 + * @return 是否 + */ + public static boolean isToday(LocalDateTime date) { + return LocalDateTimeUtil.isSameDay(date, LocalDateTime.now()); + } + } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/core/loader/ErrorCodeLoaderImpl.java b/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/core/loader/ErrorCodeLoaderImpl.java index da8a60152..870c74f11 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/core/loader/ErrorCodeLoaderImpl.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/core/loader/ErrorCodeLoaderImpl.java @@ -10,7 +10,7 @@ import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.event.EventListener; import org.springframework.scheduling.annotation.Scheduled; -import java.util.Date; +import java.time.LocalDateTime; import java.util.List; /** @@ -41,7 +41,7 @@ public class ErrorCodeLoaderImpl implements ErrorCodeLoader { /** * 缓存错误码的最大更新时间,用于后续的增量轮询,判断是否有更新 */ - private Date maxUpdateTime; + private LocalDateTime maxUpdateTime; @EventListener(ApplicationReadyEvent.class) public void loadErrorCodes() { diff --git a/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/aop/OperateLogAspect.java b/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/aop/OperateLogAspect.java index d3b94d25a..75819cbe1 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/aop/OperateLogAspect.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/aop/OperateLogAspect.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.framework.operatelog.core.aop; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.exceptions.ExceptionUtil; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.StrUtil; @@ -32,6 +33,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.lang.annotation.Annotation; import java.lang.reflect.Array; +import java.time.LocalDateTime; import java.util.*; import java.util.function.Predicate; import java.util.stream.IntStream; @@ -94,7 +96,7 @@ public class OperateLogAspect { } // 记录开始时间 - Date startTime = new Date(); + LocalDateTime startTime = LocalDateTime.now(); try { // 执行原有方法 Object result = joinPoint.proceed(); @@ -128,7 +130,7 @@ public class OperateLogAspect { private void log(ProceedingJoinPoint joinPoint, cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog operateLog, ApiOperation apiOperation, - Date startTime, Object result, Throwable exception) { + LocalDateTime startTime, Object result, Throwable exception) { try { // 判断不记录的情况 if (!isLogEnable(joinPoint, operateLog)) { @@ -145,7 +147,7 @@ public class OperateLogAspect { private void log0(ProceedingJoinPoint joinPoint, cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog operateLog, ApiOperation apiOperation, - Date startTime, Object result, Throwable exception) { + LocalDateTime startTime, Object result, Throwable exception) { OperateLog operateLogObj = new OperateLog(); // 补全通用字段 operateLogObj.setTraceId(TracerUtils.getTraceId()); @@ -226,7 +228,7 @@ public class OperateLogAspect { private static void fillMethodFields(OperateLog operateLogObj, ProceedingJoinPoint joinPoint, cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog operateLog, - Date startTime, Object result, Throwable exception) { + LocalDateTime startTime, Object result, Throwable exception) { MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature(); operateLogObj.setJavaMethod(methodSignature.toString()); if (operateLog == null || operateLog.logArgs()) { @@ -235,7 +237,7 @@ public class OperateLogAspect { if (operateLog == null || operateLog.logResultData()) { operateLogObj.setResultData(obtainResultData(result)); } - operateLogObj.setDuration((int) (System.currentTimeMillis() - startTime.getTime())); + operateLogObj.setDuration((int) (LocalDateTimeUtil.between(startTime, LocalDateTime.now()).toMillis())); // (正常)处理 resultCode 和 resultMsg 字段 if (result instanceof CommonResult) { CommonResult commonResult = (CommonResult) result; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/OperateLog.java b/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/OperateLog.java index 7bce1c6bd..1e3b8c8a8 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/OperateLog.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/OperateLog.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.framework.operatelog.core.service; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; import java.util.Map; /** @@ -85,7 +85,7 @@ public class OperateLog { /** * 开始时间 */ - private Date startTime; + private LocalDateTime startTime; /** * 执行时长,单位:毫秒 diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderNotifyRespDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderNotifyRespDTO.java index a5c24c24e..91f3b2a37 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderNotifyRespDTO.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderNotifyRespDTO.java @@ -5,7 +5,7 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import java.util.Date; +import java.time.LocalDateTime; /** * 支付通知 Response DTO @@ -33,7 +33,7 @@ public class PayOrderNotifyRespDTO { /** * 支付成功时间 */ - private Date successTime; + private LocalDateTime successTime; /** * 通知的原始数据 diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderUnifiedReqDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderUnifiedReqDTO.java index 6f99bb80d..ea3628931 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderUnifiedReqDTO.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderUnifiedReqDTO.java @@ -7,7 +7,7 @@ import org.hibernate.validator.constraints.URL; import javax.validation.constraints.DecimalMin; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; import java.util.Map; /** @@ -68,7 +68,7 @@ public class PayOrderUnifiedReqDTO { * 支付过期时间 */ @NotNull(message = "支付过期时间不能为空") - private Date expireTime; + private LocalDateTime expireTime; // ========== 拓展参数 ========== /** diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundNotifyDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundNotifyDTO.java index 05fcff3c1..edb593d82 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundNotifyDTO.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundNotifyDTO.java @@ -5,7 +5,7 @@ import lombok.Builder; import lombok.Data; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; /** * 从渠道返回数据中解析得到的支付退款通知的Notify DTO @@ -57,7 +57,7 @@ public class PayRefundNotifyDTO { /** * 退款成功时间 */ - private Date refundSuccessTime; + private LocalDateTime refundSuccessTime; } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/config/PayProperties.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/config/PayProperties.java new file mode 100644 index 000000000..d26c394ed --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/config/PayProperties.java @@ -0,0 +1,38 @@ +package pay.config; + +import lombok.Data; +import org.hibernate.validator.constraints.URL; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.validation.annotation.Validated; + +import javax.validation.constraints.NotEmpty; + +@ConfigurationProperties(prefix = "yudao.pay") +@Validated +@Data +public class PayProperties { + + /** + * 支付回调地址 + * 注意,支付渠道统一回调到 payNotifyUrl 地址,由支付模块统一处理;然后,自己的支付模块,在回调 PayAppDO.payNotifyUrl 地址 + */ + @NotEmpty(message = "支付回调地址不能为空") + @URL(message = "支付回调地址的格式必须是 URL") + private String payNotifyUrl; + /** + * 退款回调地址 + * 注意点,同 {@link #payNotifyUrl} 属性 + */ + @NotEmpty(message = "退款回调地址不能为空") + @URL(message = "退款回调地址的格式必须是 URL") + private String refundNotifyUrl; + + + /** + * 支付完成的返回地址 + */ + @URL(message = "支付返回的地址的格式必须是 URL") + @NotEmpty(message = "支付返回的地址不能为空") + private String payReturnUrl; + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/config/YudaoPayAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/config/YudaoPayAutoConfiguration.java new file mode 100644 index 000000000..aa683baaf --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/config/YudaoPayAutoConfiguration.java @@ -0,0 +1,24 @@ +package pay.config; + +import cn.iocoder.yudao.framework.pay.config.PayProperties; +import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; +import cn.iocoder.yudao.framework.pay.core.client.impl.PayClientFactoryImpl; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * 支付配置类 + * + * @author 芋道源码 + */ +@Configuration +@EnableConfigurationProperties(PayProperties.class) +public class YudaoPayAutoConfiguration { + + @Bean + public PayClientFactory payClientFactory() { + return new PayClientFactoryImpl(); + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/AbstractPayCodeMapping.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/AbstractPayCodeMapping.java new file mode 100644 index 000000000..0754c8cee --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/AbstractPayCodeMapping.java @@ -0,0 +1,34 @@ +package pay.core.client; + +import cn.iocoder.yudao.framework.common.exception.ErrorCode; +import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; +import cn.iocoder.yudao.framework.pay.core.enums.PayFrameworkErrorCodeConstants; +import lombok.extern.slf4j.Slf4j; + +/** + * 将 API 的错误码,转换为通用的错误码 + * + * @see PayCommonResult + * @see PayFrameworkErrorCodeConstants + * + * @author 芋道源码 + */ +@Slf4j +public abstract class AbstractPayCodeMapping { + + public final ErrorCode apply(String apiCode, String apiMsg) { + if (apiCode == null) { + log.error("[apply][API 错误码为空,请排查]"); + return PayFrameworkErrorCodeConstants.EXCEPTION; + } + ErrorCode errorCode = this.apply0(apiCode, apiMsg); + if (errorCode == null) { + log.error("[apply][API 错误码({}) 错误提示({}) 无法匹配]", apiCode, apiMsg); + return PayFrameworkErrorCodeConstants.PAY_UNKNOWN; + } + return errorCode; + } + + protected abstract ErrorCode apply0(String apiCode, String apiMsg); + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/PayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/PayClient.java new file mode 100644 index 000000000..b19ffb32f --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/PayClient.java @@ -0,0 +1,74 @@ +package pay.core.client; + + +import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; +import cn.iocoder.yudao.framework.pay.core.client.dto.*; + +/** + * 支付客户端,用于对接各支付渠道的 SDK,实现发起支付、退款等功能 + * + * @author 芋道源码 + */ +public interface PayClient { + + /** + * 获得渠道编号 + * + * @return 渠道编号 + */ + Long getId(); + + /** + * 调用支付渠道,统一下单 + * + * @param reqDTO 下单信息 + * @return 各支付渠道的返回结果 + */ + cn.iocoder.yudao.framework.pay.core.client.PayCommonResult unifiedOrder(PayOrderUnifiedReqDTO reqDTO); + + /** + * 解析支付单的通知结果 + * + * @param data 通知结果 + * @return 解析结果 + * @throws Exception 解析失败,抛出异常 + */ + PayOrderNotifyRespDTO parseOrderNotify(PayNotifyDataDTO data) throws Exception; + + /** + * 调用支付渠道,进行退款 + * @param reqDTO 统一退款请求信息 + * @return 各支付渠道的统一返回结果 + */ + PayCommonResult unifiedRefund(PayRefundUnifiedReqDTO reqDTO); + + /** + * 解析支付退款通知数据 + * @param notifyData 支付退款通知请求数据 + * @return 支付退款通知的Notify DTO + */ + PayRefundNotifyDTO parseRefundNotify(PayNotifyDataDTO notifyData); + + // TODO @芋艿:后续改成非 default,避免不知道去实现 + /** + * 验证是否渠道通知 + * + * @param notifyData 通知数据 + * @return 默认是 true + */ + default boolean verifyNotifyData(PayNotifyDataDTO notifyData) { + return true; + } + + // TODO @芋艿:后续改成非 default,避免不知道去实现 + /** + * 判断是否为退款通知 + * + * @param notifyData 通知数据 + * @return 默认是 false + */ + default boolean isRefundNotify(PayNotifyDataDTO notifyData){ + return false; + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/PayClientConfig.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/PayClientConfig.java new file mode 100644 index 000000000..18ca10c9c --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/PayClientConfig.java @@ -0,0 +1,42 @@ +package pay.core.client; + +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; +import javax.validation.Validator; +import java.util.Set; + +/** + * 支付客户端的配置,本质是支付渠道的配置 + * 每个不同的渠道,需要不同的配置,通过子类来定义 + * + * @author 芋道源码 + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS) +// @JsonTypeInfo 注解的作用,Jackson 多态 +// 1. 序列化到时数据库时,增加 @class 属性。 +// 2. 反序列化到内存对象时,通过 @class 属性,可以创建出正确的类型 +public interface PayClientConfig { + + /** + * 配置验证参数是 + * + * @param validator 校验对象 + * @return 配置好的验证参数 + */ + Set> verifyParam(Validator validator); + + // TODO @aquan:貌似抽象一个 validation group 就好了! + /** + * 参数校验 + * + * @param validator 校验对象 + */ + default void validate(Validator validator) { + Set> violations = verifyParam(validator); + if (!violations.isEmpty()) { + throw new ConstraintViolationException(violations); + } + } +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/PayClientFactory.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/PayClientFactory.java new file mode 100644 index 000000000..d058533d2 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/PayClientFactory.java @@ -0,0 +1,31 @@ +package pay.core.client; + +import cn.iocoder.yudao.framework.pay.core.client.PayClient; +import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; + +/** + * 支付客户端的工厂接口 + * + * @author 芋道源码 + */ +public interface PayClientFactory { + + /** + * 获得支付客户端 + * + * @param channelId 渠道编号 + * @return 支付客户端 + */ + PayClient getPayClient(Long channelId); + + /** + * 创建支付客户端 + * + * @param channelId 渠道编号 + * @param channelCode 渠道编码 + * @param config 支付配置 + */ + void createOrUpdatePayClient(Long channelId, String channelCode, + Config config); + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/PayCommonResult.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/PayCommonResult.java new file mode 100644 index 000000000..f633b85e0 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/PayCommonResult.java @@ -0,0 +1,58 @@ +package pay.core.client; + +import cn.hutool.core.exceptions.ExceptionUtil; +import cn.hutool.core.lang.Assert; +import cn.iocoder.yudao.framework.common.exception.ErrorCode; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.pay.core.client.AbstractPayCodeMapping; +import cn.iocoder.yudao.framework.pay.core.enums.PayFrameworkErrorCodeConstants; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +/** + * 支付的 CommonResult 拓展类 + * + * 考虑到不同的平台,返回的 code 和 msg 是不同的,所以统一额外返回 {@link #apiCode} 和 {@link #apiMsg} 字段 + * + * @author 芋道源码 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class PayCommonResult extends CommonResult { + + /** + * API 返回错误码 + * + * 由于第三方的错误码可能是字符串,所以使用 String 类型 + */ + private String apiCode; + /** + * API 返回提示 + */ + private String apiMsg; + + private PayCommonResult() { + } + + public static PayCommonResult build(String apiCode, String apiMsg, T data, AbstractPayCodeMapping codeMapping) { + Assert.notNull(codeMapping, "参数 codeMapping 不能为空"); + PayCommonResult result = new PayCommonResult().setApiCode(apiCode).setApiMsg(apiMsg); + result.setData(data); + // 翻译错误码 + if (codeMapping != null) { + ErrorCode errorCode = codeMapping.apply(apiCode, apiMsg); + result.setCode(errorCode.getCode()).setMsg(errorCode.getMsg()); + } + return result; + } + + public static PayCommonResult error(Throwable ex) { + PayCommonResult result = new PayCommonResult<>(); + result.setCode(PayFrameworkErrorCodeConstants.EXCEPTION.getCode()); + result.setMsg(ExceptionUtil.getRootCauseMessage(ex)); + return result; + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayNotifyDataDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayNotifyDataDTO.java new file mode 100644 index 000000000..fc1907fa9 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayNotifyDataDTO.java @@ -0,0 +1,29 @@ +package pay.core.client.dto; + +import lombok.Builder; +import lombok.Data; +import lombok.ToString; + +import java.util.Map; + + +/** + * 支付订单,退款订单回调,渠道的统一通知请求数据 + */ +@Data +@ToString +@Builder +public class PayNotifyDataDTO { + + + /** + * HTTP 回调接口的 request body + */ + private String body; + + + /** + * HTTP 回调接口 content type 为 application/x-www-form-urlencoded 的所有参数 + */ + private Map params; +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayOrderNotifyRespDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayOrderNotifyRespDTO.java new file mode 100644 index 000000000..57e0ec445 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayOrderNotifyRespDTO.java @@ -0,0 +1,54 @@ +package pay.core.client.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * 支付通知 Response DTO + * + * @author 芋道源码 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class PayOrderNotifyRespDTO { + + /** + * 支付订单号(支付模块的) + */ + private String orderExtensionNo; + /** + * 支付渠道编号 + */ + private String channelOrderNo; + /** + * 支付渠道用户编号 + */ + private String channelUserId; + /** + * 支付成功时间 + */ + private LocalDateTime successTime; + + /** + * 通知的原始数据 + * + * 主要用于持久化,方便后续修复数据,或者排错 + */ + private String data; + + /** + * TODO @jason 结合其他的渠道定义成枚举, + * alipay + * TRADE_CLOSED,未付款交易超时关闭,或支付完成后全额退款。 + * TRADE_SUCCESS, 交易支付成功 + * TRADE_FINISHED 交易结束,不可退款。 + */ + private String tradeStatus; + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayOrderUnifiedReqDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayOrderUnifiedReqDTO.java new file mode 100644 index 000000000..ad68a5edf --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayOrderUnifiedReqDTO.java @@ -0,0 +1,81 @@ +package pay.core.client.dto; + +import lombok.Data; +import org.hibernate.validator.constraints.Length; +import org.hibernate.validator.constraints.URL; + +import javax.validation.constraints.DecimalMin; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; +import java.util.Map; + +/** + * 统一下单 Request DTO + * + * @author 芋道源码 + */ +@Data +public class PayOrderUnifiedReqDTO { + + /** + * 用户 IP + */ + @NotEmpty(message = "用户 IP 不能为空") + private String userIp; + + // ========== 商户相关字段 ========== + + /** + * 商户订单编号 + */ + @NotEmpty(message = "商户订单编号不能为空") + private String merchantOrderId; + /** + * 商品标题 + */ + @NotEmpty(message = "商品标题不能为空") + @Length(max = 32, message = "商品标题不能超过 32") + private String subject; + /** + * 商品描述信息 + */ + @NotEmpty(message = "商品描述信息不能为空") + @Length(max = 128, message = "商品描述信息长度不能超过128") + private String body; + /** + * 支付结果的 notify 回调地址 + */ + @NotEmpty(message = "支付结果的回调地址不能为空") + @URL(message = "支付结果的 notify 回调地址必须是 URL 格式") + private String notifyUrl; + /** + * 支付结果的 return 回调地址 + */ + @URL(message = "支付结果的 return 回调地址必须是 URL 格式") + private String returnUrl; + + // ========== 订单相关字段 ========== + + /** + * 支付金额,单位:分 + */ + @NotNull(message = "支付金额不能为空") + @DecimalMin(value = "0", inclusive = false, message = "支付金额必须大于零") + private Long amount; + + /** + * 支付过期时间 + */ + @NotNull(message = "支付过期时间不能为空") + private LocalDateTime expireTime; + + // ========== 拓展参数 ========== + /** + * 支付渠道的额外参数 + * + * 例如说,微信公众号需要传递 openid 参数 + */ + private Map channelExtras; + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayRefundNotifyDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayRefundNotifyDTO.java new file mode 100644 index 000000000..be5c2231d --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayRefundNotifyDTO.java @@ -0,0 +1,63 @@ +package pay.core.client.dto; + +import cn.iocoder.yudao.framework.pay.core.enums.PayNotifyRefundStatusEnum; +import lombok.Builder; +import lombok.Data; +import lombok.ToString; + +import java.time.LocalDateTime; + +/** + * 从渠道返回数据中解析得到的支付退款通知的Notify DTO + * + * @author jason + */ +@Data +@ToString +@Builder +public class PayRefundNotifyDTO { + + /** + * 支付渠道编号 + */ + private String channelOrderNo; + + + /** + * 交易订单号,根据规则生成 + * 调用支付渠道时,使用该字段作为对接的订单号。 + * 1. 调用微信支付 https://api.mch.weixin.qq.com/pay/unifiedorder 时,使用该字段作为 out_trade_no + * 2. 调用支付宝 https://opendocs.alipay.com/apis 时,使用该字段作为 out_trade_no + * 这里对应 pay_extension 里面的 no + * 例如说,P202110132239124200055 + */ + private String tradeNo; + + /** + * https://api.mch.weixin.qq.com/v3/refund/domestic/refunds 中的 out_refund_no + * https://opendocs.alipay.com/apis alipay.trade.refund 中的 out_request_no + * 退款请求号。 + * 标识一次退款请求,需要保证在交易号下唯一,如需部分退款,则此参数必传。 + * 注:针对同一次退款请求,如果调用接口失败或异常了,重试时需要保证退款请求号不能变更, + * 防止该笔交易重复退款。支付宝会保证同样的退款请求号多次请求只会退一次。 + * 退款单请求号,根据规则生成 + * + * 例如说,RR202109181134287570000 + */ + private String reqNo; + + + /** + * 退款是否成功 + */ + private PayNotifyRefundStatusEnum status; + + + + /** + * 退款成功时间 + */ + private LocalDateTime refundSuccessTime; + + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayRefundUnifiedReqDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayRefundUnifiedReqDTO.java new file mode 100644 index 000000000..fc9a13a13 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayRefundUnifiedReqDTO.java @@ -0,0 +1,74 @@ +package pay.core.client.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +import org.hibernate.validator.constraints.URL; + +import javax.validation.constraints.DecimalMin; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * 统一 退款 Request DTO + * + * @author jason + */ +@Accessors(chain = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Data +public class PayRefundUnifiedReqDTO { + + /** + * 用户 IP + */ + private String userIp; + + // TODO @jason:这个是否为非必传字段呀,只需要传递 payTradeNo 字段即可。尽可能精简 + /** + * https://api.mch.weixin.qq.com/v3/refund/domestic/refunds 中的 transaction_id + * https://opendocs.alipay.com/apis alipay.trade.refund 中的 trade_no + * 渠道订单号 + */ + private String channelOrderNo; + + /** + * https://api.mch.weixin.qq.com/v3/refund/domestic/refunds 中的 out_trade_no + * https://opendocs.alipay.com/apis alipay.trade.refund 中的 out_trade_no + * 支付交易号 {PayOrderExtensionDO no字段} 和 渠道订单号 不能同时为空 + */ + private String payTradeNo; + + /** + * https://api.mch.weixin.qq.com/v3/refund/domestic/refunds 中的 out_refund_no + * https://opendocs.alipay.com/apis alipay.trade.refund 中的 out_trade_no + * 退款请求单号 同一退款请求单号多次请求只退一笔。 + * 使用 商户的退款单号。{PayRefundDO 字段 merchantRefundNo} + */ + @NotEmpty(message = "退款请求单号") + private String merchantRefundId; + + /** + * 退款原因 + */ + @NotEmpty(message = "退款原因不能为空") + private String reason; + + /** + * 退款金额,单位:分 + */ + @NotNull(message = "退款金额不能为空") + @DecimalMin(value = "0", inclusive = false, message = "支付金额必须大于零") + private Long amount; + + /** + * 退款结果 notify 回调地址, 支付宝退款不需要回调地址, 微信需要 + */ + @URL(message = "支付结果的 notify 回调地址必须是 URL 格式") + private String notifyUrl; + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayRefundUnifiedRespDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayRefundUnifiedRespDTO.java new file mode 100644 index 000000000..4adeb98ff --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/dto/PayRefundUnifiedRespDTO.java @@ -0,0 +1,24 @@ +package pay.core.client.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +/** + * 统一退款 Response DTO + * + * @author jason + */ +@Accessors(chain = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Data +public class PayRefundUnifiedRespDTO { + + /** + * 渠道退款单编号 + */ + private String channelRefundId; +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/AbstractPayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/AbstractPayClient.java new file mode 100644 index 000000000..2d10cea18 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/AbstractPayClient.java @@ -0,0 +1,115 @@ +package pay.core.client.impl; + +import cn.iocoder.yudao.framework.pay.core.client.AbstractPayCodeMapping; +import cn.iocoder.yudao.framework.pay.core.client.PayClient; +import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; +import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; +import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO; +import cn.iocoder.yudao.framework.pay.core.client.dto.PayRefundUnifiedReqDTO; +import cn.iocoder.yudao.framework.pay.core.client.dto.PayRefundUnifiedRespDTO; +import lombok.extern.slf4j.Slf4j; + +import javax.validation.Validation; + +import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; + +/** + * 支付客户端的抽象类,提供模板方法,减少子类的冗余代码 + * + * @author 芋道源码 + */ +@Slf4j +public abstract class AbstractPayClient implements PayClient { + + /** + * 渠道编号 + */ + private final Long channelId; + /** + * 渠道编码 + */ + private final String channelCode; + /** + * 错误码枚举类 + */ + protected AbstractPayCodeMapping codeMapping; + /** + * 支付配置 + */ + protected Config config; + + public AbstractPayClient(Long channelId, String channelCode, Config config, AbstractPayCodeMapping codeMapping) { + this.channelId = channelId; + this.channelCode = channelCode; + this.codeMapping = codeMapping; + this.config = config; + } + + /** + * 初始化 + */ + public final void init() { + doInit(); + log.info("[init][配置({}) 初始化完成]", config); + } + + /** + * 自定义初始化 + */ + protected abstract void doInit(); + + public final void refresh(Config config) { + // 判断是否更新 + if (config.equals(this.config)) { + return; + } + log.info("[refresh][配置({})发生变化,重新初始化]", config); + this.config = config; + // 初始化 + this.init(); + } + + protected Double calculateAmount(Long amount) { + return amount / 100.0; + } + + @Override + public Long getId() { + return channelId; + } + + @Override + public final PayCommonResult unifiedOrder(PayOrderUnifiedReqDTO reqDTO) { + Validation.buildDefaultValidatorFactory().getValidator().validate(reqDTO); + // 执行短信发送 + PayCommonResult result; + try { + result = doUnifiedOrder(reqDTO); + } catch (Throwable ex) { + // 打印异常日志 + log.error("[unifiedOrder][request({}) 发起支付失败]", toJsonString(reqDTO), ex); + // 封装返回 + return PayCommonResult.error(ex); + } + return result; + } + + protected abstract PayCommonResult doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) + throws Throwable; + + @Override + public PayCommonResult unifiedRefund(PayRefundUnifiedReqDTO reqDTO) { + PayCommonResult resp; + try { + resp = doUnifiedRefund(reqDTO); + } catch (Throwable ex) { + // 记录异常日志 + log.error("[unifiedRefund][request({}) 发起退款失败]", toJsonString(reqDTO), ex); + resp = PayCommonResult.error(ex); + } + return resp; + } + + protected abstract PayCommonResult doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) throws Throwable; + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/PayClientFactoryImpl.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/PayClientFactoryImpl.java new file mode 100644 index 000000000..2a0c0d074 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/PayClientFactoryImpl.java @@ -0,0 +1,81 @@ +package pay.core.client.impl; + +import cn.hutool.core.lang.Assert; +import cn.iocoder.yudao.framework.pay.core.client.PayClient; +import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; +import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; +import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; +import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; +import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPcPayClient; +import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayQrPayClient; +import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayWapPayClient; +import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXLitePayClient; +import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXNativePayClient; +import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; +import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPubPayClient; +import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; +import lombok.extern.slf4j.Slf4j; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +/** + * 支付客户端的工厂实现类 + * + * @author 芋道源码 + */ +@Slf4j +public class PayClientFactoryImpl implements PayClientFactory { + + /** + * 支付客户端 Map + * key:渠道编号 + */ + private final ConcurrentMap> clients = new ConcurrentHashMap<>(); + + @Override + public PayClient getPayClient(Long channelId) { + cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient client = clients.get(channelId); + if (client == null) { + log.error("[getPayClient][渠道编号({}) 找不到客户端]", channelId); + } + return client; + } + + @Override + @SuppressWarnings("unchecked") + public void createOrUpdatePayClient(Long channelId, String channelCode, + Config config) { + cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient client = (cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient) clients.get(channelId); + if (client == null) { + client = this.createPayClient(channelId, channelCode, config); + client.init(); + clients.put(client.getId(), client); + } else { + client.refresh(config); + } + } + + @SuppressWarnings("unchecked") + private cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient createPayClient( + Long channelId, String channelCode, Config config) { + PayChannelEnum channelEnum = PayChannelEnum.getByCode(channelCode); + Assert.notNull(channelEnum, String.format("支付渠道(%s) 为空", channelEnum)); + // 创建客户端 + // TODO @芋艿 WX_LITE WX_APP 如果不添加在 项目启动的时候去初始化会报错无法启动。所以我手动加了两个,具体需要你来配 + switch (channelEnum) { + case WX_PUB: return (cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient) new WXPubPayClient(channelId, (WXPayClientConfig) config); + case WX_LITE: return (cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient) new WXLitePayClient(channelId, (WXPayClientConfig) config); //微信小程序请求支付 + case WX_APP: return (cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient) new WXPubPayClient(channelId, (WXPayClientConfig) config); + case WX_NATIVE: return (cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient) new WXNativePayClient(channelId, (WXPayClientConfig) config); + case ALIPAY_WAP: return (cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient) new AlipayWapPayClient(channelId, (AlipayPayClientConfig) config); + case ALIPAY_QR: return (cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient) new AlipayQrPayClient(channelId, (AlipayPayClientConfig) config); + case ALIPAY_APP: return (cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient) new AlipayQrPayClient(channelId, (AlipayPayClientConfig) config); + case ALIPAY_PC: return (AbstractPayClient) new AlipayPcPayClient(channelId, (AlipayPayClientConfig) config); + } + // 创建失败,错误日志 + 抛出异常 + log.error("[createPayClient][配置({}) 找不到合适的客户端实现]", config); + throw new IllegalArgumentException(String.format("配置(%s) 找不到合适的客户端实现", config)); + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AbstractAlipayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AbstractAlipayClient.java new file mode 100644 index 000000000..a230bb841 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AbstractAlipayClient.java @@ -0,0 +1,157 @@ +package pay.core.client.impl.alipay; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.iocoder.yudao.framework.pay.core.client.AbstractPayCodeMapping; +import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; +import cn.iocoder.yudao.framework.pay.core.client.dto.*; +import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; +import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; +import cn.iocoder.yudao.framework.pay.core.enums.PayNotifyRefundStatusEnum; +import com.alipay.api.AlipayApiException; +import com.alipay.api.AlipayConfig; +import com.alipay.api.DefaultAlipayClient; +import com.alipay.api.domain.AlipayTradeRefundModel; +import com.alipay.api.internal.util.AlipaySignature; +import com.alipay.api.request.AlipayTradeRefundRequest; +import com.alipay.api.response.AlipayTradeRefundResponse; +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; + +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; + +import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; + +/** + * 支付宝抽象类, 实现支付宝统一的接口。如退款 + * + * @author jason + */ +@Slf4j +public abstract class AbstractAlipayClient extends AbstractPayClient { + + protected DefaultAlipayClient client; + + public AbstractAlipayClient(Long channelId, String channelCode, + AlipayPayClientConfig config, AbstractPayCodeMapping codeMapping) { + super(channelId, channelCode, config, codeMapping); + } + + @Override + @SneakyThrows + protected void doInit() { + AlipayConfig alipayConfig = new AlipayConfig(); + BeanUtil.copyProperties(config, alipayConfig, false); + this.client = new DefaultAlipayClient(alipayConfig); + } + + /** + * 从支付宝通知返回参数中解析 PayOrderNotifyRespDTO, 通知具体参数参考 + * //https://opendocs.alipay.com/open/203/105286 + * @param data 通知结果 + * @return 解析结果 PayOrderNotifyRespDTO + * @throws Exception 解析失败,抛出异常 + */ + @Override + public PayOrderNotifyRespDTO parseOrderNotify(PayNotifyDataDTO data) throws Exception { + Map params = strToMap(data.getBody()); + + return PayOrderNotifyRespDTO.builder().orderExtensionNo(params.get("out_trade_no")) + .channelOrderNo(params.get("trade_no")).channelUserId(params.get("seller_id")) + .tradeStatus(params.get("trade_status")) + .successTime(LocalDateTimeUtil.parse(params.get("notify_time"), "yyyy-MM-dd HH:mm:ss")) + .data(data.getBody()).build(); + } + + @Override + public PayRefundNotifyDTO parseRefundNotify(PayNotifyDataDTO notifyData) { + Map params = strToMap(notifyData.getBody()); + PayRefundNotifyDTO notifyDTO = PayRefundNotifyDTO.builder().channelOrderNo(params.get("trade_no")) + .tradeNo(params.get("out_trade_no")) + .reqNo(params.get("out_biz_no")) + .status(PayNotifyRefundStatusEnum.SUCCESS) + .refundSuccessTime(LocalDateTimeUtil.parse(params.get("gmt_refund"), "yyyy-MM-dd HH:mm:ss")) + .build(); + return notifyDTO; + } + + @Override + public boolean isRefundNotify(PayNotifyDataDTO notifyData) { + if (notifyData.getParams().containsKey("refund_fee")) { + return true; + } else { + return false; + } + } + + @Override + public boolean verifyNotifyData(PayNotifyDataDTO notifyData) { + boolean verifyResult = false; + try { + verifyResult = AlipaySignature.rsaCheckV1(notifyData.getParams(), config.getAlipayPublicKey(), StandardCharsets.UTF_8.name(), "RSA2"); + } catch (AlipayApiException e) { + log.error("[AlipayClient verifyNotifyData][(notify param is :{}) 验证失败]", toJsonString(notifyData.getParams()), e); + } + return verifyResult; + } + + /** + * 支付宝统一的退款接口 alipay.trade.refund + * @param reqDTO 退款请求 request DTO + * @return 退款请求 Response + */ + @Override + protected PayCommonResult doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) { + AlipayTradeRefundModel model=new AlipayTradeRefundModel(); + model.setTradeNo(reqDTO.getChannelOrderNo()); + model.setOutTradeNo(reqDTO.getPayTradeNo()); + model.setOutRequestNo(reqDTO.getMerchantRefundId()); + model.setRefundAmount(calculateAmount(reqDTO.getAmount()).toString()); + model.setRefundReason(reqDTO.getReason()); + AlipayTradeRefundRequest refundRequest = new AlipayTradeRefundRequest(); + refundRequest.setBizModel(model); + try { + AlipayTradeRefundResponse response = client.execute(refundRequest); + log.info("[doUnifiedRefund][response({}) 发起退款 渠道返回", toJsonString(response)); + if (response.isSuccess()) { + //退款导致触发的异步通知是发送到支付接口中设置的notify_url + //支付宝不返回退款单号,设置为空 + PayRefundUnifiedRespDTO respDTO = new PayRefundUnifiedRespDTO(); + respDTO.setChannelRefundId(""); + return PayCommonResult.build(response.getCode(), response.getMsg(), respDTO, codeMapping); + } + // 失败。需要抛出异常 + return PayCommonResult.build(response.getCode(), response.getMsg(), null, codeMapping); + } catch (AlipayApiException e) { + // TODO 记录异常日志 + log.error("[doUnifiedRefund][request({}) 发起退款失败,网络读超时,退款状态未知]", toJsonString(reqDTO), e); + return PayCommonResult.build(e.getErrCode(), e.getErrMsg(), null, codeMapping); + } + } + + + + /** + * 支付宝统一回调参数 str 转 map + * + * @param s 支付宝支付通知回调参数 + * @return map 支付宝集合 + */ + public static Map strToMap(String s) { + // TODO @zxy:这个可以使用 hutool 的 HttpUtil decodeParams 方法么? + Map stringStringMap = new HashMap<>(); + // 调整时间格式 + String s3 = s.replaceAll("%3A", ":"); + // 获取 map + String s4 = s3.replace("+", " "); + String[] split = s4.split("&"); + for (String s1 : split) { + String[] split1 = s1.split("="); + stringStringMap.put(split1[0], split1[1]); + } + return stringStringMap; + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayPayClientConfig.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayPayClientConfig.java new file mode 100644 index 000000000..dd3bd5f00 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayPayClientConfig.java @@ -0,0 +1,117 @@ +package pay.core.client.impl.alipay; + +import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; +import lombok.Data; + +import javax.validation.ConstraintViolation; +import javax.validation.Validator; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.Set; + +// TODO 芋艿:参数校验 + +/** + * 支付宝的 PayClientConfig 实现类 + * 属性主要来自 {@link com.alipay.api.AlipayConfig} 的必要属性 + * + * @author 芋道源码 + */ +@Data +public class AlipayPayClientConfig implements PayClientConfig { + + /** + * 网关地址 - 线上 + */ + public static final String SERVER_URL_PROD = "https://openapi.alipay.com/gateway.do"; + /** + * 网关地址 - 沙箱 + */ + public static final String SERVER_URL_SANDBOX = "https://openapi.alipaydev.com/gateway.do"; + + /** + * 公钥类型 - 公钥模式 + */ + public static final Integer MODE_PUBLIC_KEY = 1; + /** + * 公钥类型 - 证书模式 + */ + public static final Integer MODE_CERTIFICATE = 2; + + /** + * 签名算法类型 - RSA + */ + public static final String SIGN_TYPE_DEFAULT = "RSA2"; + + /** + * 网关地址 + * 1. {@link #SERVER_URL_PROD} + * 2. {@link #SERVER_URL_SANDBOX} + */ + @NotBlank(message = "网关地址不能为空", groups = {ModePublicKey.class, ModeCertificate.class}) + private String serverUrl; + + /** + * 开放平台上创建的应用的 ID + */ + @NotBlank(message = "开放平台上创建的应用的 ID不能为空", groups = {ModePublicKey.class, ModeCertificate.class}) + private String appId; + + /** + * 签名算法类型,推荐:RSA2 + *

+ * {@link #SIGN_TYPE_DEFAULT} + */ + @NotBlank(message = "签名算法类型不能为空", groups = {ModePublicKey.class, ModeCertificate.class}) + private String signType; + + /** + * 公钥类型 + * 1. {@link #MODE_PUBLIC_KEY} 情况,privateKey + alipayPublicKey + * 2. {@link #MODE_CERTIFICATE} 情况,appCertContent + alipayPublicCertContent + rootCertContent + */ + @NotNull(message = "公钥类型不能为空", groups = {ModePublicKey.class, ModeCertificate.class}) + private Integer mode; + + // ========== 公钥模式 ========== + /** + * 商户私钥 + */ + @NotBlank(message = "商户私钥不能为空", groups = {ModePublicKey.class}) + private String privateKey; + + /** + * 支付宝公钥字符串 + */ + @NotBlank(message = "支付宝公钥字符串不能为空", groups = {ModePublicKey.class}) + private String alipayPublicKey; + + // ========== 证书模式 ========== + /** + * 指定商户公钥应用证书内容字符串 + */ + @NotBlank(message = "指定商户公钥应用证书内容不能为空", groups = {ModeCertificate.class}) + private String appCertContent; + /** + * 指定支付宝公钥证书内容字符串 + */ + @NotBlank(message = "指定支付宝公钥证书内容不能为空", groups = {ModeCertificate.class}) + private String alipayPublicCertContent; + /** + * 指定根证书内容字符串 + */ + @NotBlank(message = "指定根证书内容字符串不能为空", groups = {ModeCertificate.class}) + private String rootCertContent; + + public interface ModePublicKey { + } + + public interface ModeCertificate { + } + + @Override + public Set> verifyParam(Validator validator) { + return validator.validate(this, + MODE_PUBLIC_KEY.equals(this.getMode()) ? ModePublicKey.class : ModeCertificate.class); + } +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayPayCodeMapping.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayPayCodeMapping.java new file mode 100644 index 000000000..558266f52 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayPayCodeMapping.java @@ -0,0 +1,28 @@ +package pay.core.client.impl.alipay; + +import cn.iocoder.yudao.framework.common.exception.ErrorCode; +import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; +import cn.iocoder.yudao.framework.pay.core.client.AbstractPayCodeMapping; + +import java.util.Objects; + +/** + * 支付宝的 PayCodeMapping 实现类 + * + * @author 芋道源码 + */ +public class AlipayPayCodeMapping extends AbstractPayCodeMapping { + + @Override + protected ErrorCode apply0(String apiCode, String apiMsg) { + if (Objects.equals(apiCode, "10000")) { + return GlobalErrorCodeConstants.SUCCESS; + } + // alipay wap api code 返回为null, 暂时定为-9999 + if (Objects.equals(apiCode, "-9999")) { + return GlobalErrorCodeConstants.SUCCESS; + } + return null; + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayPcPayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayPcPayClient.java new file mode 100644 index 000000000..15326fa35 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayPcPayClient.java @@ -0,0 +1,63 @@ +package pay.core.client.impl.alipay; + +import cn.hutool.core.util.StrUtil; +import cn.iocoder.yudao.framework.common.util.json.JsonUtils; +import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; +import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO; +import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AbstractAlipayClient; +import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; +import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayCodeMapping; +import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; +import com.alibaba.fastjson.JSONObject; +import com.alipay.api.AlipayApiException; +import com.alipay.api.domain.AlipayTradePagePayModel; +import com.alipay.api.request.AlipayTradePagePayRequest; +import com.alipay.api.response.AlipayTradePagePayResponse; +import lombok.extern.slf4j.Slf4j; + + +/** + * 支付宝【PC网站支付】的 PayClient 实现类 + * 文档:https://opendocs.alipay.com/open/270/105898 + * + * @author XGD + */ +@Slf4j +public class AlipayPcPayClient extends AbstractAlipayClient { + + public AlipayPcPayClient(Long channelId, AlipayPayClientConfig config) { + super(channelId, PayChannelEnum.ALIPAY_PC.getCode(), config, new AlipayPayCodeMapping()); + } + + @Override + public PayCommonResult doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) { + // 构建 AlipayTradePagePayModel 请求 + AlipayTradePagePayModel model = new AlipayTradePagePayModel(); + // 构建 AlipayTradePagePayRequest + AlipayTradePagePayRequest request = new AlipayTradePagePayRequest(); + request.setBizModel(model); + JSONObject bizContent = new JSONObject(); + // 参数说明可查看: https://opendocs.alipay.com/open/028r8t?scene=22 + bizContent.put("out_trade_no", reqDTO.getMerchantOrderId()); + bizContent.put("total_amount", calculateAmount(reqDTO.getAmount())); + bizContent.put("subject", reqDTO.getSubject()); + bizContent.put("product_code", "FAST_INSTANT_TRADE_PAY"); + // PC扫码支付的方式:支持前置模式和跳转模式。4: 订单码-可定义宽度的嵌入式二维码 + bizContent.put("qr_pay_mode", "4"); + // 自定义二维码宽度 + bizContent.put("qrcode_width", "150"); + request.setBizContent(bizContent.toJSONString()); + request.setNotifyUrl(reqDTO.getNotifyUrl()); + request.setReturnUrl(""); + // 执行请求 + AlipayTradePagePayResponse response; + try { + response = client.pageExecute(request); + } catch (AlipayApiException e) { + log.error("[unifiedOrder][request({}) 发起支付失败]", JsonUtils.toJsonString(reqDTO), e); + return PayCommonResult.build(e.getErrCode(), e.getErrMsg(), null, codeMapping); + } + // 响应为表单格式,前端可嵌入响应的页面或关闭当前支付窗口 + return PayCommonResult.build(StrUtil.blankToDefault(response.getCode(),"10000") ,response.getMsg(), response, codeMapping); + } +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayQrPayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayQrPayClient.java new file mode 100644 index 000000000..a9eec8d0c --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayQrPayClient.java @@ -0,0 +1,55 @@ +package pay.core.client.impl.alipay; + +import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; +import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO; +import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AbstractAlipayClient; +import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; +import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayCodeMapping; +import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; +import com.alipay.api.AlipayApiException; +import com.alipay.api.domain.AlipayTradePrecreateModel; +import com.alipay.api.request.AlipayTradePrecreateRequest; +import com.alipay.api.response.AlipayTradePrecreateResponse; +import lombok.extern.slf4j.Slf4j; + +import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; + +/** + * 支付宝【扫码支付】的 PayClient 实现类 + * 文档:https://opendocs.alipay.com/apis/02890k + * + * @author 芋道源码 + */ +@Slf4j +public class AlipayQrPayClient extends AbstractAlipayClient { + + public AlipayQrPayClient(Long channelId, AlipayPayClientConfig config) { + super(channelId, PayChannelEnum.ALIPAY_QR.getCode(), config, new AlipayPayCodeMapping()); + } + + @Override + public PayCommonResult doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) { + // 构建 AlipayTradePrecreateModel 请求 + AlipayTradePrecreateModel model = new AlipayTradePrecreateModel(); + model.setOutTradeNo(reqDTO.getMerchantOrderId()); + model.setSubject(reqDTO.getSubject()); + model.setBody(reqDTO.getBody()); + model.setTotalAmount(calculateAmount(reqDTO.getAmount()).toString()); // 单位:元 + // TODO 芋艿:userIp + expireTime + // 构建 AlipayTradePrecreateRequest + AlipayTradePrecreateRequest request = new AlipayTradePrecreateRequest(); + request.setBizModel(model); + request.setNotifyUrl(reqDTO.getNotifyUrl()); + request.setReturnUrl(reqDTO.getReturnUrl()); + // 执行请求 + AlipayTradePrecreateResponse response; + try { + response = client.execute(request); + } catch (AlipayApiException e) { + log.error("[unifiedOrder][request({}) 发起支付失败]", toJsonString(reqDTO), e); + return PayCommonResult.build(e.getErrCode(), e.getErrMsg(), null, codeMapping); + } + // TODO 芋艿:sub Code 需要测试下各种失败的情况 + return PayCommonResult.build(response.getCode(), response.getMsg(), response, codeMapping); + } +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayWapPayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayWapPayClient.java new file mode 100644 index 000000000..72af37eff --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/alipay/AlipayWapPayClient.java @@ -0,0 +1,78 @@ +package pay.core.client.impl.alipay; + +import cn.hutool.core.date.DateUtil; +import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; +import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO; +import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AbstractAlipayClient; +import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; +import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayCodeMapping; +import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; +import com.alipay.api.AlipayApiException; +import com.alipay.api.domain.AlipayTradeWapPayModel; +import com.alipay.api.request.AlipayTradeWapPayRequest; +import com.alipay.api.response.AlipayTradeWapPayResponse; +import lombok.extern.slf4j.Slf4j; + +import java.util.Objects; + +/** + * 支付宝【手机网站】的 PayClient 实现类 + * 文档:https://opendocs.alipay.com/apis/api_1/alipay.trade.wap.pay + * + * @author 芋道源码 + */ +@Slf4j +public class AlipayWapPayClient extends AbstractAlipayClient { + + + public AlipayWapPayClient(Long channelId, AlipayPayClientConfig config) { + super(channelId, PayChannelEnum.ALIPAY_WAP.getCode(), config, new AlipayPayCodeMapping()); + } + + @Override + public PayCommonResult doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) { + // 构建 AlipayTradeWapPayModel 请求 + AlipayTradeWapPayModel model = new AlipayTradeWapPayModel(); + model.setOutTradeNo(reqDTO.getMerchantOrderId()); + model.setSubject(reqDTO.getSubject()); + model.setBody(reqDTO.getBody()); + model.setTotalAmount(calculateAmount(reqDTO.getAmount()).toString()); + model.setProductCode("QUICK_WAP_PAY"); // TODO 芋艿:这里咋整 + //TODO 芋艿:这里咋整 jason @芋艿 可以去掉吧, + // TODO 芋艿 似乎这里不用传sellerId + // https://opendocs.alipay.com/apis/api_1/alipay.trade.wap.pay + //model.setSellerId("2088102147948060"); + model.setTimeExpire(DateUtil.format(reqDTO.getExpireTime(),"yyyy-MM-dd HH:mm:ss")); + // TODO 芋艿:userIp + // 构建 AlipayTradeWapPayRequest + AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); + request.setBizModel(model); + request.setNotifyUrl(reqDTO.getNotifyUrl()); + request.setReturnUrl(reqDTO.getReturnUrl()); + + // 执行请求 + AlipayTradeWapPayResponse response; + try { + response = client.pageExecute(request); + } catch (AlipayApiException e) { + return PayCommonResult.build(e.getErrCode(), e.getErrMsg(), null, codeMapping); + } + + // TODO 芋艿:sub Code + if(response.isSuccess() && Objects.isNull(response.getCode()) && Objects.nonNull(response.getBody())){ + //成功alipay wap 成功 code 为 null , body 为form 表单 + return PayCommonResult.build("-9999", "Success", response, codeMapping); + }else { + return PayCommonResult.build(response.getCode(), response.getMsg(), response, codeMapping); + } + } + + + + + + + + + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXCodeMapping.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXCodeMapping.java new file mode 100644 index 000000000..cacb29ec0 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXCodeMapping.java @@ -0,0 +1,56 @@ +package pay.core.client.impl.wx; + +import cn.hutool.core.util.StrUtil; +import cn.iocoder.yudao.framework.common.exception.ErrorCode; +import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; +import cn.iocoder.yudao.framework.pay.core.client.AbstractPayCodeMapping; + +import java.util.Objects; + +import static cn.iocoder.yudao.framework.pay.core.enums.PayFrameworkErrorCodeConstants.*; + +/** + * 微信支付 PayCodeMapping 实现类 + * + * @author 芋道源码 + */ +public class WXCodeMapping extends AbstractPayCodeMapping { + + /** + * 错误码 - 成功 + * 由于 weixin-java-pay 封装的 Result 未返回 code,所以自己定义下 + */ + public static final String CODE_SUCCESS = "SUCCESS"; + /** + * 错误提示 - 成功 + */ + public static final String MESSAGE_SUCCESS = "成功"; + + @Override + protected ErrorCode apply0(String apiCode, String apiMsg) { + if (Objects.equals(apiCode, CODE_SUCCESS)) { + return GlobalErrorCodeConstants.SUCCESS; + } + if (Objects.equals(apiCode, "FAIL")) { + if (Objects.equals(apiMsg, "AppID不存在,请检查后再试")) { + return PAY_CONFIG_APP_ID_ERROR; + } + if (Objects.equals(apiMsg, "签名错误,请检查后再试") + || Objects.equals(apiMsg, "签名错误")) { + return PAY_CONFIG_SIGN_ERROR; + } + } + if (Objects.equals(apiCode, "PARAM_ERROR")) { + if (Objects.equals(apiMsg, "无效的openid")) { + return PAY_OPENID_ERROR; + } + } + if (Objects.equals(apiCode, "CustomErrorCode")) { + if (StrUtil.contains(apiMsg, "必填字段")) { + return PAY_PARAM_MISSING; + } + } + return null; + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXLitePayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXLitePayClient.java new file mode 100644 index 000000000..72b197214 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXLitePayClient.java @@ -0,0 +1,206 @@ +package pay.core.client.impl.wx; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.StrUtil; +import cn.iocoder.yudao.framework.common.util.io.FileUtils; +import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; +import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; +import cn.iocoder.yudao.framework.pay.core.client.dto.*; +import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; +import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXCodeMapping; +import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; +import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; +import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; +import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result; +import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult; +import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; +import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request; +import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderV3Result; +import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum; +import com.github.binarywang.wxpay.config.WxPayConfig; +import com.github.binarywang.wxpay.constant.WxPayConstants; +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.service.WxPayService; +import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; +import lombok.extern.slf4j.Slf4j; + +import java.util.Objects; + +import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; +import static cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXCodeMapping.CODE_SUCCESS; +import static cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXCodeMapping.MESSAGE_SUCCESS; + + +/** + * 微信小程序下支付 + * + * @author zwy + */ +@Slf4j +public class WXLitePayClient extends AbstractPayClient { + + private WxPayService client; + + public WXLitePayClient(Long channelId, cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig config) { + super(channelId, PayChannelEnum.WX_LITE.getCode(), config, new WXCodeMapping()); + } + + @Override + protected void doInit() { + WxPayConfig payConfig = new WxPayConfig(); + BeanUtil.copyProperties(config, payConfig, "keyContent"); + payConfig.setTradeType(WxPayConstants.TradeType.JSAPI); // 设置使用 JS API 支付方式 +// if (StrUtil.isNotEmpty(config.getKeyContent())) { +// payConfig.setKeyContent(config.getKeyContent().getBytes(StandardCharsets.UTF_8)); +// } + if (StrUtil.isNotEmpty(config.getPrivateKeyContent())) { + // weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决 + payConfig.setPrivateKeyPath(FileUtils.createTempFile(config.getPrivateKeyContent()).getPath()); + } + if (StrUtil.isNotEmpty(config.getPrivateCertContent())) { + // weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决 + payConfig.setPrivateCertPath(FileUtils.createTempFile(config.getPrivateCertContent()).getPath()); + } + // 真实客户端 + this.client = new WxPayServiceImpl(); + client.setConfig(payConfig); + } + + @Override + public PayCommonResult doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) { + WxPayMpOrderResult response; + try { + switch (config.getApiVersion()) { + case cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig.API_VERSION_V2: + response = this.unifiedOrderV2(reqDTO); + break; + case cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig.API_VERSION_V3: + WxPayUnifiedOrderV3Result.JsapiResult responseV3 = this.unifiedOrderV3(reqDTO); + // 将 V3 的结果,统一转换成 V2。返回的字段是一致的 + response = new WxPayMpOrderResult(); + BeanUtil.copyProperties(responseV3, response, true); + break; + default: + throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion())); + } + } catch (WxPayException e) { + log.error("[unifiedOrder][request({}) 发起支付失败,原因({})]", toJsonString(reqDTO), e); + return PayCommonResult.build(ObjectUtils.defaultIfNull(e.getErrCode(), e.getReturnCode(), "CustomErrorCode"), + ObjectUtils.defaultIfNull(e.getErrCodeDes(), e.getCustomErrorMsg()), null, codeMapping); + } + return PayCommonResult.build(CODE_SUCCESS, MESSAGE_SUCCESS, response, codeMapping); + } + + private WxPayMpOrderResult unifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException { + // 构建 WxPayUnifiedOrderRequest 对象 + WxPayUnifiedOrderRequest request = WxPayUnifiedOrderRequest.newBuilder() + .outTradeNo(reqDTO.getMerchantOrderId()) + .body(reqDTO.getBody()) + .totalFee(reqDTO.getAmount().intValue()) // 单位分 + .timeExpire(DateUtil.format(reqDTO.getExpireTime(), "yyyyMMddHHmmss")) // v2的时间格式 + .spbillCreateIp(reqDTO.getUserIp()) + .openid(getOpenid(reqDTO)) + .notifyUrl(reqDTO.getNotifyUrl()) + .build(); + // 执行请求 + return client.createOrder(request); + } + + private WxPayUnifiedOrderV3Result.JsapiResult unifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException { + // 构建 WxPayUnifiedOrderRequest 对象 + WxPayUnifiedOrderV3Request request = new WxPayUnifiedOrderV3Request(); + request.setOutTradeNo(reqDTO.getMerchantOrderId()); + + request.setDescription(reqDTO.getBody()); + request.setAmount(new WxPayUnifiedOrderV3Request + .Amount() + .setTotal(reqDTO + .getAmount() + .intValue())); // 单位分 + request.setTimeExpire(DateUtil.format(reqDTO.getExpireTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")); // v3的时间格式 + request.setPayer(new WxPayUnifiedOrderV3Request.Payer().setOpenid(getOpenid(reqDTO))); + request.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(reqDTO.getUserIp())); + request.setNotifyUrl(reqDTO.getNotifyUrl()); + // 执行请求 + return client.createOrderV3(TradeTypeEnum.JSAPI, request); + } + + private static String getOpenid(PayOrderUnifiedReqDTO reqDTO) { + String openid = MapUtil.getStr(reqDTO.getChannelExtras(), "openid"); + if (StrUtil.isEmpty(openid)) { + throw new IllegalArgumentException("支付请求的 openid 不能为空!"); + } + return openid; + } + + /** + * + * 微信支付回调 分 v2 和v3 的处理方式 + * + * @param data 通知结果 + * @return 支付回调对象 + * @throws WxPayException 微信异常类 + */ + @Override + public PayOrderNotifyRespDTO parseOrderNotify(PayNotifyDataDTO data) throws WxPayException { + log.info("[parseOrderNotify][微信支付回调data数据:{}]", data.getBody()); + // 微信支付 v2 回调结果处理 + switch (config.getApiVersion()) { + case cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig.API_VERSION_V2: + return parseOrderNotifyV2(data); + case WXPayClientConfig.API_VERSION_V3: + return parseOrderNotifyV3(data); + default: + throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion())); + } + } + + private PayOrderNotifyRespDTO parseOrderNotifyV3(PayNotifyDataDTO data) throws WxPayException { + WxPayOrderNotifyV3Result wxPayOrderNotifyV3Result = client.parseOrderNotifyV3Result(data.getBody(), null); + WxPayOrderNotifyV3Result.DecryptNotifyResult result = wxPayOrderNotifyV3Result.getResult(); + // 转换结果 + Assert.isTrue(Objects.equals(wxPayOrderNotifyV3Result.getResult().getTradeState(), "SUCCESS"), + "支付结果非 SUCCESS"); + + return PayOrderNotifyRespDTO + .builder() + .orderExtensionNo(result.getOutTradeNo()) + .channelOrderNo(result.getTradeState()) + .successTime(LocalDateTimeUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) + .data(data.getBody()) + .build(); + } + + private PayOrderNotifyRespDTO parseOrderNotifyV2(PayNotifyDataDTO data) throws WxPayException { + WxPayOrderNotifyResult notifyResult = client.parseOrderNotifyResult(data.getBody()); + Assert.isTrue(Objects.equals(notifyResult.getResultCode(), "SUCCESS"), "支付结果非 SUCCESS"); + // 转换结果 + return PayOrderNotifyRespDTO + .builder() + .orderExtensionNo(notifyResult.getOutTradeNo()) + .channelOrderNo(notifyResult.getTransactionId()) + .channelUserId(notifyResult.getOpenid()) + .successTime(LocalDateTimeUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss")) + .data(data.getBody()) + .build(); + + } + + @Override + public PayRefundNotifyDTO parseRefundNotify(PayNotifyDataDTO notifyData) { + //TODO 需要实现 + throw new UnsupportedOperationException("需要实现"); + } + + + @Override + protected PayCommonResult doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) throws Throwable { + //TODO 需要实现 + throw new UnsupportedOperationException(); + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXNativePayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXNativePayClient.java new file mode 100644 index 000000000..d7a2ce2c8 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXNativePayClient.java @@ -0,0 +1,189 @@ +package pay.core.client.impl.wx; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.util.StrUtil; +import cn.iocoder.yudao.framework.common.util.io.FileUtils; +import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; +import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; +import cn.iocoder.yudao.framework.pay.core.client.dto.*; +import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; +import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXCodeMapping; +import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; +import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; +import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; +import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result; +import com.github.binarywang.wxpay.bean.order.WxPayNativeOrderResult; +import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; +import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request; +import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum; +import com.github.binarywang.wxpay.config.WxPayConfig; +import com.github.binarywang.wxpay.constant.WxPayConstants; +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.service.WxPayService; +import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; +import lombok.extern.slf4j.Slf4j; + +import java.util.Objects; + +import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; +import static cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXCodeMapping.CODE_SUCCESS; +import static cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXCodeMapping.MESSAGE_SUCCESS; + +/** + * 微信 App 支付 + * + * @author zwy + */ +@Slf4j +public class WXNativePayClient extends AbstractPayClient { + + private WxPayService client; + + public WXNativePayClient(Long channelId, cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig config) { + super(channelId, PayChannelEnum.WX_NATIVE.getCode(), config, new WXCodeMapping()); + } + + @Override + protected void doInit() { + WxPayConfig payConfig = new WxPayConfig(); + BeanUtil.copyProperties(config, payConfig, "keyContent"); + payConfig.setTradeType(WxPayConstants.TradeType.NATIVE); // 设置使用 native 支付方式 +// if (StrUtil.isNotEmpty(config.getKeyContent())) { +// payConfig.setKeyContent(config.getKeyContent().getBytes(StandardCharsets.UTF_8)); +// } + if (StrUtil.isNotEmpty(config.getPrivateKeyContent())) { + // weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决 + payConfig.setPrivateKeyPath(FileUtils.createTempFile(config.getPrivateKeyContent()).getPath()); + } + if (StrUtil.isNotEmpty(config.getPrivateCertContent())) { + // weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决 + payConfig.setPrivateCertPath(FileUtils.createTempFile(config.getPrivateCertContent()).getPath()); + } + // 真实客户端 + this.client = new WxPayServiceImpl(); + client.setConfig(payConfig); + } + + @Override + public PayCommonResult doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) { + // 这里原生的返回的是支付的 url 所以直接使用string接收 + // "invokeResponse": "weixin://wxpay/bizpayurl?pr=EGYAem7zz" + String responseV3; + try { + switch (config.getApiVersion()) { + case cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig.API_VERSION_V2: + responseV3 = unifiedOrderV2(reqDTO).getCodeUrl(); + break; + case cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig.API_VERSION_V3: + responseV3 = this.unifiedOrderV3(reqDTO); + break; + default: + throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion())); + } + } catch (WxPayException e) { + log.error("[unifiedOrder][request({}) 发起支付失败,原因({})]", toJsonString(reqDTO), e); + return PayCommonResult.build(ObjectUtils.defaultIfNull(e.getErrCode(), e.getReturnCode(), "CustomErrorCode"), + ObjectUtils.defaultIfNull(e.getErrCodeDes(), e.getCustomErrorMsg()), null, codeMapping); + } + return PayCommonResult.build(CODE_SUCCESS, MESSAGE_SUCCESS, responseV3, codeMapping); + } + + private WxPayNativeOrderResult unifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException { + //前端 + String tradeType = reqDTO.getChannelExtras().get("trade_type"); + // 构建 WxPayUnifiedOrderRequest 对象 + WxPayUnifiedOrderRequest request = WxPayUnifiedOrderRequest + .newBuilder() + .outTradeNo(reqDTO.getMerchantOrderId()) + .body(reqDTO.getBody()) + .totalFee(reqDTO.getAmount().intValue()) // 单位分 + .timeExpire(DateUtil.format(reqDTO.getExpireTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) + .spbillCreateIp(reqDTO.getUserIp()) + .notifyUrl(reqDTO.getNotifyUrl()) + .productId(tradeType) + .build(); + // 执行请求 + return client.createOrder(request); + } + + private String unifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException { + // 构建 WxPayUnifiedOrderRequest 对象 + WxPayUnifiedOrderV3Request request = new WxPayUnifiedOrderV3Request(); + request.setOutTradeNo(reqDTO.getMerchantOrderId()); + request.setDescription(reqDTO.getBody()); + request.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(reqDTO.getAmount().intValue())); // 单位分 + request.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(reqDTO.getUserIp())); + request.setNotifyUrl(reqDTO.getNotifyUrl()); + // 执行请求 + return client.createOrderV3(TradeTypeEnum.NATIVE, request); + } + + /** + * + * 微信支付回调 分v2 和v3 的处理方式 + * + * @param data 通知结果 + * @return 支付回调对象 + * @throws WxPayException 微信异常类 + */ + @Override + public PayOrderNotifyRespDTO parseOrderNotify(PayNotifyDataDTO data) throws WxPayException { + log.info("微信支付回调data数据:{}", data.getBody()); + // 微信支付 v2 回调结果处理 + switch (config.getApiVersion()) { + case cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig.API_VERSION_V2: + return parseOrderNotifyV2(data); + case WXPayClientConfig.API_VERSION_V3: + return parseOrderNotifyV3(data); + default: + throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion())); + } + } + + private PayOrderNotifyRespDTO parseOrderNotifyV3(PayNotifyDataDTO data) throws WxPayException { + WxPayOrderNotifyV3Result wxPayOrderNotifyV3Result = client.parseOrderNotifyV3Result(data.getBody(), null); + WxPayOrderNotifyV3Result.DecryptNotifyResult result = wxPayOrderNotifyV3Result.getResult(); + // 转换结果 + Assert.isTrue(Objects.equals(wxPayOrderNotifyV3Result.getResult().getTradeState(), "SUCCESS"), + "支付结果非 SUCCESS"); + return PayOrderNotifyRespDTO + .builder() + .orderExtensionNo(result.getOutTradeNo()) + .channelOrderNo(result.getTradeState()) + .successTime(LocalDateTimeUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) + .data(data.getBody()) + .build(); + } + + private PayOrderNotifyRespDTO parseOrderNotifyV2(PayNotifyDataDTO data) throws WxPayException { + WxPayOrderNotifyResult notifyResult = client.parseOrderNotifyResult(data.getBody()); + Assert.isTrue(Objects.equals(notifyResult.getResultCode(), "SUCCESS"), "支付结果非 SUCCESS"); + // 转换结果 + return PayOrderNotifyRespDTO + .builder() + .orderExtensionNo(notifyResult.getOutTradeNo()) + .channelOrderNo(notifyResult.getTransactionId()) + .channelUserId(notifyResult.getOpenid()) + .successTime(LocalDateTimeUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss")) + .data(data.getBody()) + .build(); + + } + + @Override + public PayRefundNotifyDTO parseRefundNotify(PayNotifyDataDTO notifyData) { + // TODO 需要实现 + throw new UnsupportedOperationException("需要实现"); + } + + + @Override + protected PayCommonResult doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) throws Throwable { + // TODO 需要实现 + throw new UnsupportedOperationException(); + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXPayClientConfig.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXPayClientConfig.java new file mode 100644 index 000000000..4004f0d9e --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXPayClientConfig.java @@ -0,0 +1,111 @@ +package pay.core.client.impl.wx; + +import cn.hutool.core.io.IoUtil; +import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; +import lombok.Data; + +import javax.validation.ConstraintViolation; +import javax.validation.Validator; +import javax.validation.constraints.NotBlank; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.util.Set; + +/** + * 微信支付的 PayClientConfig 实现类 + * 属性主要来自 {@link com.github.binarywang.wxpay.config.WxPayConfig} 的必要属性 + * + * @author 芋道源码 + */ +@Data +public class WXPayClientConfig implements PayClientConfig { + + /** + * API 版本 - V2 + * https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_1 + */ + public static final String API_VERSION_V2 = "v2"; + /** + * API 版本 - V3 + * https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay-1.shtml + */ + public static final String API_VERSION_V3 = "v3"; + + /** + * 公众号或者小程序的 appid + */ + @NotBlank(message = "APPID 不能为空", groups = {V2.class, V3.class}) + private String appId; + /** + * 商户号 + */ + @NotBlank(message = "商户号 不能为空", groups = {V2.class, V3.class}) + private String mchId; + /** + * API 版本 + */ + @NotBlank(message = "API 版本 不能为空", groups = {V2.class, V3.class}) + private String apiVersion; + + // ========== V2 版本的参数 ========== + + /** + * 商户密钥 + */ + @NotBlank(message = "商户密钥 不能为空", groups = V2.class) + private String mchKey; + /** + * apiclient_cert.p12 证书文件的绝对路径或者以 classpath: 开头的类路径. + * 对应的字符串 + * + * 注意,可通过 {@link #main(String[])} 读取 + */ + /// private String keyContent; + + // ========== V3 版本的参数 ========== + /** + * apiclient_key.pem 证书文件的绝对路径或者以 classpath: 开头的类路径. + * 对应的字符串 + * 注意,可通过 {@link #main(String[])} 读取 + */ + @NotBlank(message = "apiclient_key 不能为空", groups = V3.class) + private String privateKeyContent; + /** + * apiclient_cert.pem 证书文件的绝对路径或者以 classpath: 开头的类路径. + * 对应的字符串 + *

+ * 注意,可通过 {@link #main(String[])} 读取 + */ + @NotBlank(message = "apiclient_cert 不能为空", groups = V3.class) + private String privateCertContent; + /** + * apiV3 密钥值 + */ + @NotBlank(message = "apiV3 密钥值 不能为空", groups = V3.class) + private String apiV3Key; + + /** + * 分组校验 v2版本 + */ + public interface V2 { + } + + /** + * 分组校验 v3版本 + */ + public interface V3 { + } + + @Override + public Set> verifyParam(Validator validator) { + return validator.validate(this, this.getApiVersion().equals(API_VERSION_V2) ? V2.class : V3.class); + } + + public static void main(String[] args) throws FileNotFoundException { + String path = "/Users/yunai/Downloads/wx_pay/apiclient_cert.p12"; + /// String path = "/Users/yunai/Downloads/wx_pay/apiclient_key.pem"; + /// String path = "/Users/yunai/Downloads/wx_pay/apiclient_cert.pem"; + System.out.println(IoUtil.readUtf8(new FileInputStream(path))); + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXPubPayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXPubPayClient.java new file mode 100644 index 000000000..0c070933e --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/client/impl/wx/WXPubPayClient.java @@ -0,0 +1,199 @@ +package pay.core.client.impl.wx; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.lang.Assert; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.StrUtil; +import cn.iocoder.yudao.framework.common.util.io.FileUtils; +import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; +import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; +import cn.iocoder.yudao.framework.pay.core.client.dto.*; +import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; +import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXCodeMapping; +import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; +import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; +import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; +import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result; +import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult; +import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; +import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request; +import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderV3Result; +import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum; +import com.github.binarywang.wxpay.config.WxPayConfig; +import com.github.binarywang.wxpay.constant.WxPayConstants; +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.service.WxPayService; +import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; +import lombok.extern.slf4j.Slf4j; + +import java.util.Objects; + +import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; +import static cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXCodeMapping.CODE_SUCCESS; +import static cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXCodeMapping.MESSAGE_SUCCESS; + +/** + * 微信支付(公众号)的 PayClient 实现类 + * + * @author 芋道源码 + */ +@Slf4j +public class WXPubPayClient extends AbstractPayClient { + + private WxPayService client; + + public WXPubPayClient(Long channelId, cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig config) { + super(channelId, PayChannelEnum.WX_PUB.getCode(), config, new WXCodeMapping()); + } + + @Override + protected void doInit() { + WxPayConfig payConfig = new WxPayConfig(); + BeanUtil.copyProperties(config, payConfig, "keyContent"); + payConfig.setTradeType(WxPayConstants.TradeType.JSAPI); // 设置使用 JS API 支付方式 +// if (StrUtil.isNotEmpty(config.getKeyContent())) { +// payConfig.setKeyContent(config.getKeyContent().getBytes(StandardCharsets.UTF_8)); +// } + if (StrUtil.isNotEmpty(config.getPrivateKeyContent())) { + // weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决 + payConfig.setPrivateKeyPath(FileUtils.createTempFile(config.getPrivateKeyContent()).getPath()); + } + if (StrUtil.isNotEmpty(config.getPrivateCertContent())) { + // weixin-pay-java 存在 BUG,无法直接设置内容,所以创建临时文件来解决 + payConfig.setPrivateCertPath(FileUtils.createTempFile(config.getPrivateCertContent()).getPath()); + } + // 真实客户端 + this.client = new WxPayServiceImpl(); + client.setConfig(payConfig); + } + + @Override + public PayCommonResult doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) { + WxPayMpOrderResult response; + try { + switch (config.getApiVersion()) { + case cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig.API_VERSION_V2: + response = this.unifiedOrderV2(reqDTO); + break; + case cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig.API_VERSION_V3: + WxPayUnifiedOrderV3Result.JsapiResult responseV3 = this.unifiedOrderV3(reqDTO); + // 将 V3 的结果,统一转换成 V2。返回的字段是一致的 + response = new WxPayMpOrderResult(); + BeanUtil.copyProperties(responseV3, response, true); + break; + default: + throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion())); + } + } catch (WxPayException e) { + log.error("[unifiedOrder][request({}) 发起支付失败,原因({})]", toJsonString(reqDTO), e); + return PayCommonResult.build(ObjectUtils.defaultIfNull(e.getErrCode(), e.getReturnCode(), "CustomErrorCode"), + ObjectUtils.defaultIfNull(e.getErrCodeDes(), e.getCustomErrorMsg()),null, codeMapping); + } + return PayCommonResult.build(CODE_SUCCESS, MESSAGE_SUCCESS, response, codeMapping); + } + + + private WxPayMpOrderResult unifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException { + // 构建 WxPayUnifiedOrderRequest 对象 + WxPayUnifiedOrderRequest request = WxPayUnifiedOrderRequest.newBuilder() + .outTradeNo(reqDTO.getMerchantOrderId()) + .body(reqDTO.getBody()) + .totalFee(reqDTO.getAmount().intValue()) // 单位分 + .timeExpire(DateUtil.format(reqDTO.getExpireTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) + .spbillCreateIp(reqDTO.getUserIp()) + .openid(getOpenid(reqDTO)) + .notifyUrl(reqDTO.getNotifyUrl()) + .build(); + // 执行请求 + return client.createOrder(request); + } + + private WxPayUnifiedOrderV3Result.JsapiResult unifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException { + // 构建 WxPayUnifiedOrderRequest 对象 + WxPayUnifiedOrderV3Request request = new WxPayUnifiedOrderV3Request(); + request.setOutTradeNo(reqDTO.getMerchantOrderId()); + request.setDescription(reqDTO.getBody()); + request.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(reqDTO.getAmount().intValue())); // 单位分 + request.setTimeExpire(DateUtil.format(reqDTO.getExpireTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")); + request.setPayer(new WxPayUnifiedOrderV3Request.Payer().setOpenid(getOpenid(reqDTO))); + request.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(reqDTO.getUserIp())); + request.setNotifyUrl(reqDTO.getNotifyUrl()); + // 执行请求 + return client.createOrderV3(TradeTypeEnum.JSAPI, request); + } + + private static String getOpenid(PayOrderUnifiedReqDTO reqDTO) { + String openid = MapUtil.getStr(reqDTO.getChannelExtras(), "openid"); + if (StrUtil.isEmpty(openid)) { + throw new IllegalArgumentException("支付请求的 openid 不能为空!"); + } + return openid; + } + + /** + * + * 微信支付回调 分v2 和v3 的处理方式 + * + * @param data 通知结果 + * @return 支付回调对象 + * @throws WxPayException 微信异常类 + */ + @Override + public PayOrderNotifyRespDTO parseOrderNotify(PayNotifyDataDTO data) throws WxPayException { + log.info("[parseOrderNotify][微信支付回调data数据: {}]", data.getBody()); + // 微信支付 v2 回调结果处理 + switch (config.getApiVersion()) { + case cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig.API_VERSION_V2: + return parseOrderNotifyV2(data); + case WXPayClientConfig.API_VERSION_V3: + return parseOrderNotifyV3(data); + default: + throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion())); + } + } + + private PayOrderNotifyRespDTO parseOrderNotifyV3(PayNotifyDataDTO data) throws WxPayException { + WxPayOrderNotifyV3Result wxPayOrderNotifyV3Result = client.parseOrderNotifyV3Result(data.getBody(), null); + WxPayOrderNotifyV3Result.DecryptNotifyResult result = wxPayOrderNotifyV3Result.getResult(); + // 转换结果 + Assert.isTrue(Objects.equals(wxPayOrderNotifyV3Result.getResult().getTradeState(), "SUCCESS"), + "支付结果非 SUCCESS"); + return PayOrderNotifyRespDTO + .builder() + .orderExtensionNo(result.getOutTradeNo()) + .channelOrderNo(result.getTradeState()) + .successTime(LocalDateTimeUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) + .data(data.getBody()) + .build(); + } + + private PayOrderNotifyRespDTO parseOrderNotifyV2(PayNotifyDataDTO data) throws WxPayException { + WxPayOrderNotifyResult notifyResult = client.parseOrderNotifyResult(data.getBody()); + Assert.isTrue(Objects.equals(notifyResult.getResultCode(), "SUCCESS"), "支付结果非 SUCCESS"); + // 转换结果 + return PayOrderNotifyRespDTO + .builder() + .orderExtensionNo(notifyResult.getOutTradeNo()) + .channelOrderNo(notifyResult.getTransactionId()) + .channelUserId(notifyResult.getOpenid()) + .successTime(LocalDateTimeUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss")) + .data(data.getBody()) + .build(); + + } + + @Override + public PayRefundNotifyDTO parseRefundNotify(PayNotifyDataDTO notifyData) { + // TODO 需要实现 + throw new UnsupportedOperationException("需要实现"); + } + + @Override + protected PayCommonResult doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) throws Throwable { + // TODO 需要实现 + throw new UnsupportedOperationException(); + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/enums/PayChannelEnum.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/enums/PayChannelEnum.java new file mode 100644 index 000000000..7f9681d17 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/enums/PayChannelEnum.java @@ -0,0 +1,60 @@ +package pay.core.enums; + +import cn.hutool.core.util.ArrayUtil; +import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; +import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; +import cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXPayClientConfig; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 支付渠道的编码的枚举 + * 枚举值 + * + * @author 芋道源码 + */ +@Getter +@AllArgsConstructor +public enum PayChannelEnum { + + WX_PUB("wx_pub", "微信 JSAPI 支付", WXPayClientConfig.class), // 公众号网页 + WX_LITE("wx_lite", "微信小程序支付", WXPayClientConfig.class), + WX_APP("wx_app", "微信 App 支付", WXPayClientConfig.class), + WX_NATIVE("wx_native", "微信 native 支付", WXPayClientConfig.class), + + ALIPAY_PC("alipay_pc", "支付宝 PC 网站支付", AlipayPayClientConfig.class), + ALIPAY_WAP("alipay_wap", "支付宝 Wap 网站支付", AlipayPayClientConfig.class), + ALIPAY_APP("alipay_app", "支付宝App 支付", AlipayPayClientConfig.class), + ALIPAY_QR("alipay_qr", "支付宝扫码支付", AlipayPayClientConfig.class); + + /** + * 编码 + *

+ * 参考 https://www.pingxx.com/api/支付渠道属性值.html + */ + private final String code; + /** + * 名字 + */ + private final String name; + + /** + * 配置类 + */ + private final Class configClass; + + /** + * 微信支付 + */ + public static final String WECHAT = "WECHAT"; + + /** + * 支付宝支付 + */ + public static final String ALIPAY = "ALIPAY"; + + public static PayChannelEnum getByCode(String code) { + return ArrayUtil.firstMatch(o -> o.getCode().equals(code), values()); + } + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/enums/PayChannelRefundRespEnum.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/enums/PayChannelRefundRespEnum.java new file mode 100644 index 000000000..d1a70445e --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/enums/PayChannelRefundRespEnum.java @@ -0,0 +1,23 @@ +package pay.core.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 渠道统一的退款返回结果 + * + * @author jason + */ +@Getter +@AllArgsConstructor +public enum PayChannelRefundRespEnum { + + SUCCESS(1, "退款成功"), + FAILURE(2, "退款失败"), + PROCESSING(3,"退款处理中"), + CLOSED(4, "退款关闭"); + + private final Integer status; + private final String name; + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/enums/PayFrameworkErrorCodeConstants.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/enums/PayFrameworkErrorCodeConstants.java new file mode 100644 index 000000000..f1401aac5 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/enums/PayFrameworkErrorCodeConstants.java @@ -0,0 +1,27 @@ +package pay.core.enums; + +import cn.iocoder.yudao.framework.common.exception.ErrorCode; + +/** + * 支付框架的错误码枚举 + * + * 短信框架,使用 2-002-000-000 段 + * + * @author 芋道源码 + */ +public interface PayFrameworkErrorCodeConstants { + + ErrorCode PAY_UNKNOWN = new ErrorCode(2002000000, "未知错误,需要解析"); + + // ========== 配置相关相关 2002000100 ========== + ErrorCode PAY_CONFIG_APP_ID_ERROR = new ErrorCode(2002000100, "支付渠道 AppId 不正确"); + ErrorCode PAY_CONFIG_SIGN_ERROR = new ErrorCode(2002000100, "签名错误"); // 例如说,微信支付,配置错了 mchId 或者 mchKey + + + // ========== 其它相关 2002000900 开头 ========== + ErrorCode PAY_OPENID_ERROR = new ErrorCode(2002000900, "无效的 openid"); // 例如说,微信 openid 未授权过 + ErrorCode PAY_PARAM_MISSING = new ErrorCode(2002000901, "请求参数缺失"); // 例如说,支付少传了金额 + + ErrorCode EXCEPTION = new ErrorCode(2002000999, "调用异常"); + +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/enums/PayNotifyRefundStatusEnum.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/enums/PayNotifyRefundStatusEnum.java new file mode 100644 index 000000000..bd6f4b0e0 --- /dev/null +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/pay/core/enums/PayNotifyRefundStatusEnum.java @@ -0,0 +1,20 @@ +package pay.core.enums; + +/** + * 退款通知, 统一的渠道退款状态 + * + * @author jason + */ +public enum PayNotifyRefundStatusEnum { + /** + * 支付宝 中 全额退款 trade_status=TRADE_CLOSED, 部分退款 trade_status=TRADE_SUCCESS + * 退款成功 + */ + SUCCESS, + + /** + * 支付宝退款通知没有这个状态 + * 退款异常 + */ + ABNORMAL; +} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/dto/SmsReceiveRespDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/dto/SmsReceiveRespDTO.java index 8c841ebea..4def4a25c 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/dto/SmsReceiveRespDTO.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/dto/SmsReceiveRespDTO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.framework.sms.core.client.dto; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; /** * 消息接收 Response DTO @@ -32,7 +32,7 @@ public class SmsReceiveRespDTO { /** * 用户接收时间 */ - private Date receiveTime; + private LocalDateTime receiveTime; /** * 短信 API 发送返回的序号 diff --git a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/aliyun/AliyunSmsClient.java b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/aliyun/AliyunSmsClient.java index ae93a88b6..59723c4c9 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/aliyun/AliyunSmsClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/aliyun/AliyunSmsClient.java @@ -4,6 +4,8 @@ import cn.hutool.core.lang.Assert; import cn.hutool.core.util.ReflectUtil; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.core.KeyValue; +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; +import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.framework.sms.core.client.SmsCommonResult; import cn.iocoder.yudao.framework.sms.core.client.dto.SmsReceiveRespDTO; import cn.iocoder.yudao.framework.sms.core.client.dto.SmsSendRespDTO; @@ -11,8 +13,6 @@ import cn.iocoder.yudao.framework.sms.core.client.dto.SmsTemplateRespDTO; import cn.iocoder.yudao.framework.sms.core.client.impl.AbstractSmsClient; import cn.iocoder.yudao.framework.sms.core.enums.SmsTemplateAuditStatusEnum; import cn.iocoder.yudao.framework.sms.core.property.SmsChannelProperties; -import cn.iocoder.yudao.framework.common.util.collection.MapUtils; -import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import com.aliyuncs.AcsRequest; import com.aliyuncs.AcsResponse; import com.aliyuncs.DefaultAcsClient; @@ -28,7 +28,7 @@ import com.google.common.annotations.VisibleForTesting; import lombok.Data; import lombok.extern.slf4j.Slf4j; -import java.util.Date; +import java.time.LocalDateTime; import java.util.List; import java.util.Objects; import java.util.function.Function; @@ -166,13 +166,13 @@ public class AliyunSmsClient extends AbstractSmsClient { */ @JsonProperty("send_time") @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) - private Date sendTime; + private LocalDateTime sendTime; /** * 状态报告时间 */ @JsonProperty("report_time") @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) - private Date reportTime; + private LocalDateTime reportTime; /** * 是否接收成功 */ diff --git a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/tencent/TencentSmsClient.java b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/tencent/TencentSmsClient.java index 23bb01a02..743c1aed8 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/tencent/TencentSmsClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/tencent/TencentSmsClient.java @@ -22,7 +22,7 @@ import com.tencentcloudapi.sms.v20210111.SmsClient; import com.tencentcloudapi.sms.v20210111.models.*; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; import java.util.List; import java.util.function.Function; import java.util.function.Supplier; @@ -240,7 +240,7 @@ public class TencentSmsClient extends AbstractSmsClient { */ @JsonProperty("user_receive_time") @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) - private Date receiveTime; + private LocalDateTime receiveTime; /** * 国家(或地区)码 diff --git a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClient.java b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClient.java index 12cb6635c..c5d1f88d0 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClient.java @@ -5,6 +5,7 @@ import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.URLUtil; import cn.iocoder.yudao.framework.common.core.KeyValue; +import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.framework.sms.core.client.SmsCommonResult; import cn.iocoder.yudao.framework.sms.core.client.dto.SmsReceiveRespDTO; import cn.iocoder.yudao.framework.sms.core.client.dto.SmsSendRespDTO; @@ -12,7 +13,6 @@ import cn.iocoder.yudao.framework.sms.core.client.dto.SmsTemplateRespDTO; import cn.iocoder.yudao.framework.sms.core.client.impl.AbstractSmsClient; import cn.iocoder.yudao.framework.sms.core.enums.SmsTemplateAuditStatusEnum; import cn.iocoder.yudao.framework.sms.core.property.SmsChannelProperties; -import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.annotations.VisibleForTesting; @@ -23,6 +23,7 @@ import com.yunpian.sdk.model.Template; import lombok.Data; import lombok.extern.slf4j.Slf4j; +import java.time.LocalDateTime; import java.util.*; import java.util.function.Function; import java.util.function.Supplier; @@ -198,7 +199,7 @@ public class YunpianSmsClient extends AbstractSmsClient { */ @JsonProperty("user_receive_time") @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) - private Date userReceiveTime; + private LocalDateTime userReceiveTime; } diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java index 7bb555450..19abaa6fe 100644 --- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java +++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java @@ -7,7 +7,7 @@ import lombok.Data; import org.apache.ibatis.type.JdbcType; import java.io.Serializable; -import java.util.Date; +import java.time.LocalDateTime; /** * 基础实体对象 @@ -21,12 +21,12 @@ public abstract class BaseDO implements Serializable { * 创建时间 */ @TableField(fill = FieldFill.INSERT) - private Date createTime; + private LocalDateTime createTime; /** * 最后更新时间 */ @TableField(fill = FieldFill.INSERT_UPDATE) - private Date updateTime; + private LocalDateTime updateTime; /** * 创建者,目前使用 SysUser 的 id 编号 * diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/handler/DefaultDBFieldHandler.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/handler/DefaultDBFieldHandler.java index 65910b16e..94dada129 100644 --- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/handler/DefaultDBFieldHandler.java +++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/handler/DefaultDBFieldHandler.java @@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; import org.apache.ibatis.reflection.MetaObject; -import java.util.Date; +import java.time.LocalDateTime; import java.util.Objects; /** @@ -22,7 +22,7 @@ public class DefaultDBFieldHandler implements MetaObjectHandler { if (Objects.nonNull(metaObject) && metaObject.getOriginalObject() instanceof BaseDO) { BaseDO baseDO = (BaseDO) metaObject.getOriginalObject(); - Date current = new Date(); + LocalDateTime current = LocalDateTime.now(); // 创建时间为空,则以当前时间为插入时间 if (Objects.isNull(baseDO.getCreateTime())) { baseDO.setCreateTime(current); @@ -49,7 +49,7 @@ public class DefaultDBFieldHandler implements MetaObjectHandler { // 更新时间为空,则以当前时间为更新时间 Object modifyTime = getFieldValByName("updateTime", metaObject); if (Objects.isNull(modifyTime)) { - setFieldValByName("updateTime", new Date(), metaObject); + setFieldValByName("updateTime", LocalDateTime.now(), metaObject); } // 当前登录用户不为空,更新人为空,则当前登录用户为更新人 diff --git a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/RandomUtils.java b/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/RandomUtils.java index d41c3951e..8664dae42 100644 --- a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/RandomUtils.java +++ b/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/RandomUtils.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.framework.test.core.util; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.StrUtil; @@ -8,6 +9,7 @@ import uk.co.jemos.podam.api.PodamFactory; import uk.co.jemos.podam.api.PodamFactoryImpl; import java.lang.reflect.Type; +import java.time.LocalDateTime; import java.util.Arrays; import java.util.Date; import java.util.List; @@ -76,6 +78,10 @@ public class RandomUtils { return RandomUtil.randomDay(0, RANDOM_DATE_MAX); } + public static LocalDateTime randomLocalDateTime() { + return LocalDateTimeUtil.of(randomDate()); + } + public static Short randomShort() { return (short) RandomUtil.randomInt(0, Short.MAX_VALUE); } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java index 6417189b0..3a2ab6bd4 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.framework.apilog.core.filter; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.exceptions.ExceptionUtil; import cn.hutool.core.map.MapUtil; import cn.hutool.extra.servlet.ServletUtil; @@ -7,7 +8,6 @@ import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLog; import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLogFrameworkService; import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; import cn.iocoder.yudao.framework.web.config.WebProperties; @@ -20,7 +20,8 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.util.Date; +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; import java.util.Map; import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; @@ -47,7 +48,7 @@ public class ApiAccessLogFilter extends ApiRequestFilter { protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { // 获得开始时间 - Date beginTim = new Date(); + LocalDateTime beginTime = LocalDateTime.now(); // 提前获得参数,避免 XssFilter 过滤处理 Map queryString = ServletUtil.getParamMap(request); String requestBody = ServletUtils.isJsonRequest(request) ? ServletUtil.getBody(request) : null; @@ -56,15 +57,15 @@ public class ApiAccessLogFilter extends ApiRequestFilter { // 继续过滤器 filterChain.doFilter(request, response); // 正常执行,记录日志 - createApiAccessLog(request, beginTim, queryString, requestBody, null); + createApiAccessLog(request, beginTime, queryString, requestBody, null); } catch (Exception ex) { // 异常执行,记录日志 - createApiAccessLog(request, beginTim, queryString, requestBody, ex); + createApiAccessLog(request, beginTime, queryString, requestBody, ex); throw ex; } } - private void createApiAccessLog(HttpServletRequest request, Date beginTime, + private void createApiAccessLog(HttpServletRequest request, LocalDateTime beginTime, Map queryString, String requestBody, Exception ex) { ApiAccessLog accessLog = new ApiAccessLog(); try { @@ -75,7 +76,7 @@ public class ApiAccessLogFilter extends ApiRequestFilter { } } - private void buildApiAccessLogDTO(ApiAccessLog accessLog, HttpServletRequest request, Date beginTime, + private void buildApiAccessLogDTO(ApiAccessLog accessLog, HttpServletRequest request, LocalDateTime beginTime, Map queryString, String requestBody, Exception ex) { // 处理用户信息 accessLog.setUserId(WebFrameworkUtils.getLoginUserId(request)); @@ -103,8 +104,8 @@ public class ApiAccessLogFilter extends ApiRequestFilter { accessLog.setUserIp(ServletUtil.getClientIP(request)); // 持续时间 accessLog.setBeginTime(beginTime); - accessLog.setEndTime(new Date()); - accessLog.setDuration((int) DateUtils.diff(accessLog.getEndTime(), accessLog.getBeginTime())); + accessLog.setEndTime(LocalDateTime.now()); + accessLog.setDuration((int) LocalDateTimeUtil.between(accessLog.getBeginTime(), accessLog.getEndTime(), ChronoUnit.SECONDS)); } } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLog.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLog.java index a92b06c26..7799c42f6 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLog.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLog.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.framework.apilog.core.service; import lombok.Data; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; /** * API 访问日志 @@ -61,12 +61,12 @@ public class ApiAccessLog { * 开始请求时间 */ @NotNull(message = "开始请求时间不能为空") - private Date beginTime; + private LocalDateTime beginTime; /** * 结束请求时间 */ @NotNull(message = "结束请求时间不能为空") - private Date endTime; + private LocalDateTime endTime; /** * 执行时长,单位:毫秒 */ diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLog.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLog.java index 3f5d539cb..087dd5d08 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLog.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLog.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.framework.apilog.core.service; import lombok.Data; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; /** * API 错误日志 @@ -61,7 +61,7 @@ public class ApiErrorLog { * 异常时间 */ @NotNull(message = "异常时间不能为空") - private Date exceptionTime; + private LocalDateTime exceptionTime; /** * 异常名 */ diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java index fdf77de96..a9e231285 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java @@ -30,7 +30,8 @@ import javax.servlet.http.HttpServletRequest; import javax.validation.ConstraintViolation; import javax.validation.ConstraintViolationException; import javax.validation.ValidationException; -import java.util.Date; +import java.time.LocalDateTime; +import java.time.LocalDateTime; import java.util.Map; import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.*; @@ -267,7 +268,7 @@ public class GlobalExceptionHandler { errorLog.setRequestMethod(request.getMethod()); errorLog.setUserAgent(ServletUtils.getUserAgent(request)); errorLog.setUserIp(ServletUtil.getClientIP(request)); - errorLog.setExceptionTime(new Date()); + errorLog.setExceptionTime(LocalDateTime.now()); } } diff --git a/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/logging/AccessLog.java b/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/logging/AccessLog.java index dd2bc24b0..52b46fc23 100644 --- a/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/logging/AccessLog.java +++ b/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/logging/AccessLog.java @@ -5,8 +5,7 @@ import org.springframework.cloud.gateway.route.Route; import org.springframework.http.HttpStatus; import org.springframework.util.MultiValueMap; -import java.util.Date; -import java.util.Map; +import java.time.LocalDateTime; /** * 网关的访问日志 @@ -80,11 +79,11 @@ public class AccessLog { /** * 开始请求时间 */ - private Date startTime; + private LocalDateTime startTime; /** * 结束请求时间 */ - private Date endTime; + private LocalDateTime endTime; /** * 执行时长,单位:毫秒 */ diff --git a/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/logging/AccessLogFilter.java b/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/logging/AccessLogFilter.java index f753ef5f1..4f9c34c53 100644 --- a/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/logging/AccessLogFilter.java +++ b/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/logging/AccessLogFilter.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.gateway.filter.logging; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.json.JSONUtil; import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; @@ -38,12 +39,13 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.nio.charset.StandardCharsets; -import java.util.Date; +import java.time.LocalDateTime; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import static cn.hutool.core.date.DatePattern.NORM_DATETIME_MS_FORMAT; +import static cn.hutool.core.date.DatePattern.NORM_DATETIME_MS_FORMATTER; /** * 网关的访问日志过滤器 @@ -89,8 +91,8 @@ public class AccessLogFilter implements GlobalFilter, Ordered { values.put("responseHeaders", gatewayLog.getResponseHeaders() != null ? JsonUtils.toJsonString(gatewayLog.getResponseHeaders().toSingleValueMap()) : null); values.put("httpStatus", gatewayLog.getHttpStatus()); - values.put("startTime", DateUtil.format(gatewayLog.getStartTime(), NORM_DATETIME_MS_FORMAT)); - values.put("endTime", DateUtil.format(gatewayLog.getEndTime(), NORM_DATETIME_MS_FORMAT)); + values.put("startTime", LocalDateTimeUtil.format(gatewayLog.getStartTime(), NORM_DATETIME_MS_FORMATTER)); + values.put("endTime", LocalDateTimeUtil.format(gatewayLog.getEndTime(), NORM_DATETIME_MS_FORMATTER)); values.put("duration", gatewayLog.getDuration() != null ? gatewayLog.getDuration() + " ms" : null); log.info("[writeAccessLog][网关日志:{}]", JsonUtils.toJsonPrettyString(values)); } @@ -112,7 +114,7 @@ public class AccessLogFilter implements GlobalFilter, Ordered { gatewayLog.setRequestUrl(request.getURI().getRawPath()); gatewayLog.setQueryParams(request.getQueryParams()); gatewayLog.setRequestHeaders(request.getHeaders()); - gatewayLog.setStartTime(new Date()); + gatewayLog.setStartTime(LocalDateTime.now()); gatewayLog.setUserIp(WebFrameworkUtils.getClientIP(exchange)); // 继续 filter 过滤 @@ -179,8 +181,9 @@ public class AccessLogFilter implements GlobalFilter, Ordered { if (body instanceof Flux) { DataBufferFactory bufferFactory = response.bufferFactory(); // 计算执行时间 - gatewayLog.setEndTime(new Date()); - gatewayLog.setDuration((int) DateUtils.diff(gatewayLog.getEndTime(), gatewayLog.getStartTime())); + gatewayLog.setEndTime(LocalDateTime.now()); + gatewayLog.setDuration((int) (LocalDateTimeUtil.between(gatewayLog.getStartTime(), + gatewayLog.getEndTime()).toMillis())); // 设置其它字段 gatewayLog.setUserId(SecurityFrameworkUtils.getLoginUserId(exchange)); gatewayLog.setUserType(SecurityFrameworkUtils.getLoginUserType(exchange)); diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormRespVO.java index 76cf62046..e49f09879 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormRespVO.java @@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; import java.util.List; @ApiModel("管理后台 - 动态表单 Response VO") @@ -28,6 +28,6 @@ public class BpmFormRespVO extends BpmFormBaseVO { private List fields; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupPageReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupPageReqVO.java index 2bbe95192..2608607bf 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupPageReqVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupPageReqVO.java @@ -9,7 +9,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 用户组分页 Request VO") @Data @@ -25,6 +25,6 @@ public class BpmUserGroupPageReqVO extends PageParam { @DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "创建时间") - private Date[] createTime; + private LocalDateTime[] createTime; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupRespVO.java index 55018d502..f240016d6 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupRespVO.java @@ -1,6 +1,8 @@ package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group; import lombok.*; + +import java.time.LocalDateTime; import java.util.*; import io.swagger.annotations.*; @@ -14,6 +16,6 @@ public class BpmUserGroupRespVO extends BpmUserGroupBaseVO { private Long id; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelPageItemRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelPageItemRespVO.java index 7442b5ab0..10d23892e 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelPageItemRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelPageItemRespVO.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 流程模型的分页的每一项 Response VO") @Data @@ -21,7 +21,7 @@ public class BpmModelPageItemRespVO extends BpmModelBaseVO { private String formName; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; /** * 最新部署的流程定义 @@ -39,7 +39,7 @@ public class BpmModelPageItemRespVO extends BpmModelBaseVO { private Integer version; @ApiModelProperty(value = "部署时间", required = true) - private Date deploymentTime; + private LocalDateTime deploymentTime; @ApiModelProperty(value = "中断状态", required = true, example = "1", notes = "参见 SuspensionState 枚举") private Integer suspensionState; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelRespVO.java index bce0f9100..571850ff0 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelRespVO.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 流程模型的创建 Request VO") @Data @@ -21,6 +21,6 @@ public class BpmModelRespVO extends BpmModelBaseVO { private String bpmnXml; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionPageItemRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionPageItemRespVO.java index 75990f08a..1952e95a7 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionPageItemRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionPageItemRespVO.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 流程定义的分页的每一项 Response VO") @Data @@ -18,6 +18,6 @@ public class BpmProcessDefinitionPageItemRespVO extends BpmProcessDefinitionResp private String formName; @ApiModelProperty(value = "部署时间", required = true) - private Date deploymentTime; + private LocalDateTime deploymentTime; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveBaseVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveBaseVO.java index cbc568a11..be34b428d 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveBaseVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveBaseVO.java @@ -1,11 +1,12 @@ package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo; -import lombok.*; -import java.util.*; -import io.swagger.annotations.*; -import javax.validation.constraints.*; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; +import javax.validation.constraints.NotNull; +import java.time.LocalDateTime; + import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; /** @@ -18,11 +19,11 @@ public class BpmOALeaveBaseVO { @ApiModelProperty(value = "请假的开始时间", required = true) @NotNull(message = "开始时间不能为空") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date startTime; + private LocalDateTime startTime; @ApiModelProperty(value = "请假的结束时间", required = true) @NotNull(message = "结束时间不能为空") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date endTime; + private LocalDateTime endTime; @ApiModelProperty(value = "请假类型", required = true, example = "1", notes = "参见 bpm_oa_type 枚举") private Integer type; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveCreateReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveCreateReqVO.java index 2ebab63e9..5230e2722 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveCreateReqVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveCreateReqVO.java @@ -15,7 +15,8 @@ public class BpmOALeaveCreateReqVO extends BpmOALeaveBaseVO { @AssertTrue(message = "结束时间,需要在开始时间之后") public boolean isEndTimeValid() { - return !getEndTime().before(getStartTime()); + return !getEndTime().isBefore(getStartTime()); } + } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveRespVO.java index 908c48e06..42b3ec66c 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveRespVO.java @@ -5,7 +5,7 @@ import io.swagger.annotations.*; import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -24,7 +24,7 @@ public class BpmOALeaveRespVO extends BpmOALeaveBaseVO { @ApiModelProperty(value = "申请时间", required = true) @NotNull(message = "申请时间不能为空") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date createTime; + private LocalDateTime createTime; @ApiModelProperty(value = "流程id") private String processInstanceId; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/activity/BpmActivityRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/activity/BpmActivityRespVO.java index ef9d11ac1..7f183f50c 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/activity/BpmActivityRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/activity/BpmActivityRespVO.java @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 流程活动的 Response VO") @Data @@ -16,9 +16,9 @@ public class BpmActivityRespVO { private String type; @ApiModelProperty(value = "流程活动的开始时间", required = true) - private Date startTime; + private LocalDateTime startTime; @ApiModelProperty(value = "流程活动的结束时间", required = true) - private Date endTime; + private LocalDateTime endTime; @ApiModelProperty(value = "关联的流程任务的编号", example = "2048", notes = "关联的流程任务,只有 UserTask 等类型才有") private String taskId; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceMyPageReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceMyPageReqVO.java index db297e268..e52d45f44 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceMyPageReqVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceMyPageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -35,6 +35,6 @@ public class BpmProcessInstanceMyPageReqVO extends PageParam { @ApiModelProperty(value = "创建时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date[] createTime; + private LocalDateTime[] createTime; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstancePageItemRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstancePageItemRespVO.java index 5b5d5797a..0d2534b53 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstancePageItemRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstancePageItemRespVO.java @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; import java.util.List; @ApiModel("管理后台 - 流程实例的分页 Item Response VO") @@ -30,10 +30,10 @@ public class BpmProcessInstancePageItemRespVO { private Integer result; @ApiModelProperty(value = "提交时间", required = true) - private Date createTime; + private LocalDateTime createTime; @ApiModelProperty(value = "结束时间", required = true) - private Date endTime; + private LocalDateTime endTime; /** * 当前任务 diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceRespVO.java index a1547b175..58374dae2 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceRespVO.java @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; import java.util.List; import java.util.Map; @@ -28,10 +28,10 @@ public class BpmProcessInstanceRespVO { private Integer result; @ApiModelProperty(value = "提交时间", required = true) - private Date createTime; + private LocalDateTime createTime; @ApiModelProperty(value = "结束时间", required = true) - private Date endTime; + private LocalDateTime endTime; @ApiModelProperty(value = "提交的表单值", required = true) private Map formVariables; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskDonePageItemRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskDonePageItemRespVO.java index c5e2c23ae..a9bb93f9e 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskDonePageItemRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskDonePageItemRespVO.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 流程任务的 Done 已完成的分页项 Response VO") @Data @@ -15,7 +15,7 @@ import java.util.Date; public class BpmTaskDonePageItemRespVO extends BpmTaskTodoPageItemRespVO { @ApiModelProperty(value = "结束时间", required = true) - private Date endTime; + private LocalDateTime endTime; @ApiModelProperty(value = "持续时间", required = true, example = "1000") private Long durationInMillis; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskDonePageReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskDonePageReqVO.java index 99145b434..a347d58fe 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskDonePageReqVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskDonePageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -23,10 +23,10 @@ public class BpmTaskDonePageReqVO extends PageParam { @ApiModelProperty(value = "开始的创建收间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date beginCreateTime; + private LocalDateTime beginCreateTime; @ApiModelProperty(value = "结束的创建时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date endCreateTime; + private LocalDateTime endCreateTime; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskTodoPageItemRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskTodoPageItemRespVO.java index e25e3aa49..5c2cbf26a 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskTodoPageItemRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskTodoPageItemRespVO.java @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 流程任务的 Running 进行中的分页项 Response VO") @Data @@ -17,10 +17,10 @@ public class BpmTaskTodoPageItemRespVO { private String name; @ApiModelProperty(value = "接收时间", required = true) - private Date claimTime; + private LocalDateTime claimTime; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; @ApiModelProperty(value = "激活状态", required = true, example = "1", notes = "参见 SuspensionState 枚举") private Integer suspensionState; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskTodoPageReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskTodoPageReqVO.java index 9f248e198..9d2ad18c2 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskTodoPageReqVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskTodoPageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -23,10 +23,10 @@ public class BpmTaskTodoPageReqVO extends PageParam { @ApiModelProperty(value = "开始的创建收间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date beginCreateTime; + private LocalDateTime beginCreateTime; @ApiModelProperty(value = "结束的创建时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date endCreateTime; + private LocalDateTime endCreateTime; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmFormConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmFormConvert.java index 6ba757417..151b4c80b 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmFormConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmFormConvert.java @@ -1,11 +1,11 @@ package cn.iocoder.yudao.module.bpm.convert.definition; +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormCreateReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormRespVO; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormSimpleRespVO; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.form.BpmFormUpdateReqVO; import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmModelConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmModelConvert.java index 4d1b2a003..9f79032f6 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmModelConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmModelConvert.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.convert.definition; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; +import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.*; import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO; @@ -44,7 +45,7 @@ public interface BpmModelConvert { default BpmModelPageItemRespVO convert(Model model, BpmFormDO form, Deployment deployment, ProcessDefinition processDefinition) { BpmModelPageItemRespVO modelRespVO = new BpmModelPageItemRespVO(); modelRespVO.setId(model.getId()); - modelRespVO.setCreateTime(model.getCreateTime()); + modelRespVO.setCreateTime(DateUtils.of(model.getCreateTime())); // 通用 copy copyTo(model, modelRespVO); // Form @@ -57,7 +58,7 @@ public interface BpmModelConvert { if (modelRespVO.getProcessDefinition() != null) { modelRespVO.getProcessDefinition().setSuspensionState(processDefinition.isSuspended() ? SuspensionState.SUSPENDED.getStateCode() : SuspensionState.ACTIVE.getStateCode()); - modelRespVO.getProcessDefinition().setDeploymentTime(deployment.getDeploymentTime()); + modelRespVO.getProcessDefinition().setDeploymentTime(DateUtils.of(deployment.getDeploymentTime())); } return modelRespVO; } @@ -65,7 +66,7 @@ public interface BpmModelConvert { default BpmModelRespVO convert(Model model) { BpmModelRespVO modelRespVO = new BpmModelRespVO(); modelRespVO.setId(model.getId()); - modelRespVO.setCreateTime(model.getCreateTime()); + modelRespVO.setCreateTime(DateUtils.of(model.getCreateTime())); // 通用 copy copyTo(model, modelRespVO); return modelRespVO; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmProcessDefinitionConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmProcessDefinitionConvert.java index 8f5bfcd26..ad57a55b4 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmProcessDefinitionConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmProcessDefinitionConvert.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.bpm.convert.definition; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionPageItemRespVO; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionRespVO; @@ -67,7 +68,7 @@ public interface BpmProcessDefinitionConvert { BpmProcessDefinitionPageItemRespVO respVO = convert(bean); respVO.setSuspensionState(bean.isSuspended() ? SuspensionState.SUSPENDED.getStateCode() : SuspensionState.ACTIVE.getStateCode()); if (deployment != null) { - respVO.setDeploymentTime(deployment.getDeploymentTime()); + respVO.setDeploymentTime(LocalDateTimeUtil.of(deployment.getDeploymentTime())); } if (form != null) { respVO.setFormName(form.getName()); diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmUserGroupConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmUserGroupConvert.java index bbf00ba52..b5cd631f7 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmUserGroupConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmUserGroupConvert.java @@ -1,17 +1,16 @@ package cn.iocoder.yudao.module.bpm.convert.definition; -import java.util.*; - +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupCreateReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupRespVO; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group.BpmUserGroupUpdateReqVO; import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmUserGroupDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - import org.mapstruct.Mapper; import org.mapstruct.Named; import org.mapstruct.factory.Mappers; +import java.util.List; + /** * 用户组 Convert * diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/message/BpmMessageConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/message/BpmMessageConvert.java index 181e29618..99b7bebf2 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/message/BpmMessageConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/message/BpmMessageConvert.java @@ -17,4 +17,5 @@ public interface BpmMessageConvert { @Mapping(source = "templateCode", target = "templateCode") @Mapping(source = "templateParams", target = "templateParams") SmsSendSingleToUserReqDTO convert(Long userId, String templateCode, Map templateParams); + } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/oa/BpmOALeaveConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/oa/BpmOALeaveConvert.java index f87531bfc..8c56e1dda 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/oa/BpmOALeaveConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/oa/BpmOALeaveConvert.java @@ -1,9 +1,9 @@ package cn.iocoder.yudao.module.bpm.convert.oa; +import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.BpmOALeaveCreateReqVO; import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.BpmOALeaveRespVO; import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOALeaveDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java index 91d405925..a4ba5cc85 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.bpm.convert.task; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.number.NumberUtils; import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskDonePageItemRespVO; @@ -151,7 +152,7 @@ public interface BpmTaskConvert { BpmTaskExtDO taskExtDO = new BpmTaskExtDO().setTaskId(task.getId()) .setAssigneeUserId(NumberUtils.parseLong(task.getAssignee())).setName(task.getName()) .setProcessDefinitionId(task.getProcessDefinitionId()).setProcessInstanceId(task.getProcessInstanceId()); - taskExtDO.setCreateTime(task.getCreateTime()); + taskExtDO.setCreateTime(LocalDateTimeUtil.of(task.getCreateTime())); return taskExtDO; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/oa/BpmOALeaveDO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/oa/BpmOALeaveDO.java index 31381a556..92c7c154c 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/oa/BpmOALeaveDO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/oa/BpmOALeaveDO.java @@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.bpm.dal.dataobject.oa; import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum; import lombok.*; + +import java.time.LocalDateTime; import java.util.*; import com.baomidou.mybatisplus.annotation.*; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; @@ -46,11 +48,11 @@ public class BpmOALeaveDO extends BaseDO { /** * 开始时间 */ - private Date startTime; + private LocalDateTime startTime; /** * 结束时间 */ - private Date endTime; + private LocalDateTime endTime; /** * 请假天数 */ diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmActivityDO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmActivityDO.java index 183a04147..190fcf5ed 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmActivityDO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmActivityDO.java @@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import lombok.*; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT; @@ -80,14 +80,14 @@ public class BpmActivityDO { */ @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) - private Date startTime; + private LocalDateTime startTime; /** * 任务结束时间 */ @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) - private Date endTime; + private LocalDateTime endTime; private Integer transactionOrder; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmProcessInstanceExtDO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmProcessInstanceExtDO.java index b37709962..293cc2dd7 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmProcessInstanceExtDO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmProcessInstanceExtDO.java @@ -11,7 +11,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; import java.util.Map; /** @@ -79,7 +79,7 @@ public class BpmProcessInstanceExtDO extends BaseDO { * * 冗余 HistoricProcessInstance 的 endTime 属性 */ - private Date endTime; + private LocalDateTime endTime; /** * 提交的表单值 diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmTaskExtDO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmTaskExtDO.java index 5c6b70fc3..a79fce412 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmTaskExtDO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmTaskExtDO.java @@ -8,7 +8,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; /** * Bpm 流程任务的拓展表 @@ -67,7 +67,7 @@ public class BpmTaskExtDO extends BaseDO { * * 冗余 HistoricTaskInstance 的 endTime 属性 */ - private Date endTime; + private LocalDateTime endTime; /** * 流程实例的编号 diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/BpmOALeaveServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/BpmOALeaveServiceImpl.java index d0aadd95e..33d178901 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/BpmOALeaveServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/BpmOALeaveServiceImpl.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.bpm.service.oa; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; @@ -46,7 +47,7 @@ public class BpmOALeaveServiceImpl implements BpmOALeaveService { @Transactional(rollbackFor = Exception.class) public Long createLeave(Long userId, BpmOALeaveCreateReqVO createReqVO) { // 插入 OA 请假单 - long day = DateUtil.betweenDay(createReqVO.getStartTime(), createReqVO.getEndTime(), false); + long day = LocalDateTimeUtil.between(createReqVO.getStartTime(), createReqVO.getEndTime()).toDays(); BpmOALeaveDO leave = BpmOALeaveConvert.INSTANCE.convert(createReqVO).setUserId(userId).setDay(day) .setResult(BpmProcessInstanceResultEnum.PROCESS.getResult()); leaveMapper.insert(leave); diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java index 076ecd8fc..a7468ac4f 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java @@ -1 +1 @@ -package cn.iocoder.yudao.module.bpm.service.task; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.number.NumberUtils; import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*; import cn.iocoder.yudao.module.bpm.convert.task.BpmProcessInstanceConvert; import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionExtDO; import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO; import cn.iocoder.yudao.module.bpm.dal.mysql.task.BpmProcessInstanceExtMapper; import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceDeleteReasonEnum; import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum; import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceStatusEnum; import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEventPublisher; import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService; import cn.iocoder.yudao.module.bpm.service.message.BpmMessageService; import cn.iocoder.yudao.module.system.api.dept.DeptApi; import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import lombok.extern.slf4j.Slf4j; import org.flowable.engine.HistoryService; import org.flowable.engine.RuntimeService; import org.flowable.engine.delegate.event.FlowableCancelledEvent; import org.flowable.engine.history.HistoricProcessInstance; import org.flowable.engine.repository.ProcessDefinition; import org.flowable.engine.runtime.ProcessInstance; import org.flowable.task.api.Task; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import javax.validation.Valid; import java.util.*; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; /** * 流程实例 Service 实现类 * * ProcessDefinition & ProcessInstance & Execution & Task 的关系: * 1. * * HistoricProcessInstance & ProcessInstance 的关系: * 1. * * 简单来说,前者 = 历史 + 运行中的流程实例,后者仅是运行中的流程实例 * * @author 芋道源码 */ @Service @Validated @Slf4j public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService { @Resource private RuntimeService runtimeService; @Resource private BpmProcessInstanceExtMapper processInstanceExtMapper; @Resource @Lazy // 解决循环依赖 private BpmTaskService taskService; @Resource private BpmProcessDefinitionService processDefinitionService; @Resource private HistoryService historyService; @Resource private AdminUserApi adminUserApi; @Resource private DeptApi deptApi; @Resource private BpmProcessInstanceResultEventPublisher processInstanceResultEventPublisher; @Resource private BpmMessageService messageService; @Override public ProcessInstance getProcessInstance(String id) { return runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult(); } @Override public List getProcessInstances(Set ids) { return runtimeService.createProcessInstanceQuery().processInstanceIds(ids).list(); } @Override public PageResult getMyProcessInstancePage(Long userId, BpmProcessInstanceMyPageReqVO pageReqVO) { // 通过 BpmProcessInstanceExtDO 表,先查询到对应的分页 PageResult pageResult = processInstanceExtMapper.selectPage(userId, pageReqVO); if (CollUtil.isEmpty(pageResult.getList())) { return new PageResult<>(pageResult.getTotal()); } // 获得流程 Task Map List processInstanceIds = convertList(pageResult.getList(), BpmProcessInstanceExtDO::getProcessInstanceId); Map> taskMap = taskService.getTaskMapByProcessInstanceIds(processInstanceIds); // 转换返回 return BpmProcessInstanceConvert.INSTANCE.convertPage(pageResult, taskMap); } @Override @Transactional(rollbackFor = Exception.class) public String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqVO createReqVO) { // 获得流程定义 ProcessDefinition definition = processDefinitionService.getProcessDefinition(createReqVO.getProcessDefinitionId()); // 发起流程 return createProcessInstance0(userId, definition, createReqVO.getVariables(), null); } @Override public String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqDTO createReqDTO) { // 获得流程定义 ProcessDefinition definition = processDefinitionService.getActiveProcessDefinition(createReqDTO.getProcessDefinitionKey()); // 发起流程 return createProcessInstance0(userId, definition, createReqDTO.getVariables(), createReqDTO.getBusinessKey()); } @Override public BpmProcessInstanceRespVO getProcessInstanceVO(String id) { // 获得流程实例 HistoricProcessInstance processInstance = getHistoricProcessInstance(id); if (processInstance == null) { return null; } BpmProcessInstanceExtDO processInstanceExt = processInstanceExtMapper.selectByProcessInstanceId(id); Assert.notNull(processInstanceExt, "流程实例拓展({}) 不存在", id); // 获得流程定义 ProcessDefinition processDefinition = processDefinitionService .getProcessDefinition(processInstance.getProcessDefinitionId()); Assert.notNull(processDefinition, "流程定义({}) 不存在", processInstance.getProcessDefinitionId()); BpmProcessDefinitionExtDO processDefinitionExt = processDefinitionService.getProcessDefinitionExt( processInstance.getProcessDefinitionId()); Assert.notNull(processDefinitionExt, "流程定义拓展({}) 不存在", id); String bpmnXml = processDefinitionService.getProcessDefinitionBpmnXML(processInstance.getProcessDefinitionId()); // 获得 User AdminUserRespDTO startUser = adminUserApi.getUser(NumberUtils.parseLong(processInstance.getStartUserId())).getCheckedData(); DeptRespDTO dept = null; if (startUser != null) { dept = deptApi.getDept(startUser.getDeptId()).getCheckedData(); } // 拼接结果 return BpmProcessInstanceConvert.INSTANCE.convert2(processInstance, processInstanceExt, processDefinition, processDefinitionExt, bpmnXml, startUser, dept); } @Override public void cancelProcessInstance(Long userId, @Valid BpmProcessInstanceCancelReqVO cancelReqVO) { // 校验流程实例存在 ProcessInstance instance = getProcessInstance(cancelReqVO.getId()); if (instance == null) { throw exception(PROCESS_INSTANCE_CANCEL_FAIL_NOT_EXISTS); } // 只能取消自己的 if (!Objects.equals(instance.getStartUserId(), String.valueOf(userId))) { throw exception(PROCESS_INSTANCE_CANCEL_FAIL_NOT_SELF); } // 通过删除流程实例,实现流程实例的取消, // 删除流程实例,正则执行任务 ACT_RU_TASK. 任务会被删除。通过历史表查询 deleteProcessInstance(cancelReqVO.getId(), BpmProcessInstanceDeleteReasonEnum.CANCEL_TASK.format(cancelReqVO.getReason())); } /** * 获得历史的流程实例 * * @param id 流程实例的编号 * @return 历史的流程实例 */ @Override public HistoricProcessInstance getHistoricProcessInstance(String id) { return historyService.createHistoricProcessInstanceQuery().processInstanceId(id).singleResult(); } @Override public List getHistoricProcessInstances(Set ids) { return historyService.createHistoricProcessInstanceQuery().processInstanceIds(ids).list(); } @Override public void createProcessInstanceExt(ProcessInstance instance) { // 获得流程定义 ProcessDefinition definition = processDefinitionService.getProcessDefinition2(instance.getProcessDefinitionId()); // 插入 BpmProcessInstanceExtDO 对象 BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO() .setProcessInstanceId(instance.getId()) .setProcessDefinitionId(definition.getId()) .setName(instance.getProcessDefinitionName()) .setStartUserId(Long.valueOf(instance.getStartUserId())) .setCategory(definition.getCategory()) .setStatus(BpmProcessInstanceStatusEnum.RUNNING.getStatus()) .setResult(BpmProcessInstanceResultEnum.PROCESS.getResult()); processInstanceExtMapper.insert(instanceExtDO); } @Override public void updateProcessInstanceExtCancel(FlowableCancelledEvent event) { // 判断是否为 Reject 不通过。如果是,则不进行更新. // 因为,updateProcessInstanceExtReject 方法,已经进行更新了 if (BpmProcessInstanceDeleteReasonEnum.isRejectReason((String)event.getCause())) { return; } // 需要主动查询,因为 instance 只有 id 属性 // 另外,此时如果去查询 ProcessInstance 的话,字段是不全的,所以去查询了 HistoricProcessInstance HistoricProcessInstance processInstance = getHistoricProcessInstance(event.getProcessInstanceId()); // 更新拓展表 BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO() .setProcessInstanceId(event.getProcessInstanceId()) .setEndTime(new Date()) // 由于 ProcessInstance 里没有办法拿到 endTime,所以这里设置 .setStatus(BpmProcessInstanceStatusEnum.FINISH.getStatus()) .setResult(BpmProcessInstanceResultEnum.CANCEL.getResult()); processInstanceExtMapper.updateByProcessInstanceId(instanceExtDO); // 发送流程实例的状态事件 processInstanceResultEventPublisher.sendProcessInstanceResultEvent( BpmProcessInstanceConvert.INSTANCE.convert(this, processInstance, instanceExtDO.getResult())); } @Override public void updateProcessInstanceExtComplete(ProcessInstance instance) { // 需要主动查询,因为 instance 只有 id 属性 // 另外,此时如果去查询 ProcessInstance 的话,字段是不全的,所以去查询了 HistoricProcessInstance HistoricProcessInstance processInstance = getHistoricProcessInstance(instance.getId()); // 更新拓展表 BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO() .setProcessInstanceId(instance.getProcessInstanceId()) .setEndTime(new Date()) // 由于 ProcessInstance 里没有办法拿到 endTime,所以这里设置 .setStatus(BpmProcessInstanceStatusEnum.FINISH.getStatus()) .setResult(BpmProcessInstanceResultEnum.APPROVE.getResult()); // 如果正常完全,说明审批通过 processInstanceExtMapper.updateByProcessInstanceId(instanceExtDO); // 发送流程被通过的消息 messageService.sendMessageWhenProcessInstanceApprove(BpmProcessInstanceConvert.INSTANCE.convert2ApprovedReq(instance)); // 发送流程实例的状态事件 processInstanceResultEventPublisher.sendProcessInstanceResultEvent( BpmProcessInstanceConvert.INSTANCE.convert(this, processInstance, instanceExtDO.getResult())); } @Transactional(rollbackFor = Exception.class) public void updateProcessInstanceExtReject(String id, String reason) { // 需要主动查询,因为 instance 只有 id 属性 ProcessInstance processInstance = getProcessInstance(id); // 删除流程实例,以实现驳回任务时,取消整个审批流程 deleteProcessInstance(id, StrUtil.format(BpmProcessInstanceDeleteReasonEnum.REJECT_TASK.format(reason))); // 更新 status + result // 注意,不能和上面的逻辑更换位置。因为 deleteProcessInstance 会触发流程的取消,进而调用 updateProcessInstanceExtCancel 方法, // 设置 result 为 BpmProcessInstanceStatusEnum.CANCEL,显然和 result 不一定是一致的 BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO().setProcessInstanceId(id) .setStatus(BpmProcessInstanceStatusEnum.FINISH.getStatus()) .setResult(BpmProcessInstanceResultEnum.REJECT.getResult()); processInstanceExtMapper.updateByProcessInstanceId(instanceExtDO); // 发送流程被不通过的消息 messageService.sendMessageWhenProcessInstanceReject(BpmProcessInstanceConvert.INSTANCE.convert2RejectReq(processInstance, reason)); // 发送流程实例的状态事件 processInstanceResultEventPublisher.sendProcessInstanceResultEvent( BpmProcessInstanceConvert.INSTANCE.convert(this, processInstance, instanceExtDO.getResult())); } private void deleteProcessInstance(String id, String reason) { runtimeService.deleteProcessInstance(id, reason); } private String createProcessInstance0(Long userId, ProcessDefinition definition, Map variables, String businessKey) { // 校验流程定义 if (definition == null) { throw exception(PROCESS_DEFINITION_NOT_EXISTS); } if (definition.isSuspended()) { throw exception(PROCESS_DEFINITION_IS_SUSPENDED); } // 创建流程实例 ProcessInstance instance = runtimeService.startProcessInstanceById(definition.getId(), businessKey, variables); // 设置流程名字 runtimeService.setProcessInstanceName(instance.getId(), definition.getName()); // 补全流程实例的拓展表 processInstanceExtMapper.updateByProcessInstanceId(new BpmProcessInstanceExtDO().setProcessInstanceId(instance.getId()) .setFormVariables(variables)); return instance.getId(); } } \ No newline at end of file +package cn.iocoder.yudao.module.bpm.service.task; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.number.NumberUtils; import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*; import cn.iocoder.yudao.module.bpm.convert.task.BpmProcessInstanceConvert; import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionExtDO; import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO; import cn.iocoder.yudao.module.bpm.dal.mysql.task.BpmProcessInstanceExtMapper; import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceDeleteReasonEnum; import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum; import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceStatusEnum; import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEventPublisher; import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService; import cn.iocoder.yudao.module.bpm.service.message.BpmMessageService; import cn.iocoder.yudao.module.system.api.dept.DeptApi; import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import lombok.extern.slf4j.Slf4j; import org.flowable.engine.HistoryService; import org.flowable.engine.RuntimeService; import org.flowable.engine.delegate.event.FlowableCancelledEvent; import org.flowable.engine.history.HistoricProcessInstance; import org.flowable.engine.repository.ProcessDefinition; import org.flowable.engine.runtime.ProcessInstance; import org.flowable.task.api.Task; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import javax.validation.Valid; import java.time.LocalDateTime; import java.util.*; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; /** * 流程实例 Service 实现类 * * ProcessDefinition & ProcessInstance & Execution & Task 的关系: * 1. * * HistoricProcessInstance & ProcessInstance 的关系: * 1. * * 简单来说,前者 = 历史 + 运行中的流程实例,后者仅是运行中的流程实例 * * @author 芋道源码 */ @Service @Validated @Slf4j public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService { @Resource private RuntimeService runtimeService; @Resource private BpmProcessInstanceExtMapper processInstanceExtMapper; @Resource @Lazy // 解决循环依赖 private BpmTaskService taskService; @Resource private BpmProcessDefinitionService processDefinitionService; @Resource private HistoryService historyService; @Resource private AdminUserApi adminUserApi; @Resource private DeptApi deptApi; @Resource private BpmProcessInstanceResultEventPublisher processInstanceResultEventPublisher; @Resource private BpmMessageService messageService; @Override public ProcessInstance getProcessInstance(String id) { return runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult(); } @Override public List getProcessInstances(Set ids) { return runtimeService.createProcessInstanceQuery().processInstanceIds(ids).list(); } @Override public PageResult getMyProcessInstancePage(Long userId, BpmProcessInstanceMyPageReqVO pageReqVO) { // 通过 BpmProcessInstanceExtDO 表,先查询到对应的分页 PageResult pageResult = processInstanceExtMapper.selectPage(userId, pageReqVO); if (CollUtil.isEmpty(pageResult.getList())) { return new PageResult<>(pageResult.getTotal()); } // 获得流程 Task Map List processInstanceIds = convertList(pageResult.getList(), BpmProcessInstanceExtDO::getProcessInstanceId); Map> taskMap = taskService.getTaskMapByProcessInstanceIds(processInstanceIds); // 转换返回 return BpmProcessInstanceConvert.INSTANCE.convertPage(pageResult, taskMap); } @Override @Transactional(rollbackFor = Exception.class) public String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqVO createReqVO) { // 获得流程定义 ProcessDefinition definition = processDefinitionService.getProcessDefinition(createReqVO.getProcessDefinitionId()); // 发起流程 return createProcessInstance0(userId, definition, createReqVO.getVariables(), null); } @Override public String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqDTO createReqDTO) { // 获得流程定义 ProcessDefinition definition = processDefinitionService.getActiveProcessDefinition(createReqDTO.getProcessDefinitionKey()); // 发起流程 return createProcessInstance0(userId, definition, createReqDTO.getVariables(), createReqDTO.getBusinessKey()); } @Override public BpmProcessInstanceRespVO getProcessInstanceVO(String id) { // 获得流程实例 HistoricProcessInstance processInstance = getHistoricProcessInstance(id); if (processInstance == null) { return null; } BpmProcessInstanceExtDO processInstanceExt = processInstanceExtMapper.selectByProcessInstanceId(id); Assert.notNull(processInstanceExt, "流程实例拓展({}) 不存在", id); // 获得流程定义 ProcessDefinition processDefinition = processDefinitionService .getProcessDefinition(processInstance.getProcessDefinitionId()); Assert.notNull(processDefinition, "流程定义({}) 不存在", processInstance.getProcessDefinitionId()); BpmProcessDefinitionExtDO processDefinitionExt = processDefinitionService.getProcessDefinitionExt( processInstance.getProcessDefinitionId()); Assert.notNull(processDefinitionExt, "流程定义拓展({}) 不存在", id); String bpmnXml = processDefinitionService.getProcessDefinitionBpmnXML(processInstance.getProcessDefinitionId()); // 获得 User AdminUserRespDTO startUser = adminUserApi.getUser(NumberUtils.parseLong(processInstance.getStartUserId())).getCheckedData(); DeptRespDTO dept = null; if (startUser != null) { dept = deptApi.getDept(startUser.getDeptId()).getCheckedData(); } // 拼接结果 return BpmProcessInstanceConvert.INSTANCE.convert2(processInstance, processInstanceExt, processDefinition, processDefinitionExt, bpmnXml, startUser, dept); } @Override public void cancelProcessInstance(Long userId, @Valid BpmProcessInstanceCancelReqVO cancelReqVO) { // 校验流程实例存在 ProcessInstance instance = getProcessInstance(cancelReqVO.getId()); if (instance == null) { throw exception(PROCESS_INSTANCE_CANCEL_FAIL_NOT_EXISTS); } // 只能取消自己的 if (!Objects.equals(instance.getStartUserId(), String.valueOf(userId))) { throw exception(PROCESS_INSTANCE_CANCEL_FAIL_NOT_SELF); } // 通过删除流程实例,实现流程实例的取消, // 删除流程实例,正则执行任务 ACT_RU_TASK. 任务会被删除。通过历史表查询 deleteProcessInstance(cancelReqVO.getId(), BpmProcessInstanceDeleteReasonEnum.CANCEL_TASK.format(cancelReqVO.getReason())); } /** * 获得历史的流程实例 * * @param id 流程实例的编号 * @return 历史的流程实例 */ @Override public HistoricProcessInstance getHistoricProcessInstance(String id) { return historyService.createHistoricProcessInstanceQuery().processInstanceId(id).singleResult(); } @Override public List getHistoricProcessInstances(Set ids) { return historyService.createHistoricProcessInstanceQuery().processInstanceIds(ids).list(); } @Override public void createProcessInstanceExt(ProcessInstance instance) { // 获得流程定义 ProcessDefinition definition = processDefinitionService.getProcessDefinition2(instance.getProcessDefinitionId()); // 插入 BpmProcessInstanceExtDO 对象 BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO() .setProcessInstanceId(instance.getId()) .setProcessDefinitionId(definition.getId()) .setName(instance.getProcessDefinitionName()) .setStartUserId(Long.valueOf(instance.getStartUserId())) .setCategory(definition.getCategory()) .setStatus(BpmProcessInstanceStatusEnum.RUNNING.getStatus()) .setResult(BpmProcessInstanceResultEnum.PROCESS.getResult()); processInstanceExtMapper.insert(instanceExtDO); } @Override public void updateProcessInstanceExtCancel(FlowableCancelledEvent event) { // 判断是否为 Reject 不通过。如果是,则不进行更新. // 因为,updateProcessInstanceExtReject 方法,已经进行更新了 if (BpmProcessInstanceDeleteReasonEnum.isRejectReason((String)event.getCause())) { return; } // 需要主动查询,因为 instance 只有 id 属性 // 另外,此时如果去查询 ProcessInstance 的话,字段是不全的,所以去查询了 HistoricProcessInstance HistoricProcessInstance processInstance = getHistoricProcessInstance(event.getProcessInstanceId()); // 更新拓展表 BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO() .setProcessInstanceId(event.getProcessInstanceId()) .setEndTime(LocalDateTime.now()) // 由于 ProcessInstance 里没有办法拿到 endTime,所以这里设置 .setStatus(BpmProcessInstanceStatusEnum.FINISH.getStatus()) .setResult(BpmProcessInstanceResultEnum.CANCEL.getResult()); processInstanceExtMapper.updateByProcessInstanceId(instanceExtDO); // 发送流程实例的状态事件 processInstanceResultEventPublisher.sendProcessInstanceResultEvent( BpmProcessInstanceConvert.INSTANCE.convert(this, processInstance, instanceExtDO.getResult())); } @Override public void updateProcessInstanceExtComplete(ProcessInstance instance) { // 需要主动查询,因为 instance 只有 id 属性 // 另外,此时如果去查询 ProcessInstance 的话,字段是不全的,所以去查询了 HistoricProcessInstance HistoricProcessInstance processInstance = getHistoricProcessInstance(instance.getId()); // 更新拓展表 BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO() .setProcessInstanceId(instance.getProcessInstanceId()) .setEndTime(LocalDateTime.now()) // 由于 ProcessInstance 里没有办法拿到 endTime,所以这里设置 .setStatus(BpmProcessInstanceStatusEnum.FINISH.getStatus()) .setResult(BpmProcessInstanceResultEnum.APPROVE.getResult()); // 如果正常完全,说明审批通过 processInstanceExtMapper.updateByProcessInstanceId(instanceExtDO); // 发送流程被通过的消息 messageService.sendMessageWhenProcessInstanceApprove(BpmProcessInstanceConvert.INSTANCE.convert2ApprovedReq(instance)); // 发送流程实例的状态事件 processInstanceResultEventPublisher.sendProcessInstanceResultEvent( BpmProcessInstanceConvert.INSTANCE.convert(this, processInstance, instanceExtDO.getResult())); } @Transactional(rollbackFor = Exception.class) public void updateProcessInstanceExtReject(String id, String reason) { // 需要主动查询,因为 instance 只有 id 属性 ProcessInstance processInstance = getProcessInstance(id); // 删除流程实例,以实现驳回任务时,取消整个审批流程 deleteProcessInstance(id, StrUtil.format(BpmProcessInstanceDeleteReasonEnum.REJECT_TASK.format(reason))); // 更新 status + result // 注意,不能和上面的逻辑更换位置。因为 deleteProcessInstance 会触发流程的取消,进而调用 updateProcessInstanceExtCancel 方法, // 设置 result 为 BpmProcessInstanceStatusEnum.CANCEL,显然和 result 不一定是一致的 BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO().setProcessInstanceId(id) .setStatus(BpmProcessInstanceStatusEnum.FINISH.getStatus()) .setResult(BpmProcessInstanceResultEnum.REJECT.getResult()); processInstanceExtMapper.updateByProcessInstanceId(instanceExtDO); // 发送流程被不通过的消息 messageService.sendMessageWhenProcessInstanceReject(BpmProcessInstanceConvert.INSTANCE.convert2RejectReq(processInstance, reason)); // 发送流程实例的状态事件 processInstanceResultEventPublisher.sendProcessInstanceResultEvent( BpmProcessInstanceConvert.INSTANCE.convert(this, processInstance, instanceExtDO.getResult())); } private void deleteProcessInstance(String id, String reason) { runtimeService.deleteProcessInstance(id, reason); } private String createProcessInstance0(Long userId, ProcessDefinition definition, Map variables, String businessKey) { // 校验流程定义 if (definition == null) { throw exception(PROCESS_DEFINITION_NOT_EXISTS); } if (definition.isSuspended()) { throw exception(PROCESS_DEFINITION_IS_SUSPENDED); } // 创建流程实例 ProcessInstance instance = runtimeService.startProcessInstanceById(definition.getId(), businessKey, variables); // 设置流程名字 runtimeService.setProcessInstanceName(instance.getId(), definition.getName()); // 补全流程实例的拓展表 processInstanceExtMapper.updateByProcessInstanceId(new BpmProcessInstanceExtDO().setProcessInstanceId(instance.getId()) .setFormVariables(variables)); return instance.getId(); } } \ No newline at end of file diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java index b2c12bd2b..28862b0d2 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.bpm.service.task; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.common.util.number.NumberUtils; import cn.iocoder.yudao.framework.common.util.object.PageUtils; import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*; @@ -32,6 +33,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager import javax.annotation.Resource; import javax.validation.Valid; +import java.time.LocalDateTime; import java.util.*; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; @@ -74,10 +76,10 @@ public class BpmTaskServiceImpl implements BpmTaskService { taskQuery.taskNameLike("%" + pageVO.getName() + "%"); } if (pageVO.getBeginCreateTime() != null) { - taskQuery.taskCreatedAfter(pageVO.getBeginCreateTime()); + taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getBeginCreateTime())); } if (pageVO.getEndCreateTime() != null) { - taskQuery.taskCreatedBefore(pageVO.getEndCreateTime()); + taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getEndCreateTime())); } // 执行查询 List tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); @@ -106,10 +108,10 @@ public class BpmTaskServiceImpl implements BpmTaskService { taskQuery.taskNameLike("%" + pageVO.getName() + "%"); } if (pageVO.getBeginCreateTime() != null) { - taskQuery.taskCreatedAfter(pageVO.getBeginCreateTime()); + taskQuery.taskCreatedAfter(DateUtils.of(pageVO.getBeginCreateTime())); } if (pageVO.getEndCreateTime() != null) { - taskQuery.taskCreatedBefore(pageVO.getEndCreateTime()); + taskQuery.taskCreatedBefore(DateUtils.of(pageVO.getEndCreateTime())); } // 执行查询 List tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); @@ -205,7 +207,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { // 更新任务拓展表为不通过 taskExtMapper.updateByTaskId( new BpmTaskExtDO().setTaskId(task.getId()).setResult(BpmProcessInstanceResultEnum.REJECT.getResult()) - .setEndTime(new Date()).setReason(reqVO.getReason())); + .setEndTime(LocalDateTime.now()).setReason(reqVO.getReason())); } @Override @@ -249,7 +251,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { public void updateTaskExtComplete(Task task) { BpmTaskExtDO taskExtDO = BpmTaskConvert.INSTANCE.convert2TaskExt(task) .setResult(BpmProcessInstanceResultEnum.APPROVE.getResult()) // 不设置也问题不大,因为 Complete 一般是审核通过,已经设置 - .setEndTime(new Date()); + .setEndTime(LocalDateTime.now()); taskExtMapper.updateByTaskId(taskExtDO); } @@ -280,7 +282,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { // 更新任务 taskExtMapper.updateById(new BpmTaskExtDO().setId(taskExt.getId()).setResult(BpmProcessInstanceResultEnum.CANCEL.getResult()) - .setEndTime(new Date()).setReason(BpmProcessInstanceDeleteReasonEnum.translateReason(task.getDeleteReason()))); + .setEndTime(LocalDateTime.now()).setReason(BpmProcessInstanceDeleteReasonEnum.translateReason(task.getDeleteReason()))); } }); diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application.yaml b/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application.yaml index f629bed50..677656171 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application.yaml +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/resources/application.yaml @@ -16,7 +16,7 @@ spring: # Jackson 配置项 jackson: serialization: - write-dates-as-timestamps: true # 设置 Date 的格式,使用时间戳 + write-dates-as-timestamps: true # 设置 LocalDateTime 的格式,使用时间戳 write-date-timestamps-as-nanoseconds: false # 设置不使用 nanoseconds 的格式。例如说 1611460870.401,而是直接 1611460870401 write-durations-as-timestamps: true # 设置 Duration 的格式,使用时间戳 fail-on-empty-beans: false # 允许序列化无属性的 Bean diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/test/java/cn/iocoder/yudao/module/bpm/service/definition/BpmUserGroupServiceTest.java b/yudao-module-bpm/yudao-module-bpm-biz/src/test/java/cn/iocoder/yudao/module/bpm/service/definition/BpmUserGroupServiceTest.java index 1053c95e1..6fb9d91a1 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/test/java/cn/iocoder/yudao/module/bpm/service/definition/BpmUserGroupServiceTest.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/test/java/cn/iocoder/yudao/module/bpm/service/definition/BpmUserGroupServiceTest.java @@ -17,8 +17,9 @@ import org.springframework.context.annotation.Import; import javax.annotation.Resource; -import java.util.Date; +import java.time.LocalDateTime; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.USER_GROUP_NOT_EXISTS; @@ -106,7 +107,7 @@ public class BpmUserGroupServiceTest extends BaseDbUnitTest { BpmUserGroupDO dbUserGroup = RandomUtils.randomPojo(BpmUserGroupDO.class, o -> { // 等会查询到 o.setName("芋道源码"); o.setStatus(CommonStatusEnum.ENABLE.getStatus()); - o.setCreateTime(DateUtils.buildTime(2021, 11, 11)); + o.setCreateTime(buildLocalDateTime(2021, 11, 11)); }); userGroupMapper.insert(dbUserGroup); // 测试 name 不匹配 @@ -114,12 +115,13 @@ public class BpmUserGroupServiceTest extends BaseDbUnitTest { // 测试 status 不匹配 userGroupMapper.insert(cloneIgnoreId(dbUserGroup, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); // 测试 createTime 不匹配 - userGroupMapper.insert(cloneIgnoreId(dbUserGroup, o -> o.setCreateTime(DateUtils.buildTime(2021, 12, 12)))); + userGroupMapper.insert(cloneIgnoreId(dbUserGroup, o -> o.setCreateTime(buildLocalDateTime(2021, 12, 12)))); // 准备参数 BpmUserGroupPageReqVO reqVO = new BpmUserGroupPageReqVO(); reqVO.setName("源码"); reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); - reqVO.setCreateTime((new Date[]{buildTime(2021, 11, 10),buildTime(2021, 11, 12)})); + reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 11, 10), + buildLocalDateTime(2021, 11, 12)})); // 调用 PageResult pageResult = userGroupService.getUserGroupPage(reqVO); diff --git a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/dto/ApiAccessLogCreateReqDTO.java b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/dto/ApiAccessLogCreateReqDTO.java index eac503b22..f4e8e6495 100644 --- a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/dto/ApiAccessLogCreateReqDTO.java +++ b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/dto/ApiAccessLogCreateReqDTO.java @@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("RPC 服务 - API 访问日志创建 Request DTO") @Data @@ -40,10 +40,10 @@ public class ApiAccessLogCreateReqDTO { @ApiModelProperty(value = "开始时间", required = true) @NotNull(message = "开始请求时间不能为空") - private Date beginTime; + private LocalDateTime beginTime; @ApiModelProperty(value = "结束时间", required = true) @NotNull(message = "结束请求时间不能为空") - private Date endTime; + private LocalDateTime endTime; @ApiModelProperty(value = "执行时长,单位:毫秒", required = true) @NotNull(message = "执行时长不能为空") private Integer duration; diff --git a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/dto/ApiErrorLogCreateReqDTO.java b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/dto/ApiErrorLogCreateReqDTO.java index 2da5046c2..06aab01b5 100644 --- a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/dto/ApiErrorLogCreateReqDTO.java +++ b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/dto/ApiErrorLogCreateReqDTO.java @@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("RPC 服务 - API 错误日志创建 Request DTO") @Data @@ -40,7 +40,7 @@ public class ApiErrorLogCreateReqDTO { @ApiModelProperty(value = "异常时间", required = true) @NotNull(message = "异常时间不能为空") - private Date exceptionTime; + private LocalDateTime exceptionTime; @ApiModelProperty(value = "异常名", required = true) @NotNull(message = "异常名不能为空") private String exceptionName; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/column/CodegenColumnRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/column/CodegenColumnRespVO.java index 36dd3a05c..125b71801 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/column/CodegenColumnRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/column/CodegenColumnRespVO.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 代码生成字段定义 Response VO") @Data @@ -18,6 +18,6 @@ public class CodegenColumnRespVO extends CodegenColumnBaseVO { private Long id; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTablePageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTablePageReqVO.java index adff119b0..bf940c995 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTablePageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTablePageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -26,6 +26,6 @@ public class CodegenTablePageReqVO extends PageParam { @ApiModelProperty(value = "创建时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date[] createTime; + private LocalDateTime[] createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTableRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTableRespVO.java index bd1004bc7..7ef96b9a8 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTableRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTableRespVO.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 代码生成表定义 Response VO") @Data @@ -21,9 +21,9 @@ public class CodegenTableRespVO extends CodegenTableBaseVO { private Integer dataSourceConfigId; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; @ApiModelProperty(value = "更新时间", required = true) - private Date updateTime; + private LocalDateTime updateTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/vo/DataSourceConfigRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/vo/DataSourceConfigRespVO.java index af63aa0dd..134b2b2f1 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/vo/DataSourceConfigRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/vo/DataSourceConfigRespVO.java @@ -1,6 +1,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.db.vo; import lombok.*; + +import java.time.LocalDateTime; import java.util.*; import io.swagger.annotations.*; @@ -14,6 +16,6 @@ public class DataSourceConfigRespVO extends DataSourceConfigBaseVO { private Integer id; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigPageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigPageReqVO.java index 3752b37c5..f8ea275f3 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigPageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -26,6 +26,6 @@ public class FileConfigPageReqVO extends PageParam { @ApiModelProperty(value = "创建时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date[] createTime; + private LocalDateTime[] createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigRespVO.java index 74291925b..c2341e486 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigRespVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 文件配置 Response VO") @Data @@ -31,6 +31,6 @@ public class FileConfigRespVO extends FileConfigBaseVO { private FileClientConfig config; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FilePageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FilePageReqVO.java index 0ae43bbe0..774ed4f39 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FilePageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FilePageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -26,6 +26,6 @@ public class FilePageReqVO extends PageParam { @ApiModelProperty(value = "创建时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date[] createTime; + private LocalDateTime[] createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FileRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FileRespVO.java index 8e39a7520..ff51725bf 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FileRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FileRespVO.java @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel(value = "管理后台 - 文件 Response VO", description = "不返回 content 字段,太大") @Data @@ -26,6 +26,6 @@ public class FileRespVO { private Integer size; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogBaseVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogBaseVO.java index 619dea65a..077f26133 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogBaseVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogBaseVO.java @@ -5,7 +5,7 @@ import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -54,12 +54,12 @@ public class ApiAccessLogBaseVO { @ApiModelProperty(value = "开始请求时间", required = true) @NotNull(message = "开始请求时间不能为空") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date beginTime; + private LocalDateTime beginTime; @ApiModelProperty(value = "结束请求时间", required = true) @NotNull(message = "结束请求时间不能为空") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date endTime; + private LocalDateTime endTime; @ApiModelProperty(value = "执行时长", required = true, example = "100") @NotNull(message = "执行时长不能为空") diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExcelVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExcelVO.java index 5c1995c6a..21447743d 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExcelVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExcelVO.java @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; /** * API 访问日志 Excel VO @@ -48,10 +48,10 @@ public class ApiAccessLogExcelVO { private String userAgent; @ExcelProperty("开始请求时间") - private Date beginTime; + private LocalDateTime beginTime; @ExcelProperty("结束请求时间") - private Date endTime; + private LocalDateTime endTime; @ExcelProperty("执行时长") private Integer duration; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExportReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExportReqVO.java index dc2ef8714..406446d98 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExportReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExportReqVO.java @@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -27,7 +27,7 @@ public class ApiAccessLogExportReqVO { @ApiModelProperty(value = "开始时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date[] beginTime; + private LocalDateTime[] beginTime; @ApiModelProperty(value = "执行时长", example = "100", notes = "大于等于,单位:毫秒") private Integer duration; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java index 97ff8e949..a141a758b 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -32,7 +32,7 @@ public class ApiAccessLogPageReqVO extends PageParam { @ApiModelProperty(value = "开始时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date[] beginTime; + private LocalDateTime[] beginTime; @ApiModelProperty(value = "执行时长", example = "100", notes = "大于等于,单位:毫秒") private Integer duration; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogRespVO.java index 0458affb0..2a6125d38 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogRespVO.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - API 访问日志 Response VO") @Data @@ -18,6 +18,6 @@ public class ApiAccessLogRespVO extends ApiAccessLogBaseVO { private Long id; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogBaseVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogBaseVO.java index 08fbdace8..ad0b44368 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogBaseVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogBaseVO.java @@ -5,7 +5,7 @@ import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -55,7 +55,7 @@ public class ApiErrorLogBaseVO { @ApiModelProperty(value = "异常发生时间", required = true) @NotNull(message = "异常发生时间不能为空") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date exceptionTime; + private LocalDateTime exceptionTime; @ApiModelProperty(value = "异常名", required = true) @NotNull(message = "异常名不能为空") diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExcelVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExcelVO.java index 7e1e2ef0c..08f10894f 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExcelVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExcelVO.java @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; /** * API 错误日志 Excel VO @@ -48,7 +48,7 @@ public class ApiErrorLogExcelVO { private String userAgent; @ExcelProperty("异常发生时间") - private Date exceptionTime; + private LocalDateTime exceptionTime; @ExcelProperty("异常名") private String exceptionName; @@ -75,14 +75,14 @@ public class ApiErrorLogExcelVO { private Integer exceptionLineNumber; @ExcelProperty("创建时间") - private Date createTime; + private LocalDateTime createTime; @ExcelProperty(value = "处理状态", converter = DictConvert.class) @DictFormat(DictTypeConstants.API_ERROR_LOG_PROCESS_STATUS) private Integer processStatus; @ExcelProperty("处理时间") - private Date processTime; + private LocalDateTime processTime; @ExcelProperty("处理用户编号") private Integer processUserId; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExportReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExportReqVO.java index d8e121e0b..e2c241138 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExportReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExportReqVO.java @@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -27,7 +27,7 @@ public class ApiErrorLogExportReqVO { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "异常发生时间") - private Date[] exceptionTime; + private LocalDateTime[] exceptionTime; @ApiModelProperty(value = "处理状态", example = "0") private Integer processStatus; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java index fda23ba14..56496325d 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -32,7 +32,7 @@ public class ApiErrorLogPageReqVO extends PageParam { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "异常发生时间") - private Date[] exceptionTime; + private LocalDateTime[] exceptionTime; @ApiModelProperty(value = "处理状态", example = "0") private Integer processStatus; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogRespVO.java index 0f0c2724d..c108b548c 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogRespVO.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - API 错误日志 Response VO") @Data @@ -18,10 +18,10 @@ public class ApiErrorLogRespVO extends ApiErrorLogBaseVO { private Integer id; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; @ApiModelProperty(value = "处理时间", required = true) - private Date processTime; + private LocalDateTime processTime; @ApiModelProperty(value = "处理用户编号", example = "233") private Integer processUserId; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExcelVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExcelVO.java index e87d89586..d255c86d5 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExcelVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExcelVO.java @@ -1,6 +1,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.test.vo; import lombok.*; + +import java.time.LocalDateTime; import java.util.*; import io.swagger.annotations.*; @@ -33,6 +35,6 @@ public class TestDemoExcelVO { private String remark; @ExcelProperty("创建时间") - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExportReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExportReqVO.java index 8836919a6..c685bffa7 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExportReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExportReqVO.java @@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -30,6 +30,6 @@ public class TestDemoExportReqVO { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "创建时间") - private Date[] createTime; + private LocalDateTime[] createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoPageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoPageReqVO.java index 0ee9e060c..be68e57a6 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoPageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -35,6 +35,6 @@ public class TestDemoPageReqVO extends PageParam { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "创建时间") - private Date[] createTime; + private LocalDateTime[] createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoRespVO.java index 56d6b0a11..93f5aecca 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoRespVO.java @@ -1,8 +1,12 @@ package cn.iocoder.yudao.module.infra.controller.admin.test.vo; -import lombok.*; -import java.util.*; -import io.swagger.annotations.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.time.LocalDateTime; @ApiModel("管理后台 - 字典类型 Response VO") @Data @@ -14,6 +18,6 @@ public class TestDemoRespVO extends TestDemoBaseVO { private Long id; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiAccessLogDO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiAccessLogDO.java index 03a433f96..ab4292bf9 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiAccessLogDO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiAccessLogDO.java @@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; -import java.util.Date; +import java.time.LocalDateTime; /** * API 访问日志 @@ -84,11 +84,11 @@ public class ApiAccessLogDO extends BaseDO { /** * 开始请求时间 */ - private Date beginTime; + private LocalDateTime beginTime; /** * 结束请求时间 */ - private Date endTime; + private LocalDateTime endTime; /** * 执行时长,单位:毫秒 */ diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiErrorLogDO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiErrorLogDO.java index 524e8a2eb..7dc040981 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiErrorLogDO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiErrorLogDO.java @@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; -import java.util.Date; +import java.time.LocalDateTime; /** * API 异常数据 @@ -84,7 +84,7 @@ public class ApiErrorLogDO extends BaseDO { /** * 异常发生时间 */ - private Date exceptionTime; + private LocalDateTime exceptionTime; /** * 异常名 * @@ -145,7 +145,7 @@ public class ApiErrorLogDO extends BaseDO { /** * 处理时间 */ - private Date processTime; + private LocalDateTime processTime; /** * 处理用户编号 * diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileConfigMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileConfigMapper.java index 69a1e1cd7..e770dcafd 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileConfigMapper.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileConfigMapper.java @@ -8,7 +8,7 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; -import java.util.Date; +import java.time.LocalDateTime; /** * 文件配置 Mapper @@ -27,6 +27,6 @@ public interface FileConfigMapper extends BaseMapperX { } @Select("SELECT COUNT(*) FROM infra_file_config WHERE update_time > #{maxUpdateTime}") - Long selectCountByUpdateTimeGt(Date maxUpdateTime); + Long selectCountByUpdateTimeGt(LocalDateTime maxUpdateTime); } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/db/DatabaseTableServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/db/DatabaseTableServiceImpl.java index 9eb0a3a93..52014d514 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/db/DatabaseTableServiceImpl.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/db/DatabaseTableServiceImpl.java @@ -53,7 +53,7 @@ public class DatabaseTableServiceImpl implements DatabaseTableService { if (StrUtil.isNotEmpty(name)) { strategyConfig.addInclude(name); } - GlobalConfig globalConfig = new GlobalConfig.Builder().dateType(DateType.ONLY_DATE).build(); // 只使用 Date 类型,不使用 LocalDate + GlobalConfig globalConfig = new GlobalConfig.Builder().dateType(DateType.ONLY_DATE).build(); // 只使用 LocalDateTime 类型,不使用 LocalDate ConfigBuilder builder = new ConfigBuilder(null, dataSourceConfig, strategyConfig.build(), null, globalConfig, null); // 按照名字排序 diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java index ea82c61b3..129889ef0 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java @@ -32,7 +32,7 @@ import javax.annotation.PostConstruct; import javax.annotation.Resource; import javax.validation.Validator; import java.util.Collection; -import java.util.Date; +import java.time.LocalDateTime; import java.util.List; import java.util.Map; @@ -60,7 +60,7 @@ public class FileConfigServiceImpl implements FileConfigService { * 缓存菜单的最大更新时间,用于后续的增量轮询,判断是否有更新 */ @Getter - private volatile Date maxUpdateTime; + private volatile LocalDateTime maxUpdateTime; @Resource private FileClientFactory fileClientFactory; @@ -118,7 +118,7 @@ public class FileConfigServiceImpl implements FileConfigService { * @param maxUpdateTime 当前文件配置的最大更新时间 * @return 文件配置列表 */ - private List loadFileConfigIfUpdate(Date maxUpdateTime) { + private List loadFileConfigIfUpdate(LocalDateTime maxUpdateTime) { // 第一步,判断是否要更新。 if (maxUpdateTime == null) { // 如果更新时间为空,说明 DB 一定有新数据 log.info("[loadFileConfigIfUpdate][首次加载全量文件配置]"); diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java index 7e0cc3d85..6d79f8754 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java @@ -16,7 +16,7 @@ import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; -import java.util.Date; +import java.time.LocalDateTime; import java.util.List; /** @@ -59,7 +59,7 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService { } // 标记处理 apiErrorLogMapper.updateById(ApiErrorLogDO.builder().id(id).processStatus(processStatus) - .processUserId(processUserId).processTime(new Date()).build()); + .processUserId(processUserId).processTime(LocalDateTime.now()).build()); } } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application.yaml b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application.yaml index b23c5710b..37977e898 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application.yaml +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/application.yaml @@ -16,7 +16,7 @@ spring: # Jackson 配置项 jackson: serialization: - write-dates-as-timestamps: true # 设置 Date 的格式,使用时间戳 + write-dates-as-timestamps: true # 设置 LocalDateTime 的格式,使用时间戳 write-date-timestamps-as-nanoseconds: false # 设置不使用 nanoseconds 的格式。例如说 1611460870.401,而是直接 1611460870401 write-durations-as-timestamps: true # 设置 Duration 的格式,使用时间戳 fail-on-empty-beans: false # 允许序列化无属性的 Bean diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/_column.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/_column.vm index 2e2222509..69477d433 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/_column.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/_column.vm @@ -7,7 +7,7 @@ @NotNull(message = "${column.columnComment}不能为空") #end #end -#if (${column.javaType} == "Date")## 时间类型 +#if (${column.javaType} == "LocalDateTime")## 时间类型 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) #end private ${column.javaType} ${column.javaField}; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/baseVO.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/baseVO.vm index 8b9fbaac2..a0ad48d60 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/baseVO.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/baseVO.vm @@ -5,7 +5,9 @@ import java.util.*; #foreach ($column in $columns) #if (${column.javaType} == "BigDecimal") import java.math.BigDecimal; -#break +#end +#if (${column.javaType} == "LocalDateTime") +import java.time.LocalDateTime; #end #end import io.swagger.annotations.*; @@ -13,7 +15,7 @@ import javax.validation.constraints.*; ## 处理 Date 字段的引入 #foreach ($column in $columns) #if (${column.createOperation} && ${column.updateOperation} && ${column.listOperationResult} - && ${column.javaType} == "Date")## 时间类型 + && ${column.javaType} == "LocalDateTime")## 时间类型 import org.springframework.format.annotation.DateTimeFormat; import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/createReqVO.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/createReqVO.vm index ca13efac5..dc6cee6b6 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/createReqVO.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/createReqVO.vm @@ -7,7 +7,7 @@ import javax.validation.constraints.*; ## 处理 Date 字段的引入 #foreach ($column in $columns) #if (${column.createOperation} && (!${column.updateOperation} || !${column.listOperationResult}) - && ${column.javaType} == "Date")## 时间类型 + && ${column.javaType} == "LocalDateTime")## 时间类型 import org.springframework.format.annotation.DateTimeFormat; import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/excelVO.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/excelVO.vm index 6b3ea2467..8bfd92b69 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/excelVO.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/excelVO.vm @@ -5,7 +5,9 @@ import java.util.*; #foreach ($column in $columns) #if (${column.javaType} == "BigDecimal") import java.math.BigDecimal; -#break +#end +#if (${column.javaType} == "LocalDateTime") +import java.time.LocalDateTime; #end #end import io.swagger.annotations.*; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/exportReqVO.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/exportReqVO.vm index afd583c28..cd68dd82e 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/exportReqVO.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/exportReqVO.vm @@ -6,7 +6,8 @@ import io.swagger.annotations.*; import ${PageParamClassName}; ## 处理 Date 字段的引入 #foreach ($column in $columns) -#if (${column.listOperation} && ${column.javaType} == "Date")## 时间类型 +#if (${column.listOperation} && ${column.javaType} == "LocalDateTime")## 时间类型 +import java.time.LocalDateTime; import org.springframework.format.annotation.DateTimeFormat; import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/pageReqVO.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/pageReqVO.vm index df2be7036..f2664390a 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/pageReqVO.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/pageReqVO.vm @@ -6,8 +6,9 @@ import io.swagger.annotations.*; import ${PageParamClassName}; ## 处理 Date 字段的引入 #foreach ($column in $columns) -#if (${column.listOperation} && ${column.javaType} == "Date")## 时间类型 +#if (${column.listOperation} && ${column.javaType} == "LocalDateTime")## 时间类型 import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; #break diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/updateReqVO.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/updateReqVO.vm index c6057d55a..636991508 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/updateReqVO.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/updateReqVO.vm @@ -7,9 +7,9 @@ import javax.validation.constraints.*; ## 处理 Date 字段的引入 #foreach ($column in $columns) #if (${column.updateOperation} && (!${column.createOperation} || !${column.listOperationResult}) - && ${column.javaType} == "Date")## 时间类型 + && ${column.javaType} == "LocalDateTime")## 时间类型 import org.springframework.format.annotation.DateTimeFormat; - +import java.time.LocalDateTime; import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; #break #end diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/dal/do.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/dal/do.vm index 4abae1591..d551d4b30 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/dal/do.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/dal/do.vm @@ -5,7 +5,9 @@ import java.util.*; #foreach ($column in $columns) #if (${column.javaType} == "BigDecimal") import java.math.BigDecimal; -#break +#end +#if (${column.javaType} == "LocalDateTime") +import java.time.LocalDateTime; #end #end import com.baomidou.mybatisplus.annotation.*; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/test/serviceTest.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/test/serviceTest.vm index 1b5c60a3f..e97fbb275 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/test/serviceTest.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/test/serviceTest.vm @@ -16,6 +16,7 @@ import ${PageResultClassName}; 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 ${basePackage}.module.${table.moduleName}.enums.ErrorCodeConstants.*; @@ -51,7 +52,7 @@ import static org.mockito.Mockito.*; #if (${column.listOperation}) #set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写 #if (${column.listOperationCondition} == "BETWEEN")## BETWEEN 的情况 - reqVO.set${JavaField}((new Date[]{})); + reqVO.set${JavaField}((new LocalDateTime[]{})); #else reqVO.set$JavaField(null); #end diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue/views/index.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue/views/index.vue.vm index c84a510ac..7a6add604 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue/views/index.vue.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue/views/index.vue.vm @@ -65,15 +65,15 @@ #set ($javaField = $column.javaField) #set ($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set ($comment=$column.columnComment) -#if ($column.javaType == "Date")## 时间类型 +#if ($column.javaType == "LocalDateTime")## 时间类型 -