├── mall-admin-api └── src │ ├── main │ ├── resources │ │ ├── stop.sh │ │ ├── mysql.sh │ │ ├── startup.sh │ │ ├── restart.sh │ │ ├── install.sh │ │ ├── deploy.sh │ │ ├── mall-admin-api.conf │ │ ├── com │ │ │ └── mall │ │ │ │ ├── pms │ │ │ │ └── dao │ │ │ │ │ └── ProductCategoryAttributeRelationDao.xml │ │ │ │ ├── oms │ │ │ │ └── dao │ │ │ │ │ └── OrderOperateHistoryDao.xml │ │ │ │ └── sms │ │ │ │ └── dao │ │ │ │ ├── CouponProductRelationDao.xml │ │ │ │ └── CouponProductCategoryRelationDao.xml │ │ └── application.properties │ └── java │ │ └── com │ │ └── mall │ │ ├── sms │ │ ├── dao │ │ │ ├── CouponDao.java │ │ │ ├── CouponProductRelationDao.java │ │ │ ├── CouponProductCategoryRelationDao.java │ │ │ └── FlashPromotionProductRelationDao.java │ │ ├── dto │ │ │ ├── FlashPromotionSession.java │ │ │ ├── FlashPromotionProduct.java │ │ │ └── CouponParam.java │ │ └── service │ │ │ ├── FlashPromotionService.java │ │ │ ├── HomeAdvertiseService.java │ │ │ ├── HomeBrandService.java │ │ │ ├── HomeNewProductService.java │ │ │ ├── HomeRecommendSubjectService.java │ │ │ ├── HomeRecommendProductService.java │ │ │ ├── FlashPromotionSessionService.java │ │ │ ├── CouponService.java │ │ │ └── FlashPromotionProductRelationService.java │ │ ├── cms │ │ ├── service │ │ │ ├── PreferenceAreaService.java │ │ │ ├── SubjectService.java │ │ │ └── impl │ │ │ │ ├── PreferenceAreaServiceImpl.java │ │ │ │ └── SubjectServiceImpl.java │ │ └── controller │ │ │ └── PreferenceAreaController.java │ │ ├── oms │ │ ├── service │ │ │ ├── ExpressService.java │ │ │ ├── OrderSettingService.java │ │ │ ├── AddressService.java │ │ │ ├── OrderService.java │ │ │ ├── OrderReturnService.java │ │ │ └── impl │ │ │ │ └── OrderSettingServiceImpl.java │ │ ├── dao │ │ │ ├── OrderOperateHistoryDao.java │ │ │ ├── OrderReturnDao.java │ │ │ └── OrderDao.java │ │ └── dto │ │ │ ├── OrderReturnApplyResult.java │ │ │ ├── OrderDetail.java │ │ │ ├── OrderDeliveryParam.java │ │ │ └── MoneyParam.java │ │ ├── pms │ │ ├── service │ │ │ ├── MinioService.java │ │ │ ├── FreightService.java │ │ │ ├── ProductSkuStockService.java │ │ │ ├── ProductAttributeCategoryService.java │ │ │ ├── BrandService.java │ │ │ ├── ProductAttributeService.java │ │ │ ├── ProductCategoryService.java │ │ │ ├── impl │ │ │ │ └── FreightServiceImpl.java │ │ │ └── ProductService.java │ │ ├── dao │ │ │ ├── ProductAttributeDao.java │ │ │ ├── ProductCategoryAttributeRelationDao.java │ │ │ ├── SkuStockDao.java │ │ │ ├── ProductPriceDao.java │ │ │ └── ProductDao.java │ │ └── dto │ │ │ ├── ProductEditDto.java │ │ │ ├── ProductCategoryTreeDto.java │ │ │ ├── MinioUploadDto.java │ │ │ ├── ProductAttributeCategoryDto.java │ │ │ ├── ProductAttribute.java │ │ │ └── FreightCompany.java │ │ ├── ums │ │ ├── service │ │ │ ├── AuthService.java │ │ │ ├── AdminService.java │ │ │ └── impl │ │ │ │ └── AuthServiceImpl.java │ │ ├── dao │ │ │ └── AuthDao.java │ │ └── dto │ │ │ ├── LoginParam.java │ │ │ ├── UpdatePwdParam.java │ │ │ └── LoginAdmin.java │ │ ├── core │ │ └── HttpUtil.java │ │ ├── Application.java │ │ └── conf │ │ └── OpenAPIConfiguration.java │ └── test │ └── java │ └── com │ └── mall │ └── pms │ └── service │ └── impl │ └── MinioServiceImplTest.java ├── mall-mini-api └── src │ ├── main │ ├── resources │ │ ├── mysql.sh │ │ ├── stop.sh │ │ ├── restart.sh │ │ ├── startup.sh │ │ ├── install.sh │ │ ├── deploy.sh │ │ └── mall-mini-api.conf │ └── java │ │ └── com │ │ └── mall │ │ ├── wechat │ │ ├── auth │ │ │ ├── Signer.java │ │ │ ├── Verifier.java │ │ │ ├── SignResult.java │ │ │ └── PrivateKeySigner.java │ │ ├── pay │ │ │ ├── OrderDetail.java │ │ │ ├── PrepayResult.java │ │ │ ├── Payer.java │ │ │ ├── PayerAmount.java │ │ │ ├── Amount.java │ │ │ └── NotifyResult.java │ │ ├── core │ │ │ ├── Descryptor.java │ │ │ ├── Validator.java │ │ │ └── Credentials.java │ │ ├── api │ │ │ ├── Watermark.java │ │ │ ├── TokenResult.java │ │ │ ├── SessionResult.java │ │ │ ├── ApiResult.java │ │ │ └── UserPhone.java │ │ └── util │ │ │ └── Nonce.java │ │ ├── domain │ │ ├── SensitivePhone.java │ │ ├── SensitiveMember.java │ │ ├── MemberLoginDto.java │ │ ├── ProductCategory.java │ │ ├── OrderItem.java │ │ ├── OrderDetail.java │ │ ├── MinioUploadDto.java │ │ ├── CartOrder.java │ │ ├── ExpressParam.java │ │ ├── CartProduct.java │ │ ├── QueueEnum.java │ │ ├── FlashPromotionProduct.java │ │ ├── CouponHistoryDetail.java │ │ └── CouponHistory.java │ │ ├── service │ │ ├── ExpressService.java │ │ ├── MinioService.java │ │ ├── FreightService.java │ │ ├── WxPayService.java │ │ ├── CommentService.java │ │ ├── HistoryService.java │ │ ├── PromotionService.java │ │ ├── BrandService.java │ │ ├── AttentionService.java │ │ ├── CollectionService.java │ │ ├── AddressService.java │ │ ├── ProductService.java │ │ ├── CartItemService.java │ │ ├── OrderReturnService.java │ │ ├── impl │ │ │ ├── HistoryServiceImpl.java │ │ │ ├── AttentionServiceImpl.java │ │ │ ├── CollectionServiceImpl.java │ │ │ └── FreightServiceImpl.java │ │ ├── CouponService.java │ │ ├── HomeService.java │ │ ├── MemberService.java │ │ └── OrderService.java │ │ ├── dao │ │ ├── OrderItemDao.java │ │ ├── CouponHistoryDao.java │ │ ├── ProductDao.java │ │ ├── OrderDao.java │ │ └── HomeDao.java │ │ ├── Application.java │ │ ├── mq │ │ ├── CancelOrderReceiver.java │ │ └── CancelOrderSender.java │ │ ├── core │ │ └── Scheduler.java │ │ └── conf │ │ └── OpenAPIConfiguration.java │ └── test │ └── java │ └── com │ └── mall │ ├── wechat │ └── util │ │ └── JsonTest.java │ └── domain │ └── SensitiveTest.java ├── mall-jdbc └── src │ └── main │ └── java │ └── com │ └── mall │ └── jdbc │ ├── JdbcRouter.java │ ├── JdbcRouterSelector.java │ ├── JdbcRouterHolder.java │ └── JdbcRoutingDataSource.java ├── mall-crosscut └── src │ ├── main │ └── java │ │ └── com │ │ └── mall │ │ └── crosscut │ │ ├── lb │ │ └── Upstream.java │ │ ├── excel │ │ ├── convert │ │ │ └── Converter.java │ │ ├── util │ │ │ └── ObjectUtil.java │ │ └── annotation │ │ │ ├── Freeze.java │ │ │ ├── Filter.java │ │ │ └── Statistics.java │ │ ├── exception │ │ ├── ReentryException.java │ │ ├── RetryException.java │ │ └── ApiException.java │ │ ├── core │ │ ├── ApiResultDisabled.java │ │ └── ApiExceptionHandler.java │ │ ├── eventbus │ │ ├── Subscriber.java │ │ └── GlobalEventBus.java │ │ ├── validation │ │ ├── CrossConstraint.java │ │ ├── Flags.java │ │ ├── FlagsValidator.java │ │ ├── EnsureChecked.java │ │ └── AbstractChecker.java │ │ ├── conf │ │ └── EnableCrosscut.java │ │ ├── util │ │ ├── HttpUtil.java │ │ ├── Async.java │ │ ├── HashUtil.java │ │ └── Hex.java │ │ └── standard │ │ └── StatusCode.java │ └── test │ └── java │ └── com │ └── mall │ └── crosscut │ └── util │ ├── AssertTest.java │ └── HashTest.java ├── mall-model └── src │ └── main │ ├── resources │ └── generator.properties │ └── java │ └── com │ └── mall │ ├── OrderSources.java │ ├── OrderKind.java │ ├── ReturnStatus.java │ ├── PayKind.java │ ├── CouponUsage.java │ ├── OrderStatus.java │ ├── mapper │ ├── PmsAlbumPicDynamicSqlSupport.java │ ├── UmsRoleMenuRelationDynamicSqlSupport.java │ ├── UmsAdminRoleRelationDynamicSqlSupport.java │ ├── UmsRoleResourceRelationDynamicSqlSupport.java │ ├── UmsMemberMemberTagRelationDynamicSqlSupport.java │ ├── CmsSubjectProductRelationDynamicSqlSupport.java │ ├── CmsPreferenceAreaProductRelationDynamicSqlSupport.java │ ├── UmsMemberProductCategoryRelationDynamicSqlSupport.java │ ├── PmsProductCategoryAttributeRelationDynamicSqlSupport.java │ ├── UmsMemberTagDynamicSqlSupport.java │ ├── UmsResourceCategoryDynamicSqlSupport.java │ ├── PmsProductAttributeValueDynamicSqlSupport.java │ ├── UmsMemberTaskDynamicSqlSupport.java │ ├── PmsProductAttributeCategoryDynamicSqlSupport.java │ ├── PmsProductFullReductionDynamicSqlSupport.java │ ├── SmsHomeBrandDynamicSqlSupport.java │ ├── PmsFreightCompanyDynamicSqlSupport.java │ ├── PmsProductLadderDynamicSqlSupport.java │ ├── SmsHomeNewProductDynamicSqlSupport.java │ ├── PmsAlbumDynamicSqlSupport.java │ ├── PmsMemberPriceDynamicSqlSupport.java │ ├── OmsOrderReturnReasonDynamicSqlSupport.java │ └── SmsCouponProductRelationDynamicSqlSupport.java │ └── PromotionKind.java ├── mall-security └── src │ ├── main │ └── java │ │ └── com │ │ └── mall │ │ └── security │ │ ├── core │ │ ├── JwtService.java │ │ ├── TokenResolver.java │ │ ├── JwtInvalidException.java │ │ └── Jwt.java │ │ ├── jwt │ │ ├── JwtAuthenticationSuccessHandler.java │ │ ├── JwtSecurityContextRepository.java │ │ ├── JwtAuthenticationToken.java │ │ ├── JwtAccessDeniedHandler.java │ │ ├── JwtAuthenticationEntryPoint.java │ │ └── JwtAuthenticationProvider.java │ │ └── conf │ │ └── EnableJwtSecurity.java │ └── test │ └── java │ └── com │ └── mall │ └── security │ └── conf │ └── PasswordEncoderTest.java ├── mall-express ├── src │ └── main │ │ └── java │ │ └── com │ │ └── mall │ │ └── express │ │ ├── request │ │ ├── BaseRequest.java │ │ └── QueryTrackReq.java │ │ └── core │ │ ├── SignUtil.java │ │ ├── HttpClient.java │ │ └── HttpResult.java └── pom.xml ├── LICENSE └── README.md /mall-admin-api/src/main/resources/stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 4 | # 5 | 6 | cd /etc/init.d/ && sudo ./mall-admin-api stop -------------------------------------------------------------------------------- /mall-mini-api/src/main/resources/mysql.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 4 | # 5 | 6 | mysql -h172.27.0.16 -P3306 -uroot -prig@func -------------------------------------------------------------------------------- /mall-mini-api/src/main/resources/stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 4 | # 5 | 6 | cd /etc/init.d/ && sudo ./mall-mini-api stop -------------------------------------------------------------------------------- /mall-admin-api/src/main/resources/mysql.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 4 | # 5 | 6 | mysql -h172.27.0.16 -P3306 -uroot -prig@func -------------------------------------------------------------------------------- /mall-admin-api/src/main/resources/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 4 | # 5 | 6 | cd /etc/init.d/ && sudo ./mall-admin-api start -------------------------------------------------------------------------------- /mall-mini-api/src/main/resources/restart.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 4 | # 5 | 6 | cd /etc/init.d/ && sudo ./mall-mini-api restart -------------------------------------------------------------------------------- /mall-mini-api/src/main/resources/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 4 | # 5 | 6 | cd /etc/init.d/ && sudo ./mall-mini-api start -------------------------------------------------------------------------------- /mall-admin-api/src/main/resources/restart.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 4 | # 5 | 6 | cd /etc/init.d/ && sudo ./mall-admin-api restart -------------------------------------------------------------------------------- /mall-admin-api/src/main/resources/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 4 | # 5 | 6 | sudo ln -f -s /data/mall/admin/mall-admin-api.jar /etc/init.d/mall-admin-api -------------------------------------------------------------------------------- /mall-mini-api/src/main/resources/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 4 | # 5 | 6 | sudo ln -f -s /data/mall/mini/mall-mini-api.jar /etc/init.d/mall-mini-api -------------------------------------------------------------------------------- /mall-jdbc/src/main/java/com/mall/jdbc/JdbcRouter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.jdbc; 6 | 7 | public enum JdbcRouter { 8 | MASTER, SLAVE, 9 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/resources/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 4 | # 5 | 6 | cd /data/mall/mini/ && ./stop.sh && sudo rm mall-mini-api.jar && sudo rz -ybe && ./startup.sh -------------------------------------------------------------------------------- /mall-admin-api/src/main/resources/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 4 | # 5 | 6 | cd /data/mall/admin/ && ./stop.sh && sudo rm mall-admin-api.jar && sudo rz -ybe && ./startup.sh -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/auth/Signer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.auth; 6 | 7 | public interface Signer { 8 | SignResult sign(byte[] message); 9 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/lb/Upstream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.lb; 6 | 7 | public interface Upstream { 8 | boolean isAvailable(); 9 | 10 | String id(); 11 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/pay/OrderDetail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.pay; 6 | 7 | public class OrderDetail { 8 | private Long costPrice; 9 | private String invoiceId; 10 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/domain/SensitivePhone.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.domain; 6 | 7 | import com.mall.wechat.api.Sensitive; 8 | 9 | public class SensitivePhone extends Sensitive { 10 | 11 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/resources/mall-mini-api.conf: -------------------------------------------------------------------------------- 1 | JAVA_HOME=/data/openjdk 2 | JAVA_OPTS="-server -Xms1G -Xmx2G -Xss256K -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -Dfile.encoding=UTF-8 -DdeployRoot=/data/mall/mnpapi" 3 | LOG_FOLDER=/data/mall/mini/logs 4 | PID_FOLDER=/data/mall/mini/logs 5 | RUN_AS_USER=ubuntu -------------------------------------------------------------------------------- /mall-admin-api/src/main/resources/mall-admin-api.conf: -------------------------------------------------------------------------------- 1 | JAVA_HOME=/data/openjdk 2 | JAVA_OPTS="-server -Xms1G -Xmx2G -Xss256K -XX:+UseG1GC -XX:MaxGCPauseMillis=50 -Dfile.encoding=UTF-8 -DdeployRoot=/data/mall/admin" 3 | LOG_FOLDER=/data/mall/admin/logs 4 | PID_FOLDER=/data/mall/admin/logs 5 | RUN_AS_USER=ubuntu -------------------------------------------------------------------------------- /mall-model/src/main/resources/generator.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2023 - 2024 yingtingxu(???). All rights reserved. 3 | # 4 | 5 | jdbc.driverClass=com.mysql.cj.jdbc.Driver 6 | jdbc.connectionURL=jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai 7 | jdbc.userId=root 8 | jdbc.password=rig@func -------------------------------------------------------------------------------- /mall-security/src/main/java/com/mall/security/core/JwtService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.security.core; 6 | 7 | public interface JwtService { 8 | Jwt generate(String subject) throws Exception; 9 | 10 | String verify(String token) throws Exception; 11 | } -------------------------------------------------------------------------------- /mall-security/src/main/java/com/mall/security/core/TokenResolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.security.core; 6 | 7 | import javax.servlet.http.HttpServletRequest; 8 | 9 | public interface TokenResolver { 10 | String resolve(HttpServletRequest request); 11 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/excel/convert/Converter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.excel.convert; 6 | 7 | public interface Converter { 8 | 9 | default Object convert(int row, int cell, Object value) { 10 | return value; 11 | } 12 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/exception/ReentryException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.exception; 6 | 7 | public class ReentryException extends RuntimeException { 8 | public ReentryException(String message) { 9 | super(message); 10 | } 11 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/sms/dao/CouponDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.sms.dao; 6 | 7 | import com.mall.sms.dto.CouponParam; 8 | import org.apache.ibatis.annotations.Param; 9 | 10 | public interface CouponDao { 11 | 12 | CouponParam selectOne(@Param("id") Long id); 13 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/cms/service/PreferenceAreaService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.cms.service; 6 | 7 | import com.mall.model.CmsPreferenceArea; 8 | import java.util.List; 9 | 10 | public interface PreferenceAreaService { 11 | 12 | List listAll(); 13 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/core/ApiResultDisabled.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.core; 6 | 7 | import java.lang.annotation.*; 8 | 9 | @Target(value = ElementType.METHOD) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Documented 12 | public @interface ApiResultDisabled { 13 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/core/Descryptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.core; 6 | 7 | import java.security.GeneralSecurityException; 8 | 9 | public interface Descryptor { 10 | String decryptToString(byte[] associatedData, byte[] nonce, String ciphertext) throws GeneralSecurityException; 11 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/core/Validator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.core; 6 | 7 | import java.io.IOException; 8 | import org.apache.http.client.methods.CloseableHttpResponse; 9 | 10 | public interface Validator { 11 | boolean validate(CloseableHttpResponse response) throws IOException; 12 | } -------------------------------------------------------------------------------- /mall-jdbc/src/main/java/com/mall/jdbc/JdbcRouterSelector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.jdbc; 6 | 7 | import java.lang.annotation.*; 8 | 9 | @Target({ElementType.TYPE, ElementType.METHOD}) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Documented 12 | public @interface JdbcRouterSelector { 13 | JdbcRouter router(); 14 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/auth/Verifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.auth; 6 | 7 | import java.security.cert.X509Certificate; 8 | 9 | public interface Verifier { 10 | boolean verify(String serialNumber, byte[] message, String signature); 11 | 12 | X509Certificate getValidCertificate(); 13 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/OrderSources.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall; 6 | 7 | public enum OrderSources { 8 | PC(0), APP(1); 9 | 10 | private final int source; 11 | 12 | OrderSources(int source) { 13 | this.source = source; 14 | } 15 | 16 | public int getSource() { 17 | return source; 18 | } 19 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/cms/service/SubjectService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.cms.service; 6 | 7 | import com.mall.model.CmsSubject; 8 | import java.util.List; 9 | 10 | public interface SubjectService { 11 | 12 | List listAll(); 13 | 14 | List list(String keyword, int pageIndex, int pageSize); 15 | } -------------------------------------------------------------------------------- /mall-express/src/main/java/com/mall/express/request/BaseRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.express.request; 6 | 7 | public abstract class BaseRequest { 8 | private String url; 9 | 10 | public String getUrl() { 11 | return url; 12 | } 13 | 14 | public void setUrl(String url) { 15 | this.url = url; 16 | } 17 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/ExpressService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service; 6 | 7 | import com.mall.express.response.QueryTrackData; 8 | import java.util.List; 9 | 10 | public interface ExpressService { 11 | List queryExpress(long orderId); 12 | 13 | List queryReturnExpress(long id); 14 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/MinioService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service; 6 | 7 | import com.mall.domain.MinioUploadDto; 8 | import org.springframework.web.multipart.MultipartFile; 9 | 10 | public interface MinioService { 11 | MinioUploadDto upload(MultipartFile multipartFile); 12 | 13 | void delete(String name); 14 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/oms/service/ExpressService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.oms.service; 6 | 7 | import com.mall.express.response.QueryTrackData; 8 | import java.util.List; 9 | 10 | public interface ExpressService { 11 | List queryExpress(long orderId); 12 | List queryReturnExpress(long id); 13 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/core/Credentials.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.core; 6 | 7 | import java.io.IOException; 8 | import org.apache.http.client.methods.HttpRequestWrapper; 9 | 10 | public interface Credentials { 11 | String getSchema(); 12 | 13 | String getToken(HttpRequestWrapper request) throws IOException; 14 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/service/MinioService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.service; 6 | 7 | import com.mall.pms.dto.MinioUploadDto; 8 | import org.springframework.web.multipart.MultipartFile; 9 | 10 | public interface MinioService { 11 | MinioUploadDto upload(MultipartFile multipartFile); 12 | 13 | void delete(String name); 14 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/eventbus/Subscriber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.eventbus; 6 | 7 | import java.lang.annotation.*; 8 | 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Target(ElementType.TYPE) 11 | @Inherited 12 | public @interface Subscriber { 13 | String value() default GlobalEventBus.GLOBAL_EVENT_BUS_EXPRESSION; 14 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/FreightService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service; 6 | 7 | import com.mall.model.PmsFreightCompany; 8 | import java.util.List; 9 | 10 | public interface FreightService { 11 | 12 | List list(int pageIndex, int pageSize); 13 | 14 | List search(String nameOrCode); 15 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/dao/OrderItemDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.dao; 6 | 7 | import com.mall.model.OmsOrderItem; 8 | import org.apache.ibatis.annotations.Param; 9 | 10 | import java.util.List; 11 | 12 | public interface OrderItemDao { 13 | /** 14 | * 批量插入 15 | */ 16 | int insertList(@Param("list") List list); 17 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/pay/PrepayResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.pay; 6 | 7 | public class PrepayResult { 8 | private String prepayId; 9 | 10 | public String getPrepayId() { 11 | return prepayId; 12 | } 13 | 14 | public void setPrepayId(String prepayId) { 15 | this.prepayId = prepayId; 16 | } 17 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/oms/dao/OrderOperateHistoryDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.oms.dao; 6 | 7 | import com.mall.model.OmsOrderOperateHistory; 8 | import java.util.List; 9 | import org.apache.ibatis.annotations.Param; 10 | 11 | public interface OrderOperateHistoryDao { 12 | int insertList(@Param("list") List histories); 13 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/service/FreightService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.service; 6 | 7 | import com.mall.model.PmsFreightCompany; 8 | import java.util.List; 9 | 10 | public interface FreightService { 11 | 12 | List list(int pageIndex, int pageSize); 13 | 14 | List search(String nameOrCode); 15 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/service/ProductSkuStockService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.service; 6 | 7 | import com.mall.model.PmsSkuStock; 8 | 9 | import java.util.List; 10 | 11 | public interface ProductSkuStockService { 12 | List getList(Long productId, String keyword); 13 | 14 | void update(Long productId, List skuStocks); 15 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/sms/dao/CouponProductRelationDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.sms.dao; 6 | 7 | import com.mall.model.SmsCouponProductRelation; 8 | import java.util.List; 9 | import org.apache.ibatis.annotations.Param; 10 | 11 | public interface CouponProductRelationDao { 12 | int insertList(@Param("list")List productRelations); 13 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/exception/RetryException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.exception; 6 | 7 | public class RetryException extends RuntimeException { 8 | public RetryException(String message) { 9 | super(message); 10 | } 11 | 12 | public RetryException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/WxPayService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service; 6 | 7 | import com.mall.wechat.pay.NotifyResult; 8 | import com.mall.wechat.pay.Payment; 9 | import javax.servlet.http.HttpServletRequest; 10 | 11 | public interface WxPayService { 12 | Payment getPayment(long orderId); 13 | 14 | NotifyResult payNotify(HttpServletRequest request); 15 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/oms/service/OrderSettingService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.oms.service; 6 | 7 | import com.mall.model.OmsOrderSetting; 8 | import java.util.List; 9 | 10 | public interface OrderSettingService { 11 | 12 | List list(); 13 | 14 | OmsOrderSetting get(Long id); 15 | 16 | void update(Long id, OmsOrderSetting orderSetting); 17 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/CommentService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service; 6 | 7 | import com.mall.domain.CommentParam; 8 | import com.mall.model.PmsComment; 9 | import java.util.List; 10 | 11 | public interface CommentService { 12 | 13 | List list(long productId, int pageIndex, int pageSize); 14 | 15 | void create(CommentParam commentParam); 16 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/HistoryService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service; 6 | 7 | import com.mall.domain.History; 8 | 9 | import java.util.List; 10 | 11 | public interface HistoryService { 12 | void create(History history); 13 | 14 | void delete(List ids); 15 | 16 | void clear(); 17 | 18 | List list(int pageIndex, int pageSize); 19 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/sms/dao/CouponProductCategoryRelationDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.sms.dao; 6 | 7 | import com.mall.model.SmsCouponProductCategoryRelation; 8 | import java.util.List; 9 | import org.apache.ibatis.annotations.Param; 10 | 11 | public interface CouponProductCategoryRelationDao { 12 | int insertList(@Param("list")List productCategoryRelations); 13 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/PromotionService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service; 6 | 7 | import com.mall.domain.PromotionCartItem; 8 | import com.mall.model.OmsCartItem; 9 | 10 | import java.util.List; 11 | 12 | public interface PromotionService { 13 | /** 14 | * 计算购物车中的促销活动信息 15 | * @param cartItemList 购物车 16 | */ 17 | List calcCartPromotion(List cartItemList); 18 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/dao/ProductAttributeDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.dao; 6 | 7 | import com.mall.pms.dto.ProductAttribute; 8 | import com.mall.pms.dto.ProductAttributeCategoryDto; 9 | 10 | import java.util.List; 11 | 12 | public interface ProductAttributeDao { 13 | List selectCategoryWithAttributes(); 14 | 15 | List getAttributes(long productCategoryId); 16 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/ums/service/AuthService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.ums.service; 6 | 7 | import com.mall.model.UmsMenu; 8 | import com.mall.model.UmsRole; 9 | 10 | import java.util.List; 11 | 12 | public interface AuthService { 13 | /** 14 | * 根据管理员ID获取对应菜单 15 | */ 16 | List getMenus(Long adminId); 17 | /** 18 | * 获取用户对于角色 19 | */ 20 | List getRoles(Long adminId); 21 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/BrandService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service; 6 | 7 | import com.mall.model.PmsBrand; 8 | import com.mall.model.PmsProduct; 9 | 10 | import java.util.List; 11 | 12 | public interface BrandService { 13 | List recommendList(int pageIndex, int pageSize); 14 | 15 | PmsBrand detail(long id); 16 | 17 | List productList(Long brandId, int pageIndex, int pageSize); 18 | } -------------------------------------------------------------------------------- /mall-express/src/main/java/com/mall/express/core/SignUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.express.core; 6 | 7 | import org.apache.commons.codec.digest.DigestUtils; 8 | 9 | public interface SignUtil { 10 | static String sign(String msg) { 11 | return DigestUtils.md5Hex(msg).toUpperCase(); 12 | } 13 | 14 | static String querySign(String param, String key, String customer){ 15 | return sign(param+key+customer); 16 | } 17 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/AttentionService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service; 6 | 7 | import com.mall.domain.BrandAttention; 8 | 9 | import java.util.List; 10 | 11 | public interface AttentionService { 12 | void add(BrandAttention brandAttention); 13 | 14 | void delete(long brandId); 15 | 16 | List list(int pageIndex, int pageSize); 17 | 18 | BrandAttention get(long brandId); 19 | 20 | void clear(); 21 | } -------------------------------------------------------------------------------- /mall-security/src/main/java/com/mall/security/core/JwtInvalidException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.security.core; 6 | 7 | import com.nimbusds.jose.JOSEException; 8 | 9 | public class JwtInvalidException extends JOSEException { 10 | public JwtInvalidException(final String message) { 11 | super(message); 12 | } 13 | 14 | public JwtInvalidException(final String message, final Throwable cause) { 15 | super(message, cause); 16 | } 17 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/oms/service/AddressService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.oms.service; 6 | 7 | import com.mall.oms.dto.AddressParam; 8 | import com.mall.model.OmsCompanyAddress; 9 | 10 | import java.util.List; 11 | 12 | public interface AddressService { 13 | 14 | List list(); 15 | 16 | void create(AddressParam address); 17 | 18 | void update(long id, AddressParam address); 19 | 20 | void delete(List ids); 21 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/domain/SensitiveMember.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.domain; 6 | 7 | import com.mall.wechat.api.Sensitive; 8 | import com.mall.wechat.api.UserInfo; 9 | 10 | public class SensitiveMember extends Sensitive { 11 | private UserInfo userInfo; 12 | 13 | public UserInfo getUserInfo() { 14 | return userInfo; 15 | } 16 | 17 | public void setUserInfo(UserInfo userInfo) { 18 | this.userInfo = userInfo; 19 | } 20 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/CollectionService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service; 6 | 7 | import com.mall.domain.ProductCollection; 8 | 9 | import java.util.List; 10 | 11 | public interface CollectionService { 12 | void add(ProductCollection productCollection); 13 | 14 | void delete(long productId); 15 | 16 | List list(int pageIndex, int pageSize); 17 | 18 | ProductCollection get(long productId); 19 | 20 | void clear(); 21 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/dao/ProductCategoryAttributeRelationDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.dao; 6 | 7 | import com.mall.model.PmsProductCategoryAttributeRelation; 8 | import org.apache.ibatis.annotations.Param; 9 | 10 | import java.util.List; 11 | 12 | public interface ProductCategoryAttributeRelationDao { 13 | /** 14 | * 批量创建 15 | */ 16 | int insertList(@Param("list") List productCategoryAttributeRelations); 17 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/AddressService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service; 6 | 7 | import com.mall.model.UmsMemberReceiveAddress; 8 | 9 | import java.util.List; 10 | 11 | public interface AddressService { 12 | void create(UmsMemberReceiveAddress address); 13 | 14 | void delete(long id); 15 | 16 | void update(long id, UmsMemberReceiveAddress address); 17 | 18 | UmsMemberReceiveAddress get(long id); 19 | 20 | List list(); 21 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/dao/SkuStockDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.dao; 6 | 7 | import com.mall.model.PmsSkuStock; 8 | import org.apache.ibatis.annotations.Param; 9 | 10 | import java.util.List; 11 | 12 | public interface SkuStockDao { 13 | /** 14 | * 批量插入操作 15 | */ 16 | int insertList(@Param("list") List skuStockList); 17 | 18 | /** 19 | * 批量插入或替换操作 20 | */ 21 | int replaceList(@Param("list")List skuStockList); 22 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/domain/MemberLoginDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.domain; 6 | 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | 9 | import javax.validation.constraints.NotEmpty; 10 | 11 | public class MemberLoginDto { 12 | @NotEmpty 13 | @Schema(description = "授权码") 14 | private String code; 15 | 16 | public String getCode() { 17 | return code; 18 | } 19 | 20 | public void setCode(String code) { 21 | this.code = code; 22 | } 23 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/domain/ProductCategory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.domain; 6 | 7 | import com.mall.model.PmsProductCategory; 8 | 9 | import java.util.List; 10 | 11 | public class ProductCategory extends PmsProductCategory { 12 | private List children; 13 | 14 | public List getChildren() { 15 | return children; 16 | } 17 | 18 | public void setChildren(List children) { 19 | this.children = children; 20 | } 21 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/core/HttpUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.core; 6 | 7 | import org.springframework.security.core.Authentication; 8 | import org.springframework.security.core.context.SecurityContextHolder; 9 | 10 | public interface HttpUtil { 11 | static String getUsername() { 12 | Authentication auth = SecurityContextHolder.getContext().getAuthentication(); 13 | if (auth != null) { 14 | return auth.getName(); 15 | } 16 | 17 | return "后台管理员"; 18 | } 19 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/validation/CrossConstraint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.validation; 6 | 7 | import org.springframework.core.annotation.AliasFor; 8 | import org.springframework.stereotype.Component; 9 | 10 | import java.lang.annotation.*; 11 | 12 | @Target(ElementType.TYPE) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | @Documented 15 | @Inherited 16 | @Component 17 | public @interface CrossConstraint { 18 | @AliasFor(annotation = Component.class) 19 | String value() default ""; 20 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/domain/OrderItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.domain; 6 | 7 | import com.mall.model.OmsOrderItem; 8 | import io.swagger.v3.oas.annotations.media.Schema; 9 | 10 | public class OrderItem extends OmsOrderItem { 11 | @Schema(description = "售后状态") 12 | private int returnStatus; 13 | 14 | public int getReturnStatus() { 15 | return returnStatus; 16 | } 17 | 18 | public void setReturnStatus(int returnStatus) { 19 | this.returnStatus = returnStatus; 20 | } 21 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/dto/ProductEditDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.dto; 6 | 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | 9 | public class ProductEditDto extends ProductDto { 10 | @Schema(description = "商品所选分类的父id") 11 | private Long categoryParentId; 12 | 13 | public Long getCategoryParentId() { 14 | return categoryParentId; 15 | } 16 | 17 | public void setCategoryParentId(Long categoryParentId) { 18 | this.categoryParentId = categoryParentId; 19 | } 20 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/ProductService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service; 6 | 7 | import com.mall.domain.ProductCategory; 8 | import com.mall.domain.ProductDetail; 9 | import com.mall.model.PmsProduct; 10 | 11 | import java.util.List; 12 | 13 | public interface ProductService { 14 | List categoryTree(); 15 | 16 | ProductDetail detail(long id); 17 | 18 | List search(String keyword, Long brandId, Long productCategoryId, int pageIndex, int pageSize, Integer sort); 19 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/api/Watermark.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.api; 6 | 7 | public class Watermark { 8 | private String appid; 9 | private long timestamp; 10 | 11 | public String getAppid() { 12 | return appid; 13 | } 14 | 15 | public void setAppid(String appid) { 16 | this.appid = appid; 17 | } 18 | 19 | public long getTimestamp() { 20 | return timestamp; 21 | } 22 | 23 | public void setTimestamp(long timestamp) { 24 | this.timestamp = timestamp; 25 | } 26 | } -------------------------------------------------------------------------------- /mall-admin-api/src/test/java/com/mall/pms/service/impl/MinioServiceImplTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.service.impl; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 8 | import static org.junit.jupiter.api.Assertions.assertNotNull; 9 | 10 | import org.junit.jupiter.api.Test; 11 | 12 | class MinioServiceImplTest { 13 | @Test 14 | void json() { 15 | assertDoesNotThrow(() -> { 16 | String json = MinioServiceImpl.BucketPolicy.readonly("mall"); 17 | assertNotNull(json); 18 | }); 19 | } 20 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/auth/SignResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.auth; 6 | 7 | public class SignResult { 8 | private final String signature; 9 | private final String serialNumber; 10 | 11 | public String getSignature() { 12 | return signature; 13 | } 14 | 15 | public String getSerialNumber() { 16 | return serialNumber; 17 | } 18 | 19 | public SignResult(String signature, String serialNumber) { 20 | this.signature = signature; 21 | this.serialNumber = serialNumber; 22 | } 23 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/pay/Payer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.pay; 6 | 7 | public class Payer { 8 | private String openid; 9 | 10 | public String getOpenid() { 11 | return openid; 12 | } 13 | 14 | public void setOpenid(String openid) { 15 | this.openid = openid; 16 | } 17 | 18 | public Payer() { } 19 | 20 | public Payer(String openid) { 21 | this.openid = openid; 22 | } 23 | 24 | public static Payer valueOf(String openid) { 25 | return new Payer(openid); 26 | } 27 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/sms/dto/FlashPromotionSession.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.sms.dto; 6 | 7 | import com.mall.model.SmsFlashPromotionSession; 8 | import io.swagger.v3.oas.annotations.media.Schema; 9 | 10 | public class FlashPromotionSession extends SmsFlashPromotionSession { 11 | @Schema(description = "商品数量") 12 | private Long productCount; 13 | 14 | public Long getProductCount() { 15 | return productCount; 16 | } 17 | 18 | public void setProductCount(Long productCount) { 19 | this.productCount = productCount; 20 | } 21 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/sms/dao/FlashPromotionProductRelationDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.sms.dao; 6 | 7 | import com.mall.sms.dto.FlashPromotionProduct; 8 | 9 | import java.util.List; 10 | import org.apache.ibatis.annotations.Param; 11 | 12 | public interface FlashPromotionProductRelationDao { 13 | List getList( 14 | @Param("flashPromotionId") Long flashPromotionId, 15 | @Param("flashPromotionSessionId") Long flashPromotionSessionId, 16 | @Param("offset") int offset, 17 | @Param("limit") int limit); 18 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/dao/CouponHistoryDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.dao; 6 | 7 | import com.mall.domain.CouponHistoryDetail; 8 | import com.mall.model.SmsCoupon; 9 | import org.apache.ibatis.annotations.Param; 10 | 11 | import java.util.List; 12 | 13 | public interface CouponHistoryDao { 14 | /** 15 | * 获取优惠券历史详情 16 | */ 17 | List getDetailList(@Param("memberId") Long memberId); 18 | /** 19 | * 获取指定会员优惠券列表 20 | */ 21 | List getCouponList(@Param("memberId") Long memberId, @Param("useStatus")Integer useStatus); 22 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/sms/service/FlashPromotionService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.sms.service; 6 | 7 | import com.mall.model.SmsFlashPromotion; 8 | import java.util.List; 9 | 10 | public interface FlashPromotionService { 11 | 12 | void create(SmsFlashPromotion flashPromotion); 13 | 14 | void update(Long id, SmsFlashPromotion flashPromotion); 15 | 16 | void delete(Long id); 17 | 18 | void updateStatus(Long id, Integer status); 19 | 20 | SmsFlashPromotion get(Long id); 21 | 22 | List list(String keyword, int pageIndex, int pageSize); 23 | } -------------------------------------------------------------------------------- /mall-jdbc/src/main/java/com/mall/jdbc/JdbcRouterHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.jdbc; 6 | 7 | import org.springframework.util.Assert; 8 | 9 | public class JdbcRouterHolder { 10 | private static final ThreadLocal holder = new ThreadLocal<>(); 11 | 12 | public static JdbcRouter get() { 13 | return holder.get(); 14 | } 15 | 16 | public static void set(JdbcRouter router) { 17 | Assert.notNull(router, "router cannot be null"); 18 | 19 | holder.set(router); 20 | } 21 | 22 | public static void clear() { 23 | holder.remove(); 24 | } 25 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/util/Nonce.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.util; 6 | 7 | import java.security.SecureRandom; 8 | 9 | public interface Nonce { 10 | String SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 11 | SecureRandom RANDOM = new SecureRandom(); 12 | 13 | static String generate() { 14 | char[] chars = new char[32]; 15 | for (int index = 0; index < chars.length; ++index) { 16 | chars[index] = SYMBOLS.charAt(RANDOM.nextInt(SYMBOLS.length())); 17 | } 18 | return new String(chars); 19 | } 20 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/sms/service/HomeAdvertiseService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.sms.service; 6 | 7 | import com.mall.model.SmsHomeAdvertise; 8 | import java.util.List; 9 | 10 | public interface HomeAdvertiseService { 11 | 12 | List list(String name, Integer type, String endTime, int pageIndex, int pageSize); 13 | 14 | void create(SmsHomeAdvertise advertise); 15 | 16 | void update(long id, SmsHomeAdvertise advertise); 17 | 18 | void delete(List ids); 19 | 20 | void updateStatus(long id, Integer status); 21 | 22 | SmsHomeAdvertise get(Long id); 23 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/sms/dto/FlashPromotionProduct.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.sms.dto; 6 | 7 | import com.mall.model.PmsProduct; 8 | import com.mall.model.SmsFlashPromotionProductRelation; 9 | import io.swagger.v3.oas.annotations.media.Schema; 10 | 11 | public class FlashPromotionProduct extends SmsFlashPromotionProductRelation { 12 | @Schema(description = "关联商品") 13 | private PmsProduct product; 14 | 15 | public PmsProduct getProduct() { 16 | return product; 17 | } 18 | 19 | public void setProduct(PmsProduct product) { 20 | this.product = product; 21 | } 22 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/domain/OrderDetail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.domain; 6 | 7 | import com.mall.model.OmsOrder; 8 | import com.mall.model.OmsOrderItem; 9 | import io.swagger.v3.oas.annotations.media.Schema; 10 | import java.util.List; 11 | 12 | public class OrderDetail extends OmsOrder { 13 | @Schema(description = "订单项") 14 | private List orderItems; 15 | 16 | public List getOrderItems() { 17 | return orderItems; 18 | } 19 | 20 | public void setOrderItems(List orderItems) { 21 | this.orderItems = orderItems; 22 | } 23 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/api/TokenResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.api; 6 | 7 | public class TokenResult extends ApiResult { 8 | private String accessToken; 9 | private int expiresIn; 10 | 11 | public String getAccessToken() { 12 | return accessToken; 13 | } 14 | 15 | public void setAccessToken(String accessToken) { 16 | this.accessToken = accessToken; 17 | } 18 | 19 | public int getExpiresIn() { 20 | return expiresIn; 21 | } 22 | 23 | public void setExpiresIn(int expiresIn) { 24 | this.expiresIn = expiresIn; 25 | } 26 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/oms/dto/OrderReturnApplyResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.oms.dto; 6 | 7 | import com.mall.model.OmsCompanyAddress; 8 | import com.mall.model.OmsOrderReturnApply; 9 | import io.swagger.v3.oas.annotations.media.Schema; 10 | 11 | public class OrderReturnApplyResult extends OmsOrderReturnApply { 12 | @Schema(description = "公司收货地址") 13 | private OmsCompanyAddress address; 14 | 15 | public OmsCompanyAddress getAddress() { 16 | return address; 17 | } 18 | 19 | public void setAddress(OmsCompanyAddress address) { 20 | this.address = address; 21 | } 22 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/dto/ProductCategoryTreeDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.dto; 6 | 7 | import com.mall.model.PmsProductCategory; 8 | import io.swagger.v3.oas.annotations.media.Schema; 9 | 10 | import java.util.List; 11 | 12 | public class ProductCategoryTreeDto extends PmsProductCategory { 13 | @Schema(description = "子级分类") 14 | List children; 15 | 16 | public List getChildren() { 17 | return children; 18 | } 19 | 20 | public void setChildren(List children) { 21 | this.children = children; 22 | } 23 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/validation/Flags.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.validation; 6 | 7 | import javax.validation.Constraint; 8 | import javax.validation.Payload; 9 | import java.lang.annotation.*; 10 | 11 | @Documented 12 | @Retention(RetentionPolicy.RUNTIME) 13 | @Target({ElementType.FIELD,ElementType.PARAMETER}) 14 | @Constraint(validatedBy = FlagsValidator.class) 15 | public @interface Flags { 16 | int[] value() default {}; 17 | 18 | String message() default "flags is not found"; 19 | 20 | Class[] groups() default {}; 21 | 22 | Class[] payload() default {}; 23 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/pay/PayerAmount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.pay; 6 | 7 | public class PayerAmount extends Amount { 8 | private long payerTotal; 9 | private String payerCurrency; 10 | 11 | public long getPayerTotal() { 12 | return payerTotal; 13 | } 14 | 15 | public void setPayerTotal(long payerTotal) { 16 | this.payerTotal = payerTotal; 17 | } 18 | 19 | public String getPayerCurrency() { 20 | return payerCurrency; 21 | } 22 | 23 | public void setPayerCurrency(String payerCurrency) { 24 | this.payerCurrency = payerCurrency; 25 | } 26 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/oms/dao/OrderReturnDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.oms.dao; 6 | 7 | import com.mall.oms.dto.OrderReturnApplyResult; 8 | import com.mall.oms.dto.ReturnApplyQueryParam; 9 | import com.mall.model.OmsOrderReturnApply; 10 | 11 | import java.util.List; 12 | import org.apache.ibatis.annotations.Param; 13 | 14 | public interface OrderReturnDao { 15 | List listApply( 16 | @Param("param") ReturnApplyQueryParam queryParam, 17 | @Param("offset") int offset, 18 | @Param("limit") int limit); 19 | 20 | OrderReturnApplyResult getApplyDetail(@Param("id") Long id); 21 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/dao/ProductPriceDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.dao; 6 | 7 | import com.mall.model.PmsMemberPrice; 8 | import com.mall.model.PmsProductFullReduction; 9 | import com.mall.model.PmsProductLadder; 10 | import org.apache.ibatis.annotations.Param; 11 | 12 | import java.util.List; 13 | 14 | public interface ProductPriceDao { 15 | int insertMemberPrices(@Param("list") List memberPrices); 16 | 17 | int insertLadderPrices(@Param("list") List productLadders); 18 | 19 | int insertFullReductionPrices(@Param("list") List productFullReductionList); 20 | } -------------------------------------------------------------------------------- /mall-crosscut/src/test/java/com/mall/crosscut/util/AssertTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.util; 6 | 7 | import com.mall.crosscut.exception.ApiException; 8 | import com.mall.crosscut.standard.StandardCode; 9 | import org.junit.jupiter.api.Test; 10 | 11 | import static org.junit.jupiter.api.Assertions.assertThrows; 12 | 13 | class AssertTest { 14 | 15 | @Test 16 | void failure() { 17 | assertThrows(ApiException.class, () -> Assert.failure(StandardCode.AJAX_REDIRECT)); 18 | } 19 | 20 | @Test 21 | void ensure() { 22 | assertThrows(ApiException.class, () -> Assert.ensure(() -> false, "failure")); 23 | } 24 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/oms/dao/OrderDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.oms.dao; 6 | 7 | import com.mall.oms.dto.OrderDetail; 8 | import com.mall.oms.dto.OrderQueryParam; 9 | import com.mall.model.OmsOrder; 10 | import com.mall.oms.dto.OrderDeliveryParam; 11 | 12 | import java.util.List; 13 | import org.apache.ibatis.annotations.Param; 14 | 15 | public interface OrderDao { 16 | List getList(@Param("param") OrderQueryParam queryParam, @Param("offset") int offset, @Param("limit") int limit); 17 | 18 | int delivery(@Param("list") List deliveryParams); 19 | 20 | OrderDetail getDetail(@Param("id") Long id); 21 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/sms/service/HomeBrandService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.sms.service; 6 | 7 | import com.mall.model.SmsHomeBrand; 8 | import java.util.List; 9 | import org.springframework.transaction.annotation.Transactional; 10 | 11 | public interface HomeBrandService { 12 | 13 | List list(String brandName, Integer recommendStatus, int pageIndex, int pageSize); 14 | @Transactional 15 | void create(List homeBrands); 16 | 17 | void updateSort(long id, Integer sort); 18 | 19 | void updateRecommendStatus(List ids, Integer recommendStatus); 20 | 21 | void delete(List ids); 22 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/domain/MinioUploadDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.domain; 6 | 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | 9 | public class MinioUploadDto { 10 | @Schema(description = "文件访问URL") 11 | private String url; 12 | @Schema(description = "文件名称") 13 | private String name; 14 | 15 | public String getUrl() { 16 | return url; 17 | } 18 | 19 | public void setUrl(String url) { 20 | this.url = url; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public void setName(String name) { 28 | this.name = name; 29 | } 30 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/dto/MinioUploadDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.dto; 6 | 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | 9 | public class MinioUploadDto { 10 | @Schema(description = "文件访问URL") 11 | private String url; 12 | @Schema(description = "文件名称") 13 | private String name; 14 | 15 | public String getUrl() { 16 | return url; 17 | } 18 | 19 | public void setUrl(String url) { 20 | this.url = url; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public void setName(String name) { 28 | this.name = name; 29 | } 30 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/service/ProductAttributeCategoryService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.service; 6 | 7 | import com.mall.model.PmsProductAttributeCategory; 8 | import com.mall.pms.dto.ProductAttributeCategoryDto; 9 | 10 | import java.util.List; 11 | 12 | public interface ProductAttributeCategoryService { 13 | void create(String name); 14 | 15 | void update(Long id, String name); 16 | 17 | void delete(Long id); 18 | 19 | PmsProductAttributeCategory get(Long id); 20 | 21 | List getList(int pageIndex, int pageSize); 22 | 23 | List listWithAttributes(); 24 | } -------------------------------------------------------------------------------- /mall-security/src/test/java/com/mall/security/conf/PasswordEncoderTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.security.conf; 6 | 7 | import org.junit.jupiter.api.Assertions; 8 | import org.junit.jupiter.api.Test; 9 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 10 | import org.springframework.security.crypto.password.PasswordEncoder; 11 | 12 | class PasswordEncoderTest { 13 | @Test 14 | void passwordEncode() { 15 | PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); 16 | String encode = passwordEncoder.encode("p@ssword"); 17 | Assertions.assertTrue(passwordEncoder.matches("p@ssword", encode)); 18 | } 19 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/sms/service/HomeNewProductService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.sms.service; 6 | 7 | import com.mall.model.SmsHomeNewProduct; 8 | import java.util.List; 9 | import org.springframework.transaction.annotation.Transactional; 10 | 11 | public interface HomeNewProductService { 12 | @Transactional 13 | void create(List homeNewProducts); 14 | 15 | List list(String productName, Integer recommendStatus, int pageIndex, int pageSize); 16 | 17 | void updateSort(long id, Integer sort); 18 | 19 | void updateRecommendStatus(List ids, Integer recommendStatus); 20 | 21 | void delete(List ids); 22 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/ums/service/AdminService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.ums.service; 6 | 7 | import com.mall.ums.dto.LoginParam; 8 | import com.mall.model.UmsAdmin; 9 | import com.mall.ums.dto.RegisterParam; 10 | import com.mall.ums.dto.UpdatePwdParam; 11 | import com.mall.ums.dto.LoginAdmin; 12 | import com.mall.security.core.Jwt; 13 | 14 | public interface AdminService { 15 | UmsAdmin register(RegisterParam param); 16 | 17 | Jwt login(LoginParam loginParam); 18 | 19 | Jwt refreshToken(String token); 20 | 21 | void updatePassword(UpdatePwdParam updatePwdParam); 22 | 23 | UmsAdmin getByUsername(String username); 24 | 25 | LoginAdmin getLoginAdmin(); 26 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/CartItemService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service; 6 | 7 | import com.mall.domain.CartProduct; 8 | import com.mall.domain.PromotionCartItem; 9 | import com.mall.model.OmsCartItem; 10 | 11 | import java.util.List; 12 | 13 | public interface CartItemService { 14 | void add(OmsCartItem cartItem); 15 | 16 | List list(); 17 | 18 | List listPromotion(List cartIds); 19 | 20 | void updateQuantity(long id, int quantity); 21 | 22 | CartProduct getCartProduct(long productId); 23 | 24 | void updateAttribute(OmsCartItem cartItem); 25 | 26 | void delete(List ids); 27 | 28 | void clear(); 29 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/sms/service/HomeRecommendSubjectService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.sms.service; 6 | 7 | import com.mall.model.SmsHomeRecommendSubject; 8 | import java.util.List; 9 | import org.springframework.transaction.annotation.Transactional; 10 | 11 | public interface HomeRecommendSubjectService { 12 | @Transactional 13 | void create(List recommendSubjects); 14 | 15 | void updateSort(Long id, Integer sort); 16 | 17 | void delete(List ids); 18 | 19 | void updateRecommendStatus(List ids, Integer recommendStatus); 20 | 21 | List list(String subjectName, Integer recommendStatus, int pageIndex, int pageSize); 22 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/resources/com/mall/pms/dao/ProductCategoryAttributeRelationDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | INSERT INTO pms_product_category_attribute_relation (category_id, attribute_id) VALUES 11 | 12 | (#{item.categoryId,jdbcType=BIGINT}, 13 | #{item.attributeId,jdbcType=BIGINT}) 14 | 15 | 16 | -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/domain/CartOrder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.domain; 6 | 7 | import com.mall.model.OmsOrder; 8 | import com.mall.model.OmsOrderItem; 9 | 10 | import java.util.List; 11 | 12 | public class CartOrder { 13 | private OmsOrder order; 14 | private List orderItems; 15 | 16 | public OmsOrder getOrder() { 17 | return order; 18 | } 19 | 20 | public void setOrder(OmsOrder order) { 21 | this.order = order; 22 | } 23 | 24 | public List getOrderItems() { 25 | return orderItems; 26 | } 27 | 28 | public void setOrderItems(List orderItems) { 29 | this.orderItems = orderItems; 30 | } 31 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/dto/ProductAttributeCategoryDto.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.dto; 6 | 7 | import com.mall.model.PmsProductAttribute; 8 | import com.mall.model.PmsProductAttributeCategory; 9 | import io.swagger.v3.oas.annotations.media.Schema; 10 | 11 | import java.util.List; 12 | 13 | public class ProductAttributeCategoryDto extends PmsProductAttributeCategory { 14 | @Schema(description = "商品属性列表") 15 | private List attributes; 16 | 17 | public List getAttributes() { 18 | return attributes; 19 | } 20 | 21 | public void setAttributes(List attributes) { 22 | this.attributes = attributes; 23 | } 24 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/sms/service/HomeRecommendProductService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.sms.service; 6 | 7 | import com.mall.model.SmsHomeRecommendProduct; 8 | import java.util.List; 9 | import org.springframework.transaction.annotation.Transactional; 10 | 11 | public interface HomeRecommendProductService { 12 | 13 | List list(String productName, Integer recommendStatus, int pageIndex, int pageSize); 14 | 15 | void updateRecommendStatus(List ids, Integer recommendStatus); 16 | 17 | void delete(List ids); 18 | 19 | void updateSort(Long id, Integer sort); 20 | 21 | @Transactional 22 | void create(List recommendProducts); 23 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/sms/service/FlashPromotionSessionService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.sms.service; 6 | 7 | import com.mall.model.SmsFlashPromotionSession; 8 | import com.mall.sms.dto.FlashPromotionSession; 9 | import java.util.List; 10 | 11 | public interface FlashPromotionSessionService { 12 | 13 | void create(SmsFlashPromotionSession promotionSession); 14 | 15 | void update(Long id, SmsFlashPromotionSession promotionSession); 16 | 17 | void updateStatus(Long id, Integer status); 18 | 19 | void delete(Long id); 20 | 21 | SmsFlashPromotionSession get(Long id); 22 | 23 | List list(); 24 | 25 | List list(Long flashPromotionId); 26 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/OrderReturnService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service; 6 | 7 | import com.mall.domain.ExpressParam; 8 | import com.mall.domain.OrderReturnApplyParam; 9 | import com.mall.domain.OrderReturnDetail; 10 | import com.mall.model.OmsOrderReturnReason; 11 | import java.util.List; 12 | import javax.validation.Valid; 13 | import org.springframework.transaction.annotation.Transactional; 14 | 15 | public interface OrderReturnService { 16 | @Transactional 17 | void apply(OrderReturnApplyParam returnApplyParam); 18 | 19 | List getReasons(); 20 | 21 | OrderReturnDetail detail(long id); 22 | 23 | void setReturnExpress(long id, @Valid ExpressParam param); 24 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/impl/HistoryServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service.impl; 6 | 7 | import com.mall.domain.History; 8 | import com.mall.service.HistoryService; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.List; 12 | 13 | @Service 14 | public class HistoryServiceImpl implements HistoryService { 15 | @Override 16 | public void create(History history) { 17 | 18 | } 19 | 20 | @Override 21 | public void delete(List ids) { 22 | 23 | } 24 | 25 | @Override 26 | public void clear() { 27 | 28 | } 29 | 30 | @Override 31 | public List list(int pageIndex, int pageSize) { 32 | return null; 33 | } 34 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/OrderKind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall; 6 | 7 | public enum OrderKind { 8 | /** 9 | * 正常订单 10 | */ 11 | NORMAL(0), 12 | /** 13 | * 秒杀订单 14 | */ 15 | FLASH(1); 16 | 17 | private final int code; 18 | 19 | OrderKind(int code) { 20 | this.code = code; 21 | } 22 | 23 | public int getCode() { 24 | return code; 25 | } 26 | 27 | public static OrderKind valueOf(int code) { 28 | for (OrderKind v : values()) { 29 | if (v.getCode() == code) { 30 | return v; 31 | } 32 | } 33 | 34 | throw new IllegalArgumentException("code: " + code + " undefined in OrderKind"); 35 | } 36 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/ReturnStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall; 6 | 7 | public enum ReturnStatus { 8 | // 0->待处理;1->退货中;2->已完成;3->已拒绝 9 | APPLY(0), RETURNING(1), FINISHED(2), REFUSED(3); 10 | 11 | private final int status; 12 | 13 | ReturnStatus(int status) { 14 | this.status = status; 15 | } 16 | 17 | public int getStatus() { 18 | return status; 19 | } 20 | 21 | public static ReturnStatus valueOf(int status) { 22 | for (ReturnStatus v : values()) { 23 | if (v.getStatus() == status) { 24 | return v; 25 | } 26 | } 27 | 28 | throw new IllegalArgumentException("status: " + status + " undefined in OrderStatus"); 29 | } 30 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/dto/ProductAttribute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.dto; 6 | 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | 9 | public class ProductAttribute { 10 | @Schema(description = "商品属性ID") 11 | private Long attributeId; 12 | @Schema(description = "商品属性分类ID") 13 | private Long categoryId; 14 | 15 | public Long getAttributeId() { 16 | return attributeId; 17 | } 18 | 19 | public void setAttributeId(Long attributeId) { 20 | this.attributeId = attributeId; 21 | } 22 | 23 | public Long getCategoryId() { 24 | return categoryId; 25 | } 26 | 27 | public void setCategoryId(Long categoryId) { 28 | this.categoryId = categoryId; 29 | } 30 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/conf/EnableCrosscut.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.conf; 6 | 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.context.annotation.Import; 9 | 10 | import java.lang.annotation.*; 11 | 12 | @Retention(value = RetentionPolicy.RUNTIME) 13 | @Target(value = ElementType.TYPE) 14 | @Documented 15 | @Import({CrosscutConfiguration.class, PropertiesConfiguration.class}) 16 | @Configuration 17 | public @interface EnableCrosscut { 18 | String corsPathPattern() default "/api/**"; 19 | 20 | String deployRoot() default "deployRoot"; 21 | 22 | String[] apiResultDisabledURI() default {}; 23 | 24 | String datePattern() default "yyyy-MM-dd HH:mm:ss"; 25 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/validation/FlagsValidator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.validation; 6 | 7 | import javax.validation.ConstraintValidator; 8 | import javax.validation.ConstraintValidatorContext; 9 | 10 | public class FlagsValidator implements ConstraintValidator { 11 | private int[] values; 12 | 13 | @Override 14 | public void initialize(Flags flags) { 15 | this.values = flags.value(); 16 | } 17 | 18 | @Override 19 | public boolean isValid(Integer value, ConstraintValidatorContext context) { 20 | for (int v : values) { 21 | if (value == v) { 22 | return true; 23 | } 24 | } 25 | 26 | return false; 27 | } 28 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/dao/ProductDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.dao; 6 | 7 | import com.mall.domain.CartProduct; 8 | import com.mall.domain.PromotionProduct; 9 | import com.mall.model.SmsCoupon; 10 | import org.apache.ibatis.annotations.Param; 11 | 12 | import java.util.List; 13 | 14 | public interface ProductDao { 15 | /** 16 | * 获取购物车商品信息 17 | */ 18 | CartProduct getCartProduct(@Param("id") Long id); 19 | 20 | /** 21 | * 获取促销商品信息列表 22 | */ 23 | List getPromotionProductList(@Param("ids") List ids); 24 | 25 | /** 26 | * 获取可用优惠券列表 27 | */ 28 | List getAvailableCouponList(@Param("productId")Long id, @Param("productCategoryId")Long productCategoryId); 29 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/pay/Amount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.pay; 6 | 7 | public class Amount { 8 | private long total; 9 | private String currency; 10 | 11 | public static Amount CNY(long total) { 12 | Amount amount = new Amount(); 13 | amount.setTotal(total); 14 | amount.setCurrency("CNY"); 15 | return amount; 16 | } 17 | 18 | public long getTotal() { 19 | return total; 20 | } 21 | 22 | public void setTotal(long total) { 23 | this.total = total; 24 | } 25 | 26 | public String getCurrency() { 27 | return currency; 28 | } 29 | 30 | public void setCurrency(String currency) { 31 | this.currency = currency; 32 | } 33 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/CouponService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service; 6 | 7 | import com.mall.domain.CouponHistoryDetail; 8 | import com.mall.domain.PromotionCartItem; 9 | import com.mall.model.SmsCoupon; 10 | import com.mall.model.SmsCouponHistory; 11 | import org.springframework.transaction.annotation.Transactional; 12 | 13 | import java.util.List; 14 | 15 | public interface CouponService { 16 | @Transactional 17 | void add(long couponId); 18 | 19 | List history(Integer useStatus); 20 | 21 | List list(Integer useStatus); 22 | 23 | List listCart(List promotionCartItems, int type); 24 | 25 | List listByProduct(Long productId); 26 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/HomeService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service; 6 | 7 | import com.mall.domain.HomeContent; 8 | import com.mall.model.CmsSubject; 9 | import com.mall.model.PmsProduct; 10 | import com.mall.model.PmsProductCategory; 11 | 12 | import java.util.List; 13 | 14 | public interface HomeService { 15 | HomeContent content(); 16 | 17 | List recommendProductList(int pageIndex, int pageSize); 18 | 19 | List getProductCateList(long parentId); 20 | 21 | List getSubjectList(Long categoryId, int pageIndex, int pageSize); 22 | 23 | List hotProductList(int pageIndex, int pageSize); 24 | 25 | List newProductList(int pageIndex, int pageSize); 26 | } -------------------------------------------------------------------------------- /mall-security/src/main/java/com/mall/security/core/Jwt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.security.core; 6 | 7 | public class Jwt { 8 | private String token; 9 | private int expiresIn; 10 | 11 | public String getToken() { 12 | return token; 13 | } 14 | 15 | public void setToken(String token) { 16 | this.token = token; 17 | } 18 | 19 | public int getExpiresIn() { 20 | return expiresIn; 21 | } 22 | 23 | public void setExpiresIn(int expiresIn) { 24 | this.expiresIn = expiresIn; 25 | } 26 | 27 | public static Jwt valueOf(String token, int expiresIn) { 28 | Jwt jwt = new Jwt(); 29 | jwt.setToken(token); 30 | jwt.setExpiresIn(expiresIn); 31 | return jwt; 32 | } 33 | } -------------------------------------------------------------------------------- /mall-security/src/main/java/com/mall/security/jwt/JwtAuthenticationSuccessHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.security.jwt; 6 | 7 | import org.springframework.security.core.Authentication; 8 | import org.springframework.security.web.authentication.AuthenticationSuccessHandler; 9 | 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | 13 | public class JwtAuthenticationSuccessHandler implements AuthenticationSuccessHandler { 14 | @Override 15 | public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) { 16 | // We do not need to do anything extra on REST authentication success, because there is no page to redirect to 17 | } 18 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/resources/com/mall/oms/dao/OrderOperateHistoryDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | INSERT INTO oms_order_operate_history (order_id, operate_man, create_time, order_status, note) VALUES 10 | 11 | (#{item.orderId}, 12 | #{item.operateMan}, 13 | #{item.createTime,jdbcType=TIMESTAMP}, 14 | #{item.orderStatus}, 15 | #{item.note}) 16 | 17 | 18 | -------------------------------------------------------------------------------- /mall-admin-api/src/main/resources/com/mall/sms/dao/CouponProductRelationDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | INSERT INTO sms_coupon_product_relation (product_id,product_name,product_sn,coupon_id) VALUES 10 | 11 | (#{item.productId,jdbcType=BIGINT}, 12 | #{item.productName,jdbcType=VARCHAR}, 13 | #{item.productSn,jdbcType=VARCHAR}, 14 | #{item.couponId,jdbcType=INTEGER}) 15 | 16 | 17 | -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/excel/util/ObjectUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.excel.util; 6 | 7 | import java.util.Collection; 8 | 9 | public interface ObjectUtil { 10 | 11 | static boolean isEmpty(Collection collection) { 12 | return (collection == null || collection.isEmpty()); 13 | } 14 | 15 | static boolean hasText(String str) { 16 | return (str != null && !str.isEmpty() && containsText(str)); 17 | } 18 | 19 | static boolean containsText(CharSequence str) { 20 | int strLen = str.length(); 21 | for (int i = 0; i < strLen; i++) { 22 | if (!Character.isWhitespace(str.charAt(i))) { 23 | return true; 24 | } 25 | } 26 | return false; 27 | } 28 | } -------------------------------------------------------------------------------- /mall-mini-api/src/test/java/com/mall/wechat/util/JsonTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.util; 6 | 7 | import static org.junit.jupiter.api.Assertions.*; 8 | 9 | import com.mall.wechat.api.TokenResult; 10 | import org.junit.jupiter.api.Test; 11 | 12 | class JsonTest { 13 | 14 | @Test 15 | void deserialize() { 16 | String json = "{\n" 17 | + " \"access_token\": \"access token\",\n" 18 | + " \"expires_in\": 1000,\n" 19 | + " \"errcode\": 0,\n" 20 | + " \"errmsg\": \"\"\n" 21 | + "}"; 22 | TokenResult result = Json.deserialize(json, TokenResult.class); 23 | assertNotNull(result); 24 | assertEquals("access token", result.getAccessToken()); 25 | } 26 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/PayKind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall; 6 | 7 | public enum PayKind { 8 | /** 9 | * 未支付 10 | */ 11 | UNPAID(0), 12 | /** 13 | * 支付宝 14 | */ 15 | ALIPAY(1), 16 | /** 17 | * 微信 18 | */ 19 | WECHAT(2); 20 | 21 | private final int code; 22 | 23 | PayKind(int code) { 24 | this.code = code; 25 | } 26 | 27 | public int getCode() { 28 | return code; 29 | } 30 | 31 | public static PayKind valueOf(int code) { 32 | for (PayKind v : values()) { 33 | if (v.getCode() == code) { 34 | return v; 35 | } 36 | } 37 | 38 | throw new IllegalArgumentException("code: " + code + " undefined in PayKind"); 39 | } 40 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/ums/dao/AuthDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.ums.dao; 6 | 7 | import com.mall.model.UmsMenu; 8 | import com.mall.model.UmsResource; 9 | import com.mall.model.UmsRole; 10 | import org.apache.ibatis.annotations.Param; 11 | 12 | import java.util.List; 13 | 14 | public interface AuthDao { 15 | /** 16 | * 获取用于所有角色 17 | */ 18 | List getRoles(@Param("adminId") Long adminId); 19 | 20 | /** 21 | * 根据后台用户ID获取菜单 22 | */ 23 | List getMenus(@Param("adminId") Long adminId); 24 | /** 25 | * 根据角色ID获取菜单 26 | */ 27 | List getMenusByRoleId(@Param("roleId") Long roleId); 28 | /** 29 | * 根据角色ID获取资源 30 | */ 31 | List getResourcesByRoleId(@Param("roleId") Long roleId); 32 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/validation/EnsureChecked.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.validation; 6 | 7 | import javax.validation.Constraint; 8 | import javax.validation.Payload; 9 | import java.lang.annotation.*; 10 | 11 | @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER}) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | @Documented 14 | @Constraint(validatedBy = { DelegatingValidatorProxy.class }) 15 | public @interface EnsureChecked { 16 | String message() default "{com.sunrise.crosscut.validation.EnsureChecked.message}"; 17 | 18 | Class[] groups() default {}; 19 | 20 | Class[] payload() default {}; 21 | 22 | boolean isNullable() default false; 23 | 24 | Class> checkBy(); 25 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/api/SessionResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.api; 6 | 7 | public class SessionResult extends ApiResult { 8 | private String openid; 9 | private String sessionKey; 10 | private String unionid; 11 | 12 | public String getOpenid() { 13 | return openid; 14 | } 15 | 16 | public void setOpenid(String openid) { 17 | this.openid = openid; 18 | } 19 | 20 | public String getSessionKey() { 21 | return sessionKey; 22 | } 23 | 24 | public void setSessionKey(String sessionKey) { 25 | this.sessionKey = sessionKey; 26 | } 27 | 28 | public String getUnionid() { 29 | return unionid; 30 | } 31 | 32 | public void setUnionid(String unionid) { 33 | this.unionid = unionid; 34 | } 35 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/sms/service/CouponService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.sms.service; 6 | 7 | import com.mall.model.SmsCoupon; 8 | import com.mall.model.SmsCouponHistory; 9 | import com.mall.sms.dto.CouponParam; 10 | import java.util.List; 11 | import org.springframework.transaction.annotation.Transactional; 12 | 13 | public interface CouponService { 14 | @Transactional 15 | void create(CouponParam couponParam); 16 | @Transactional 17 | void delete(Long id); 18 | @Transactional 19 | void update(long id, CouponParam couponParam); 20 | 21 | List list(String name, Integer type, int pageIndex, int pageSize); 22 | 23 | CouponParam get(Long id); 24 | 25 | List history(Long couponId, Integer useStatus, String orderSn, int pageIndex, int pageSize); 26 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/service/BrandService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.service; 6 | 7 | import com.mall.model.PmsBrand; 8 | import com.mall.pms.dto.BrandDto; 9 | import org.springframework.transaction.annotation.Transactional; 10 | 11 | import java.util.List; 12 | 13 | public interface BrandService { 14 | List listAll(); 15 | 16 | List pagedList(String keyword, int pageIndex, int pageSize); 17 | 18 | void create(BrandDto brandDto); 19 | 20 | @Transactional 21 | void update(long id, BrandDto brandDto); 22 | 23 | void delete(long id); 24 | 25 | PmsBrand getOne(long id); 26 | 27 | void delete(List ids); 28 | 29 | void updateShowStatus(List ids, int showStatus); 30 | 31 | void updateFactoryStatus(List ids, int factoryStatus); 32 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/ums/dto/LoginParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.ums.dto; 6 | 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | 9 | import javax.validation.constraints.NotEmpty; 10 | 11 | public class LoginParam { 12 | @NotEmpty 13 | @Schema(description = "用户名", required = true) 14 | private String username; 15 | @NotEmpty 16 | @Schema(description = "密码", required = true) 17 | private String password; 18 | 19 | public String getUsername() { 20 | return username; 21 | } 22 | 23 | public void setUsername(String username) { 24 | this.username = username; 25 | } 26 | 27 | public String getPassword() { 28 | return password; 29 | } 30 | 31 | public void setPassword(String password) { 32 | this.password = password; 33 | } 34 | } -------------------------------------------------------------------------------- /mall-express/src/main/java/com/mall/express/core/HttpClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.express.core; 6 | 7 | import com.mall.express.request.BaseRequest; 8 | 9 | public class HttpClient { 10 | private int connectTimeout = 3000; 11 | 12 | private int socketTimeout = 3000; 13 | 14 | public void setTimeOut(int connectTimeout, int socketTimeout) { 15 | this.connectTimeout = connectTimeout; 16 | this.socketTimeout = socketTimeout; 17 | } 18 | 19 | public int getConnectTimeout() { 20 | return connectTimeout; 21 | } 22 | 23 | public int getSocketTimeout() { 24 | return socketTimeout; 25 | } 26 | 27 | public HttpResult execute(BaseRequest request) throws Exception { 28 | return HttpUtil.doPost(request.getUrl(), request, connectTimeout, socketTimeout); 29 | } 30 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/CouponUsage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall; 6 | 7 | public enum CouponUsage { 8 | /** 9 | * 全场通用 10 | */ 11 | ALL_POWERFUL(0), 12 | /** 13 | * 指定分类 14 | */ 15 | SPECIFIED_CATEGORY(1), 16 | /** 17 | * 指定商品 18 | */ 19 | SPECIFIED_PRODUCT(2); 20 | 21 | private final int type; 22 | 23 | CouponUsage(int type) { 24 | this.type = type; 25 | } 26 | 27 | public int getType() { 28 | return type; 29 | } 30 | 31 | public static CouponUsage valueOf(int type) { 32 | for (CouponUsage v : values()) { 33 | if (v.getType() == type) { 34 | return v; 35 | } 36 | } 37 | 38 | throw new IllegalArgumentException("type: " + type + " not defined byte CouponUsage"); 39 | } 40 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/domain/ExpressParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.domain; 6 | 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | import javax.validation.constraints.NotEmpty; 9 | 10 | public class ExpressParam { 11 | @NotEmpty 12 | @Schema(description = "快递公司编号") 13 | private String deliveryCode; 14 | @NotEmpty 15 | @Schema(description = "快递单号") 16 | private String deliverySn; 17 | 18 | public String getDeliveryCode() { 19 | return deliveryCode; 20 | } 21 | 22 | public void setDeliveryCode(String deliveryCode) { 23 | this.deliveryCode = deliveryCode; 24 | } 25 | 26 | public String getDeliverySn() { 27 | return deliverySn; 28 | } 29 | 30 | public void setDeliverySn(String deliverySn) { 31 | this.deliverySn = deliverySn; 32 | } 33 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/ums/service/impl/AuthServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.ums.service.impl; 6 | 7 | import com.mall.ums.service.AuthService; 8 | import com.mall.model.UmsMenu; 9 | import com.mall.model.UmsRole; 10 | import com.mall.ums.dao.AuthDao; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.List; 14 | 15 | @Service 16 | public class AuthServiceImpl implements AuthService { 17 | private final AuthDao authDao; 18 | 19 | public AuthServiceImpl(AuthDao authDao) { 20 | this.authDao = authDao; 21 | } 22 | 23 | @Override 24 | public List getMenus(Long adminId) { 25 | return authDao.getMenus(adminId); 26 | } 27 | 28 | @Override 29 | public List getRoles(Long adminId) { 30 | return authDao.getRoles(adminId); 31 | } 32 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/util/HttpUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.util; 6 | 7 | import java.util.Optional; 8 | import javax.servlet.http.HttpServletRequest; 9 | import org.springframework.web.context.request.RequestContextHolder; 10 | import org.springframework.web.context.request.ServletRequestAttributes; 11 | 12 | public interface HttpUtil { 13 | static Optional getCurrentRequest() { 14 | return Optional.ofNullable(RequestContextHolder.getRequestAttributes()) 15 | .filter(requestAttributes -> ServletRequestAttributes.class 16 | .isAssignableFrom(requestAttributes.getClass())) 17 | .map(requestAttributes -> ((ServletRequestAttributes) requestAttributes)) 18 | .map(ServletRequestAttributes::getRequest); 19 | } 20 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/resources/com/mall/sms/dao/CouponProductCategoryRelationDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | INSERT INTO sms_coupon_product_category_relation (product_category_id,product_category_name,parent_category_name,coupon_id) VALUES 10 | 11 | (#{item.productCategoryId,jdbcType=BIGINT}, 12 | #{item.productCategoryName,jdbcType=VARCHAR}, 13 | #{item.parentCategoryName,jdbcType=VARCHAR}, 14 | #{item.couponId,jdbcType=BIGINT}) 15 | 16 | 17 | -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/dto/FreightCompany.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.dto; 6 | 7 | import com.mall.crosscut.excel.annotation.Column; 8 | 9 | public class FreightCompany { 10 | @Column(index = 0) 11 | private String name; 12 | @Column(index = 1) 13 | private String code; 14 | @Column(index = 2) 15 | private String kind; 16 | 17 | public String getName() { 18 | return name; 19 | } 20 | 21 | public void setName(String name) { 22 | this.name = name; 23 | } 24 | 25 | public String getCode() { 26 | return code; 27 | } 28 | 29 | public void setCode(String code) { 30 | this.code = code; 31 | } 32 | 33 | public String getKind() { 34 | return kind; 35 | } 36 | 37 | public void setKind(String kind) { 38 | this.kind = kind; 39 | } 40 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/impl/AttentionServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service.impl; 6 | 7 | import com.mall.domain.BrandAttention; 8 | import com.mall.service.AttentionService; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.List; 12 | 13 | @Service 14 | public class AttentionServiceImpl implements AttentionService { 15 | @Override 16 | public void add(BrandAttention brandAttention) { 17 | 18 | } 19 | 20 | @Override 21 | public void delete(long brandId) { 22 | 23 | } 24 | 25 | @Override 26 | public List list(int pageIndex, int pageSize) { 27 | return null; 28 | } 29 | 30 | @Override 31 | public BrandAttention get(long brandId) { 32 | return null; 33 | } 34 | 35 | @Override 36 | public void clear() { 37 | 38 | } 39 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/service/ProductAttributeService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.service; 6 | 7 | import com.mall.model.PmsProductAttribute; 8 | import com.mall.pms.dto.ProductAttribute; 9 | import com.mall.pms.dto.ProductAttributeDto; 10 | import org.springframework.transaction.annotation.Transactional; 11 | 12 | import java.util.List; 13 | 14 | public interface ProductAttributeService { 15 | List getList(Long categoryId, Integer type, int pageIndex, int pageSize); 16 | 17 | @Transactional 18 | void create(ProductAttributeDto productAttributeDto); 19 | 20 | void update(Long id, ProductAttributeDto productAttributeDto); 21 | 22 | PmsProductAttribute get(long id); 23 | 24 | @Transactional 25 | void delete(List ids); 26 | 27 | List getAttributes(long productCategoryId); 28 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/sms/service/FlashPromotionProductRelationService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.sms.service; 6 | 7 | import com.mall.model.SmsFlashPromotionProductRelation; 8 | import com.mall.sms.dto.FlashPromotionProduct; 9 | import java.util.List; 10 | import org.springframework.transaction.annotation.Transactional; 11 | 12 | public interface FlashPromotionProductRelationService { 13 | 14 | long getCount(Long flashPromotionId, Long flashPromotionSessionId); 15 | 16 | @Transactional 17 | void create(List relations); 18 | 19 | void update(Long id, SmsFlashPromotionProductRelation relation); 20 | 21 | void delete(Long id); 22 | 23 | SmsFlashPromotionProductRelation get(Long id); 24 | 25 | List list(Long flashPromotionId, Long flashPromotionSessionId, int pageIndex, int pageSize); 26 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/impl/CollectionServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service.impl; 6 | 7 | import com.mall.domain.ProductCollection; 8 | import com.mall.service.CollectionService; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.util.List; 12 | 13 | @Service 14 | public class CollectionServiceImpl implements CollectionService { 15 | @Override 16 | public void add(ProductCollection productCollection) { 17 | 18 | } 19 | 20 | @Override 21 | public void delete(long productId) { 22 | 23 | } 24 | 25 | @Override 26 | public List list(int pageIndex, int pageSize) { 27 | return null; 28 | } 29 | 30 | @Override 31 | public ProductCollection get(long productId) { 32 | return null; 33 | } 34 | 35 | @Override 36 | public void clear() { 37 | 38 | } 39 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/validation/AbstractChecker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.validation; 6 | 7 | import javax.validation.ConstraintValidatorContext; 8 | 9 | /** 10 | * Represents an abstract checker for he specified type. 11 | * 12 | * @param The type of model should be checking. 13 | */ 14 | @CrossConstraint 15 | public abstract class AbstractChecker { 16 | public boolean isValid(T value, ConstraintValidatorContext context) { 17 | return true; 18 | } 19 | 20 | protected boolean invalid(ConstraintValidatorContext context, String parameterName, String promptMessage) { 21 | context.disableDefaultConstraintViolation(); 22 | context.buildConstraintViolationWithTemplate(promptMessage) 23 | .addPropertyNode(parameterName) 24 | .addConstraintViolation(); 25 | 26 | return false; 27 | } 28 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/api/ApiResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.api; 6 | 7 | import com.mall.crosscut.util.Assert; 8 | import com.mall.wechat.util.Json; 9 | 10 | public class ApiResult { 11 | private static final int SUCCESS_CODE = 0; 12 | 13 | private int errcode; 14 | private String errmsg; 15 | 16 | public int getErrcode() { 17 | return errcode; 18 | } 19 | 20 | public void setErrcode(int errcode) { 21 | this.errcode = errcode; 22 | } 23 | 24 | public String getErrmsg() { 25 | return errmsg; 26 | } 27 | 28 | public void setErrmsg(String errmsg) { 29 | this.errmsg = errmsg; 30 | } 31 | 32 | public boolean success() { 33 | return errcode == SUCCESS_CODE; 34 | } 35 | 36 | public void ensureSuccess() { 37 | Assert.ensure(success(), Json.serialize(this)); 38 | } 39 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall; 6 | 7 | import com.mall.crosscut.conf.EnableCrosscut; 8 | import com.mall.jdbc.EnableMyBatis; 9 | import com.mall.security.conf.EnableJwtSecurity; 10 | import org.springframework.boot.SpringApplication; 11 | import org.springframework.boot.autoconfigure.SpringBootApplication; 12 | 13 | @EnableCrosscut(apiResultDisabledURI = { "/v3/api-docs", "/v3/api-docs/swagger-config" }) 14 | @EnableMyBatis({ "com.sunrise.mall.mapper", "com.sunrise.mall.*.dao" }) 15 | @EnableJwtSecurity(permitAll = { 16 | "/api-docs", 17 | "/v3/api-docs/**", 18 | "/swagger-ui/**", 19 | "/api/admin/login", 20 | "/api/admin/register" 21 | }) 22 | @SpringBootApplication 23 | public class Application { 24 | public static void main(String[] args) { 25 | SpringApplication.run(Application.class, args); 26 | } 27 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/pay/NotifyResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.pay; 6 | 7 | public class NotifyResult { 8 | public static final NotifyResult SUCCESS = new NotifyResult("SUCCESS", "成功"); 9 | 10 | private String code; 11 | private String message; 12 | 13 | public String getCode() { 14 | return code; 15 | } 16 | 17 | public void setCode(String code) { 18 | this.code = code; 19 | } 20 | 21 | public String getMessage() { 22 | return message; 23 | } 24 | 25 | public void setMessage(String message) { 26 | this.message = message; 27 | } 28 | 29 | public NotifyResult(String code, String message) { 30 | this.code = code; 31 | this.message = message; 32 | } 33 | 34 | public static NotifyResult failure(String message) { 35 | return new NotifyResult("FAILURE", message); 36 | } 37 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/cms/service/impl/PreferenceAreaServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.cms.service.impl; 6 | 7 | import com.mall.cms.service.PreferenceAreaService; 8 | import com.mall.mapper.CmsPreferenceAreaMapper; 9 | import com.mall.model.CmsPreferenceArea; 10 | import java.util.List; 11 | import org.mybatis.dynamic.sql.select.SelectDSLCompleter; 12 | import org.springframework.stereotype.Service; 13 | 14 | @Service 15 | public class PreferenceAreaServiceImpl implements PreferenceAreaService { 16 | private final CmsPreferenceAreaMapper preferenceAreaMapper; 17 | 18 | public PreferenceAreaServiceImpl( 19 | CmsPreferenceAreaMapper preferenceAreaMapper) { 20 | this.preferenceAreaMapper = preferenceAreaMapper; 21 | } 22 | 23 | @Override 24 | public List listAll() { 25 | return preferenceAreaMapper.select(SelectDSLCompleter.allRows()); 26 | } 27 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2023 - 2024 yingtingxu(???). All rights reserved. 3 | # 4 | 5 | server.port=8010 6 | 7 | jdbc.master.driver-name=com.mysql.cj.jdbc.Driver 8 | jdbc.master.driver-url=jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=round&useSSL=true&serverTimezone=Asia/Shanghai 9 | jdbc.master.username=root 10 | jdbc.master.password=rig@func 11 | 12 | jdbc.slave.driver-name=com.mysql.cj.jdbc.Driver 13 | jdbc.slave.driver-url=jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=round&useSSL=true&serverTimezone=Asia/Shanghai 14 | jdbc.slave.username=root 15 | jdbc.slave.password=rig@func 16 | 17 | jwt.secret=mall-admin-secret 18 | # 24 * 60 * 60 19 | jwt.expires-in=86400 20 | 21 | # https://springdoc.org/springdoc-properties.html 22 | springdoc.swagger-ui.path=api-docs 23 | 24 | minio.endpoint=http://mio.xyting.org 25 | minio.bucket=mall 26 | minio.access-key=mall 27 | minio.secret-key=m@ll -------------------------------------------------------------------------------- /mall-express/src/main/java/com/mall/express/core/HttpResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.express.core; 6 | 7 | public class HttpResult { 8 | private int status; 9 | private String body; 10 | private String error; 11 | 12 | public HttpResult() { 13 | } 14 | 15 | public HttpResult(int status, String body, String error) { 16 | this.status = status; 17 | this.body = body; 18 | this.error = error; 19 | } 20 | 21 | public int getStatus() { 22 | return status; 23 | } 24 | 25 | public void setStatus(int status) { 26 | this.status = status; 27 | } 28 | 29 | public String getBody() { 30 | return body; 31 | } 32 | 33 | public void setBody(String body) { 34 | this.body = body; 35 | } 36 | 37 | public String getError() { 38 | return error; 39 | } 40 | 41 | public void setError(String error) { 42 | this.error = error; 43 | } 44 | } -------------------------------------------------------------------------------- /mall-security/src/main/java/com/mall/security/jwt/JwtSecurityContextRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.security.jwt; 6 | 7 | import org.springframework.security.core.context.SecurityContext; 8 | import org.springframework.security.web.context.HttpRequestResponseHolder; 9 | import org.springframework.security.web.context.SecurityContextRepository; 10 | 11 | import javax.servlet.http.HttpServletRequest; 12 | import javax.servlet.http.HttpServletResponse; 13 | 14 | public class JwtSecurityContextRepository implements SecurityContextRepository { 15 | @Override 16 | public SecurityContext loadContext(HttpRequestResponseHolder holder) { 17 | return null; 18 | } 19 | 20 | @Override 21 | public void saveContext(SecurityContext securityContext, HttpServletRequest request, HttpServletResponse response) { 22 | 23 | } 24 | 25 | @Override 26 | public boolean containsContext(HttpServletRequest request) { 27 | return false; 28 | } 29 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/service/ProductCategoryService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.service; 6 | 7 | import com.mall.model.PmsProductCategory; 8 | import com.mall.pms.dto.ProductCategoryDto; 9 | import com.mall.pms.dto.ProductCategoryTreeDto; 10 | import org.springframework.transaction.annotation.Transactional; 11 | 12 | import java.util.List; 13 | 14 | public interface ProductCategoryService { 15 | @Transactional 16 | void create(ProductCategoryDto productCategoryDto); 17 | 18 | @Transactional 19 | void update(long id, ProductCategoryDto productCategoryDto); 20 | 21 | List getList(long parentId, int pageIndex, int pageSize); 22 | 23 | PmsProductCategory getOne(long id); 24 | 25 | void delete(long id); 26 | 27 | void updateNavStatus(List ids, Integer navStatus); 28 | 29 | void updateShowStatus(List ids, Integer showStatus); 30 | 31 | List listWithChildren(); 32 | } -------------------------------------------------------------------------------- /mall-mini-api/src/test/java/com/mall/domain/SensitiveTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.domain; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 8 | import static org.junit.jupiter.api.Assertions.assertNotNull; 9 | 10 | import com.mall.crosscut.util.Json; 11 | import org.junit.jupiter.api.Test; 12 | 13 | class SensitiveTest { 14 | @Test 15 | void testDecrypt() { 16 | String json = "{\"errMsg\":\"getPhoneNumber:ok\",\"encryptedData\":\"umZmWnxGyERV6NOIbRvgUKch+94DmIBKEgY+l6wkxI4cwKx9CVQWxBsg8QMyX1Qg3755zu6JppF2iUrcpe3wRLbOk4H+4Zsd6Vvhzya0INWKwsXdt5wryCycysvJ45j7htHFqXzTHKsLDMj8IyX7JefOLnl3iiF3ZcwTln/Ep1ko/I43LT51mQhJ3nBVIc9O81yEqEVTtDhaiwbwILUaOA==\",\"iv\":\"jJBViCoWbvLXw5taQHOn/g==\"}"; 17 | SensitivePhone phone = Json.deserialize(json, SensitivePhone.class); 18 | assertNotNull(phone); 19 | assertDoesNotThrow(() -> { 20 | String raw = phone.decrypt("HyVFkGl5F5OQWJZZaNzBBg=="); 21 | }); 22 | } 23 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/dao/OrderDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.dao; 6 | 7 | import com.mall.domain.OrderDetail; 8 | import com.mall.model.OmsOrderItem; 9 | import java.util.List; 10 | import org.apache.ibatis.annotations.Param; 11 | 12 | public interface OrderDao { 13 | /** 14 | * 获取订单及下单商品详情 15 | */ 16 | OrderDetail getDetail(@Param("orderId") Long orderId); 17 | 18 | /** 19 | * 修改 pms_sku_stock表的锁定库存及真实库存 20 | */ 21 | int updateSkuStock(@Param("itemList") List orderItemList); 22 | 23 | /** 24 | * 获取超时订单 25 | * @param minute 超时时间(分) 26 | */ 27 | List getTimeOutOrders(@Param("minute") Integer minute); 28 | 29 | /** 30 | * 批量修改订单状态 31 | */ 32 | int updateOrderStatus(@Param("ids") List ids, @Param("status") Integer status); 33 | 34 | /** 35 | * 解除取消订单的库存锁定 36 | */ 37 | int releaseSkuStockLock(@Param("itemList") List orderItemList); 38 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/domain/CartProduct.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.domain; 6 | 7 | import com.mall.model.PmsProduct; 8 | import com.mall.model.PmsProductAttribute; 9 | import com.mall.model.PmsSkuStock; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * 购物车中选择规格的商品信息 15 | */ 16 | public class CartProduct extends PmsProduct { 17 | private List productAttributeList; 18 | private List skuStockList; 19 | 20 | public List getProductAttributeList() { 21 | return productAttributeList; 22 | } 23 | 24 | public void setProductAttributeList(List productAttributeList) { 25 | this.productAttributeList = productAttributeList; 26 | } 27 | 28 | public List getSkuStockList() { 29 | return skuStockList; 30 | } 31 | 32 | public void setSkuStockList(List skuStockList) { 33 | this.skuStockList = skuStockList; 34 | } 35 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/oms/dto/OrderDetail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.oms.dto; 6 | 7 | import com.mall.model.OmsOrder; 8 | import com.mall.model.OmsOrderItem; 9 | import com.mall.model.OmsOrderOperateHistory; 10 | import io.swagger.v3.oas.annotations.media.Schema; 11 | import java.util.List; 12 | 13 | public class OrderDetail extends OmsOrder { 14 | 15 | @Schema(description = "订单商品列表") 16 | private List orderItems; 17 | @Schema(description = "订单操作记录列表") 18 | private List histories; 19 | 20 | public List getOrderItems() { 21 | return orderItems; 22 | } 23 | 24 | public void setOrderItems(List orderItems) { 25 | this.orderItems = orderItems; 26 | } 27 | 28 | public List getHistories() { 29 | return histories; 30 | } 31 | 32 | public void setHistories(List histories) { 33 | this.histories = histories; 34 | } 35 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall; 6 | 7 | import com.mall.crosscut.conf.EnableCrosscut; 8 | import com.mall.jdbc.EnableMyBatis; 9 | import com.mall.security.conf.EnableJwtSecurity; 10 | import org.springframework.boot.SpringApplication; 11 | import org.springframework.boot.autoconfigure.SpringBootApplication; 12 | 13 | @EnableCrosscut(apiResultDisabledURI = { "/v3/api-docs", "/v3/api-docs/swagger-config" }, deployRoot = "deployRoot") 14 | @EnableMyBatis({ "com.sunrise.mall.mapper", "com.sunrise.mall.dao" }) 15 | @EnableJwtSecurity(permitAll = { 16 | "/api-docs", 17 | "/v3/api-docs/**", 18 | "/swagger-ui/**", 19 | "/api/member/wx/login**", 20 | "/api/wxpay/notify", 21 | "/api/product/**", 22 | "/api/brand/**", 23 | "/api/home/**" 24 | }) 25 | @SpringBootApplication 26 | public class Application { 27 | public static void main(String[] args) { 28 | SpringApplication.run(Application.class, args); 29 | } 30 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/OrderStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall; 6 | 7 | public enum OrderStatus { 8 | /** 9 | * 待付款 10 | */ 11 | UN_PAY(0), 12 | /** 13 | * 待发货 14 | */ 15 | UN_DELIVER(1), 16 | /** 17 | * 已发货 18 | */ 19 | DELIVERED(2), 20 | /** 21 | * 已完成 22 | */ 23 | FINISHED(3), 24 | /** 25 | * 已关闭 26 | */ 27 | CLOSED(4), 28 | /** 29 | * 无效订单 30 | */ 31 | INVALID(5); 32 | 33 | private final int status; 34 | 35 | OrderStatus(int status) { 36 | this.status = status; 37 | } 38 | 39 | public int getStatus() { 40 | return status; 41 | } 42 | 43 | public static OrderStatus valueOf(int status) { 44 | for (OrderStatus v : values()) { 45 | if (v.getStatus() == status) { 46 | return v; 47 | } 48 | } 49 | 50 | throw new IllegalArgumentException("status: " + status + " undefined in OrderStatus"); 51 | } 52 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/MemberService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service; 6 | 7 | import com.mall.domain.MemberLoginDto; 8 | import com.mall.domain.MemberUpdateDto; 9 | import com.mall.domain.SensitivePhone; 10 | import com.mall.domain.SensitiveMember; 11 | import com.mall.model.UmsMember; 12 | import com.mall.security.core.Jwt; 13 | 14 | public interface MemberService { 15 | /** 16 | * 根据用户名获取会员 17 | */ 18 | UmsMember getByOpenId(String openid); 19 | 20 | /** 21 | * 根据会员编号获取会员 22 | */ 23 | UmsMember getById(Long id); 24 | 25 | Jwt login(MemberLoginDto loginDto); 26 | 27 | UmsMember getCurrentMember(); 28 | 29 | Jwt refreshToken(String token); 30 | 31 | void updatePhone(long id, SensitivePhone phone); 32 | 33 | void update(long id, SensitiveMember sensitiveMember); 34 | 35 | /** 36 | * 根据会员id修改会员积分 37 | */ 38 | void updateIntegration(Long memberId, Integer integration); 39 | 40 | void update(MemberUpdateDto updateDto); 41 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/PmsAlbumPicDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import org.mybatis.dynamic.sql.SqlColumn; 9 | import org.mybatis.dynamic.sql.SqlTable; 10 | 11 | public final class PmsAlbumPicDynamicSqlSupport { 12 | public static final PmsAlbumPic pmsAlbumPic = new PmsAlbumPic(); 13 | 14 | public static final SqlColumn id = pmsAlbumPic.id; 15 | 16 | public static final SqlColumn albumId = pmsAlbumPic.albumId; 17 | 18 | public static final SqlColumn pic = pmsAlbumPic.pic; 19 | 20 | public static final class PmsAlbumPic extends SqlTable { 21 | public final SqlColumn id = column("id", JDBCType.BIGINT); 22 | 23 | public final SqlColumn albumId = column("album_id", JDBCType.BIGINT); 24 | 25 | public final SqlColumn pic = column("pic", JDBCType.VARCHAR); 26 | 27 | public PmsAlbumPic() { 28 | super("pms_album_pic"); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /mall-security/src/main/java/com/mall/security/jwt/JwtAuthenticationToken.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.security.jwt; 6 | 7 | import org.springframework.security.authentication.AbstractAuthenticationToken; 8 | import org.springframework.security.core.GrantedAuthority; 9 | import org.springframework.security.core.authority.AuthorityUtils; 10 | 11 | import java.util.Collection; 12 | 13 | public class JwtAuthenticationToken extends AbstractAuthenticationToken { 14 | private final String token; 15 | 16 | public JwtAuthenticationToken(String token) { 17 | super(AuthorityUtils.NO_AUTHORITIES); 18 | this.token = token; 19 | } 20 | 21 | public JwtAuthenticationToken(Collection authorities, String token) { 22 | super(authorities); 23 | this.token = token; 24 | } 25 | 26 | @Override 27 | public Object getCredentials() { 28 | return "N/A"; 29 | } 30 | 31 | @Override 32 | public String getPrincipal() { 33 | return token; 34 | } 35 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/mq/CancelOrderReceiver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mq; 6 | 7 | import com.mall.service.OrderService; 8 | import org.slf4j.Logger; 9 | import org.slf4j.LoggerFactory; 10 | import org.springframework.amqp.rabbit.annotation.RabbitHandler; 11 | import org.springframework.amqp.rabbit.annotation.RabbitListener; 12 | import org.springframework.stereotype.Component; 13 | 14 | /** 15 | * 取消订单消息的消费者 16 | * Created by macro on 2018/9/14. 17 | */ 18 | @Component 19 | @RabbitListener(queues = "mall.order.cancel") 20 | public class CancelOrderReceiver { 21 | private static final Logger logger = LoggerFactory.getLogger(CancelOrderReceiver.class); 22 | 23 | private final OrderService orderService; 24 | 25 | public CancelOrderReceiver(OrderService orderService) { 26 | this.orderService = orderService; 27 | } 28 | 29 | @RabbitHandler 30 | public void handle(Long orderId){ 31 | orderService.cancelOrder(orderId); 32 | logger.info("process orderId:{}",orderId); 33 | } 34 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 THALES 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/PromotionKind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall; 6 | 7 | public enum PromotionKind { 8 | /** 9 | * 没有促销使用原价 10 | */ 11 | OriginalPrice(0), 12 | /** 13 | * 使用促销价 14 | */ 15 | PromotionPrice(1), 16 | /** 17 | * 使用会员价 18 | */ 19 | MemberPrice(2), 20 | /** 21 | * 使用阶梯价格 22 | */ 23 | LadderPrice(3), 24 | /** 25 | * 使用满减价格 26 | */ 27 | FullReductionPrice(4), 28 | /** 29 | * 限时购 30 | */ 31 | LtpPrice(5); 32 | 33 | private final int code; 34 | 35 | PromotionKind(int code) { 36 | this.code = code; 37 | } 38 | 39 | public int getCode() { 40 | return code; 41 | } 42 | 43 | public static PromotionKind valueOf(int code) { 44 | for (PromotionKind pk : values()) { 45 | if (pk.getCode() == code) { 46 | return pk; 47 | } 48 | } 49 | 50 | throw new IllegalArgumentException("the code: " + code + " not defined by PromotionKind"); 51 | } 52 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/dao/ProductDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.dao; 6 | 7 | import com.mall.model.CmsPreferenceAreaProductRelation; 8 | import com.mall.model.CmsSubjectProductRelation; 9 | import com.mall.model.PmsProductAttributeValue; 10 | import com.mall.model.PmsProductVerifyRecord; 11 | import com.mall.pms.dto.ProductCategoryTreeDto; 12 | import com.mall.pms.dto.ProductEditDto; 13 | import java.util.List; 14 | import org.apache.ibatis.annotations.Param; 15 | 16 | public interface ProductDao { 17 | List selectCategoryTree(); 18 | 19 | ProductEditDto getEdit(@Param("id") Long id); 20 | 21 | int insertAttributeValues(@Param("list")List attributeValues); 22 | 23 | int insertSubjectRelation(@Param("list") List subjectProductRelations); 24 | 25 | int insertPreferenceAreaRelation(@Param("list") List preferenceAreaProductRelations); 26 | 27 | int insertVerifyRecord(@Param("list") List list); 28 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/domain/QueueEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.domain; 6 | 7 | public enum QueueEnum { 8 | /** 9 | * 消息通知队列 10 | */ 11 | QUEUE_ORDER_CANCEL("mall.order.direct", "mall.order.cancel", "mall.order.cancel"), 12 | /** 13 | * 消息通知ttl队列 14 | */ 15 | QUEUE_TTL_ORDER_CANCEL("mall.order.direct.ttl", "mall.order.cancel.ttl", "mall.order.cancel.ttl"); 16 | 17 | /** 18 | * 交换名称 19 | */ 20 | private String exchange; 21 | /** 22 | * 队列名称 23 | */ 24 | private String name; 25 | /** 26 | * 路由键 27 | */ 28 | private String routeKey; 29 | 30 | QueueEnum(String exchange, String name, String routeKey) { 31 | this.exchange = exchange; 32 | this.name = name; 33 | this.routeKey = routeKey; 34 | } 35 | 36 | public String getExchange() { 37 | return exchange; 38 | } 39 | 40 | public String getName() { 41 | return name; 42 | } 43 | 44 | public String getRouteKey() { 45 | return routeKey; 46 | } 47 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mall 2 | Mall is a set of e-commerce systems developed based on Spring Boot & MyBatis Dynamic SQL 3 | and deployed using Docker containers. 4 | 5 | The mall ecosystem includes modules or subsystems such as: 6 | - [x] Product system 7 | - [x] Order system 8 | - [x] Member system 9 | - [x] Mini-Program of WeChat 10 | - [x] Promotion system 11 | - [x] Financial system 12 | - [x] Statistics & settings 13 | - [ ] ...more... 14 | 15 | ## Admin: web front-end 16 | The front-end of the mall includes modules such as: 17 | - [x] Product recommendation, search and display 18 | - [x] Shopping cart, order process flow 19 | - [x] Member center 20 | - [x] Customer service, and help center. 21 | - [x] Statistics and settings 22 | - [x] Operation history and audit 23 | 24 | ## API: service back-end 25 | The back-end management system includes modules such as: 26 | - [x] Product RESTful API 27 | - [x] Order RESTful API 28 | - [x] Member RESTful API 29 | - [x] Promotion RESTful API 30 | - [x] WeChat Payment 31 | - [x] Permission RESTful API 32 | 33 | ## Mini-Program of WeChat 34 | Mini-Program of WeChat for product recommendation, search and display, customer register and shopping -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/util/Async.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.util; 6 | 7 | import java.util.concurrent.ExecutorService; 8 | import java.util.concurrent.Executors; 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | 12 | public interface Async { 13 | // logging into file with runAsync catalog 14 | Logger logger = LoggerFactory.getLogger("runAsync"); 15 | 16 | // cached thread pool, (will new & reclaim automatic) 17 | ExecutorService threadPool = Executors.newCachedThreadPool(); 18 | 19 | static void runAsync(Runnable action) { 20 | // ensure exception be throw 21 | threadPool.submit(() -> { 22 | try { 23 | action.run(); 24 | } catch (Throwable cause) { 25 | // logging into file 26 | logger.error(cause.getMessage(), cause); 27 | } 28 | }); 29 | } 30 | 31 | static void runAsync(Runnable action, boolean condition) { 32 | if (condition) { 33 | runAsync(action); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /mall-security/src/main/java/com/mall/security/jwt/JwtAccessDeniedHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.security.jwt; 6 | 7 | import com.mall.crosscut.standard.ApiResult; 8 | import com.mall.crosscut.util.Json; 9 | import org.springframework.security.access.AccessDeniedException; 10 | import org.springframework.security.web.access.AccessDeniedHandler; 11 | 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import java.io.IOException; 15 | 16 | public class JwtAccessDeniedHandler implements AccessDeniedHandler { 17 | @Override 18 | public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException e) throws IOException { 19 | response.setHeader("Access-Control-Allow-Origin", "*"); 20 | response.setHeader("Cache-Control","no-cache"); 21 | response.setCharacterEncoding("UTF-8"); 22 | response.setContentType("application/json"); 23 | response.getWriter().println(Json.serialize(ApiResult.forbidden(e.getMessage()))); 24 | response.getWriter().flush(); 25 | } 26 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/excel/annotation/Freeze.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.excel.annotation; 6 | 7 | import java.lang.annotation.Documented; 8 | import java.lang.annotation.ElementType; 9 | import java.lang.annotation.Inherited; 10 | import java.lang.annotation.Retention; 11 | import java.lang.annotation.RetentionPolicy; 12 | import java.lang.annotation.Target; 13 | 14 | @Target(value = ElementType.TYPE) 15 | @Retention(RetentionPolicy.RUNTIME) 16 | @Documented 17 | @Inherited 18 | public @interface Freeze { 19 | 20 | /** 21 | * the column to split 22 | * 23 | * @return the column to split 24 | */ 25 | int colSplit(); 26 | 27 | /** 28 | * the row to split 29 | * 30 | * @return the row to split 31 | */ 32 | int rowSplit(); 33 | 34 | /** 35 | * the left most column index 36 | * 37 | * @return the left most column index 38 | */ 39 | int leftMostCol(); 40 | 41 | /** 42 | * the top most row index 43 | * 44 | * @return the top most row index 45 | */ 46 | int topRow(); 47 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/oms/service/OrderService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.oms.service; 6 | 7 | import com.mall.oms.dto.OrderDetail; 8 | import com.mall.oms.dto.OrderQueryParam; 9 | import com.mall.oms.dto.ReceiverParam; 10 | import com.mall.model.OmsOrder; 11 | import com.mall.oms.dto.MoneyParam; 12 | import com.mall.oms.dto.OrderDeliveryParam; 13 | 14 | import java.util.List; 15 | import org.springframework.transaction.annotation.Transactional; 16 | 17 | public interface OrderService { 18 | 19 | List list(OrderQueryParam queryParam, int pageIndex, int pageSize); 20 | 21 | @Transactional 22 | void delivery(List deliveryParams); 23 | 24 | @Transactional 25 | void close(List ids, String note); 26 | 27 | void delete(List ids); 28 | 29 | OrderDetail detail(Long id); 30 | 31 | @Transactional 32 | void updateReceiver(ReceiverParam receiverParam); 33 | 34 | @Transactional 35 | void updateMoney(MoneyParam moneyParam); 36 | 37 | @Transactional 38 | void updateNote(Long id, String note, Integer status); 39 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/UmsRoleMenuRelationDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import org.mybatis.dynamic.sql.SqlColumn; 9 | import org.mybatis.dynamic.sql.SqlTable; 10 | 11 | public final class UmsRoleMenuRelationDynamicSqlSupport { 12 | public static final UmsRoleMenuRelation umsRoleMenuRelation = new UmsRoleMenuRelation(); 13 | 14 | public static final SqlColumn id = umsRoleMenuRelation.id; 15 | 16 | public static final SqlColumn roleId = umsRoleMenuRelation.roleId; 17 | 18 | public static final SqlColumn menuId = umsRoleMenuRelation.menuId; 19 | 20 | public static final class UmsRoleMenuRelation extends SqlTable { 21 | public final SqlColumn id = column("id", JDBCType.BIGINT); 22 | 23 | public final SqlColumn roleId = column("role_id", JDBCType.BIGINT); 24 | 25 | public final SqlColumn menuId = column("menu_id", JDBCType.BIGINT); 26 | 27 | public UmsRoleMenuRelation() { 28 | super("ums_role_menu_relation"); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/standard/StatusCode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.standard; 6 | 7 | public interface StatusCode { 8 | 9 | int getCode(); 10 | 11 | String getMessage(); 12 | 13 | static StatusCode valueOf(final int code, final String message) { 14 | return new StatusCode() { 15 | @Override 16 | public int getCode() { 17 | return code; 18 | } 19 | 20 | @Override 21 | public String getMessage() { 22 | return message; 23 | } 24 | }; 25 | } 26 | 27 | static StatusCode valueOf(final StatusCode statusCode, final String message) { 28 | if (message == null) { 29 | return statusCode; 30 | } 31 | return new StatusCode() { 32 | @Override 33 | public int getCode() { 34 | return statusCode.getCode(); 35 | } 36 | 37 | @Override 38 | public String getMessage() { 39 | return message; 40 | } 41 | }; 42 | } 43 | } -------------------------------------------------------------------------------- /mall-security/src/main/java/com/mall/security/jwt/JwtAuthenticationEntryPoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.security.jwt; 6 | 7 | import com.mall.crosscut.standard.ApiResult; 8 | import com.mall.crosscut.util.Json; 9 | import org.springframework.security.core.AuthenticationException; 10 | import org.springframework.security.web.AuthenticationEntryPoint; 11 | 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import java.io.IOException; 15 | 16 | public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint { 17 | @Override 18 | public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) throws IOException { 19 | response.setHeader("Access-Control-Allow-Origin", "*"); 20 | response.setHeader("Cache-Control","no-cache"); 21 | response.setCharacterEncoding("UTF-8"); 22 | response.setContentType("application/json"); 23 | response.getWriter().println(Json.serialize(ApiResult.unauthorized(e.getMessage()))); 24 | response.getWriter().flush(); 25 | } 26 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/excel/annotation/Filter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.excel.annotation; 6 | 7 | import java.lang.annotation.Documented; 8 | import java.lang.annotation.ElementType; 9 | import java.lang.annotation.Inherited; 10 | import java.lang.annotation.Retention; 11 | import java.lang.annotation.RetentionPolicy; 12 | import java.lang.annotation.Target; 13 | 14 | @Target(value = ElementType.TYPE) 15 | @Retention(RetentionPolicy.RUNTIME) 16 | @Documented 17 | @Inherited 18 | public @interface Filter { 19 | 20 | /** 21 | * the first row index 22 | * 23 | * @return the first row index 24 | */ 25 | int firstRow() default 0; 26 | 27 | /** 28 | * the last row index 29 | * 30 | * @return the last row index 31 | */ 32 | int lastRow() default -1; 33 | 34 | /** 35 | * the first column index 36 | * 37 | * @return the first column index 38 | */ 39 | int firstCol() default 0; 40 | 41 | /** 42 | * the last column index 43 | * 44 | * @return the last column index 45 | */ 46 | int lastCol(); 47 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/api/UserPhone.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.api; 6 | 7 | public class UserPhone { 8 | private String phoneNumber; 9 | private String purePhoneNumber; 10 | private String countryCode; 11 | private Watermark watermark; 12 | 13 | public String getPhoneNumber() { 14 | return phoneNumber; 15 | } 16 | 17 | public void setPhoneNumber(String phoneNumber) { 18 | this.phoneNumber = phoneNumber; 19 | } 20 | 21 | public String getPurePhoneNumber() { 22 | return purePhoneNumber; 23 | } 24 | 25 | public void setPurePhoneNumber(String purePhoneNumber) { 26 | this.purePhoneNumber = purePhoneNumber; 27 | } 28 | 29 | public String getCountryCode() { 30 | return countryCode; 31 | } 32 | 33 | public void setCountryCode(String countryCode) { 34 | this.countryCode = countryCode; 35 | } 36 | 37 | public Watermark getWatermark() { 38 | return watermark; 39 | } 40 | 41 | public void setWatermark(Watermark watermark) { 42 | this.watermark = watermark; 43 | } 44 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/UmsAdminRoleRelationDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import org.mybatis.dynamic.sql.SqlColumn; 9 | import org.mybatis.dynamic.sql.SqlTable; 10 | 11 | public final class UmsAdminRoleRelationDynamicSqlSupport { 12 | public static final UmsAdminRoleRelation umsAdminRoleRelation = new UmsAdminRoleRelation(); 13 | 14 | public static final SqlColumn id = umsAdminRoleRelation.id; 15 | 16 | public static final SqlColumn adminId = umsAdminRoleRelation.adminId; 17 | 18 | public static final SqlColumn roleId = umsAdminRoleRelation.roleId; 19 | 20 | public static final class UmsAdminRoleRelation extends SqlTable { 21 | public final SqlColumn id = column("id", JDBCType.BIGINT); 22 | 23 | public final SqlColumn adminId = column("admin_id", JDBCType.BIGINT); 24 | 25 | public final SqlColumn roleId = column("role_id", JDBCType.BIGINT); 26 | 27 | public UmsAdminRoleRelation() { 28 | super("ums_admin_role_relation"); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/oms/service/OrderReturnService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.oms.service; 6 | 7 | import com.mall.oms.dto.OrderReturnApplyResult; 8 | import com.mall.oms.dto.ReturnApplyQueryParam; 9 | import com.mall.oms.dto.UpdateStatusParam; 10 | import com.mall.model.OmsOrderReturnApply; 11 | import com.mall.model.OmsOrderReturnReason; 12 | 13 | import java.util.List; 14 | 15 | public interface OrderReturnService { 16 | 17 | List listApply(ReturnApplyQueryParam queryParam, int pageIndex, int pageSize); 18 | 19 | void deleteApply(List ids); 20 | 21 | OrderReturnApplyResult getApply(Long id); 22 | 23 | void updateApplyStatus(Long id, UpdateStatusParam updateStatusParam); 24 | 25 | void createReason(OmsOrderReturnReason returnReason); 26 | 27 | void updateReason(Long id, OmsOrderReturnReason returnReason); 28 | 29 | void deleteReason(List ids); 30 | 31 | List listReason(int pageIndex, int pageSize); 32 | 33 | OmsOrderReturnReason getReason(Long id); 34 | 35 | void updateReasonStatus(List ids, Integer status); 36 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.exception; 6 | 7 | import com.mall.crosscut.standard.ApiResult; 8 | import com.mall.crosscut.standard.StatusCode; 9 | 10 | /** 11 | * This exception class will be used in those scenarios when an exception should be thrown but provide 12 | * a custom {@link ApiResult}, such as customizing the status code and more meaningful message. 13 | */ 14 | public class ApiException extends RuntimeException { 15 | private static final long serialVersionUID = 1L; 16 | private final StatusCode statusCode; 17 | 18 | public ApiException(String message) { 19 | super(message); 20 | statusCode = null; 21 | } 22 | 23 | public ApiException(Throwable cause) { 24 | super(cause); 25 | statusCode = null; 26 | } 27 | 28 | public ApiException(StatusCode statusCode) { 29 | super(String.format("%d: %s", statusCode.getCode(), statusCode.getMessage())); 30 | this.statusCode = statusCode; 31 | } 32 | 33 | public StatusCode getStatusCode() { 34 | return statusCode; 35 | } 36 | } -------------------------------------------------------------------------------- /mall-crosscut/src/test/java/com/mall/crosscut/util/HashTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.util; 6 | 7 | import static org.junit.jupiter.api.Assertions.*; 8 | 9 | import org.junit.jupiter.api.Test; 10 | 11 | class HashTest { 12 | 13 | @Test 14 | void md5() { 15 | String plainText = "m@ll"; 16 | // 9d2278f65987e04e75323af4e7e598a2 17 | String md5 = HashUtil.md5(plainText); 18 | assertEquals(32, md5.length()); 19 | 20 | String apiv3 = "sunrisem@ll"; 21 | // e134c20381b4c13bb687db8bd8261b82 22 | String key = HashUtil.md5(apiv3); 23 | assertEquals(32, key.length()); 24 | } 25 | 26 | @Test 27 | void sh1() { 28 | String raw = "{\"nickName\":\"Band\",\"gender\":1,\"language\":\"zh_CN\",\"city\":\"Guangzhou\",\"province\":\"Guangdong\",\"country\":\"CN\",\"avatarUrl\":\"http://wx.qlogo.cn/mmopen/vi_32/1vZvI39NWFQ9XM4LtQpFrQJ1xlgZxx3w7bQxKARol6503Iuswjjn6nIGBiaycAjAtpujxyzYsrztuuICqIM5ibXQ/0\"}HyVFkGl5F5OQWJZZaNzBBg=="; 29 | String sh1 = "75e81ceda165f4ffa64f4068af58c64b8f54b88c"; 30 | assertEquals(sh1, HashUtil.sha1(raw)); 31 | } 32 | } -------------------------------------------------------------------------------- /mall-express/src/main/java/com/mall/express/request/QueryTrackReq.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.express.request; 6 | 7 | import com.mall.express.core.ApiURL; 8 | 9 | public class QueryTrackReq extends BaseRequest { 10 | /** 11 | * 我方分配给贵司的的公司编号, 点击查看账号信息 12 | */ 13 | private String customer; 14 | /** 15 | * 签名, 用于验证身份, 按param + key + customer 的顺序进行MD5加密(注意加密后字符串要转大写), 不需要“+”号 16 | */ 17 | private String sign; 18 | /** 19 | * 其他参数组合成的json对象 20 | */ 21 | private String param; 22 | 23 | public QueryTrackReq() { 24 | setUrl(ApiURL.QUERY_URL); 25 | } 26 | 27 | public String getCustomer() { 28 | return customer; 29 | } 30 | 31 | public void setCustomer(String customer) { 32 | this.customer = customer; 33 | } 34 | 35 | public String getSign() { 36 | return sign; 37 | } 38 | 39 | public void setSign(String sign) { 40 | this.sign = sign; 41 | } 42 | 43 | public String getParam() { 44 | return param; 45 | } 46 | 47 | public void setParam(String param) { 48 | this.param = param; 49 | } 50 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/domain/FlashPromotionProduct.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.domain; 6 | 7 | import com.mall.model.PmsProduct; 8 | 9 | import java.math.BigDecimal; 10 | 11 | public class FlashPromotionProduct extends PmsProduct { 12 | private BigDecimal flashPromotionPrice; 13 | private Integer flashPromotionCount; 14 | private Integer flashPromotionLimit; 15 | 16 | public BigDecimal getFlashPromotionPrice() { 17 | return flashPromotionPrice; 18 | } 19 | 20 | public void setFlashPromotionPrice(BigDecimal flashPromotionPrice) { 21 | this.flashPromotionPrice = flashPromotionPrice; 22 | } 23 | 24 | public Integer getFlashPromotionCount() { 25 | return flashPromotionCount; 26 | } 27 | 28 | public void setFlashPromotionCount(Integer flashPromotionCount) { 29 | this.flashPromotionCount = flashPromotionCount; 30 | } 31 | 32 | public Integer getFlashPromotionLimit() { 33 | return flashPromotionLimit; 34 | } 35 | 36 | public void setFlashPromotionLimit(Integer flashPromotionLimit) { 37 | this.flashPromotionLimit = flashPromotionLimit; 38 | } 39 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/UmsRoleResourceRelationDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import org.mybatis.dynamic.sql.SqlColumn; 9 | import org.mybatis.dynamic.sql.SqlTable; 10 | 11 | public final class UmsRoleResourceRelationDynamicSqlSupport { 12 | public static final UmsRoleResourceRelation umsRoleResourceRelation = new UmsRoleResourceRelation(); 13 | 14 | public static final SqlColumn id = umsRoleResourceRelation.id; 15 | 16 | public static final SqlColumn roleId = umsRoleResourceRelation.roleId; 17 | 18 | public static final SqlColumn resourceId = umsRoleResourceRelation.resourceId; 19 | 20 | public static final class UmsRoleResourceRelation extends SqlTable { 21 | public final SqlColumn id = column("id", JDBCType.BIGINT); 22 | 23 | public final SqlColumn roleId = column("role_id", JDBCType.BIGINT); 24 | 25 | public final SqlColumn resourceId = column("resource_id", JDBCType.BIGINT); 26 | 27 | public UmsRoleResourceRelation() { 28 | super("ums_role_resource_relation"); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/ums/dto/UpdatePwdParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.ums.dto; 6 | 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | 9 | import javax.validation.constraints.NotEmpty; 10 | 11 | public class UpdatePwdParam { 12 | @NotEmpty 13 | @Schema(description = "用户名", required = true) 14 | private String username; 15 | @NotEmpty 16 | @Schema(description = "旧密码", required = true) 17 | private String oldPassword; 18 | @NotEmpty 19 | @Schema(description = "新密码", required = true) 20 | private String newPassword; 21 | 22 | public String getUsername() { 23 | return username; 24 | } 25 | 26 | public void setUsername(String username) { 27 | this.username = username; 28 | } 29 | 30 | public String getOldPassword() { 31 | return oldPassword; 32 | } 33 | 34 | public void setOldPassword(String oldPassword) { 35 | this.oldPassword = oldPassword; 36 | } 37 | 38 | public String getNewPassword() { 39 | return newPassword; 40 | } 41 | 42 | public void setNewPassword(String newPassword) { 43 | this.newPassword = newPassword; 44 | } 45 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/dao/HomeDao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.dao; 6 | 7 | import com.mall.domain.FlashPromotionProduct; 8 | import com.mall.model.CmsSubject; 9 | import com.mall.model.PmsBrand; 10 | import com.mall.model.PmsProduct; 11 | import org.apache.ibatis.annotations.Param; 12 | 13 | import java.util.List; 14 | 15 | public interface HomeDao { 16 | /** 17 | * 获取推荐品牌 18 | */ 19 | List getRecommendBrandList(@Param("offset") Integer offset, @Param("limit") Integer limit); 20 | 21 | /** 22 | * 获取秒杀商品 23 | */ 24 | List getFlashProductList(@Param("flashPromotionId") Long flashPromotionId, @Param("sessionId") Long sessionId); 25 | 26 | /** 27 | * 获取新品推荐 28 | */ 29 | List getNewProductList(@Param("offset") Integer offset, @Param("limit") Integer limit); 30 | /** 31 | * 获取人气推荐 32 | */ 33 | List getHotProductList(@Param("offset") Integer offset,@Param("limit") Integer limit); 34 | 35 | /** 36 | * 获取推荐专题 37 | */ 38 | List getRecommendSubjectList(@Param("offset") Integer offset, @Param("limit") Integer limit); 39 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/mq/CancelOrderSender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mq; 6 | 7 | import com.mall.domain.QueueEnum; 8 | import org.slf4j.Logger; 9 | import org.slf4j.LoggerFactory; 10 | import org.springframework.amqp.core.AmqpTemplate; 11 | import org.springframework.stereotype.Component; 12 | 13 | /** 14 | * 取消订单消息的生产者 15 | * Created by macro on 2018/9/14. 16 | */ 17 | @Component 18 | public class CancelOrderSender { 19 | private static final Logger logger =LoggerFactory.getLogger(CancelOrderSender.class); 20 | 21 | private final AmqpTemplate amqpTemplate; 22 | 23 | public CancelOrderSender(AmqpTemplate amqpTemplate) { 24 | this.amqpTemplate = amqpTemplate; 25 | } 26 | 27 | public void sendMessage(Long orderId,final long delayTimes){ 28 | // 给延迟队列发送消息 29 | amqpTemplate.convertAndSend(QueueEnum.QUEUE_TTL_ORDER_CANCEL.getExchange(), QueueEnum.QUEUE_TTL_ORDER_CANCEL.getRouteKey(), orderId, message -> { 30 | // 给消息设置延迟毫秒值 31 | message.getMessageProperties().setExpiration(String.valueOf(delayTimes)); 32 | return message; 33 | }); 34 | logger.info("send orderId:{}",orderId); 35 | } 36 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/UmsMemberMemberTagRelationDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import org.mybatis.dynamic.sql.SqlColumn; 9 | import org.mybatis.dynamic.sql.SqlTable; 10 | 11 | public final class UmsMemberMemberTagRelationDynamicSqlSupport { 12 | public static final UmsMemberMemberTagRelation umsMemberMemberTagRelation = new UmsMemberMemberTagRelation(); 13 | 14 | public static final SqlColumn id = umsMemberMemberTagRelation.id; 15 | 16 | public static final SqlColumn memberId = umsMemberMemberTagRelation.memberId; 17 | 18 | public static final SqlColumn tagId = umsMemberMemberTagRelation.tagId; 19 | 20 | public static final class UmsMemberMemberTagRelation extends SqlTable { 21 | public final SqlColumn id = column("id", JDBCType.BIGINT); 22 | 23 | public final SqlColumn memberId = column("member_id", JDBCType.BIGINT); 24 | 25 | public final SqlColumn tagId = column("tag_id", JDBCType.BIGINT); 26 | 27 | public UmsMemberMemberTagRelation() { 28 | super("ums_member_member_tag_relation"); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/core/Scheduler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.core; 6 | 7 | import com.mall.mq.CancelOrderReceiver; 8 | import com.mall.service.OrderService; 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | import org.springframework.context.annotation.Configuration; 12 | import org.springframework.scheduling.annotation.EnableScheduling; 13 | import org.springframework.scheduling.annotation.Scheduled; 14 | 15 | @Configuration 16 | @EnableScheduling 17 | public class Scheduler { 18 | private static final Logger logger = LoggerFactory.getLogger(CancelOrderReceiver.class); 19 | 20 | private final OrderService orderService; 21 | 22 | public Scheduler(OrderService orderService) { 23 | this.orderService = orderService; 24 | } 25 | 26 | /** 27 | * cron表达式:Seconds Minutes Hours DayofMonth Month DayofWeek [Year] 28 | * 每10分钟扫描一次,扫描设定超时时间之前下的订单,如果没支付则取消该订单 29 | */ 30 | @Scheduled(cron = "${scheduler.cancel-timeout-order-cron:0 0/10 * ? * ?}") 31 | private void cancelTimeOutOrder(){ 32 | Integer count = orderService.cancelTimeoutOrder(); 33 | logger.info("取消订单,并根据sku编号释放锁定库存,取消订单数量:{}",count); 34 | } 35 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/CmsSubjectProductRelationDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import org.mybatis.dynamic.sql.SqlColumn; 9 | import org.mybatis.dynamic.sql.SqlTable; 10 | 11 | public final class CmsSubjectProductRelationDynamicSqlSupport { 12 | public static final CmsSubjectProductRelation cmsSubjectProductRelation = new CmsSubjectProductRelation(); 13 | 14 | public static final SqlColumn id = cmsSubjectProductRelation.id; 15 | 16 | public static final SqlColumn subjectId = cmsSubjectProductRelation.subjectId; 17 | 18 | public static final SqlColumn productId = cmsSubjectProductRelation.productId; 19 | 20 | public static final class CmsSubjectProductRelation extends SqlTable { 21 | public final SqlColumn id = column("id", JDBCType.BIGINT); 22 | 23 | public final SqlColumn subjectId = column("subject_id", JDBCType.BIGINT); 24 | 25 | public final SqlColumn productId = column("product_id", JDBCType.BIGINT); 26 | 27 | public CmsSubjectProductRelation() { 28 | super("cms_subject_product_relation"); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/excel/annotation/Statistics.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.excel.annotation; 6 | 7 | import java.lang.annotation.Documented; 8 | import java.lang.annotation.ElementType; 9 | import java.lang.annotation.Inherited; 10 | import java.lang.annotation.Retention; 11 | import java.lang.annotation.RetentionPolicy; 12 | import java.lang.annotation.Target; 13 | 14 | @Target(value = ElementType.TYPE) 15 | @Retention(RetentionPolicy.RUNTIME) 16 | @Documented 17 | @Inherited 18 | public @interface Statistics { 19 | 20 | /** 21 | * the statistics name. e.g. Total 22 | * 23 | * @return the statistics name 24 | */ 25 | String name(); 26 | 27 | /** 28 | * the cell formula, such as SUM, AVERAGE and so on, which for vertical statistics 29 | * 30 | * @return the cell formula 31 | */ 32 | String formula(); 33 | 34 | /** 35 | * column indexes for statistics. 36 | * 37 | * If the {@link Statistics#formula()} if SUM, and the columns is [1,3], the column No. 1 and 3 38 | * will be SUM from first to last row 39 | * 40 | * @return the statistics column indexes 41 | */ 42 | int[] columns(); 43 | } -------------------------------------------------------------------------------- /mall-jdbc/src/main/java/com/mall/jdbc/JdbcRoutingDataSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.jdbc; 6 | 7 | import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; 8 | import org.springframework.lang.NonNull; 9 | 10 | import java.util.Map; 11 | 12 | public class JdbcRoutingDataSource extends AbstractRoutingDataSource implements AutoCloseable { 13 | private Map targetDataSources; 14 | 15 | @Override 16 | public void setTargetDataSources(@NonNull Map targetDataSources) { 17 | this.targetDataSources = targetDataSources; 18 | super.setTargetDataSources(targetDataSources); 19 | } 20 | 21 | @Override 22 | protected Object determineCurrentLookupKey() { 23 | return JdbcRouterHolder.get(); 24 | } 25 | 26 | @Override 27 | public void close() throws Exception { 28 | for (Map.Entry entry : targetDataSources.entrySet()) { 29 | Object dataSource = entry.getValue(); 30 | if (AutoCloseable.class.isAssignableFrom(dataSource.getClass())) { 31 | AutoCloseable closeable = (AutoCloseable) dataSource; 32 | closeable.close(); 33 | } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/OrderService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service; 6 | 7 | import com.mall.PayKind; 8 | import com.mall.domain.CartOrder; 9 | import com.mall.domain.ConfirmOrder; 10 | import com.mall.domain.OrderDetail; 11 | import com.mall.domain.OrderParam; 12 | import com.mall.model.OmsOrder; 13 | import java.util.Optional; 14 | import org.springframework.transaction.annotation.Transactional; 15 | 16 | import java.util.List; 17 | 18 | public interface OrderService { 19 | ConfirmOrder generateConfirmOrder(List cartIds); 20 | 21 | /** 22 | * 根据提交信息生成订单 23 | */ 24 | @Transactional 25 | CartOrder generateOrder(OrderParam orderParam); 26 | 27 | @Transactional 28 | boolean paySuccess(long orderId, PayKind kind, String transactionId); 29 | 30 | @Transactional 31 | Integer cancelTimeoutOrder(); 32 | 33 | @Transactional 34 | void cancelOrder(Long orderId); 35 | 36 | void cancelAsync(long orderId); 37 | 38 | List list(Integer status, int pageIndex, int pageSize); 39 | 40 | OrderDetail detail(long orderId); 41 | 42 | Optional get(String orderSn); 43 | 44 | void confirmOrderReceived(long orderId); 45 | 46 | void delete(long orderId); 47 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/ums/dto/LoginAdmin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.ums.dto; 6 | 7 | import com.mall.model.UmsMenu; 8 | import io.swagger.v3.oas.annotations.media.Schema; 9 | 10 | import java.util.List; 11 | 12 | public class LoginAdmin { 13 | @Schema(description = "用户名") 14 | private String username; 15 | @Schema(description = "头像") 16 | private String icon; 17 | @Schema(description = "已授权菜单") 18 | private List menus; 19 | @Schema(description = "已授权角色") 20 | private List roles; 21 | 22 | public String getUsername() { 23 | return username; 24 | } 25 | 26 | public void setUsername(String username) { 27 | this.username = username; 28 | } 29 | 30 | public String getIcon() { 31 | return icon; 32 | } 33 | 34 | public void setIcon(String icon) { 35 | this.icon = icon; 36 | } 37 | 38 | public List getMenus() { 39 | return menus; 40 | } 41 | 42 | public void setMenus(List menus) { 43 | this.menus = menus; 44 | } 45 | 46 | public List getRoles() { 47 | return roles; 48 | } 49 | 50 | public void setRoles(List roles) { 51 | this.roles = roles; 52 | } 53 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/core/ApiExceptionHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.core; 6 | 7 | import com.mall.crosscut.standard.ApiResult; 8 | import com.mall.crosscut.standard.StandardCode; 9 | import org.springframework.web.bind.annotation.ExceptionHandler; 10 | import org.springframework.web.bind.annotation.RestControllerAdvice; 11 | 12 | import javax.servlet.http.HttpServletRequest; 13 | 14 | /** 15 | * This exceptions handler will only convert all exceptions that thrown by API to {@link ApiResult ApiResult}. 16 | * The exceptions logging or notifying to system maintain developers is delegating to {@link ExceptionNotifier ExceptionNotifier}. 17 | */ 18 | @RestControllerAdvice 19 | public class ApiExceptionHandler { 20 | private final ExceptionNotifier exceptionNotifier; 21 | 22 | public ApiExceptionHandler(ExceptionNotifier exceptionNotifier) { 23 | this.exceptionNotifier = exceptionNotifier; 24 | } 25 | 26 | @ExceptionHandler(Exception.class) 27 | public ApiResult handler(HttpServletRequest request, Exception cause) { 28 | ApiResult result = ApiResult.valueOf(StandardCode.valueOf(cause)); 29 | exceptionNotifier.notify(request, cause, result.getMessage()); 30 | return result; 31 | } 32 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/sms/dto/CouponParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.sms.dto; 6 | 7 | import com.mall.model.SmsCoupon; 8 | import com.mall.model.SmsCouponProductCategoryRelation; 9 | import com.mall.model.SmsCouponProductRelation; 10 | import io.swagger.v3.oas.annotations.media.Schema; 11 | import java.util.List; 12 | 13 | /** 14 | * 优惠券信息封装,包括绑定商品和绑定分类 15 | */ 16 | public class CouponParam extends SmsCoupon { 17 | @Schema(description = "优惠券绑定的商品") 18 | private List productRelations; 19 | @Schema(description = "优惠券绑定的商品分类") 20 | private List productCategoryRelations; 21 | 22 | public List getProductRelations() { 23 | return productRelations; 24 | } 25 | 26 | public void setProductRelations(List productRelations) { 27 | this.productRelations = productRelations; 28 | } 29 | 30 | public List getProductCategoryRelations() { 31 | return productCategoryRelations; 32 | } 33 | 34 | public void setProductCategoryRelations( 35 | List productCategoryRelations) { 36 | this.productCategoryRelations = productCategoryRelations; 37 | } 38 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/CmsPreferenceAreaProductRelationDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import org.mybatis.dynamic.sql.SqlColumn; 9 | import org.mybatis.dynamic.sql.SqlTable; 10 | 11 | public final class CmsPreferenceAreaProductRelationDynamicSqlSupport { 12 | public static final CmsPreferenceAreaProductRelation cmsPreferenceAreaProductRelation = new CmsPreferenceAreaProductRelation(); 13 | 14 | public static final SqlColumn id = cmsPreferenceAreaProductRelation.id; 15 | 16 | public static final SqlColumn preferenceAreaId = cmsPreferenceAreaProductRelation.preferenceAreaId; 17 | 18 | public static final SqlColumn productId = cmsPreferenceAreaProductRelation.productId; 19 | 20 | public static final class CmsPreferenceAreaProductRelation extends SqlTable { 21 | public final SqlColumn id = column("id", JDBCType.BIGINT); 22 | 23 | public final SqlColumn preferenceAreaId = column("preference_area_id", JDBCType.BIGINT); 24 | 25 | public final SqlColumn productId = column("product_id", JDBCType.BIGINT); 26 | 27 | public CmsPreferenceAreaProductRelation() { 28 | super("cms_preference_area_product_relation"); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/UmsMemberProductCategoryRelationDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import org.mybatis.dynamic.sql.SqlColumn; 9 | import org.mybatis.dynamic.sql.SqlTable; 10 | 11 | public final class UmsMemberProductCategoryRelationDynamicSqlSupport { 12 | public static final UmsMemberProductCategoryRelation umsMemberProductCategoryRelation = new UmsMemberProductCategoryRelation(); 13 | 14 | public static final SqlColumn id = umsMemberProductCategoryRelation.id; 15 | 16 | public static final SqlColumn memberId = umsMemberProductCategoryRelation.memberId; 17 | 18 | public static final SqlColumn productCategoryId = umsMemberProductCategoryRelation.productCategoryId; 19 | 20 | public static final class UmsMemberProductCategoryRelation extends SqlTable { 21 | public final SqlColumn id = column("id", JDBCType.BIGINT); 22 | 23 | public final SqlColumn memberId = column("member_id", JDBCType.BIGINT); 24 | 25 | public final SqlColumn productCategoryId = column("product_category_id", JDBCType.BIGINT); 26 | 27 | public UmsMemberProductCategoryRelation() { 28 | super("ums_member_product_category_relation"); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/conf/OpenAPIConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.conf; 6 | 7 | import io.swagger.v3.oas.models.Components; 8 | import io.swagger.v3.oas.models.OpenAPI; 9 | import io.swagger.v3.oas.models.info.Info; 10 | import io.swagger.v3.oas.models.security.SecurityScheme; 11 | import org.springframework.context.annotation.Bean; 12 | import org.springframework.context.annotation.Configuration; 13 | 14 | @Configuration 15 | public class OpenAPIConfiguration { 16 | @Bean 17 | public OpenAPI openAPI() { 18 | return new OpenAPI().info(new Info() 19 | .title("MALL后台系统") 20 | .description("MALL后台相关接口文档") 21 | .version("v1.0")) 22 | .components(new Components() 23 | .addSecuritySchemes("jwtScheme", 24 | new SecurityScheme() 25 | .type(SecurityScheme.Type.APIKEY) 26 | .name("Authorization") 27 | .description("JWT Bearer Authorization") 28 | .in(SecurityScheme.In.HEADER) 29 | .scheme("http") 30 | .bearerFormat("bearer"))); 31 | } 32 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/conf/OpenAPIConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.conf; 6 | 7 | import io.swagger.v3.oas.models.Components; 8 | import io.swagger.v3.oas.models.OpenAPI; 9 | import io.swagger.v3.oas.models.info.Info; 10 | import io.swagger.v3.oas.models.security.SecurityScheme; 11 | import org.springframework.context.annotation.Bean; 12 | import org.springframework.context.annotation.Configuration; 13 | 14 | @Configuration 15 | public class OpenAPIConfiguration { 16 | @Bean 17 | public OpenAPI openAPI() { 18 | return new OpenAPI().info(new Info() 19 | .title("MALL小程序") 20 | .description("MALL小程序相关接口文档") 21 | .version("v1.0")) 22 | .components(new Components() 23 | .addSecuritySchemes("jwtScheme", 24 | new SecurityScheme() 25 | .type(SecurityScheme.Type.APIKEY) 26 | .name("Authorization") 27 | .description("JWT Bearer Authorization") 28 | .in(SecurityScheme.In.HEADER) 29 | .scheme("http") 30 | .bearerFormat("bearer"))); 31 | } 32 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/PmsProductCategoryAttributeRelationDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import org.mybatis.dynamic.sql.SqlColumn; 9 | import org.mybatis.dynamic.sql.SqlTable; 10 | 11 | public final class PmsProductCategoryAttributeRelationDynamicSqlSupport { 12 | public static final PmsProductCategoryAttributeRelation pmsProductCategoryAttributeRelation = new PmsProductCategoryAttributeRelation(); 13 | 14 | public static final SqlColumn id = pmsProductCategoryAttributeRelation.id; 15 | 16 | public static final SqlColumn categoryId = pmsProductCategoryAttributeRelation.categoryId; 17 | 18 | public static final SqlColumn attributeId = pmsProductCategoryAttributeRelation.attributeId; 19 | 20 | public static final class PmsProductCategoryAttributeRelation extends SqlTable { 21 | public final SqlColumn id = column("id", JDBCType.BIGINT); 22 | 23 | public final SqlColumn categoryId = column("category_id", JDBCType.BIGINT); 24 | 25 | public final SqlColumn attributeId = column("attribute_id", JDBCType.BIGINT); 26 | 27 | public PmsProductCategoryAttributeRelation() { 28 | super("pms_product_category_attribute_relation"); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/oms/dto/OrderDeliveryParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.oms.dto; 6 | 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | 9 | public class OrderDeliveryParam { 10 | 11 | @Schema(description = "订单id") 12 | private Long orderId; 13 | @Schema(description = "物流公司编号") 14 | private String deliveryCode; 15 | @Schema(description = "物流公司名称") 16 | private String deliveryCompany; 17 | @Schema(description = "物流单号") 18 | private String deliverySn; 19 | 20 | public Long getOrderId() { 21 | return orderId; 22 | } 23 | 24 | public void setOrderId(Long orderId) { 25 | this.orderId = orderId; 26 | } 27 | 28 | public String getDeliveryCode() { 29 | return deliveryCode; 30 | } 31 | 32 | public void setDeliveryCode(String deliveryCode) { 33 | this.deliveryCode = deliveryCode; 34 | } 35 | 36 | public String getDeliveryCompany() { 37 | return deliveryCompany; 38 | } 39 | 40 | public void setDeliveryCompany(String deliveryCompany) { 41 | this.deliveryCompany = deliveryCompany; 42 | } 43 | 44 | public String getDeliverySn() { 45 | return deliverySn; 46 | } 47 | 48 | public void setDeliverySn(String deliverySn) { 49 | this.deliverySn = deliverySn; 50 | } 51 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/service/impl/FreightServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.service.impl; 6 | 7 | import static com.mall.mapper.PmsFreightCompanyDynamicSqlSupport.pmsFreightCompany; 8 | import static org.mybatis.dynamic.sql.SqlBuilder.isLike; 9 | 10 | import com.mall.mapper.PmsFreightCompanyMapper; 11 | import com.mall.model.PmsFreightCompany; 12 | import com.mall.pms.service.FreightService; 13 | import java.util.List; 14 | import org.springframework.stereotype.Service; 15 | 16 | @Service 17 | public class FreightServiceImpl implements FreightService { 18 | private final PmsFreightCompanyMapper freightCompanyMapper; 19 | 20 | public FreightServiceImpl(PmsFreightCompanyMapper freightCompanyMapper) { 21 | this.freightCompanyMapper = freightCompanyMapper; 22 | } 23 | 24 | @Override 25 | public List list(int pageIndex, int pageSize) { 26 | return freightCompanyMapper.select(c -> c.limit(pageSize).offset(pageIndex * pageSize)); 27 | } 28 | 29 | @Override 30 | public List search(String nameOrCode) { 31 | return freightCompanyMapper.select(c -> 32 | c.where(pmsFreightCompany.name, isLike("%" + nameOrCode + "%")) 33 | .or(pmsFreightCompany.code, isLike("%" + nameOrCode + "%"))); 34 | } 35 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/service/impl/FreightServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.service.impl; 6 | 7 | import static com.mall.mapper.PmsFreightCompanyDynamicSqlSupport.pmsFreightCompany; 8 | import static org.mybatis.dynamic.sql.SqlBuilder.isLike; 9 | 10 | import com.mall.service.FreightService; 11 | import com.mall.mapper.PmsFreightCompanyMapper; 12 | import com.mall.model.PmsFreightCompany; 13 | 14 | import java.util.List; 15 | import org.springframework.stereotype.Service; 16 | 17 | @Service 18 | public class FreightServiceImpl implements FreightService { 19 | private final PmsFreightCompanyMapper freightCompanyMapper; 20 | 21 | public FreightServiceImpl(PmsFreightCompanyMapper freightCompanyMapper) { 22 | this.freightCompanyMapper = freightCompanyMapper; 23 | } 24 | 25 | @Override 26 | public List list(int pageIndex, int pageSize) { 27 | return freightCompanyMapper.select(c -> c.limit(pageSize).offset(pageIndex * pageSize)); 28 | } 29 | 30 | @Override 31 | public List search(String nameOrCode) { 32 | return freightCompanyMapper.select(c -> 33 | c.where(pmsFreightCompany.name, isLike("%" + nameOrCode + "%")) 34 | .or(pmsFreightCompany.code, isLike("%" + nameOrCode + "%"))); 35 | } 36 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/UmsMemberTagDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.math.BigDecimal; 8 | import java.sql.JDBCType; 9 | import org.mybatis.dynamic.sql.SqlColumn; 10 | import org.mybatis.dynamic.sql.SqlTable; 11 | 12 | public final class UmsMemberTagDynamicSqlSupport { 13 | public static final UmsMemberTag umsMemberTag = new UmsMemberTag(); 14 | 15 | public static final SqlColumn id = umsMemberTag.id; 16 | 17 | public static final SqlColumn name = umsMemberTag.name; 18 | 19 | public static final SqlColumn finishOrderCount = umsMemberTag.finishOrderCount; 20 | 21 | public static final SqlColumn finishOrderAmount = umsMemberTag.finishOrderAmount; 22 | 23 | public static final class UmsMemberTag extends SqlTable { 24 | public final SqlColumn id = column("id", JDBCType.BIGINT); 25 | 26 | public final SqlColumn name = column("name", JDBCType.VARCHAR); 27 | 28 | public final SqlColumn finishOrderCount = column("finish_order_count", JDBCType.INTEGER); 29 | 30 | public final SqlColumn finishOrderAmount = column("finish_order_amount", JDBCType.DECIMAL); 31 | 32 | public UmsMemberTag() { 33 | super("ums_member_tag"); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/cms/controller/PreferenceAreaController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.cms.controller; 6 | 7 | import com.mall.cms.service.PreferenceAreaService; 8 | import com.mall.model.CmsPreferenceArea; 9 | import io.swagger.v3.oas.annotations.Operation; 10 | import io.swagger.v3.oas.annotations.security.SecurityRequirement; 11 | import io.swagger.v3.oas.annotations.tags.Tag; 12 | import org.springframework.http.MediaType; 13 | import org.springframework.web.bind.annotation.GetMapping; 14 | import org.springframework.web.bind.annotation.RequestMapping; 15 | import org.springframework.web.bind.annotation.RestController; 16 | 17 | import java.util.List; 18 | 19 | @Tag(name = "商品优选管理") 20 | @RestController 21 | @RequestMapping(value = "/api/cms/preference", produces = MediaType.APPLICATION_JSON_VALUE) 22 | public class PreferenceAreaController { 23 | 24 | private final PreferenceAreaService preferenceAreaService; 25 | 26 | public PreferenceAreaController( 27 | PreferenceAreaService preferenceAreaService) { 28 | this.preferenceAreaService = preferenceAreaService; 29 | } 30 | 31 | @Operation(summary = "获取所有商品优选", security = {@SecurityRequirement(name = "jwtScheme")}) 32 | @GetMapping 33 | public List get() { 34 | return preferenceAreaService.listAll(); 35 | } 36 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/UmsResourceCategoryDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import java.time.LocalDateTime; 9 | import org.mybatis.dynamic.sql.SqlColumn; 10 | import org.mybatis.dynamic.sql.SqlTable; 11 | 12 | public final class UmsResourceCategoryDynamicSqlSupport { 13 | public static final UmsResourceCategory umsResourceCategory = new UmsResourceCategory(); 14 | 15 | public static final SqlColumn id = umsResourceCategory.id; 16 | 17 | public static final SqlColumn name = umsResourceCategory.name; 18 | 19 | public static final SqlColumn sort = umsResourceCategory.sort; 20 | 21 | public static final SqlColumn createTime = umsResourceCategory.createTime; 22 | 23 | public static final class UmsResourceCategory extends SqlTable { 24 | public final SqlColumn id = column("id", JDBCType.BIGINT); 25 | 26 | public final SqlColumn name = column("name", JDBCType.VARCHAR); 27 | 28 | public final SqlColumn sort = column("sort", JDBCType.INTEGER); 29 | 30 | public final SqlColumn createTime = column("create_time", JDBCType.TIMESTAMP); 31 | 32 | public UmsResourceCategory() { 33 | super("ums_resource_category"); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /mall-express/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 10 | com.mall 11 | mall-parent 12 | 1.0.0 13 | 14 | 4.0.0 15 | 16 | mall-express 17 | 18 | 19 | 20 | org.apache.commons 21 | commons-lang3 22 | 3.8.1 23 | 24 | 25 | 26 | org.apache.httpcomponents 27 | httpclient 28 | 4.5.13 29 | 30 | 31 | 32 | org.apache.httpcomponents 33 | httpcore 34 | 35 | 36 | 37 | org.apache.httpcomponents 38 | httpmime 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/pms/service/ProductService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.pms.service; 6 | 7 | import com.mall.model.PmsProduct; 8 | import com.mall.pms.dto.ProductDto; 9 | import com.mall.pms.dto.ProductEditDto; 10 | import com.mall.pms.dto.ProductQuery; 11 | import org.springframework.transaction.annotation.Isolation; 12 | import org.springframework.transaction.annotation.Propagation; 13 | import org.springframework.transaction.annotation.Transactional; 14 | 15 | import java.util.List; 16 | 17 | public interface ProductService { 18 | @Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.REQUIRED) 19 | void create(ProductDto productDto); 20 | 21 | List list(ProductQuery productQuery, int pageIndex, int pageSize); 22 | 23 | ProductEditDto getEdit(long id); 24 | 25 | @Transactional 26 | void update(long id, ProductDto productDto); 27 | 28 | List list(String keyword); 29 | 30 | @Transactional 31 | void updateVerifyStatus(List ids, Integer verifyStatus, String detail); 32 | 33 | void updatePublishStatus(List ids, Integer publishStatus); 34 | 35 | void updateRecommendStatus(List ids, Integer recommendStatus); 36 | 37 | void updateNewStatus(List ids, Integer newStatus); 38 | 39 | void updateDeleteStatus(List ids, Integer deleteStatus); 40 | } -------------------------------------------------------------------------------- /mall-security/src/main/java/com/mall/security/jwt/JwtAuthenticationProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.security.jwt; 6 | 7 | import com.mall.security.core.JwtService; 8 | import org.springframework.security.authentication.AuthenticationProvider; 9 | import org.springframework.security.authentication.BadCredentialsException; 10 | import org.springframework.security.core.Authentication; 11 | import org.springframework.security.core.AuthenticationException; 12 | 13 | public class JwtAuthenticationProvider implements AuthenticationProvider { 14 | private final JwtService jwtService; 15 | 16 | public JwtAuthenticationProvider(JwtService jwtService) { 17 | this.jwtService = jwtService; 18 | } 19 | 20 | @Override 21 | public Authentication authenticate(Authentication authentication) throws AuthenticationException { 22 | JwtAuthenticationToken jat = (JwtAuthenticationToken) authentication; 23 | String token = jat.getPrincipal(); 24 | try { 25 | String subject = jwtService.verify(token); 26 | 27 | } catch (Throwable cause) { 28 | throw new BadCredentialsException(cause.getMessage()); 29 | } 30 | return null; 31 | } 32 | 33 | @Override 34 | public boolean supports(Class authentication) { 35 | return (JwtAuthenticationToken.class.isAssignableFrom(authentication)); 36 | } 37 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/PmsProductAttributeValueDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import org.mybatis.dynamic.sql.SqlColumn; 9 | import org.mybatis.dynamic.sql.SqlTable; 10 | 11 | public final class PmsProductAttributeValueDynamicSqlSupport { 12 | public static final PmsProductAttributeValue pmsProductAttributeValue = new PmsProductAttributeValue(); 13 | 14 | public static final SqlColumn id = pmsProductAttributeValue.id; 15 | 16 | public static final SqlColumn productId = pmsProductAttributeValue.productId; 17 | 18 | public static final SqlColumn productAttributeId = pmsProductAttributeValue.productAttributeId; 19 | 20 | public static final SqlColumn value = pmsProductAttributeValue.value; 21 | 22 | public static final class PmsProductAttributeValue extends SqlTable { 23 | public final SqlColumn id = column("id", JDBCType.BIGINT); 24 | 25 | public final SqlColumn productId = column("product_id", JDBCType.BIGINT); 26 | 27 | public final SqlColumn productAttributeId = column("product_attribute_id", JDBCType.BIGINT); 28 | 29 | public final SqlColumn value = column("value", JDBCType.VARCHAR); 30 | 31 | public PmsProductAttributeValue() { 32 | super("pms_product_attribute_value"); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/UmsMemberTaskDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import org.mybatis.dynamic.sql.SqlColumn; 9 | import org.mybatis.dynamic.sql.SqlTable; 10 | 11 | public final class UmsMemberTaskDynamicSqlSupport { 12 | public static final UmsMemberTask umsMemberTask = new UmsMemberTask(); 13 | 14 | public static final SqlColumn id = umsMemberTask.id; 15 | 16 | public static final SqlColumn name = umsMemberTask.name; 17 | 18 | public static final SqlColumn growth = umsMemberTask.growth; 19 | 20 | public static final SqlColumn integration = umsMemberTask.integration; 21 | 22 | public static final SqlColumn type = umsMemberTask.type; 23 | 24 | public static final class UmsMemberTask extends SqlTable { 25 | public final SqlColumn id = column("id", JDBCType.BIGINT); 26 | 27 | public final SqlColumn name = column("name", JDBCType.VARCHAR); 28 | 29 | public final SqlColumn growth = column("growth", JDBCType.INTEGER); 30 | 31 | public final SqlColumn integration = column("integration", JDBCType.INTEGER); 32 | 33 | public final SqlColumn type = column("type", JDBCType.INTEGER); 34 | 35 | public UmsMemberTask() { 36 | super("ums_member_task"); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/eventbus/GlobalEventBus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.eventbus; 6 | 7 | import com.google.common.eventbus.AsyncEventBus; 8 | import com.google.common.eventbus.EventBus; 9 | 10 | import java.util.concurrent.Executors; 11 | 12 | /** 13 | * https://www.baeldung.com/spring-beanpostprocessor 14 | */ 15 | public class GlobalEventBus { 16 | public static final String GLOBAL_EVENT_BUS_EXPRESSION 17 | = "T(com.sunrise.crosscut.eventbus.GlobalEventBus).getEventBus()"; 18 | 19 | private static final String IDENTIFIER = "global-event-bus"; 20 | 21 | private static final GlobalEventBus GLOBAL_EVENT_BUS = new GlobalEventBus(); 22 | 23 | private final EventBus eventBus = new AsyncEventBus(IDENTIFIER, Executors.newCachedThreadPool()); 24 | 25 | private GlobalEventBus() { 26 | } 27 | 28 | public static GlobalEventBus getInstance() { 29 | return GlobalEventBus.GLOBAL_EVENT_BUS; 30 | } 31 | 32 | public static EventBus getEventBus() { 33 | return GlobalEventBus.GLOBAL_EVENT_BUS.eventBus; 34 | } 35 | 36 | public static void subscribe(Object obj) { 37 | getEventBus().register(obj); 38 | } 39 | 40 | public static void unsubscribe(Object obj) { 41 | getEventBus().unregister(obj); 42 | } 43 | 44 | public static void post(Object event) { 45 | getEventBus().post(event); 46 | } 47 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/cms/service/impl/SubjectServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.cms.service.impl; 6 | 7 | import static com.mall.mapper.CmsSubjectDynamicSqlSupport.cmsSubject; 8 | import static org.mybatis.dynamic.sql.SqlBuilder.isLike; 9 | 10 | import com.mall.cms.service.SubjectService; 11 | import com.mall.mapper.CmsSubjectMapper; 12 | import com.mall.model.CmsSubject; 13 | import java.util.List; 14 | import org.mybatis.dynamic.sql.select.SelectDSLCompleter; 15 | import org.springframework.stereotype.Service; 16 | import org.springframework.util.StringUtils; 17 | 18 | @Service 19 | public class SubjectServiceImpl implements SubjectService { 20 | private final CmsSubjectMapper subjectMapper; 21 | 22 | public SubjectServiceImpl(CmsSubjectMapper subjectMapper) { 23 | this.subjectMapper = subjectMapper; 24 | } 25 | 26 | @Override 27 | public List listAll() { 28 | return subjectMapper.select(SelectDSLCompleter.allRows()); 29 | } 30 | 31 | @Override 32 | public List list(String keyword, int pageIndex, int pageSize) { 33 | return subjectMapper.select(c -> { 34 | if (StringUtils.hasText(keyword)) { 35 | c.where(cmsSubject.title, isLike("%" + keyword + "%")); 36 | } 37 | 38 | c.limit(pageSize).offset(pageIndex * pageSize); 39 | 40 | return c; 41 | }); 42 | } 43 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/oms/service/impl/OrderSettingServiceImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.oms.service.impl; 6 | 7 | import com.mall.crosscut.standard.StandardCode; 8 | import com.mall.crosscut.util.Assert; 9 | import com.mall.mapper.OmsOrderSettingMapper; 10 | import com.mall.model.OmsOrderSetting; 11 | import com.mall.oms.service.OrderSettingService; 12 | import java.util.List; 13 | import org.mybatis.dynamic.sql.select.SelectDSLCompleter; 14 | import org.springframework.stereotype.Service; 15 | 16 | @Service 17 | public class OrderSettingServiceImpl implements OrderSettingService { 18 | private final OmsOrderSettingMapper orderSettingMapper; 19 | 20 | public OrderSettingServiceImpl( 21 | OmsOrderSettingMapper orderSettingMapper) { 22 | this.orderSettingMapper = orderSettingMapper; 23 | } 24 | 25 | @Override 26 | public List list() { 27 | return orderSettingMapper.select(SelectDSLCompleter.allRows()); 28 | } 29 | 30 | @Override 31 | public OmsOrderSetting get(Long id) { 32 | return orderSettingMapper.selectByPrimaryKey(id).orElse(null); 33 | } 34 | 35 | @Override 36 | public void update(Long id, OmsOrderSetting orderSetting) { 37 | orderSetting.setId(id); 38 | int count = orderSettingMapper.updateByPrimaryKey(orderSetting); 39 | Assert.ensure(count == 1, StandardCode.SQL_FAILURE); 40 | } 41 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/PmsProductAttributeCategoryDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import org.mybatis.dynamic.sql.SqlColumn; 9 | import org.mybatis.dynamic.sql.SqlTable; 10 | 11 | public final class PmsProductAttributeCategoryDynamicSqlSupport { 12 | public static final PmsProductAttributeCategory pmsProductAttributeCategory = new PmsProductAttributeCategory(); 13 | 14 | public static final SqlColumn id = pmsProductAttributeCategory.id; 15 | 16 | public static final SqlColumn name = pmsProductAttributeCategory.name; 17 | 18 | public static final SqlColumn attributeCount = pmsProductAttributeCategory.attributeCount; 19 | 20 | public static final SqlColumn paramCount = pmsProductAttributeCategory.paramCount; 21 | 22 | public static final class PmsProductAttributeCategory extends SqlTable { 23 | public final SqlColumn id = column("id", JDBCType.BIGINT); 24 | 25 | public final SqlColumn name = column("name", JDBCType.VARCHAR); 26 | 27 | public final SqlColumn attributeCount = column("attribute_count", JDBCType.INTEGER); 28 | 29 | public final SqlColumn paramCount = column("param_count", JDBCType.INTEGER); 30 | 31 | public PmsProductAttributeCategory() { 32 | super("pms_product_attribute_category"); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/PmsProductFullReductionDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.math.BigDecimal; 8 | import java.sql.JDBCType; 9 | import org.mybatis.dynamic.sql.SqlColumn; 10 | import org.mybatis.dynamic.sql.SqlTable; 11 | 12 | public final class PmsProductFullReductionDynamicSqlSupport { 13 | public static final PmsProductFullReduction pmsProductFullReduction = new PmsProductFullReduction(); 14 | 15 | public static final SqlColumn id = pmsProductFullReduction.id; 16 | 17 | public static final SqlColumn productId = pmsProductFullReduction.productId; 18 | 19 | public static final SqlColumn fullPrice = pmsProductFullReduction.fullPrice; 20 | 21 | public static final SqlColumn reducePrice = pmsProductFullReduction.reducePrice; 22 | 23 | public static final class PmsProductFullReduction extends SqlTable { 24 | public final SqlColumn id = column("id", JDBCType.BIGINT); 25 | 26 | public final SqlColumn productId = column("product_id", JDBCType.BIGINT); 27 | 28 | public final SqlColumn fullPrice = column("full_price", JDBCType.DECIMAL); 29 | 30 | public final SqlColumn reducePrice = column("reduce_price", JDBCType.DECIMAL); 31 | 32 | public PmsProductFullReduction() { 33 | super("pms_product_full_reduction"); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/SmsHomeBrandDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import org.mybatis.dynamic.sql.SqlColumn; 9 | import org.mybatis.dynamic.sql.SqlTable; 10 | 11 | public final class SmsHomeBrandDynamicSqlSupport { 12 | public static final SmsHomeBrand smsHomeBrand = new SmsHomeBrand(); 13 | 14 | public static final SqlColumn id = smsHomeBrand.id; 15 | 16 | public static final SqlColumn brandId = smsHomeBrand.brandId; 17 | 18 | public static final SqlColumn brandName = smsHomeBrand.brandName; 19 | 20 | public static final SqlColumn recommendStatus = smsHomeBrand.recommendStatus; 21 | 22 | public static final SqlColumn sort = smsHomeBrand.sort; 23 | 24 | public static final class SmsHomeBrand extends SqlTable { 25 | public final SqlColumn id = column("id", JDBCType.BIGINT); 26 | 27 | public final SqlColumn brandId = column("brand_id", JDBCType.BIGINT); 28 | 29 | public final SqlColumn brandName = column("brand_name", JDBCType.VARCHAR); 30 | 31 | public final SqlColumn recommendStatus = column("recommend_status", JDBCType.INTEGER); 32 | 33 | public final SqlColumn sort = column("sort", JDBCType.INTEGER); 34 | 35 | public SmsHomeBrand() { 36 | super("sms_home_brand"); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /mall-security/src/main/java/com/mall/security/conf/EnableJwtSecurity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.security.conf; 6 | 7 | import java.lang.annotation.Documented; 8 | import java.lang.annotation.ElementType; 9 | import java.lang.annotation.Retention; 10 | import java.lang.annotation.RetentionPolicy; 11 | import java.lang.annotation.Target; 12 | import org.springframework.context.annotation.Configuration; 13 | import org.springframework.context.annotation.Import; 14 | import org.springframework.core.annotation.AliasFor; 15 | import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; 16 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; 17 | 18 | @Retention(value = RetentionPolicy.RUNTIME) 19 | @Target(value = ElementType.TYPE) 20 | @Documented 21 | @Import(JwtSecurityConfiguration.class) 22 | @EnableWebSecurity 23 | @EnableGlobalMethodSecurity(prePostEnabled = true) 24 | @Configuration 25 | public @interface EnableJwtSecurity { 26 | /** 27 | * Security permit all URL array 28 | * 29 | * @return the permit all URL array 30 | */ 31 | String[] permitAll() default {}; 32 | 33 | /** 34 | * Controls debugging support for Spring Security. Default is false. 35 | * 36 | * @return if true, enables debug support with Spring Security 37 | */ 38 | @AliasFor(annotation = EnableWebSecurity.class) 39 | boolean debug() default false; 40 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/util/HashUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.util; 6 | 7 | import java.nio.charset.StandardCharsets; 8 | import java.security.MessageDigest; 9 | import java.security.NoSuchAlgorithmException; 10 | 11 | public interface HashUtil { 12 | static String sha256(String src) { 13 | try { 14 | MessageDigest md = MessageDigest.getInstance("SHA-256"); 15 | md.update(src.getBytes(StandardCharsets.UTF_8)); 16 | return new String(Hex.encode(md.digest())); 17 | } catch (NoSuchAlgorithmException e) { 18 | throw new RuntimeException(e.getMessage(), e); 19 | } 20 | } 21 | 22 | static String sha1(String src) { 23 | try { 24 | MessageDigest md = MessageDigest.getInstance("SHA-1"); 25 | md.update(src.getBytes(StandardCharsets.UTF_8)); 26 | return new String(Hex.encode(md.digest())); 27 | } catch (NoSuchAlgorithmException e) { 28 | throw new RuntimeException(e.getMessage(), e); 29 | } 30 | } 31 | 32 | static String md5(String src) { 33 | try { 34 | MessageDigest md = MessageDigest.getInstance("MD5"); 35 | md.update(src.getBytes(StandardCharsets.UTF_8)); 36 | return new String(Hex.encode(md.digest())); 37 | } catch (NoSuchAlgorithmException e) { 38 | throw new RuntimeException(e.getMessage(), e); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/wechat/auth/PrivateKeySigner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.wechat.auth; 6 | 7 | import java.security.InvalidKeyException; 8 | import java.security.NoSuchAlgorithmException; 9 | import java.security.PrivateKey; 10 | import java.security.Signature; 11 | import java.security.SignatureException; 12 | import java.util.Base64; 13 | 14 | public class PrivateKeySigner implements Signer { 15 | private final String certificateSerialNumber; 16 | 17 | private final PrivateKey privateKey; 18 | 19 | public PrivateKeySigner(String serialNumber, PrivateKey privateKey) { 20 | this.certificateSerialNumber = serialNumber; 21 | this.privateKey = privateKey; 22 | } 23 | 24 | @Override 25 | public SignResult sign(byte[] message) { 26 | try { 27 | Signature sign = Signature.getInstance("SHA256withRSA"); 28 | sign.initSign(privateKey); 29 | sign.update(message); 30 | 31 | return new SignResult( 32 | Base64.getEncoder().encodeToString(sign.sign()), 33 | certificateSerialNumber); 34 | } catch (NoSuchAlgorithmException e) { 35 | throw new RuntimeException("当前Java环境不支持SHA256withRSA", e); 36 | } catch (SignatureException e) { 37 | throw new RuntimeException("签名计算失败", e); 38 | } catch (InvalidKeyException e) { 39 | throw new RuntimeException("无效的私钥", e); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/PmsFreightCompanyDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import java.time.LocalDateTime; 9 | import org.mybatis.dynamic.sql.SqlColumn; 10 | import org.mybatis.dynamic.sql.SqlTable; 11 | 12 | public final class PmsFreightCompanyDynamicSqlSupport { 13 | public static final PmsFreightCompany pmsFreightCompany = new PmsFreightCompany(); 14 | 15 | public static final SqlColumn id = pmsFreightCompany.id; 16 | 17 | public static final SqlColumn name = pmsFreightCompany.name; 18 | 19 | public static final SqlColumn code = pmsFreightCompany.code; 20 | 21 | public static final SqlColumn kind = pmsFreightCompany.kind; 22 | 23 | public static final SqlColumn createTime = pmsFreightCompany.createTime; 24 | 25 | public static final class PmsFreightCompany extends SqlTable { 26 | public final SqlColumn id = column("id", JDBCType.BIGINT); 27 | 28 | public final SqlColumn name = column("name", JDBCType.VARCHAR); 29 | 30 | public final SqlColumn code = column("code", JDBCType.VARCHAR); 31 | 32 | public final SqlColumn kind = column("kind", JDBCType.VARCHAR); 33 | 34 | public final SqlColumn createTime = column("create_time", JDBCType.TIMESTAMP); 35 | 36 | public PmsFreightCompany() { 37 | super("pms_freight_company"); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/PmsProductLadderDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.math.BigDecimal; 8 | import java.sql.JDBCType; 9 | import org.mybatis.dynamic.sql.SqlColumn; 10 | import org.mybatis.dynamic.sql.SqlTable; 11 | 12 | public final class PmsProductLadderDynamicSqlSupport { 13 | public static final PmsProductLadder pmsProductLadder = new PmsProductLadder(); 14 | 15 | public static final SqlColumn id = pmsProductLadder.id; 16 | 17 | public static final SqlColumn productId = pmsProductLadder.productId; 18 | 19 | public static final SqlColumn count = pmsProductLadder.count; 20 | 21 | public static final SqlColumn discount = pmsProductLadder.discount; 22 | 23 | public static final SqlColumn price = pmsProductLadder.price; 24 | 25 | public static final class PmsProductLadder extends SqlTable { 26 | public final SqlColumn id = column("id", JDBCType.BIGINT); 27 | 28 | public final SqlColumn productId = column("product_id", JDBCType.BIGINT); 29 | 30 | public final SqlColumn count = column("count", JDBCType.INTEGER); 31 | 32 | public final SqlColumn discount = column("discount", JDBCType.DECIMAL); 33 | 34 | public final SqlColumn price = column("price", JDBCType.DECIMAL); 35 | 36 | public PmsProductLadder() { 37 | super("pms_product_ladder"); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/SmsHomeNewProductDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import org.mybatis.dynamic.sql.SqlColumn; 9 | import org.mybatis.dynamic.sql.SqlTable; 10 | 11 | public final class SmsHomeNewProductDynamicSqlSupport { 12 | public static final SmsHomeNewProduct smsHomeNewProduct = new SmsHomeNewProduct(); 13 | 14 | public static final SqlColumn id = smsHomeNewProduct.id; 15 | 16 | public static final SqlColumn productId = smsHomeNewProduct.productId; 17 | 18 | public static final SqlColumn productName = smsHomeNewProduct.productName; 19 | 20 | public static final SqlColumn recommendStatus = smsHomeNewProduct.recommendStatus; 21 | 22 | public static final SqlColumn sort = smsHomeNewProduct.sort; 23 | 24 | public static final class SmsHomeNewProduct extends SqlTable { 25 | public final SqlColumn id = column("id", JDBCType.BIGINT); 26 | 27 | public final SqlColumn productId = column("product_id", JDBCType.BIGINT); 28 | 29 | public final SqlColumn productName = column("product_name", JDBCType.VARCHAR); 30 | 31 | public final SqlColumn recommendStatus = column("recommend_status", JDBCType.INTEGER); 32 | 33 | public final SqlColumn sort = column("sort", JDBCType.INTEGER); 34 | 35 | public SmsHomeNewProduct() { 36 | super("sms_home_new_product"); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/domain/CouponHistoryDetail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.domain; 6 | 7 | import com.mall.model.SmsCoupon; 8 | import com.mall.model.SmsCouponHistory; 9 | import com.mall.model.SmsCouponProductCategoryRelation; 10 | import com.mall.model.SmsCouponProductRelation; 11 | import io.swagger.v3.oas.annotations.media.Schema; 12 | 13 | import java.util.List; 14 | 15 | public class CouponHistoryDetail extends SmsCouponHistory { 16 | @Schema(description = "相关优惠券信息") 17 | private SmsCoupon coupon; 18 | @Schema(description = "优惠券关联商品") 19 | private List productRelations; 20 | @Schema(description = "优惠券关联商品分类") 21 | private List categoryRelations; 22 | 23 | public SmsCoupon getCoupon() { 24 | return coupon; 25 | } 26 | 27 | public void setCoupon(SmsCoupon coupon) { 28 | this.coupon = coupon; 29 | } 30 | 31 | public List getProductRelations() { 32 | return productRelations; 33 | } 34 | 35 | public void setProductRelations(List productRelations) { 36 | this.productRelations = productRelations; 37 | } 38 | 39 | public List getCategoryRelations() { 40 | return categoryRelations; 41 | } 42 | 43 | public void setCategoryRelations(List categoryRelations) { 44 | this.categoryRelations = categoryRelations; 45 | } 46 | } -------------------------------------------------------------------------------- /mall-admin-api/src/main/java/com/mall/oms/dto/MoneyParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.oms.dto; 6 | 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | import java.math.BigDecimal; 9 | import javax.validation.constraints.Min; 10 | 11 | public class MoneyParam { 12 | @Schema(description = "订单ID") 13 | private Long orderId; 14 | @Schema(description = "运费金额") 15 | @Min(value = 0, message = "运费必须大于等于0") 16 | private BigDecimal freightAmount; 17 | @Schema(description = "管理员后台调整订单使用的折扣金额") 18 | @Min(value = 0, message = "折扣金额必须大于等于0") 19 | private BigDecimal discountAmount; 20 | @Schema(description = "订单状态:0->待付款;1->待发货;2->已发货;3->已完成;4->已关闭;5->无效订单") 21 | private Integer status; 22 | 23 | public Long getOrderId() { 24 | return orderId; 25 | } 26 | 27 | public void setOrderId(Long orderId) { 28 | this.orderId = orderId; 29 | } 30 | 31 | public BigDecimal getFreightAmount() { 32 | return freightAmount; 33 | } 34 | 35 | public void setFreightAmount(BigDecimal freightAmount) { 36 | this.freightAmount = freightAmount; 37 | } 38 | 39 | public BigDecimal getDiscountAmount() { 40 | return discountAmount; 41 | } 42 | 43 | public void setDiscountAmount(BigDecimal discountAmount) { 44 | this.discountAmount = discountAmount; 45 | } 46 | 47 | public Integer getStatus() { 48 | return status; 49 | } 50 | 51 | public void setStatus(Integer status) { 52 | this.status = status; 53 | } 54 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/PmsAlbumDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import org.mybatis.dynamic.sql.SqlColumn; 9 | import org.mybatis.dynamic.sql.SqlTable; 10 | 11 | public final class PmsAlbumDynamicSqlSupport { 12 | public static final PmsAlbum pmsAlbum = new PmsAlbum(); 13 | 14 | public static final SqlColumn id = pmsAlbum.id; 15 | 16 | public static final SqlColumn name = pmsAlbum.name; 17 | 18 | public static final SqlColumn coverPic = pmsAlbum.coverPic; 19 | 20 | public static final SqlColumn picCount = pmsAlbum.picCount; 21 | 22 | public static final SqlColumn sort = pmsAlbum.sort; 23 | 24 | public static final SqlColumn description = pmsAlbum.description; 25 | 26 | public static final class PmsAlbum extends SqlTable { 27 | public final SqlColumn id = column("id", JDBCType.BIGINT); 28 | 29 | public final SqlColumn name = column("name", JDBCType.VARCHAR); 30 | 31 | public final SqlColumn coverPic = column("cover_pic", JDBCType.VARCHAR); 32 | 33 | public final SqlColumn picCount = column("pic_count", JDBCType.INTEGER); 34 | 35 | public final SqlColumn sort = column("sort", JDBCType.INTEGER); 36 | 37 | public final SqlColumn description = column("description", JDBCType.VARCHAR); 38 | 39 | public PmsAlbum() { 40 | super("pms_album"); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/PmsMemberPriceDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.math.BigDecimal; 8 | import java.sql.JDBCType; 9 | import org.mybatis.dynamic.sql.SqlColumn; 10 | import org.mybatis.dynamic.sql.SqlTable; 11 | 12 | public final class PmsMemberPriceDynamicSqlSupport { 13 | public static final PmsMemberPrice pmsMemberPrice = new PmsMemberPrice(); 14 | 15 | public static final SqlColumn id = pmsMemberPrice.id; 16 | 17 | public static final SqlColumn productId = pmsMemberPrice.productId; 18 | 19 | public static final SqlColumn memberLevelId = pmsMemberPrice.memberLevelId; 20 | 21 | public static final SqlColumn memberPrice = pmsMemberPrice.memberPrice; 22 | 23 | public static final SqlColumn memberLevelName = pmsMemberPrice.memberLevelName; 24 | 25 | public static final class PmsMemberPrice extends SqlTable { 26 | public final SqlColumn id = column("id", JDBCType.BIGINT); 27 | 28 | public final SqlColumn productId = column("product_id", JDBCType.BIGINT); 29 | 30 | public final SqlColumn memberLevelId = column("member_level_id", JDBCType.BIGINT); 31 | 32 | public final SqlColumn memberPrice = column("member_price", JDBCType.DECIMAL); 33 | 34 | public final SqlColumn memberLevelName = column("member_level_name", JDBCType.VARCHAR); 35 | 36 | public PmsMemberPrice() { 37 | super("pms_member_price"); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /mall-mini-api/src/main/java/com/mall/domain/CouponHistory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.domain; 6 | 7 | import com.mall.model.SmsCoupon; 8 | import com.mall.model.SmsCouponHistory; 9 | import com.mall.model.SmsCouponProductCategoryRelation; 10 | import com.mall.model.SmsCouponProductRelation; 11 | import io.swagger.v3.oas.annotations.media.Schema; 12 | 13 | import java.util.List; 14 | 15 | public class CouponHistory extends SmsCouponHistory { 16 | @Schema(description = "相关优惠券信息") 17 | private SmsCoupon coupon; 18 | @Schema(description = "优惠券关联商品") 19 | private List productRelationList; 20 | @Schema(description = "优惠券关联商品分类") 21 | private List categoryRelationList; 22 | 23 | public SmsCoupon getCoupon() { 24 | return coupon; 25 | } 26 | 27 | public void setCoupon(SmsCoupon coupon) { 28 | this.coupon = coupon; 29 | } 30 | 31 | public List getProductRelationList() { 32 | return productRelationList; 33 | } 34 | 35 | public void setProductRelationList(List productRelationList) { 36 | this.productRelationList = productRelationList; 37 | } 38 | 39 | public List getCategoryRelationList() { 40 | return categoryRelationList; 41 | } 42 | 43 | public void setCategoryRelationList(List categoryRelationList) { 44 | this.categoryRelationList = categoryRelationList; 45 | } 46 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/OmsOrderReturnReasonDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import java.time.LocalDateTime; 9 | import org.mybatis.dynamic.sql.SqlColumn; 10 | import org.mybatis.dynamic.sql.SqlTable; 11 | 12 | public final class OmsOrderReturnReasonDynamicSqlSupport { 13 | public static final OmsOrderReturnReason omsOrderReturnReason = new OmsOrderReturnReason(); 14 | 15 | public static final SqlColumn id = omsOrderReturnReason.id; 16 | 17 | public static final SqlColumn name = omsOrderReturnReason.name; 18 | 19 | public static final SqlColumn sort = omsOrderReturnReason.sort; 20 | 21 | public static final SqlColumn status = omsOrderReturnReason.status; 22 | 23 | public static final SqlColumn createTime = omsOrderReturnReason.createTime; 24 | 25 | public static final class OmsOrderReturnReason extends SqlTable { 26 | public final SqlColumn id = column("id", JDBCType.BIGINT); 27 | 28 | public final SqlColumn name = column("name", JDBCType.VARCHAR); 29 | 30 | public final SqlColumn sort = column("sort", JDBCType.INTEGER); 31 | 32 | public final SqlColumn status = column("status", JDBCType.INTEGER); 33 | 34 | public final SqlColumn createTime = column("create_time", JDBCType.TIMESTAMP); 35 | 36 | public OmsOrderReturnReason() { 37 | super("oms_order_return_reason"); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /mall-crosscut/src/main/java/com/mall/crosscut/util/Hex.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.crosscut.util; 6 | 7 | public final class Hex { 8 | private static final char[] HEX = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 9 | 'a', 'b', 'c', 'd', 'e', 'f' }; 10 | 11 | public static char[] encode(byte[] bytes) { 12 | final int nBytes = bytes.length; 13 | char[] result = new char[2 * nBytes]; 14 | 15 | int j = 0; 16 | for (byte aByte : bytes) { 17 | // Char for top 4 bits 18 | result[j++] = HEX[(0xF0 & aByte) >>> 4]; 19 | // Bottom 4 20 | result[j++] = HEX[(0x0F & aByte)]; 21 | } 22 | 23 | return result; 24 | } 25 | 26 | public static byte[] decode(CharSequence s) { 27 | int nChars = s.length(); 28 | 29 | if (nChars % 2 != 0) { 30 | throw new IllegalArgumentException( 31 | "Hex-encoded string must have an even number of characters"); 32 | } 33 | 34 | byte[] result = new byte[nChars / 2]; 35 | 36 | for (int i = 0; i < nChars; i += 2) { 37 | int msb = Character.digit(s.charAt(i), 16); 38 | int lsb = Character.digit(s.charAt(i + 1), 16); 39 | 40 | if (msb < 0 || lsb < 0) { 41 | throw new IllegalArgumentException( 42 | "Detected a Non-hex character at " + (i + 1) + " or " + (i + 2) + " position"); 43 | } 44 | result[i / 2] = (byte) ((msb << 4) | lsb); 45 | } 46 | return result; 47 | } 48 | } -------------------------------------------------------------------------------- /mall-model/src/main/java/com/mall/mapper/SmsCouponProductRelationDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2023 - 2024 yingtingxu(徐应庭). All rights reserved. 3 | */ 4 | 5 | package com.mall.mapper; 6 | 7 | import java.sql.JDBCType; 8 | import org.mybatis.dynamic.sql.SqlColumn; 9 | import org.mybatis.dynamic.sql.SqlTable; 10 | 11 | public final class SmsCouponProductRelationDynamicSqlSupport { 12 | public static final SmsCouponProductRelation smsCouponProductRelation = new SmsCouponProductRelation(); 13 | 14 | public static final SqlColumn id = smsCouponProductRelation.id; 15 | 16 | public static final SqlColumn couponId = smsCouponProductRelation.couponId; 17 | 18 | public static final SqlColumn productId = smsCouponProductRelation.productId; 19 | 20 | public static final SqlColumn productName = smsCouponProductRelation.productName; 21 | 22 | public static final SqlColumn productSn = smsCouponProductRelation.productSn; 23 | 24 | public static final class SmsCouponProductRelation extends SqlTable { 25 | public final SqlColumn id = column("id", JDBCType.BIGINT); 26 | 27 | public final SqlColumn couponId = column("coupon_id", JDBCType.BIGINT); 28 | 29 | public final SqlColumn productId = column("product_id", JDBCType.BIGINT); 30 | 31 | public final SqlColumn productName = column("product_name", JDBCType.VARCHAR); 32 | 33 | public final SqlColumn productSn = column("product_sn", JDBCType.VARCHAR); 34 | 35 | public SmsCouponProductRelation() { 36 | super("sms_coupon_product_relation"); 37 | } 38 | } 39 | } --------------------------------------------------------------------------------