├── src ├── main │ ├── resources │ │ ├── application-prod.yml │ │ ├── config │ │ │ ├── settings.properties │ │ │ └── database.properties │ │ ├── cert │ │ │ └── jwt.jks │ │ ├── application.yml │ │ ├── graphql │ │ │ ├── root.graphqls │ │ │ └── schema.graphqls │ │ ├── application-local.yml │ │ └── application-dev.yml │ └── java │ │ └── com │ │ └── rfrongfei │ │ └── onehammer │ │ ├── base │ │ ├── entity │ │ │ ├── UserInfo.java │ │ │ └── Audit.java │ │ ├── enums │ │ │ └── OnehammerEnum.java │ │ ├── util │ │ │ ├── RedisKeyHelper.java │ │ │ ├── Constant.java │ │ │ ├── BeanHelper.java │ │ │ ├── HttpHelper.java │ │ │ ├── EnumHelper.java │ │ │ ├── SpringContextHelper.java │ │ │ ├── StringHelper.java │ │ │ ├── RedisHelper.java │ │ │ ├── JwtTokenHelper.java │ │ │ ├── DateUtil.java │ │ │ ├── EntityHelper.java │ │ │ └── PkgUtil.java │ │ ├── properties │ │ │ └── TokenProperties.java │ │ ├── interceptor │ │ │ └── MybatisPagePlugins.java │ │ ├── exception │ │ │ ├── OnehammerExceptionHandler.java │ │ │ └── OnehammerException.java │ │ ├── key │ │ │ ├── CommonIdGenetator.java │ │ │ └── IdGenerator.java │ │ ├── handler │ │ │ └── OnehammerMateObjectHandler.java │ │ └── config │ │ │ ├── redis │ │ │ └── RedisConfig.java │ │ │ └── durid │ │ │ └── DruidDataSourceConfig.java │ │ ├── goods │ │ ├── service │ │ │ ├── IGoodsService.java │ │ │ ├── IGoodsSizeService.java │ │ │ ├── IGoodsCategoryService.java │ │ │ ├── IGoodsSalesRecordService.java │ │ │ └── impl │ │ │ │ ├── GoodsServiceImpl.java │ │ │ │ ├── GoodsSizeServiceImpl.java │ │ │ │ ├── GoodsCategoryServiceImpl.java │ │ │ │ └── GoodsSalesRecordServiceImpl.java │ │ ├── mapper │ │ │ ├── GoodsMapper.java │ │ │ ├── GoodsSizeMapper.java │ │ │ ├── GoodsCategoryMapper.java │ │ │ └── GoodsSalesRecordMapper.java │ │ └── entity │ │ │ ├── GoodsCategory.java │ │ │ ├── GoodsSize.java │ │ │ ├── GoodsSalesRecord.java │ │ │ └── Goods.java │ │ ├── order │ │ ├── service │ │ │ ├── IOrderService.java │ │ │ ├── IOrderPayService.java │ │ │ ├── IOrderDetailService.java │ │ │ ├── IOrderRefundService.java │ │ │ ├── IOrderDeliveryService.java │ │ │ ├── IOrderEvaluateService.java │ │ │ ├── IOrderProgressService.java │ │ │ ├── IOrderEvaluatePicService.java │ │ │ └── impl │ │ │ │ ├── OrderServiceImpl.java │ │ │ │ ├── OrderPayServiceImpl.java │ │ │ │ ├── OrderDetailServiceImpl.java │ │ │ │ ├── OrderRefundServiceImpl.java │ │ │ │ ├── OrderDeliveryServiceImpl.java │ │ │ │ ├── OrderEvaluateServiceImpl.java │ │ │ │ ├── OrderProgressServiceImpl.java │ │ │ │ └── OrderEvaluatePicServiceImpl.java │ │ ├── mapper │ │ │ ├── OrderMapper.java │ │ │ ├── OrderPayMapper.java │ │ │ ├── OrderDetailMapper.java │ │ │ ├── OrderRefundMapper.java │ │ │ ├── OrderDeliveryMapper.java │ │ │ ├── OrderEvaluateMapper.java │ │ │ ├── OrderProgressMapper.java │ │ │ └── OrderEvaluatePicMapper.java │ │ ├── enums │ │ │ ├── PayStatusEnum.java │ │ │ ├── ProccessStatusEnum.java │ │ │ └── OrderStatusEnum.java │ │ └── entity │ │ │ ├── OrderEvaluatePic.java │ │ │ ├── OrderEvaluate.java │ │ │ ├── OrderDelivery.java │ │ │ ├── OrderPay.java │ │ │ ├── OrderProgress.java │ │ │ ├── OrderDetail.java │ │ │ ├── OrderRefund.java │ │ │ └── Order.java │ │ ├── common │ │ ├── service │ │ │ ├── IAddressService.java │ │ │ ├── INoticeService.java │ │ │ ├── IRegionService.java │ │ │ ├── impl │ │ │ │ ├── NoticeServiceImpl.java │ │ │ │ ├── RegionServiceImpl.java │ │ │ │ ├── AddressServiceImpl.java │ │ │ │ └── UserServiceImpl.java │ │ │ ├── IUserInfoService.java │ │ │ ├── IUserService.java │ │ │ └── UserInfoServiceHolder.java │ │ ├── mapper │ │ │ ├── NoticeMapper.java │ │ │ ├── RegionMapper.java │ │ │ ├── AddressMapper.java │ │ │ └── UserMapper.java │ │ ├── vo │ │ │ ├── UserInfoVO.java │ │ │ └── InfoVO.java │ │ ├── input │ │ │ ├── UserInput.java │ │ │ └── InfoVOInput.java │ │ ├── enums │ │ │ ├── LoginStatus.java │ │ │ └── UserType.java │ │ ├── resolver │ │ │ ├── mutation │ │ │ │ └── UserInfoMutationResolver.java │ │ │ └── query │ │ │ │ └── UserInfoQueryResolver.java │ │ └── entity │ │ │ ├── Region.java │ │ │ ├── User.java │ │ │ ├── Notice.java │ │ │ └── Address.java │ │ ├── coupon │ │ ├── service │ │ │ ├── ICouponService.java │ │ │ ├── ICouponRecordService.java │ │ │ └── impl │ │ │ │ ├── CouponServiceImpl.java │ │ │ │ └── CouponRecordServiceImpl.java │ │ ├── mapper │ │ │ ├── CouponMapper.java │ │ │ └── CouponRecordMapper.java │ │ ├── enums │ │ │ ├── CouponTypeEnum.java │ │ │ └── UseStatusEnum.java │ │ └── entity │ │ │ ├── CouponRecord.java │ │ │ └── Coupon.java │ │ ├── user │ │ ├── service │ │ │ ├── IConsumerInfoService.java │ │ │ ├── IUserAccountBalanceService.java │ │ │ ├── IUserIntegralRecordService.java │ │ │ ├── IUserRechargeRecordService.java │ │ │ ├── IUserIntegralIncRecordService.java │ │ │ ├── IUserWithdrawalRecordService.java │ │ │ └── impl │ │ │ │ ├── UserAccountBalanceServiceImpl.java │ │ │ │ ├── UserIntegralRecordServiceImpl.java │ │ │ │ ├── UserRechargeRecordServiceImpl.java │ │ │ │ ├── UserWithdrawalRecordServiceImpl.java │ │ │ │ ├── UserIntegralIncRecordServiceImpl.java │ │ │ │ └── ConsumerInfoServiceImpl.java │ │ ├── mapper │ │ │ ├── ConsumerInfoMapper.java │ │ │ ├── UserAccountBalanceMapper.java │ │ │ ├── UserIntegralRecordMapper.java │ │ │ ├── UserRechargeRecordMapper.java │ │ │ ├── UserWithdrawalRecordMapper.java │ │ │ └── UserIntegralIncRecordMapper.java │ │ ├── enums │ │ │ ├── IntegralTypeEnum.java │ │ │ └── WithdrawalStatusEnum.java │ │ └── entity │ │ │ ├── UserIntegralRecord.java │ │ │ ├── UserAccountBalance.java │ │ │ ├── UserRechargeRecord.java │ │ │ ├── UserWithdrawalRecord.java │ │ │ ├── UserIntegralIncRecord.java │ │ │ └── ConsumerInfo.java │ │ ├── merchants │ │ ├── service │ │ │ ├── IMerchantsInfoService.java │ │ │ ├── IMerchantsLeagueService.java │ │ │ ├── IMerchantsActivityService.java │ │ │ ├── IMerchantsCategoryService.java │ │ │ ├── IMerchantsLeagueLevelService.java │ │ │ └── impl │ │ │ │ ├── MerchantsLeagueServiceImpl.java │ │ │ │ ├── MerchantsActivityServiceImpl.java │ │ │ │ ├── MerchantsCategoryServiceImpl.java │ │ │ │ ├── MerchantsLeagueLevelServiceImpl.java │ │ │ │ └── MerchantsInfoServiceImpl.java │ │ ├── mapper │ │ │ ├── MerchantsInfoMapper.java │ │ │ ├── MerchantsLeagueMapper.java │ │ │ ├── MerchantsActivityMapper.java │ │ │ ├── MerchantsCategoryMapper.java │ │ │ └── MerchantsLeagueLevelMapper.java │ │ ├── enums │ │ │ └── ActivityStatusEnum.java │ │ └── entity │ │ │ ├── MerchantsLeague.java │ │ │ ├── MerchantsCategory.java │ │ │ ├── MerchantsLeagueLevel.java │ │ │ ├── MerchantsActivity.java │ │ │ └── MerchantsInfo.java │ │ ├── shoppingcart │ │ ├── service │ │ │ ├── IShoppingCartService.java │ │ │ └── impl │ │ │ │ └── ShoppingCartServiceImpl.java │ │ ├── mapper │ │ │ └── ShoppingCartMapper.java │ │ └── entity │ │ │ └── ShoppingCart.java │ │ ├── licenses │ │ ├── service │ │ │ ├── ILicenseMerchantsService.java │ │ │ ├── ILicenseDeliverymanService.java │ │ │ └── impl │ │ │ │ ├── LicenseMerchantsServiceImpl.java │ │ │ │ └── LicenseDeliverymanServiceImpl.java │ │ ├── mapper │ │ │ ├── LicenseMerchantsMapper.java │ │ │ └── LicenseDeliverymanMapper.java │ │ ├── enums │ │ │ └── VerifyStatuEnum.java │ │ └── entity │ │ │ ├── LicenseDeliveryman.java │ │ │ └── LicenseMerchants.java │ │ ├── deliveryman │ │ ├── service │ │ │ ├── IDeliverymanInfoService.java │ │ │ └── impl │ │ │ │ └── DeliverymanInfoServiceImpl.java │ │ ├── mapper │ │ │ └── DeliverymanInfoMapper.java │ │ └── entity │ │ │ └── DeliverymanInfo.java │ │ └── OnehammerApplication.java └── test │ └── java │ └── com │ └── rfrongfei │ └── onehammer │ └── common │ └── service │ └── impl │ └── UserServiceImplTest.java ├── README.md ├── .gitignore └── pom.xml /src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/resources/config/settings.properties: -------------------------------------------------------------------------------- 1 | token.expire = 7 2 | token.flush = 7 3 | smsCode.expire = 180 -------------------------------------------------------------------------------- /src/main/resources/cert/jwt.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/170309/rfbackend/HEAD/src/main/resources/cert/jwt.jks -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/entity/UserInfo.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.entity; 2 | 3 | public interface UserInfo { 4 | void setUserId(String userId); 5 | 6 | String getUserId(); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 9000 3 | spring: 4 | profiles: 5 | active: dev 6 | 7 | graphql: 8 | servlet: 9 | enabled: true 10 | corsEnabled: true 11 | tools: 12 | schemaLocationPattern: "**/*.graphqls" -------------------------------------------------------------------------------- /src/main/resources/config/database.properties: -------------------------------------------------------------------------------- 1 | datasource1.url=jdbc:mysql://rm-wz9x2692i9kgi870pqo.mysql.rds.aliyuncs.com:3306/onehammer?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&autoReconnect=true&useSSL=false 2 | datasource1.username=rfronfei 3 | datasource1.password=29H@OtC^5 -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/goods/service/IGoodsService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.goods.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.goods.entity.Goods; 5 | 6 | public interface IGoodsService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/service/IOrderService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.order.entity.Order; 5 | 6 | public interface IOrderService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/service/IAddressService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.common.entity.Address; 5 | 6 | public interface IAddressService extends IService
{ 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/service/INoticeService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.common.entity.Notice; 5 | 6 | public interface INoticeService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/service/IRegionService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.common.entity.Region; 5 | 6 | public interface IRegionService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/coupon/service/ICouponService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.coupon.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.coupon.entity.Coupon; 5 | 6 | public interface ICouponService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/goods/service/IGoodsSizeService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.goods.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.goods.entity.GoodsSize; 5 | 6 | public interface IGoodsSizeService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/service/IOrderPayService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.order.entity.OrderPay; 5 | 6 | public interface IOrderPayService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/service/IOrderDetailService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.order.entity.OrderDetail; 5 | 6 | public interface IOrderDetailService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/service/IOrderRefundService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.order.entity.OrderRefund; 5 | 6 | public interface IOrderRefundService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/service/IConsumerInfoService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.user.entity.ConsumerInfo; 5 | 6 | public interface IConsumerInfoService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/enums/OnehammerEnum.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.enums; 2 | 3 | /** 4 | * @ClassName OnehammerEnum 5 | * @Author Jxlsx 6 | * @Date 2019/12/17 下午6:23 7 | * @Version 1.0 8 | */ 9 | public interface OnehammerEnum { 10 | Integer getCode(); 11 | String getDesc(); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/goods/service/IGoodsCategoryService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.goods.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.goods.entity.GoodsCategory; 5 | 6 | public interface IGoodsCategoryService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/service/IOrderDeliveryService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.order.entity.OrderDelivery; 5 | 6 | public interface IOrderDeliveryService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/service/IOrderEvaluateService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.order.entity.OrderEvaluate; 5 | 6 | public interface IOrderEvaluateService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/service/IOrderProgressService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.order.entity.OrderProgress; 5 | 6 | public interface IOrderProgressService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/goods/service/IGoodsSalesRecordService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.goods.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.goods.entity.GoodsSalesRecord; 5 | 6 | public interface IGoodsSalesRecordService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/service/IMerchantsInfoService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.merchants.entity.MerchantsInfo; 5 | 6 | public interface IMerchantsInfoService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/service/IOrderEvaluatePicService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.order.entity.OrderEvaluatePic; 5 | 6 | public interface IOrderEvaluatePicService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/shoppingcart/service/IShoppingCartService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.shoppingcart.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.shoppingcart.entity.ShoppingCart; 5 | 6 | public interface IShoppingCartService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/service/IUserAccountBalanceService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.user.entity.UserAccountBalance; 5 | 6 | public interface IUserAccountBalanceService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/service/IUserIntegralRecordService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.user.entity.UserIntegralRecord; 5 | 6 | public interface IUserIntegralRecordService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/service/IUserRechargeRecordService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.user.entity.UserRechargeRecord; 5 | 6 | public interface IUserRechargeRecordService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/licenses/service/ILicenseMerchantsService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.licenses.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.licenses.entity.LicenseMerchants; 5 | 6 | public interface ILicenseMerchantsService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/service/IMerchantsLeagueService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.merchants.entity.MerchantsLeague; 5 | 6 | public interface IMerchantsLeagueService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/licenses/service/ILicenseDeliverymanService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.licenses.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.licenses.entity.LicenseDeliveryman; 5 | 6 | public interface ILicenseDeliverymanService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/service/IMerchantsActivityService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.merchants.entity.MerchantsActivity; 5 | 6 | public interface IMerchantsActivityService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/service/IMerchantsCategoryService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.merchants.entity.MerchantsCategory; 5 | 6 | public interface IMerchantsCategoryService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/service/IUserIntegralIncRecordService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.user.entity.UserIntegralIncRecord; 5 | 6 | public interface IUserIntegralIncRecordService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/service/IUserWithdrawalRecordService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.user.entity.UserWithdrawalRecord; 5 | 6 | public interface IUserWithdrawalRecordService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/deliveryman/service/IDeliverymanInfoService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.deliveryman.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.deliveryman.entity.DeliverymanInfo; 5 | 6 | public interface IDeliverymanInfoService extends IService { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/goods/mapper/GoodsMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.goods.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.goods.entity.Goods; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface GoodsMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/mapper/OrderMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.order.entity.Order; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface OrderMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/mapper/NoticeMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.common.entity.Notice; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface NoticeMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/mapper/RegionMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.common.entity.Region; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface RegionMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/coupon/mapper/CouponMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.coupon.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.coupon.entity.Coupon; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface CouponMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/mapper/AddressMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.common.entity.Address; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface AddressMapper extends BaseMapper
{ 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/service/IMerchantsLeagueLevelService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.merchants.entity.MerchantsLeagueLevel; 5 | 6 | public interface IMerchantsLeagueLevelService extends IService { 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/mapper/OrderPayMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.order.entity.OrderPay; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface OrderPayMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/goods/mapper/GoodsSizeMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.goods.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.goods.entity.GoodsSize; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface GoodsSizeMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/util/RedisKeyHelper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.util; 2 | 3 | public class RedisKeyHelper { 4 | 5 | public static final String smsCodePrefix = "SMS_CODE_"; 6 | 7 | // 电话号码验证码key 8 | public static String smsCode(String phone,Integer userType){ 9 | return smsCodePrefix + userType + phone; 10 | } 11 | 12 | } -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/coupon/service/ICouponRecordService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.coupon.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.coupon.entity.Coupon; 5 | import com.rfrongfei.onehammer.coupon.entity.CouponRecord; 6 | 7 | public interface ICouponRecordService extends IService { 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/mapper/OrderDetailMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.order.entity.OrderDetail; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface OrderDetailMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/mapper/OrderRefundMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.order.entity.OrderRefund; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface OrderRefundMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/mapper/ConsumerInfoMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.user.entity.ConsumerInfo; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface ConsumerInfoMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/coupon/mapper/CouponRecordMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.coupon.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.coupon.entity.CouponRecord; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface CouponRecordMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/goods/mapper/GoodsCategoryMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.goods.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.goods.entity.GoodsCategory; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface GoodsCategoryMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/mapper/OrderDeliveryMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.order.entity.OrderDelivery; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface OrderDeliveryMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/mapper/OrderEvaluateMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.order.entity.OrderEvaluate; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface OrderEvaluateMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/mapper/OrderProgressMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.order.entity.OrderProgress; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface OrderProgressMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/vo/UserInfoVO.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.vo; 2 | 3 | import com.rfrongfei.onehammer.base.entity.UserInfo; 4 | import com.rfrongfei.onehammer.common.entity.User; 5 | import lombok.Builder; 6 | import lombok.Data; 7 | 8 | @Builder 9 | @Data 10 | public class UserInfoVO { 11 | private UserInfo userInfo; 12 | private User user; 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/goods/mapper/GoodsSalesRecordMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.goods.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.goods.entity.GoodsSalesRecord; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface GoodsSalesRecordMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/mapper/MerchantsInfoMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.merchants.entity.MerchantsInfo; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface MerchantsInfoMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/mapper/OrderEvaluatePicMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.order.entity.OrderEvaluatePic; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface OrderEvaluatePicMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/licenses/mapper/LicenseMerchantsMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.licenses.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.licenses.entity.LicenseMerchants; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface LicenseMerchantsMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/mapper/MerchantsLeagueMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.merchants.entity.MerchantsLeague; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface MerchantsLeagueMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/shoppingcart/mapper/ShoppingCartMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.shoppingcart.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.shoppingcart.entity.ShoppingCart; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface ShoppingCartMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/mapper/UserAccountBalanceMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.user.entity.UserAccountBalance; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface UserAccountBalanceMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/mapper/UserIntegralRecordMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.user.entity.UserIntegralRecord; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface UserIntegralRecordMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/mapper/UserRechargeRecordMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.user.entity.UserRechargeRecord; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface UserRechargeRecordMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/deliveryman/mapper/DeliverymanInfoMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.deliveryman.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.deliveryman.entity.DeliverymanInfo; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface DeliverymanInfoMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/mapper/UserWithdrawalRecordMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.user.entity.UserWithdrawalRecord; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface UserWithdrawalRecordMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/licenses/mapper/LicenseDeliverymanMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.licenses.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.licenses.entity.LicenseDeliveryman; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface LicenseDeliverymanMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/mapper/MerchantsActivityMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.merchants.entity.MerchantsActivity; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface MerchantsActivityMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/mapper/MerchantsCategoryMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.merchants.entity.MerchantsCategory; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface MerchantsCategoryMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/mapper/UserIntegralIncRecordMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.user.entity.UserIntegralIncRecord; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface UserIntegralIncRecordMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/resources/graphql/root.graphqls: -------------------------------------------------------------------------------- 1 | schema { 2 | query: Query 3 | mutation: Mutaion 4 | } 5 | type Mutaion{ 6 | login(userInput:UserForm):InfoVO 7 | updateUser(infoVO:InfoVOInput):InfoVO 8 | deleteUser(infoVO:InfoVOInput):InfoVO 9 | } 10 | 11 | type Query{ 12 | smsCode(phone:String!,userType:Int!):String 13 | getUserInfo(userId:String,phone:String):InfoVO 14 | loginStatus(userId:String!):User 15 | } -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/mapper/MerchantsLeagueLevelMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.merchants.entity.MerchantsLeagueLevel; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | @Mapper 8 | public interface MerchantsLeagueLevelMapper extends BaseMapper { 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/OnehammerApplication.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class OnehammerApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(OnehammerApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/input/UserInput.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.input; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class UserInput { 7 | /** 用户电话号码 */ 8 | private String phone; 9 | /** 用户验证码 */ 10 | private String smsCode; 11 | /** 用户密码 */ 12 | private String password; 13 | /** 用户类型 */ 14 | private Integer userType; 15 | /** 用户ID */ 16 | private String userId; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/util/Constant.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.util; 2 | 3 | import java.util.UUID; 4 | 5 | /** 6 | * @ClassName Constant 7 | * @Author Jxlsx 8 | * @Date 2019/12/17 下午7:04 9 | * @Version 1.0 10 | */ 11 | public class Constant { 12 | public static final String JWT_ID = UUID.randomUUID().toString(); 13 | /** 14 | * 加密密文 15 | */ 16 | public static final String JWT_SECRET = "woyebuzhidaoxiediansha"; 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/coupon/enums/CouponTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.coupon.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * @ClassName CouponTypeEnum 9 | * @Author Jxlsx 10 | * @Date 2019/12/15 下午11:52 11 | * @Version 1.0 12 | */ 13 | @Getter 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | public enum CouponTypeEnum { 17 | DISCOUNT(0), 18 | REDUTION(1), 19 | ; 20 | private Integer code; 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/licenses/enums/VerifyStatuEnum.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.licenses.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * @ClassName VerifyStatuEnum 9 | * @Author Jxlsx 10 | * @Date 2019/12/16 上午12:29 11 | * @Version 1.0 12 | */ 13 | @Getter 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | public enum VerifyStatuEnum { 17 | SUCCESS(0), 18 | FAIL(1), 19 | WAIT(2), 20 | ; 21 | private Integer code; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.rfrongfei.onehammer.common.entity.User; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Select; 7 | 8 | import java.util.Map; 9 | 10 | @Mapper 11 | public interface UserMapper extends BaseMapper { 12 | 13 | @Select("select u.* ,c.* from user u,rf_consumer_info") 14 | Map findConsumerInfo(); 15 | 16 | } -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/goods/service/impl/GoodsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.goods.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.goods.mapper.GoodsMapper; 5 | import com.rfrongfei.onehammer.goods.entity.Goods; 6 | import com.rfrongfei.onehammer.goods.service.IGoodsService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class GoodsServiceImpl extends ServiceImpl implements IGoodsService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/enums/PayStatusEnum.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * @ClassName PayStatusEnum 9 | * @Author Jxlsx 10 | * @Date 2019/12/16 上午1:33 11 | * @Version 1.0 12 | */ 13 | @Getter 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | public enum PayStatusEnum { 17 | /** 已支付 */ 18 | PAID(0), 19 | NOT_PAID(1), 20 | WAIT(2) 21 | ; 22 | private Integer code; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/service/impl/OrderServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.order.mapper.OrderMapper; 5 | import com.rfrongfei.onehammer.order.entity.Order; 6 | import com.rfrongfei.onehammer.order.service.IOrderService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class OrderServiceImpl extends ServiceImpl implements IOrderService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/enums/ActivityStatusEnum.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * 商家活动状态 9 | * @ClassName ActivityStatusEnum 10 | * @Author Jxlsx 11 | * @Date 2019/12/16 上午12:34 12 | * @Version 1.0 13 | */ 14 | @Getter 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | public enum ActivityStatusEnum { 18 | ONLINE(0), 19 | OFFLINE(1), 20 | ; 21 | private Integer code; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/service/impl/NoticeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.common.mapper.NoticeMapper; 5 | import com.rfrongfei.onehammer.common.entity.Notice; 6 | import com.rfrongfei.onehammer.common.service.INoticeService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class NoticeServiceImpl extends ServiceImpl implements INoticeService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/service/impl/RegionServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.common.mapper.RegionMapper; 5 | import com.rfrongfei.onehammer.common.entity.Region; 6 | import com.rfrongfei.onehammer.common.service.IRegionService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class RegionServiceImpl extends ServiceImpl implements IRegionService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/coupon/service/impl/CouponServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.coupon.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.coupon.mapper.CouponMapper; 5 | import com.rfrongfei.onehammer.coupon.entity.Coupon; 6 | import com.rfrongfei.onehammer.coupon.service.ICouponService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class CouponServiceImpl extends ServiceImpl implements ICouponService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/coupon/enums/UseStatusEnum.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.coupon.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * @ClassName UseStatusEnum 9 | * @Author Jxlsx 10 | * @Date 2019/12/15 下午11:55 11 | * @Version 1.0 12 | */ 13 | @Getter 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | public enum UseStatusEnum { 17 | USED(0,"未使用"), 18 | UNUSED(1,"已使用"), 19 | ; 20 | private Integer code; 21 | private String description; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/enums/IntegralTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * @ClassName IntegralType 9 | * @Author Jxlsx 10 | * @Date 2019/12/15 下午12:29 11 | * @Version 1.0 12 | */ 13 | @Getter 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | public enum IntegralTypeEnum { 17 | ORDER(0,"订单消费增加"), 18 | RECHARGE(1,"充值消费增加"), 19 | ; 20 | private Integer code; 21 | private String type; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/service/impl/AddressServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.common.mapper.AddressMapper; 5 | import com.rfrongfei.onehammer.common.entity.Address; 6 | import com.rfrongfei.onehammer.common.service.IAddressService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class AddressServiceImpl extends ServiceImpl implements IAddressService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/service/impl/OrderPayServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.order.mapper.OrderPayMapper; 5 | import com.rfrongfei.onehammer.order.entity.OrderPay; 6 | import com.rfrongfei.onehammer.order.service.IOrderPayService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class OrderPayServiceImpl extends ServiceImpl implements IOrderPayService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/goods/service/impl/GoodsSizeServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.goods.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.goods.mapper.GoodsSizeMapper; 5 | import com.rfrongfei.onehammer.goods.entity.GoodsSize; 6 | import com.rfrongfei.onehammer.goods.service.IGoodsSizeService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class GoodsSizeServiceImpl extends ServiceImpl implements IGoodsSizeService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/service/IUserInfoService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.service; 2 | 3 | import com.rfrongfei.onehammer.base.entity.UserInfo; 4 | import com.rfrongfei.onehammer.common.input.UserInput; 5 | import com.rfrongfei.onehammer.common.vo.UserInfoVO; 6 | 7 | public interface IUserInfoService { 8 | 9 | UserInfoVO phoneLogin(UserInput userInput); 10 | UserInfo getUserInfoPhone(String phone); 11 | UserInfo getUserInfoUserId(String userId); 12 | void updateUser(UserInfo userInfo); 13 | void deleteUser(UserInfo userInfo); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/service/impl/OrderDetailServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.order.mapper.OrderDetailMapper; 5 | import com.rfrongfei.onehammer.order.entity.OrderDetail; 6 | import com.rfrongfei.onehammer.order.service.IOrderDetailService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class OrderDetailServiceImpl extends ServiceImpl implements IOrderDetailService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/service/impl/OrderRefundServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.order.mapper.OrderRefundMapper; 5 | import com.rfrongfei.onehammer.order.entity.OrderRefund; 6 | import com.rfrongfei.onehammer.order.service.IOrderRefundService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class OrderRefundServiceImpl extends ServiceImpl implements IOrderRefundService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/input/InfoVOInput.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.input; 2 | 3 | import com.rfrongfei.onehammer.common.entity.User; 4 | import com.rfrongfei.onehammer.deliveryman.entity.DeliverymanInfo; 5 | import com.rfrongfei.onehammer.merchants.entity.MerchantsInfo; 6 | import com.rfrongfei.onehammer.user.entity.ConsumerInfo; 7 | import lombok.Data; 8 | 9 | @Data 10 | public class InfoVOInput { 11 | private ConsumerInfo consumerInfo; 12 | private DeliverymanInfo deliverymanInfo; 13 | private MerchantsInfo merchantsInfo; 14 | private User user; 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/coupon/service/impl/CouponRecordServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.coupon.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.coupon.mapper.CouponRecordMapper; 5 | import com.rfrongfei.onehammer.coupon.entity.CouponRecord; 6 | import com.rfrongfei.onehammer.coupon.service.ICouponRecordService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class CouponRecordServiceImpl extends ServiceImpl implements ICouponRecordService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/goods/service/impl/GoodsCategoryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.goods.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.goods.mapper.GoodsCategoryMapper; 5 | import com.rfrongfei.onehammer.goods.entity.GoodsCategory; 6 | import com.rfrongfei.onehammer.goods.service.IGoodsCategoryService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class GoodsCategoryServiceImpl extends ServiceImpl implements IGoodsCategoryService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/service/impl/OrderDeliveryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.order.mapper.OrderDeliveryMapper; 5 | import com.rfrongfei.onehammer.order.entity.OrderDelivery; 6 | import com.rfrongfei.onehammer.order.service.IOrderDeliveryService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class OrderDeliveryServiceImpl extends ServiceImpl implements IOrderDeliveryService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/service/impl/OrderEvaluateServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.order.mapper.OrderEvaluateMapper; 5 | import com.rfrongfei.onehammer.order.entity.OrderEvaluate; 6 | import com.rfrongfei.onehammer.order.service.IOrderEvaluateService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class OrderEvaluateServiceImpl extends ServiceImpl implements IOrderEvaluateService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/service/impl/OrderProgressServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.order.mapper.OrderProgressMapper; 5 | import com.rfrongfei.onehammer.order.entity.OrderProgress; 6 | import com.rfrongfei.onehammer.order.service.IOrderProgressService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class OrderProgressServiceImpl extends ServiceImpl implements IOrderProgressService { 11 | } 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 外卖平台开源代码 2 | > 开发过程中遇到的订单分配的问题,目前是如下方式解决的: 3 | > 1. 用消息队列接收商户确认的订单号 4 | > 2. redis中维护一个当前在线骑手位置的位置池 5 | > 3. 如果消息被消费后,但是没有骑手在线,那订单会进入等待队列 6 | > 4. 订阅骑手上线消息,优先分配等待队列中的订单 7 | > // 整一个逻辑是这样的,但是感觉到有哪里不对,欢迎看到这个仓库的大佬私我:502228545.学习一下 谢谢 8 | 9 | ## 技术栈: 10 | springboot、mybatisplus、getui、easy-pay、mysql、redis、Aliyun RocketMQ,AliyunOSS 11 | 12 | ## 功能介绍 13 | > 程序包含商户端,用户端,骑手端三端的后台处理逻辑 14 | ### 商户端功能 15 | 1. 商品上传 16 | 2. 商户认证:对接了阿里云实名认证 17 | 3. 商品列表 18 | 4. 用户信息维护 19 | 5. 订单 20 | ### 用户端功能 21 | 1. 购物车 22 | 2. 订单 23 | 3. 支付 24 | 4. 信息维护 25 | ### 骑手端功能 26 | 1. 订单 27 | 2. 坐标 28 | 3. 钱包 29 | 30 | ### 通用功能 31 | 1. 订单分配 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/goods/service/impl/GoodsSalesRecordServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.goods.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.goods.mapper.GoodsSalesRecordMapper; 5 | import com.rfrongfei.onehammer.goods.entity.GoodsSalesRecord; 6 | import com.rfrongfei.onehammer.goods.service.IGoodsSalesRecordService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class GoodsSalesRecordServiceImpl extends ServiceImpl implements IGoodsSalesRecordService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/service/impl/OrderEvaluatePicServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.order.mapper.OrderEvaluatePicMapper; 5 | import com.rfrongfei.onehammer.order.entity.OrderEvaluatePic; 6 | import com.rfrongfei.onehammer.order.service.IOrderEvaluatePicService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class OrderEvaluatePicServiceImpl extends ServiceImpl implements IOrderEvaluatePicService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/shoppingcart/service/impl/ShoppingCartServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.shoppingcart.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.shoppingcart.mapper.ShoppingCartMapper; 5 | import com.rfrongfei.onehammer.shoppingcart.entity.ShoppingCart; 6 | import com.rfrongfei.onehammer.shoppingcart.service.IShoppingCartService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class ShoppingCartServiceImpl extends ServiceImpl implements IShoppingCartService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/service/impl/UserAccountBalanceServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.user.mapper.UserAccountBalanceMapper; 5 | import com.rfrongfei.onehammer.user.entity.UserAccountBalance; 6 | import com.rfrongfei.onehammer.user.service.IUserAccountBalanceService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class UserAccountBalanceServiceImpl extends ServiceImpl implements IUserAccountBalanceService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/service/impl/UserIntegralRecordServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.user.mapper.UserIntegralRecordMapper; 5 | import com.rfrongfei.onehammer.user.entity.UserIntegralRecord; 6 | import com.rfrongfei.onehammer.user.service.IUserIntegralRecordService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class UserIntegralRecordServiceImpl extends ServiceImpl implements IUserIntegralRecordService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/service/impl/UserRechargeRecordServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.user.mapper.UserRechargeRecordMapper; 5 | import com.rfrongfei.onehammer.user.entity.UserRechargeRecord; 6 | import com.rfrongfei.onehammer.user.service.IUserRechargeRecordService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class UserRechargeRecordServiceImpl extends ServiceImpl implements IUserRechargeRecordService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/licenses/service/impl/LicenseMerchantsServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.licenses.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.licenses.mapper.LicenseMerchantsMapper; 5 | import com.rfrongfei.onehammer.licenses.entity.LicenseMerchants; 6 | import com.rfrongfei.onehammer.licenses.service.ILicenseMerchantsService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class LicenseMerchantsServiceImpl extends ServiceImpl implements ILicenseMerchantsService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/service/impl/MerchantsLeagueServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.merchants.mapper.MerchantsLeagueMapper; 5 | import com.rfrongfei.onehammer.merchants.entity.MerchantsLeague; 6 | import com.rfrongfei.onehammer.merchants.service.IMerchantsLeagueService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class MerchantsLeagueServiceImpl extends ServiceImpl implements IMerchantsLeagueService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/licenses/service/impl/LicenseDeliverymanServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.licenses.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.licenses.mapper.LicenseDeliverymanMapper; 5 | import com.rfrongfei.onehammer.licenses.entity.LicenseDeliveryman; 6 | import com.rfrongfei.onehammer.licenses.service.ILicenseDeliverymanService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class LicenseDeliverymanServiceImpl extends ServiceImpl implements ILicenseDeliverymanService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/service/impl/MerchantsActivityServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.merchants.mapper.MerchantsActivityMapper; 5 | import com.rfrongfei.onehammer.merchants.entity.MerchantsActivity; 6 | import com.rfrongfei.onehammer.merchants.service.IMerchantsActivityService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class MerchantsActivityServiceImpl extends ServiceImpl implements IMerchantsActivityService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/service/impl/MerchantsCategoryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.merchants.mapper.MerchantsCategoryMapper; 5 | import com.rfrongfei.onehammer.merchants.entity.MerchantsCategory; 6 | import com.rfrongfei.onehammer.merchants.service.IMerchantsCategoryService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class MerchantsCategoryServiceImpl extends ServiceImpl implements IMerchantsCategoryService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/service/impl/UserWithdrawalRecordServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.user.mapper.UserWithdrawalRecordMapper; 5 | import com.rfrongfei.onehammer.user.entity.UserWithdrawalRecord; 6 | import com.rfrongfei.onehammer.user.service.IUserWithdrawalRecordService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class UserWithdrawalRecordServiceImpl extends ServiceImpl implements IUserWithdrawalRecordService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/service/impl/UserIntegralIncRecordServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.user.mapper.UserIntegralIncRecordMapper; 5 | import com.rfrongfei.onehammer.user.entity.UserIntegralIncRecord; 6 | import com.rfrongfei.onehammer.user.service.IUserIntegralIncRecordService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class UserIntegralIncRecordServiceImpl extends ServiceImpl implements IUserIntegralIncRecordService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/enums/LoginStatus.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.enums; 2 | 3 | import com.baomidou.mybatisplus.annotation.EnumValue; 4 | import com.fasterxml.jackson.annotation.JsonValue; 5 | import com.rfrongfei.onehammer.base.enums.OnehammerEnum; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Getter; 8 | import lombok.NoArgsConstructor; 9 | 10 | @Getter 11 | @AllArgsConstructor 12 | @NoArgsConstructor 13 | public enum LoginStatus implements OnehammerEnum { 14 | LOGIN(0,"已登陆"), 15 | UN_LOGIN(1,"未登陆"), 16 | ; 17 | @EnumValue 18 | private Integer code; 19 | @JsonValue 20 | private String desc; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/enums/ProccessStatusEnum.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * @ClassName ProccessStatusEnum 9 | * @Author Jxlsx 10 | * @Date 2019/12/16 上午1:59 11 | * @Version 1.0 12 | */ 13 | @Getter 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | public enum ProccessStatusEnum { 17 | /** 等待受理 */ 18 | WAIT(0), 19 | /** 商家受理 */ 20 | MERCHANTS_ACCEPT(1), 21 | /** 发起流程 */ 22 | START_PROCCESS(2), 23 | /** 流程结束 */ 24 | PROCCESS_END(3), 25 | ; 26 | private Integer code; 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/service/impl/MerchantsLeagueLevelServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.rfrongfei.onehammer.merchants.mapper.MerchantsLeagueLevelMapper; 5 | import com.rfrongfei.onehammer.merchants.entity.MerchantsLeagueLevel; 6 | import com.rfrongfei.onehammer.merchants.service.IMerchantsLeagueLevelService; 7 | import org.springframework.stereotype.Service; 8 | 9 | @Service 10 | public class MerchantsLeagueLevelServiceImpl extends ServiceImpl implements IMerchantsLeagueLevelService { 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/enums/OrderStatusEnum.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * @ClassName OrderStatusEnum 9 | * @Author Jxlsx 10 | * @Date 2019/12/16 上午1:32 11 | * @Version 1.0 12 | */ 13 | @Getter 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | public enum OrderStatusEnum { 17 | /** 商家已接单 */ 18 | MERCHANTS_ORDER(0), 19 | /** 骑手已接单 */ 20 | DELIVERY_ORDER(1), 21 | /** 骑手已取货 */ 22 | DELIVERY_ORDER_GOODS(2), 23 | /** 订单配送结束 */ 24 | DELIVERY_ORDER_END(3), 25 | ; 26 | private Integer code; 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/enums/UserType.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.enums; 2 | 3 | import com.baomidou.mybatisplus.annotation.EnumValue; 4 | import com.fasterxml.jackson.annotation.JsonValue; 5 | import com.rfrongfei.onehammer.base.enums.OnehammerEnum; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Getter; 8 | import lombok.NoArgsConstructor; 9 | 10 | 11 | @Getter 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | public enum UserType implements OnehammerEnum { 15 | CONSUMER(0,"用户"), 16 | MERCHANTS(1,"商家"), 17 | DELIVERYMAN(2,"骑手"), 18 | ; 19 | 20 | @EnumValue 21 | private Integer code; 22 | @JsonValue 23 | private String desc; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/enums/WithdrawalStatusEnum.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.enums; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * @ClassName WithdrawalStatu 9 | * @Author Jxlsx 10 | * @Date 2019/12/15 下午4:22 11 | * @Version 1.0 12 | */ 13 | @Getter 14 | @AllArgsConstructor 15 | @NoArgsConstructor 16 | public enum WithdrawalStatusEnum { 17 | /** 18 | * 提现成功 19 | */ 20 | ERROR(0,"失败"), 21 | /** 22 | * 提现失败 23 | */ 24 | SUCCESS(1,"成功"), 25 | /** 26 | * 等待处理 27 | */ 28 | WAIT(2,"等待处理"), 29 | ; 30 | private Integer code; 31 | private String type; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/properties/TokenProperties.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.properties; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.context.annotation.PropertySource; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * @ClassName TokenProperties 10 | * @Author Jxlsx 11 | * @Date 2019/12/17 下午6:42 12 | * @Version 1.0 13 | */ 14 | @Component 15 | @PropertySource(value = "classpath:config/settings.properties") 16 | @ConfigurationProperties(prefix = "token") 17 | @Data 18 | public class TokenProperties { 19 | 20 | /** token过期时间 */ 21 | private Integer expire; 22 | /** token刷新时间 */ 23 | private Integer flush; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/interceptor/MybatisPagePlugins.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.interceptor; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.transaction.annotation.EnableTransactionManagement; 7 | 8 | @EnableTransactionManagement 9 | @Configuration 10 | public class MybatisPagePlugins { 11 | 12 | @Bean 13 | public PaginationInterceptor paginationInterceptor() { 14 | // 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求 默认false 15 | // pageInterceptor.setOverflow(false); 16 | // 设置最大单页限制数量,默认 500 条,-1 不受限制 17 | // pageInterceptor.setLimit(500); 18 | return new PaginationInterceptor(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/exception/OnehammerExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.exception; 2 | 3 | import graphql.ExceptionWhileDataFetching; 4 | import graphql.GraphQLError; 5 | import graphql.execution.ExecutionPath; 6 | import graphql.language.SourceLocation; 7 | import graphql.servlet.GraphQLErrorHandler; 8 | import org.springframework.stereotype.Component; 9 | 10 | import java.util.List; 11 | 12 | @Component 13 | public class OnehammerExceptionHandler implements GraphQLErrorHandler { 14 | 15 | @Override 16 | public boolean errorsPresent(List errors) { 17 | return errors != null && errors.size() >= 1; 18 | } 19 | 20 | @Override 21 | public List processErrors(List list) { 22 | System.out.println(list); 23 | return list; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/service/IUserService.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.rfrongfei.onehammer.base.entity.UserInfo; 5 | import com.rfrongfei.onehammer.common.entity.User; 6 | import com.rfrongfei.onehammer.common.input.UserInput; 7 | import com.rfrongfei.onehammer.common.vo.InfoVO; 8 | 9 | public interface IUserService extends IService { 10 | 11 | 12 | User loginStatus(String userId); 13 | 14 | // 获取验证码 15 | String smsCode(String phone,Integer userType); 16 | 17 | //登陆 18 | User login(UserInput userInput); 19 | 20 | UserInfo getUserInfoUserId(String userId); 21 | 22 | UserInfo getUserInfoPhone(String phone); 23 | 24 | // 修改用户信息 25 | InfoVO updateUser(InfoVO infoVO); 26 | 27 | InfoVO deleteUser(InfoVO infoVO); 28 | } 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | *.iml 7 | .mvn 8 | ### STS ### 9 | .apt_generated 10 | .classpath 11 | .factorypath 12 | .project 13 | .settings 14 | .springBeans 15 | .sts4-cache 16 | 17 | ### IntelliJ IDEA ### 18 | .idea 19 | *.iws 20 | *.iml 21 | *.ipr 22 | .DS_Store 23 | 24 | ### NetBeans ### 25 | /nbproject/private/ 26 | /nbbuild/ 27 | /dist/ 28 | /nbdist/ 29 | /.nb-gradle/ 30 | build/ 31 | /.idea 32 | 33 | 34 | ### VS Code ### 35 | .vscode/ 36 | ### Java template 37 | # Compiled class file 38 | *.class 39 | 40 | # Log file 41 | *.log 42 | 43 | # BlueJ files 44 | *.ctxt 45 | 46 | # Mobile Tools for Java (J2ME) 47 | .mtj.tmp/ 48 | 49 | # Package Files # 50 | *.jar 51 | *.war 52 | *.nar 53 | *.ear 54 | *.zip 55 | *.tar.gz 56 | *.rar 57 | 58 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 59 | hs_err_pid* 60 | 61 | -------------------------------------------------------------------------------- /src/main/resources/application-local.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | driverClassName: com.mysql.cj.jdbc.Driver 4 | url: jdbc:mysql://localhost:3306/onehammer2.0?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&autoReconnect=true&useSSL=false 5 | username: root 6 | password: root 7 | type: com.alibaba.druid.pool.DruidDataSource 8 | name: onehammerDataSource 9 | initialSize: 5 10 | minIdle: 5 11 | maxActive: 20 12 | maxWait: 60000 13 | timeBetweenEvictionRunsMillis: 60000 14 | minEvictableIdleTimeMillis: 300000 15 | validationQuery: SELECT 1 FROM DUAL 16 | testWhileIdle: true 17 | testOnBorrow: false 18 | testOnReturn: false 19 | poolPreparedStatements: false 20 | maxPoolPreparedStatementPerConnectionSize: 20 21 | connectionProperties: 22 | druid: 23 | stat: 24 | mergeSql: true 25 | slowSqlMillis: 5000 26 | redis: 27 | host: localhost 28 | port: 6379 29 | database: 0 -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/entity/Audit.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.fasterxml.jackson.annotation.JsonIgnore; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | import lombok.ToString; 10 | 11 | import java.io.Serializable; 12 | import java.util.Date; 13 | 14 | /** 15 | * @ClassName Audit 16 | * @Description 审计字段 17 | * @Author eason.xu 18 | * @Date 19-11-21 下午11:44 19 | * @Version 1.0 20 | */ 21 | @Data 22 | @ToString 23 | @AllArgsConstructor 24 | @NoArgsConstructor 25 | public class Audit implements Serializable { 26 | 27 | public static final String CREATE_DATE = "create_date"; 28 | public static final String UPDATE_DATE = "update_date"; 29 | 30 | /** 创建时间 */ 31 | @TableField(fill = FieldFill.INSERT) 32 | private Date createDate; 33 | /** 更新时间 */ 34 | @TableField(fill = FieldFill.UPDATE) 35 | private Date updateDate; 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | driverClassName: com.mysql.cj.jdbc.Driver 4 | url: jdbc:mysql://rm-wz9x2692i9kgi870pqo.mysql.rds.aliyuncs.com:3306/onehammer2.0?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&autoReconnect=true&useSSL=false 5 | username: rfronfei 6 | password: 29H@OtC^5 7 | type: com.alibaba.druid.pool.DruidDataSource 8 | name: onehammerDataSource 9 | initialSize: 5 10 | minIdle: 5 11 | maxActive: 20 12 | maxWait: 60000 13 | timeBetweenEvictionRunsMillis: 60000 14 | minEvictableIdleTimeMillis: 300000 15 | validationQuery: SELECT 1 FROM DUAL 16 | testWhileIdle: true 17 | testOnBorrow: false 18 | testOnReturn: false 19 | poolPreparedStatements: false 20 | maxPoolPreparedStatementPerConnectionSize: 20 21 | connectionProperties: 22 | druid: 23 | stat: 24 | mergeSql: true 25 | slowSqlMillis: 5000 26 | redis: 27 | host: r-wz9qqzmu4kegdea16upd.redis.rds.aliyuncs.com 28 | port: 6379 29 | password: 29H@OtC^5 30 | database: 1 -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/util/BeanHelper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.util; 2 | 3 | import cn.hutool.core.bean.BeanUtil; 4 | import cn.hutool.core.bean.copier.CopyOptions; 5 | import com.rfrongfei.onehammer.base.exception.OnehammerException; 6 | 7 | /** 8 | * @ClassName BeanHelper 9 | * @Author Jxlsx 10 | * @Date 2019/12/17 下午11:59 11 | * @Version 1.0 12 | */ 13 | public class BeanHelper { 14 | 15 | /** 16 | * 拷贝对象,忽略null值 17 | * @param source : 18 | * @param clazz : 19 | * @return : {@link T} 20 | */ 21 | public static T create(Object source,Class clazz){ 22 | try { 23 | final T instance = clazz.newInstance(); 24 | final CopyOptions copyOptions = CopyOptions.create() 25 | .ignoreNullValue(); 26 | BeanUtil.copyProperties(source,instance, copyOptions); 27 | return instance; 28 | } catch (IllegalAccessException | InstantiationException e) { 29 | throw new OnehammerException(BeanHelper.class,"create","创建目标实例对象失败",source,clazz); 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/util/HttpHelper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.util; 2 | 3 | import okhttp3.*; 4 | import okhttp3.Request.Builder; 5 | 6 | import java.io.IOException; 7 | import java.util.Map; 8 | 9 | public class HttpHelper { 10 | 11 | private static OkHttpClient okHttpClient; 12 | 13 | static { 14 | okHttpClient = new OkHttpClient(); 15 | } 16 | public static String get(String url, Map parmas){ 17 | final HttpUrl.Builder urlBuilder = HttpUrl.parse(url).newBuilder(); 18 | parmas.forEach(urlBuilder::addQueryParameter); 19 | final Request.Builder reqBuilder = new Request.Builder().get(); 20 | reqBuilder.url(urlBuilder.build()); 21 | final Request request = reqBuilder.build(); 22 | final Call call = okHttpClient.newCall(request); 23 | try { 24 | final Response response = call.execute(); 25 | if (response.code() == 200) { 26 | return response.body().string(); 27 | } 28 | } catch (IOException ignored) { 29 | } 30 | return null; 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/util/EnumHelper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.util; 2 | 3 | import com.rfrongfei.onehammer.base.enums.OnehammerEnum; 4 | import com.rfrongfei.onehammer.base.exception.OnehammerException; 5 | 6 | /** 7 | * @ClassName EnumHelper 8 | * @Author Jxlsx 9 | * @Date 2019/12/17 下午6:27 10 | * @Version 1.0 11 | */ 12 | public class EnumHelper { 13 | 14 | 15 | public static T get(Integer code, Class enumClass) { 16 | for (T each: enumClass.getEnumConstants()) { 17 | if (code.equals(each.getCode())) { 18 | return each; 19 | } 20 | } 21 | throw new OnehammerException(EntityHelper.class,"getEnum()","获取enum类型失败",code,enumClass); 22 | } 23 | 24 | public static T get(String desc, Class enumClass) { 25 | for (T each: enumClass.getEnumConstants()) { 26 | if (desc.equals(each.getDesc())) { 27 | return each; 28 | } 29 | } 30 | throw new OnehammerException(EntityHelper.class,"getEnum()","获取enum类型失败",desc,enumClass); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/key/CommonIdGenetator.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.key; 2 | 3 | import cn.hutool.core.lang.Snowflake; 4 | import com.baomidou.mybatisplus.core.incrementer.IKeyGenerator; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.stereotype.Component; 7 | 8 | import java.text.SimpleDateFormat; 9 | import java.util.Date; 10 | 11 | @Component 12 | @Slf4j 13 | public class CommonIdGenetator implements IKeyGenerator { 14 | 15 | // 普通主键生成 16 | // 1. 12位日期 17 | // 用户ID生成 18 | // 订单ID生成 19 | @Override 20 | public String executeSql(String incrementerName) { 21 | Date date = new Date(); 22 | SimpleDateFormat monthFormat = new SimpleDateFormat("MM"); 23 | SimpleDateFormat dayFormat = new SimpleDateFormat("dd"); 24 | String workerId = monthFormat.format(date); 25 | String dateCenterId = dayFormat.format(date); 26 | Snowflake snowflake = new Snowflake(Long.parseLong(workerId), Long.parseLong(dateCenterId), true); 27 | String nextIdStr = snowflake.nextIdStr(); 28 | log.info("snowFlak,idWorker,ID:[{}]", nextIdStr); 29 | return String.format("select %s from dual",nextIdStr); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/resolver/mutation/UserInfoMutationResolver.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.resolver.mutation; 2 | 3 | import com.coxautodev.graphql.tools.GraphQLMutationResolver; 4 | import com.rfrongfei.onehammer.base.util.BeanHelper; 5 | import com.rfrongfei.onehammer.common.entity.User; 6 | import com.rfrongfei.onehammer.common.input.InfoVOInput; 7 | import com.rfrongfei.onehammer.common.input.UserInput; 8 | import com.rfrongfei.onehammer.common.service.IUserService; 9 | import com.rfrongfei.onehammer.common.vo.InfoVO; 10 | import lombok.AllArgsConstructor; 11 | import org.springframework.stereotype.Component; 12 | 13 | @Component 14 | @AllArgsConstructor 15 | public class UserInfoMutationResolver implements GraphQLMutationResolver { 16 | 17 | private final IUserService userService; 18 | 19 | public User login(UserInput userInput) { 20 | return userService.login(userInput); 21 | } 22 | 23 | public InfoVO updateUser(InfoVOInput infoVO) { 24 | return userService.updateUser(BeanHelper.create(infoVO, InfoVO.class)); 25 | } 26 | 27 | public InfoVO deleteUser(InfoVOInput infoVO) { 28 | return userService.deleteUser(BeanHelper.create(infoVO, InfoVO.class)); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/entity/OrderEvaluatePic.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.util.Date; 11 | 12 | import com.rfrongfei.onehammer.base.entity.Audit; 13 | import lombok.*; 14 | 15 | /** 16 | * 订单评价图片 17 | * 18 | * @author Jxlsx 19 | * @email iamlive@aliyun.com 20 | * @date 2019-12-23 15:43:16 21 | */ 22 | @Data 23 | @ToString 24 | @Builder 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | @EqualsAndHashCode(callSuper = true) 28 | @TableName("rf_order_evaluate_pic") 29 | 30 | public class OrderEvaluatePic extends Audit { 31 | 32 | public static final String ID = "id"; 33 | public static final String EVALUATE_ID = "evaluate_id"; 34 | public static final String PIC = "pic"; 35 | 36 | /** 37 | * 38 | */ 39 | 40 | @TableId 41 | private String id; 42 | /** 43 | * 评价ID 44 | */ 45 | @TableField(value = "evaluate_id") 46 | private String evaluateId; 47 | /** 48 | * 图片 49 | */ 50 | @TableField(value = "pic") 51 | private String pic; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/entity/UserIntegralRecord.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.util.Date; 11 | 12 | import com.rfrongfei.onehammer.base.entity.Audit; 13 | import lombok.*; 14 | 15 | /** 16 | * 用户积分记录 17 | * 18 | * @author Jxlsx 19 | * @email iamlive@aliyun.com 20 | * @date 2019-12-23 15:43:16 21 | */ 22 | @Data 23 | @ToString 24 | @Builder 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | @EqualsAndHashCode(callSuper = true) 28 | @TableName("rf_user_integral_record") 29 | 30 | public class UserIntegralRecord extends Audit { 31 | 32 | public static final String ID = "id"; 33 | public static final String INCREASE = "increase"; 34 | public static final String USER_ID = "user_id"; 35 | 36 | /** 37 | * 38 | */ 39 | 40 | @TableId 41 | private String id; 42 | /** 43 | * 增加的积分数 44 | */ 45 | @TableField(value = "increase") 46 | private Integer increase; 47 | /** 48 | * 用户ID 49 | */ 50 | @TableField(value = "user_id") 51 | private String userId; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/entity/UserAccountBalance.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.math.BigDecimal; 11 | import java.util.Date; 12 | 13 | import com.rfrongfei.onehammer.base.entity.Audit; 14 | import lombok.*; 15 | 16 | /** 17 | * 账户余额 18 | * 19 | * @author Jxlsx 20 | * @email iamlive@aliyun.com 21 | * @date 2019-12-23 15:43:17 22 | */ 23 | @Data 24 | @ToString 25 | @Builder 26 | @AllArgsConstructor 27 | @NoArgsConstructor 28 | @EqualsAndHashCode(callSuper = true) 29 | @TableName("rf_user_account_balance") 30 | public class UserAccountBalance extends Audit { 31 | 32 | public static final String ID = "id"; 33 | public static final String BALANCE = "balance"; 34 | public static final String USER_ID = "user_id"; 35 | 36 | /** 37 | * 38 | */ 39 | 40 | @TableId 41 | private String id; 42 | /** 43 | * 账户余额 44 | */ 45 | @TableField(value = "balance") 46 | private BigDecimal balance; 47 | /** 48 | * 用户ID 49 | */ 50 | @TableField(value = "user_id") 51 | private String userId; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/entity/UserRechargeRecord.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.math.BigDecimal; 11 | import java.util.Date; 12 | 13 | import com.rfrongfei.onehammer.base.entity.Audit; 14 | import lombok.*; 15 | 16 | /** 17 | * 用户充值记录 18 | * 19 | * @author Jxlsx 20 | * @email iamlive@aliyun.com 21 | * @date 2019-12-23 15:43:16 22 | */ 23 | @Data 24 | @ToString 25 | @Builder 26 | @AllArgsConstructor 27 | @NoArgsConstructor 28 | @EqualsAndHashCode(callSuper = true) 29 | @TableName("rf_user_recharge_record") 30 | 31 | public class UserRechargeRecord extends Audit { 32 | 33 | public static final String ID = "id"; 34 | public static final String RECHARGE = "recharge"; 35 | public static final String USER_ID = "user_id"; 36 | 37 | /** 38 | * 39 | */ 40 | 41 | @TableId 42 | private String id; 43 | /** 44 | * 充值金额 45 | */ 46 | @TableField(value = "recharge") 47 | private BigDecimal recharge; 48 | /** 49 | * 用户ID 50 | */ 51 | @TableField(value = "user_id") 52 | private String userId; 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/vo/InfoVO.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.vo; 2 | 3 | import com.rfrongfei.onehammer.base.entity.UserInfo; 4 | import com.rfrongfei.onehammer.common.entity.User; 5 | import com.rfrongfei.onehammer.common.enums.UserType; 6 | import com.rfrongfei.onehammer.deliveryman.entity.DeliverymanInfo; 7 | import com.rfrongfei.onehammer.merchants.entity.MerchantsInfo; 8 | import com.rfrongfei.onehammer.user.entity.ConsumerInfo; 9 | import lombok.Data; 10 | 11 | @Data 12 | public class InfoVO { 13 | private ConsumerInfo consumerInfo; 14 | private DeliverymanInfo deliverymanInfo; 15 | private MerchantsInfo merchantsInfo; 16 | private User user; 17 | 18 | public void setUserInfo(UserInfo userInfo){ 19 | String userId = userInfo.getUserId(); 20 | if (UserType.CONSUMER.getCode().toString().equalsIgnoreCase(userId.substring(0,1))){ 21 | setConsumerInfo(((ConsumerInfo) userInfo)); 22 | } 23 | if (UserType.MERCHANTS.getCode().toString().equalsIgnoreCase(userId.substring(0,1))){ 24 | setMerchantsInfo(((MerchantsInfo) userInfo)); 25 | } 26 | if (UserType.DELIVERYMAN.getCode().toString().equalsIgnoreCase(userId.substring(0,1))){ 27 | setDeliverymanInfo(((DeliverymanInfo) userInfo)); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/entity/Region.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | import com.rfrongfei.onehammer.base.entity.Audit; 7 | 8 | 9 | 10 | 11 | import java.util.Date; 12 | 13 | import lombok.*; 14 | 15 | /** 16 | * 地区 17 | * 18 | * @author Jxlsx 19 | * @email iamlive@aliyun.com 20 | * @date 2019-12-23 15:33:55 21 | */ 22 | @Data 23 | @ToString 24 | @Builder 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | @EqualsAndHashCode(callSuper = true) 28 | @TableName("rf_region") 29 | 30 | public class Region extends Audit { 31 | 32 | public static final String ID = "id"; 33 | public static final String CODE = "code"; 34 | public static final String NAME = "name"; 35 | public static final String REGION_ID = "region_id"; 36 | 37 | /** 38 | * 39 | */ 40 | 41 | @TableId 42 | private String id; 43 | /** 44 | * 地区编码 45 | */ 46 | @TableField(value = "code") 47 | private String code; 48 | /** 49 | * 地区中文 50 | */ 51 | @TableField(value = "name") 52 | private String name; 53 | /** 54 | * 区域ID 55 | */ 56 | @TableField(value = "region_id") 57 | private String regionId; 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/resolver/query/UserInfoQueryResolver.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.resolver.query; 2 | 3 | import com.coxautodev.graphql.tools.GraphQLQueryResolver; 4 | import com.rfrongfei.onehammer.base.entity.UserInfo; 5 | import com.rfrongfei.onehammer.common.entity.User; 6 | import com.rfrongfei.onehammer.common.service.IUserService; 7 | import com.rfrongfei.onehammer.common.vo.InfoVO; 8 | import lombok.AllArgsConstructor; 9 | import org.springframework.stereotype.Component; 10 | 11 | @Component 12 | @AllArgsConstructor 13 | public class UserInfoQueryResolver implements GraphQLQueryResolver { 14 | 15 | private final IUserService userService; 16 | 17 | public String smsCode(String phone,Integer userType){ 18 | return userService.smsCode(phone,userType); 19 | } 20 | public User loginStatus(String userId){ 21 | return userService.loginStatus(userId); 22 | } 23 | 24 | public InfoVO getUserInfo(String userId, String phone){ 25 | InfoVO infoVO = new InfoVO(); 26 | if (userId != null) { 27 | UserInfo userInfo = userService.getUserInfoUserId(userId); 28 | infoVO.setUserInfo(userInfo); 29 | } 30 | if (phone != null){ 31 | UserInfo userInfo = userService.getUserInfoPhone(phone); 32 | infoVO.setUserInfo(userInfo); 33 | } 34 | return infoVO; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/test/java/com/rfrongfei/onehammer/common/service/impl/UserServiceImplTest.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.service.impl; 2 | 3 | import com.rfrongfei.onehammer.base.util.RedisHelper; 4 | import com.rfrongfei.onehammer.common.entity.User; 5 | import com.rfrongfei.onehammer.base.key.IdGenerator; 6 | import com.rfrongfei.onehammer.common.enums.LoginStatus; 7 | import com.rfrongfei.onehammer.common.enums.UserType; 8 | import com.rfrongfei.onehammer.common.service.IUserService; 9 | import org.junit.Test; 10 | import org.junit.runner.RunWith; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.boot.test.context.SpringBootTest; 13 | import org.springframework.test.context.junit4.SpringRunner; 14 | 15 | import java.util.Date; 16 | 17 | @RunWith(SpringRunner.class) 18 | @SpringBootTest 19 | public class UserServiceImplTest { 20 | 21 | @Autowired 22 | private IUserService userService; 23 | 24 | @Test 25 | public void test1() { 26 | } 27 | 28 | @Autowired 29 | private RedisHelper redisHelper; 30 | 31 | @Test 32 | public void test2() { 33 | // User user = new User(); 34 | // user.setId("asdasd"); 35 | // user.setUserType(1); 36 | // user.setUpdateDate(new Date()); 37 | // redisHelper.set("testKey",user); 38 | // System.out.println(redisHelper.get("testKey", User.class)); 39 | // 40 | redisHelper.del("testKey"); 41 | System.out.println(redisHelper.get("testKey", User.class)); 42 | 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/entity/UserWithdrawalRecord.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.math.BigDecimal; 11 | import java.util.Date; 12 | 13 | import com.rfrongfei.onehammer.base.entity.Audit; 14 | import lombok.*; 15 | 16 | /** 17 | * 用户提现记录 18 | * 19 | * @author Jxlsx 20 | * @email iamlive@aliyun.com 21 | * @date 2019-12-23 15:43:16 22 | */ 23 | @Data 24 | @ToString 25 | @Builder 26 | @AllArgsConstructor 27 | @NoArgsConstructor 28 | @EqualsAndHashCode(callSuper = true) 29 | @TableName("rf_user_withdrawal_record") 30 | 31 | public class UserWithdrawalRecord extends Audit { 32 | 33 | public static final String ID = "id"; 34 | public static final String USER_ID = "user_id"; 35 | public static final String WITHDRAWAL_AMOUNT = "withdrawal_amount"; 36 | public static final String WITHDRAWAL_STATUS = "withdrawal_status"; 37 | 38 | /** 39 | * 40 | */ 41 | 42 | @TableId 43 | private String id; 44 | /** 45 | * 用户ID 46 | */ 47 | @TableField(value = "user_id") 48 | private String userId; 49 | /** 50 | * 提现金额 51 | */ 52 | @TableField(value = "withdrawal_amount") 53 | private BigDecimal withdrawalAmount; 54 | /** 55 | * 提现状态 56 | */ 57 | @TableField(value = "withdrawal_status") 58 | private Integer withdrawalStatus; 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/resources/graphql/schema.graphqls: -------------------------------------------------------------------------------- 1 | input UserForm{ 2 | phone:String, 3 | smsCode:String, 4 | password:String, 5 | userType:Int, 6 | userId:String, 7 | } 8 | input InfoVOInput{ 9 | consumerInfo:ConsumerInfo 10 | merchantsInfo:MerchantsInfo 11 | deliverymanInfo:DeliverymanInfo 12 | user:User 13 | } 14 | type InfoVO{ 15 | consumerInfo:ConsumerInfo 16 | merchantsInfo:MerchantsInfo 17 | deliverymanInfo:DeliverymanInfo 18 | user:User 19 | } 20 | 21 | type User{ 22 | id:ID 23 | accessToken:String 24 | loginStatus:Int 25 | userId:String 26 | userType:Int 27 | phone:String 28 | } 29 | type ConsumerInfo{ 30 | id:ID 31 | account:String 32 | consumerId:String 33 | email:String 34 | name:String 35 | password:String 36 | phone:String 37 | userNickname:String 38 | userPortrait:String 39 | } 40 | type DeliverymanInfo{ 41 | id:ID 42 | deliverymanId:String 43 | headPortrait:String 44 | name:String 45 | nickname:String 46 | password:String 47 | phone:String 48 | status:Int 49 | } 50 | scalar BigDecimal 51 | type MerchantsInfo{ 52 | id:ID 53 | avgDeliveryTime:Int 54 | bgpic:String 55 | categoryId:String 56 | description:String 57 | detail:String 58 | end:String 59 | headPortrait:String 60 | hotline:String 61 | latitude:BigDecimal 62 | longitude:BigDecimal 63 | merchantsId:String 64 | notice:String 65 | password:String 66 | phone:String 67 | regionId:String 68 | start:String 69 | storeName:String 70 | } -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/coupon/entity/CouponRecord.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.coupon.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.util.Date; 11 | 12 | import com.rfrongfei.onehammer.base.entity.Audit; 13 | import lombok.*; 14 | 15 | /** 16 | * 优惠券关联记录 17 | * 18 | * @author Jxlsx 19 | * @email iamlive@aliyun.com 20 | * @date 2019-12-23 15:33:54 21 | */ 22 | @Data 23 | @ToString 24 | @Builder 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | @EqualsAndHashCode(callSuper = true) 28 | @TableName("rf_coupon_record") 29 | public class CouponRecord extends Audit { 30 | 31 | public static final String ID = "id"; 32 | public static final String COUNT = "count"; 33 | public static final String COUPON_ID = "coupon_id"; 34 | public static final String STATUS = "status"; 35 | public static final String USER_ID = "user_id"; 36 | 37 | /** 38 | * 39 | */ 40 | 41 | @TableId 42 | private String id; 43 | /** 44 | * 优惠券数量 45 | */ 46 | @TableField(value = "count") 47 | private Integer count; 48 | /** 49 | * 优惠券ID 50 | */ 51 | @TableField(value = "coupon_id") 52 | private String couponId; 53 | /** 54 | * 使用状态 55 | */ 56 | @TableField(value = "status") 57 | private Integer status; 58 | /** 59 | * 用户ID 60 | */ 61 | @TableField(value = "user_id") 62 | private String userId; 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/entity/OrderEvaluate.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.util.Date; 11 | 12 | import com.rfrongfei.onehammer.base.entity.Audit; 13 | import lombok.*; 14 | 15 | /** 16 | * 订单评价 17 | * 18 | * @author Jxlsx 19 | * @email iamlive@aliyun.com 20 | * @date 2019-12-23 15:43:16 21 | */ 22 | @Data 23 | @ToString 24 | @Builder 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | @EqualsAndHashCode(callSuper = true) 28 | @TableName("rf_order_evaluate") 29 | 30 | public class OrderEvaluate extends Audit { 31 | 32 | public static final String ID = "id"; 33 | public static final String CONSUMER_ID = "consumer_id"; 34 | public static final String CONTENT = "content"; 35 | public static final String ORDER_ID = "order_id"; 36 | public static final String STAR = "star"; 37 | 38 | /** 39 | * 40 | */ 41 | 42 | @TableId 43 | private String id; 44 | /** 45 | * 用户ID 46 | */ 47 | @TableField(value = "consumer_id") 48 | private String consumerId; 49 | /** 50 | * 评价内容 51 | */ 52 | @TableField(value = "content") 53 | private String content; 54 | /** 55 | * 订单ID 56 | */ 57 | @TableField(value = "order_id") 58 | private String orderId; 59 | /** 60 | * 点赞数 61 | */ 62 | @TableField(value = "star") 63 | private Integer star; 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/goods/entity/GoodsCategory.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.goods.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.util.Date; 11 | 12 | import com.rfrongfei.onehammer.base.entity.Audit; 13 | import lombok.*; 14 | 15 | /** 16 | * 商品分类 17 | * 18 | * @author Jxlsx 19 | * @email iamlive@aliyun.com 20 | * @date 2019-12-23 15:33:55 21 | */ 22 | @Data 23 | @ToString 24 | @Builder 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | @EqualsAndHashCode(callSuper = true) 28 | @TableName("rf_goods_category") 29 | 30 | public class GoodsCategory extends Audit { 31 | 32 | public static final String ID = "id"; 33 | public static final String DECS = "decs"; 34 | public static final String GOODS_CATEGORY_ID = "goods_category_id"; 35 | public static final String SORT = "sort"; 36 | public static final String USER_ID = "user_id"; 37 | 38 | /** 39 | * 40 | */ 41 | 42 | @TableId 43 | private String id; 44 | /** 45 | * 分类描述 46 | */ 47 | @TableField(value = "decs") 48 | private String decs; 49 | /** 50 | * 商品分类ID 51 | */ 52 | @TableField(value = "goods_category_id") 53 | private String goodsCategoryId; 54 | /** 55 | * 排序 56 | */ 57 | @TableField(value = "sort") 58 | private Integer sort; 59 | /** 60 | * 用户ID 61 | */ 62 | @TableField(value = "user_id") 63 | private String userId; 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/goods/entity/GoodsSize.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.goods.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | import java.math.BigDecimal; 9 | import java.util.Date; 10 | 11 | import com.rfrongfei.onehammer.base.entity.Audit; 12 | import lombok.*; 13 | 14 | /** 15 | * 商品规格 16 | * 17 | * @author Jxlsx 18 | * @email iamlive@aliyun.com 19 | * @date 2019-12-23 15:33:55 20 | */ 21 | @Data 22 | @ToString 23 | @Builder 24 | @AllArgsConstructor 25 | @NoArgsConstructor 26 | @EqualsAndHashCode(callSuper = true) 27 | @TableName("rf_goods_size") 28 | 29 | public class GoodsSize extends Audit { 30 | 31 | public static final String ID = "id"; 32 | public static final String GOODS_SIZE = "goods_size"; 33 | public static final String GOODS_SIZE_ID = "goods_size_id"; 34 | public static final String PRICE = "price"; 35 | public static final String STOCK = "stock"; 36 | 37 | /** 38 | * 39 | */ 40 | 41 | @TableId 42 | private String id; 43 | /** 44 | * 规格描述 45 | */ 46 | @TableField(value = "goods_size") 47 | private String goodsSize; 48 | /** 49 | * 商品规格ID 50 | */ 51 | @TableField(value = "goods_size_id") 52 | private String goodsSizeId; 53 | /** 54 | * 价格 55 | */ 56 | @TableField(value = "price") 57 | private BigDecimal price; 58 | /** 59 | * 库存 60 | */ 61 | @TableField(value = "stock") 62 | private String stock; 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/entity/MerchantsLeague.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.util.Date; 11 | 12 | import com.rfrongfei.onehammer.base.entity.Audit; 13 | import lombok.*; 14 | 15 | /** 16 | * 商家地区 17 | * 18 | * @author Jxlsx 19 | * @email iamlive@aliyun.com 20 | * @date 2019-12-23 15:43:16 21 | */ 22 | @Data 23 | @ToString 24 | @Builder 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | @EqualsAndHashCode(callSuper = true) 28 | @TableName("rf_merchants_league") 29 | 30 | public class MerchantsLeague extends Audit { 31 | 32 | public static final String ID = "id"; 33 | public static final String LEAGUE_ID = "league_id"; 34 | public static final String LEVEL_ID = "level_id"; 35 | public static final String REGION_ID = "region_id"; 36 | public static final String USER_ID = "user_id"; 37 | 38 | /** 39 | * 40 | */ 41 | 42 | @TableId 43 | private String id; 44 | /** 45 | * 加盟信息ID 46 | */ 47 | @TableField(value = "league_id") 48 | private String leagueId; 49 | /** 50 | * 加盟等级 51 | */ 52 | @TableField(value = "level_id") 53 | private String levelId; 54 | /** 55 | * 所属地区 56 | */ 57 | @TableField(value = "region_id") 58 | private String regionId; 59 | /** 60 | * 用户ID 61 | */ 62 | @TableField(value = "user_id") 63 | private String userId; 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/entity/UserIntegralIncRecord.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableField; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import com.rfrongfei.onehammer.base.entity.Audit; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.NoArgsConstructor; 11 | 12 | import java.util.Date; 13 | 14 | /** 15 | * @ClassName IntegralIncRecord 16 | * @Author Jxlsx 17 | * @Date 2019/12/15 下午12:44 18 | * @Version 1.0 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = true) 22 | @NoArgsConstructor 23 | @AllArgsConstructor 24 | @TableName(value = "rf_user_integral_inc_record") 25 | 26 | public class UserIntegralIncRecord extends Audit { 27 | 28 | public static final String ID = "id"; 29 | public static final String USER_ID = "user_id"; 30 | public static final String INCREASE = "increase"; 31 | public static final String CREATE_DATE = "create_date"; 32 | public static final String UPDATE_DATE = "update_date"; 33 | 34 | @TableId 35 | private String id; 36 | /** 37 | * 用户ID 38 | */ 39 | @TableField(value = "user_id") 40 | private String userId; 41 | /** 42 | * 增加的积分数 43 | */ 44 | @TableField(value = "increase") 45 | private Integer increase; 46 | /** 47 | * 创建时间 48 | */ 49 | @TableField(value = "create_date") 50 | private Date createDate; 51 | /** 52 | * 更新时间 53 | */ 54 | @TableField(value = "update_date") 55 | private Date updateDate; 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/entity/MerchantsCategory.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.util.Date; 11 | 12 | import com.rfrongfei.onehammer.base.entity.Audit; 13 | import lombok.*; 14 | 15 | /** 16 | * 商家分类 17 | * 18 | * @author Jxlsx 19 | * @email iamlive@aliyun.com 20 | * @date 2019-12-23 15:43:16 21 | */ 22 | @Data 23 | @ToString 24 | @Builder 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | @EqualsAndHashCode(callSuper = true) 28 | @TableName("rf_merchants_category") 29 | 30 | public class MerchantsCategory extends Audit { 31 | 32 | public static final String ID = "id"; 33 | public static final String DESCRIPTION = "description"; 34 | public static final String MERCHANTS_CATEGORY_ID = "merchants_category_id"; 35 | public static final String MERCHANTS_ID = "merchants_id"; 36 | public static final String SORT = "sort"; 37 | 38 | /** 39 | * 40 | */ 41 | 42 | @TableId 43 | private String id; 44 | /** 45 | * 分类描述 46 | */ 47 | @TableField(value = "description") 48 | private String description; 49 | /** 50 | * 商户分类ID 51 | */ 52 | @TableField(value = "merchants_category_id") 53 | private String merchantsCategoryId; 54 | /** 55 | * 用户ID 56 | */ 57 | @TableField(value = "merchants_id") 58 | private String merchantsId; 59 | /** 60 | * 排序 61 | */ 62 | @TableField(value = "sort") 63 | private Integer sort; 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/entity/MerchantsLeagueLevel.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.math.BigDecimal; 11 | import java.util.Date; 12 | 13 | import com.rfrongfei.onehammer.base.entity.Audit; 14 | import lombok.*; 15 | 16 | /** 17 | * 加盟等级 18 | * 19 | * @author Jxlsx 20 | * @email iamlive@aliyun.com 21 | * @date 2019-12-23 15:43:16 22 | */ 23 | @Data 24 | @ToString 25 | @Builder 26 | @AllArgsConstructor 27 | @NoArgsConstructor 28 | @EqualsAndHashCode(callSuper = true) 29 | @TableName("rf_merchants_league_level") 30 | 31 | public class MerchantsLeagueLevel extends Audit { 32 | 33 | public static final String ID = "id"; 34 | public static final String LEAGUE_AMOUNT = "league_amount"; 35 | public static final String LEVEL = "level"; 36 | public static final String LEVEL_ID = "level_id"; 37 | public static final String PROPORTION = "proportion"; 38 | 39 | /** 40 | * 41 | */ 42 | 43 | @TableId 44 | private String id; 45 | /** 46 | * 等级对应金额 47 | */ 48 | @TableField(value = "league_amount") 49 | private BigDecimal leagueAmount; 50 | /** 51 | * 加盟等级 52 | */ 53 | @TableField(value = "level") 54 | private String level; 55 | /** 56 | * 加盟等级ID 57 | */ 58 | @TableField(value = "level_id") 59 | private String levelId; 60 | /** 61 | * 等级分成比例 62 | */ 63 | @TableField(value = "proportion") 64 | private BigDecimal proportion; 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/util/SpringContextHelper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.util; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * @ClassName SpringContextUtil 10 | * @Description 获取springboot 上下文bean 11 | * @Author eason.xu 12 | * @Date 19-11-22 下午1:07 13 | * @Version 1.0 14 | */ 15 | @Component 16 | public class SpringContextHelper implements ApplicationContextAware { 17 | 18 | private static ApplicationContext applicationContext; 19 | 20 | public void setApplicationContext(ApplicationContext ctx) throws BeansException { 21 | if (SpringContextHelper.applicationContext == null) { 22 | SpringContextHelper.applicationContext = ctx; 23 | } 24 | } 25 | // 获取applicationContext 26 | public static ApplicationContext getApplicationContext() { 27 | return applicationContext; 28 | } 29 | 30 | // 通过name获取 Bean. 31 | public static Object getBean(String name) { 32 | return getApplicationContext().getBean(name); 33 | } 34 | 35 | // 通过class获取Bean. 36 | public static T getBean(Class clazz) { 37 | return getApplicationContext().getBean(clazz); 38 | } 39 | 40 | // 通过name,以及Clazz返回指定的Bean 41 | public static T getBean(String name, Class clazz) { 42 | return getApplicationContext().getBean(name, clazz); 43 | } 44 | 45 | /// 获取当前环境 46 | public static String getActiveProfile() { 47 | return getApplicationContext().getEnvironment().getActiveProfiles()[0]; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/util/StringHelper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.util; 2 | 3 | import java.io.File; 4 | import java.util.Set; 5 | 6 | public class StringHelper { 7 | 8 | /*** 9 | * 下划线命名转为驼峰命名 10 | * 11 | * @param para 12 | * 下划线命名的字符串 13 | */ 14 | public static String toHump(String para){ 15 | if (!para.contains("_")) { 16 | return para; 17 | } 18 | StringBuilder result=new StringBuilder(); 19 | String a[]=para.split("_"); 20 | for(String s:a){ 21 | if (!para.contains("_")) { 22 | result.append(s); 23 | continue; 24 | } 25 | if(result.length()==0){ 26 | result.append(s.toLowerCase()); 27 | }else{ 28 | result.append(s.substring(0, 1).toUpperCase()); 29 | result.append(s.substring(1).toLowerCase()); 30 | } 31 | } 32 | return result.toString(); 33 | } 34 | 35 | 36 | 37 | /*** 38 | * 驼峰命名转为下划线命名 39 | * 40 | * @param para 41 | * 驼峰命名的字符串 42 | */ 43 | 44 | public static String underLine(String para){ 45 | if (para.contains("_")) { 46 | return para; 47 | } 48 | StringBuilder sb=new StringBuilder(para); 49 | int temp=0;//定位 50 | if (!para.contains("_")) { 51 | for(int i=0;i redisTemplate(RedisConnectionFactory factory) { 17 | RedisTemplate template = new RedisTemplate(); 18 | template.setConnectionFactory(factory); 19 | Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class); 20 | ObjectMapper om = new ObjectMapper(); 21 | om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); 22 | om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); 23 | jackson2JsonRedisSerializer.setObjectMapper(om); 24 | StringRedisSerializer stringRedisSerializer = new StringRedisSerializer(); 25 | // key采用String的序列化方式 26 | template.setKeySerializer(stringRedisSerializer); 27 | // hash的key也采用String的序列化方式 28 | template.setHashKeySerializer(stringRedisSerializer); 29 | // value序列化方式采用jackson 30 | template.setValueSerializer(jackson2JsonRedisSerializer); 31 | // hash的value序列化方式采用jackson 32 | template.setHashValueSerializer(jackson2JsonRedisSerializer); 33 | template.afterPropertiesSet(); 34 | return template; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/exception/OnehammerException.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.exception; 2 | 3 | import com.google.common.collect.ImmutableMap; 4 | import graphql.ErrorType; 5 | import graphql.GraphQLError; 6 | import graphql.language.SourceLocation; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | * @ClassName OnehammerException 15 | * @Author Jxlsx 16 | * @Date 2019/12/17 下午4:56 17 | * @Version 1.0 18 | */ 19 | @Data 20 | @EqualsAndHashCode(callSuper = true) 21 | public class OnehammerException extends RuntimeException implements GraphQLError { 22 | /** 异常类 */ 23 | private Class clazz; 24 | /** 异常方法 */ 25 | private String method; 26 | /** 异常参数 */ 27 | private Object[] param; 28 | /** 异常消息 */ 29 | private String message; 30 | public OnehammerException(){ 31 | super(); 32 | } 33 | public OnehammerException(Class clazz,String method,String message,Object ...param){ 34 | this(); 35 | this.clazz = clazz; 36 | this.method = method; 37 | this.param = param; 38 | this.message = message; 39 | } 40 | public OnehammerException(Class clazz,String method,String message){ 41 | this(clazz,method,message, (Object[]) null); 42 | } 43 | public OnehammerException(Class clazz,String method){ 44 | this(clazz,method,null); 45 | } 46 | public OnehammerException(String message){ 47 | this(null,null,message,(Object[]) null); 48 | } 49 | 50 | @Override 51 | public List getLocations() { 52 | return null; 53 | } 54 | 55 | @Override 56 | public ErrorType getErrorType() { 57 | return ErrorType.DataFetchingException; 58 | } 59 | 60 | @Override 61 | public Map getExtensions() { 62 | return ImmutableMap.of("code","101"+param.length,"message",this.message); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/entity/OrderProgress.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.util.Date; 11 | 12 | import com.rfrongfei.onehammer.base.entity.Audit; 13 | import lombok.*; 14 | 15 | /** 16 | * 订单流程 17 | * 18 | * @author Jxlsx 19 | * @email iamlive@aliyun.com 20 | * @date 2019-12-23 15:43:16 21 | */ 22 | @Data 23 | @ToString 24 | @Builder 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | @EqualsAndHashCode(callSuper = true) 28 | @TableName("rf_order_progress") 29 | 30 | public class OrderProgress extends Audit { 31 | 32 | public static final String ID = "id"; 33 | public static final String CONSUMER_ID = "consumer_id"; 34 | public static final String ORDER_ID = "order_id"; 35 | public static final String PROCESS_COMMENT = "process_comment"; 36 | public static final String PROCESS_STATUS = "process_status"; 37 | public static final String R_STATUS = "r_status"; 38 | public static final String REASON = "reason"; 39 | 40 | /** 41 | * 42 | */ 43 | 44 | @TableId 45 | private String id; 46 | /** 47 | * 用户ID 48 | */ 49 | @TableField(value = "consumer_id") 50 | private String consumerId; 51 | /** 52 | * 订单ID 53 | */ 54 | @TableField(value = "order_id") 55 | private String orderId; 56 | /** 57 | * 进度备注内容 58 | */ 59 | @TableField(value = "process_comment") 60 | private String processComment; 61 | /** 62 | * 进度 63 | */ 64 | @TableField(value = "process_status") 65 | private Integer processStatus; 66 | /** 67 | * 状态 68 | */ 69 | @TableField(value = "r_status") 70 | private Integer rStatus; 71 | /** 72 | * 理由 73 | */ 74 | @TableField(value = "reason") 75 | private String reason; 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/licenses/entity/LicenseDeliveryman.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.licenses.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.util.Date; 11 | 12 | import com.rfrongfei.onehammer.base.entity.Audit; 13 | import lombok.*; 14 | 15 | /** 16 | * 骑手许可 17 | * 18 | * @author Jxlsx 19 | * @email iamlive@aliyun.com 20 | * @date 2019-12-23 15:33:54 21 | */ 22 | @Data 23 | @ToString 24 | @Builder 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | @EqualsAndHashCode(callSuper = true) 28 | @TableName("rf_license_deliveryman") 29 | 30 | public class LicenseDeliveryman extends Audit { 31 | 32 | public static final String ID = "id"; 33 | public static final String CARD_FRONT = "card_front"; 34 | public static final String CARD_NUMBER = "card_number"; 35 | public static final String CARD_VERSO = "card_verso"; 36 | public static final String HEALTH_IMG = "health_img"; 37 | public static final String STATUS = "status"; 38 | public static final String USER_ID = "user_id"; 39 | 40 | /** 41 | * 42 | */ 43 | 44 | @TableId 45 | private String id; 46 | /** 47 | * 身份证正面 48 | */ 49 | @TableField(value = "card_front") 50 | private String cardFront; 51 | /** 52 | * 身份证号码 53 | */ 54 | @TableField(value = "card_number") 55 | private String cardNumber; 56 | /** 57 | * 身份证背面 58 | */ 59 | @TableField(value = "card_verso") 60 | private String cardVerso; 61 | /** 62 | * 健康证 63 | */ 64 | @TableField(value = "health_img") 65 | private String healthImg; 66 | /** 67 | * 审核状态:0失败,1成功,2等待 68 | */ 69 | @TableField(value = "status") 70 | private Integer status; 71 | /** 72 | * 用户ID 73 | */ 74 | @TableField(value = "user_id") 75 | private String userId; 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/licenses/entity/LicenseMerchants.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.licenses.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.util.Date; 11 | 12 | import com.rfrongfei.onehammer.base.entity.Audit; 13 | import lombok.*; 14 | 15 | /** 16 | * 商家许可 17 | * 18 | * @author Jxlsx 19 | * @email iamlive@aliyun.com 20 | * @date 2019-12-23 15:33:54 21 | */ 22 | @Data 23 | @ToString 24 | @Builder 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | @EqualsAndHashCode(callSuper = true) 28 | @TableName("rf_license_merchants") 29 | 30 | public class LicenseMerchants extends Audit { 31 | 32 | public static final String ID = "id"; 33 | public static final String CARD_NUMBER = "card_number"; 34 | public static final String CARD_VERSO = "card_verso"; 35 | public static final String CARDFRONT = "cardfront"; 36 | public static final String MERCHANTS_ID = "merchants_id"; 37 | public static final String STATUS = "status"; 38 | public static final String STORE_PIC = "store_pic"; 39 | 40 | /** 41 | * 42 | */ 43 | 44 | @TableId 45 | private String id; 46 | /** 47 | * 身份证号码 48 | */ 49 | @TableField(value = "card_number") 50 | private String cardNumber; 51 | /** 52 | * 身份证反面 53 | */ 54 | @TableField(value = "card_verso") 55 | private String cardVerso; 56 | /** 57 | * 身份证正面 58 | */ 59 | @TableField(value = "cardfront") 60 | private String cardfront; 61 | /** 62 | * 用户ID 63 | */ 64 | @TableField(value = "merchants_id") 65 | private String merchantsId; 66 | /** 67 | * 审核状态:0失败,1成功,2等待 68 | */ 69 | @TableField(value = "status") 70 | private String status; 71 | /** 72 | * 摊位图片 73 | */ 74 | @TableField(value = "store_pic") 75 | private String storePic; 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/key/IdGenerator.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.key; 2 | 3 | import cn.hutool.core.date.DateUtil; 4 | import cn.hutool.core.date.SystemClock; 5 | import com.baomidou.mybatisplus.core.toolkit.IdWorker; 6 | 7 | import java.text.DecimalFormat; 8 | import java.util.Date; 9 | 10 | public class IdGenerator { 11 | 12 | /** 13 | * 1位用户类型,13位时间戳,2位hash值正负,10位hash值 14 | * @param userType : 用户类型 15 | * @return : {@link String} 16 | */ 17 | public static String nextUserId(String userType){ 18 | String time = DateUtil.format(new Date(System.currentTimeMillis()), "yyMMddHHmmss"); 19 | return userType + time + uuidHash(); 20 | } 21 | 22 | public static String nextUserId(Integer userType){ 23 | return nextUserId(userType+""); 24 | } 25 | 26 | public static String account(String phone){ 27 | String time = SystemClock.now() + ""; 28 | time = time.substring(time.length()-4); 29 | String substring = phone.substring(phone.length() - 5); 30 | return time+substring; 31 | } 32 | 33 | /** 34 | * 13位时间戳,10位用户ID,2位商品数量 35 | * @param consumerId : 用户ID 36 | * @param goodsCount : 商品数量 37 | * @return : {@link String} 38 | */ 39 | public static String nextOrderId(String consumerId,Integer goodsCount){ 40 | String consumerSub = consumerId.substring(consumerId.length() - 10); 41 | DecimalFormat df = new DecimalFormat("00"); 42 | return System.currentTimeMillis()+consumerSub+df.format(goodsCount); 43 | } 44 | 45 | private static String uuidHash(){ 46 | String uuidHash = ""; 47 | String uuid = IdWorker.get32UUID(); 48 | int i = uuid.hashCode(); 49 | if (i>0) { 50 | uuidHash = uuidHash + "99"; 51 | }else{ 52 | uuidHash = uuidHash + "11"; 53 | } 54 | int abs = Math.abs(i); 55 | DecimalFormat df = new DecimalFormat("0000000000"); 56 | return uuidHash + df.format(abs); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/goods/entity/Goods.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.goods.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.util.Date; 11 | 12 | import com.rfrongfei.onehammer.base.entity.Audit; 13 | import lombok.*; 14 | 15 | /** 16 | * 商品 17 | * @author Jxlsx 18 | * @email iamlive@aliyun.com 19 | * @date 2019-12-23 15:33:54 20 | */ 21 | @Data 22 | @ToString 23 | @Builder 24 | @AllArgsConstructor 25 | @NoArgsConstructor 26 | @EqualsAndHashCode(callSuper = true) 27 | @TableName("rf_goods") 28 | 29 | public class Goods extends Audit { 30 | 31 | public static final String ID="id"; 32 | public static final String CATEGORY_ID="category_id"; 33 | public static final String DESCRIPTION="description"; 34 | public static final String GOODS_ID="goods_id"; 35 | public static final String NAME="name"; 36 | public static final String PIC="pic"; 37 | public static final String SHELVEL="shelvel"; 38 | public static final String SORT="sort"; 39 | public static final String USER_ID="user_id"; 40 | 41 | /** 42 | * 43 | */ 44 | 45 | @TableId 46 | private String id; 47 | /** 48 | * 商品分类 49 | */ 50 | @TableField(value = "category_id") 51 | private String categoryId; 52 | /** 53 | * 商品描述 54 | */ 55 | @TableField(value = "description") 56 | private String description; 57 | /** 58 | * 商品ID 59 | */ 60 | @TableField(value = "goods_id") 61 | private String goodsId; 62 | /** 63 | * 商品名 64 | */ 65 | @TableField(value = "name") 66 | private String name; 67 | /** 68 | * 商品图片 69 | */ 70 | @TableField(value = "pic") 71 | private String pic; 72 | /** 73 | * 上架状态0未上架,1已上架 74 | */ 75 | @TableField(value = "shelvel") 76 | private Integer shelvel; 77 | /** 78 | * 排序,数值越高越排在前面 79 | */ 80 | @TableField(value = "sort") 81 | private Integer sort; 82 | /** 83 | * 用户ID 84 | */ 85 | @TableField(value = "user_id") 86 | private String userId; 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/entity/Notice.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | import com.rfrongfei.onehammer.base.entity.Audit; 7 | 8 | 9 | 10 | 11 | import java.util.Date; 12 | 13 | import lombok.*; 14 | 15 | /** 16 | * 消息通知 17 | * 18 | * @author Jxlsx 19 | * @email iamlive@aliyun.com 20 | * @date 2019-12-23 15:33:55 21 | */ 22 | @Data 23 | @ToString 24 | @Builder 25 | @AllArgsConstructor 26 | @NoArgsConstructor 27 | @EqualsAndHashCode(callSuper = true) 28 | @TableName("rf_notice") 29 | 30 | public class Notice extends Audit { 31 | 32 | public static final String ID = "id"; 33 | public static final String CONTENT = "content"; 34 | public static final String NOTICE_ID = "notice_id"; 35 | public static final String NOTICE_FROM = "notice_from"; 36 | public static final String STATUS = "status"; 37 | public static final String TITLE = "title"; 38 | public static final String TYPE = "type"; 39 | public static final String USER_ID = "user_id"; 40 | 41 | /** 42 | * 43 | */ 44 | 45 | @TableId 46 | private String id; 47 | /** 48 | * 通知内容 49 | */ 50 | @TableField(value = "content") 51 | private String content; 52 | /** 53 | * 通知ID 54 | */ 55 | @TableField(value = "notice_id") 56 | private String noticeId; 57 | /** 58 | * 消息来源 59 | */ 60 | @TableField(value = "notice_from") 61 | private String noticeFrom; 62 | /** 63 | * 状态:0未读,1已读 64 | */ 65 | @TableField(value = "status") 66 | private Integer status; 67 | /** 68 | * 标题 69 | */ 70 | @TableField(value = "title") 71 | private String title; 72 | /** 73 | * 通知类型 74 | */ 75 | @TableField(value = "type") 76 | private Integer type; 77 | /** 78 | * 需要通知的用户IDs 79 | */ 80 | @TableField(value = "user_id") 81 | private Integer userId; 82 | 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/entity/OrderDetail.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.math.BigDecimal; 11 | import java.util.Date; 12 | 13 | import com.rfrongfei.onehammer.base.entity.Audit; 14 | import lombok.*; 15 | 16 | /** 17 | * 订单详情 18 | * 19 | * @author Jxlsx 20 | * @email iamlive@aliyun.com 21 | * @date 2019-12-23 15:43:16 22 | */ 23 | @Data 24 | @ToString 25 | @Builder 26 | @AllArgsConstructor 27 | @NoArgsConstructor 28 | @EqualsAndHashCode(callSuper = true) 29 | @TableName("rf_order_detail") 30 | 31 | public class OrderDetail extends Audit { 32 | 33 | public static final String ID = "id"; 34 | public static final String COUNT = "count"; 35 | public static final String GOODS_ID = "goods_id"; 36 | public static final String GOODS_SIZE = "goods_size"; 37 | public static final String GOODS_SIZE_ID = "goods_size_id"; 38 | public static final String NAME = "name"; 39 | public static final String ORDER_ID = "order_id"; 40 | public static final String PIC = "pic"; 41 | public static final String PRICE = "price"; 42 | 43 | /** 44 | * 45 | */ 46 | 47 | @TableId 48 | private String id; 49 | /** 50 | * 商品数量 51 | */ 52 | @TableField(value = "count") 53 | private Integer count; 54 | /** 55 | * 商品ID 56 | */ 57 | @TableField(value = "goods_id") 58 | private String goodsId; 59 | /** 60 | * 商品规格名 61 | */ 62 | @TableField(value = "goods_size") 63 | private String goodsSize; 64 | /** 65 | * 商品规格ID 66 | */ 67 | @TableField(value = "goods_size_id") 68 | private String goodsSizeId; 69 | /** 70 | * 商品名 71 | */ 72 | @TableField(value = "name") 73 | private String name; 74 | /** 75 | * 订单ID 76 | */ 77 | @TableField(value = "order_id") 78 | private String orderId; 79 | /** 80 | * 商品图片 81 | */ 82 | @TableField(value = "pic") 83 | private String pic; 84 | /** 85 | * 商品价格 86 | */ 87 | @TableField(value = "price") 88 | private BigDecimal price; 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/entity/OrderRefund.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.math.BigDecimal; 11 | import java.util.Date; 12 | 13 | import com.rfrongfei.onehammer.base.entity.Audit; 14 | import lombok.*; 15 | 16 | /** 17 | * 订单退款 18 | * 19 | * @author Jxlsx 20 | * @email iamlive@aliyun.com 21 | * @date 2019-12-23 15:43:16 22 | */ 23 | @Data 24 | @ToString 25 | @Builder 26 | @AllArgsConstructor 27 | @NoArgsConstructor 28 | @EqualsAndHashCode(callSuper = true) 29 | @TableName("rf_order_refund") 30 | 31 | public class OrderRefund extends Audit { 32 | 33 | public static final String ID = "id"; 34 | public static final String CONSUMER_ID = "consumer_id"; 35 | public static final String END = "end"; 36 | public static final String ORDER_ID = "order_id"; 37 | public static final String POUNDAGE = "poundage"; 38 | public static final String REASON = "reason"; 39 | public static final String REFUND_AMOUNT = "refund_amount"; 40 | public static final String START = "start"; 41 | public static final String STATUS = "status"; 42 | 43 | /** 44 | * 45 | */ 46 | 47 | @TableId 48 | private String id; 49 | /** 50 | * 用户ID 51 | */ 52 | @TableField(value = "consumer_id") 53 | private String consumerId; 54 | /** 55 | * 退款完成时间 56 | */ 57 | @TableField(value = "end") 58 | private Date end; 59 | /** 60 | * 订单ID 61 | */ 62 | @TableField(value = "order_id") 63 | private String orderId; 64 | /** 65 | * 协商扣除的手续费 66 | */ 67 | @TableField(value = "poundage") 68 | private BigDecimal poundage; 69 | /** 70 | * 退款理由 71 | */ 72 | @TableField(value = "reason") 73 | private String reason; 74 | /** 75 | * 退款金额 76 | */ 77 | @TableField(value = "refund_amount") 78 | private BigDecimal refundAmount; 79 | /** 80 | * 商家处理时间 81 | */ 82 | @TableField(value = "start") 83 | private Date start; 84 | /** 85 | * 退款状态 86 | */ 87 | @TableField(value = "status") 88 | private Integer status; 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/deliveryman/entity/DeliverymanInfo.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.deliveryman.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.*; 4 | 5 | import com.rfrongfei.onehammer.base.entity.Audit; 6 | import com.rfrongfei.onehammer.base.entity.UserInfo; 7 | import lombok.*; 8 | 9 | /** 10 | * 骑手信息 11 | * 12 | * @author Jxlsx 13 | * @email iamlive@aliyun.com 14 | * @date 2019-12-23 15:33:54 15 | */ 16 | @Data 17 | @ToString 18 | @Builder 19 | @AllArgsConstructor 20 | @NoArgsConstructor 21 | @EqualsAndHashCode(callSuper = true) 22 | @TableName("rf_deliveryman_info") 23 | @KeySequence(value = "commonIdGenerator",clazz = String.class) 24 | public class DeliverymanInfo extends Audit implements UserInfo { 25 | 26 | public static final String ID = "id"; 27 | public static final String DELIVERYMAN_ID = "deliveryman_id"; 28 | public static final String HEAD_PORTRAIT = "head_portrait"; 29 | public static final String NAME = "name"; 30 | public static final String NICKNAME = "nickname"; 31 | public static final String PASSWORD = "password"; 32 | public static final String PHONE = "phone"; 33 | public static final String STATUS = "status"; 34 | 35 | /** 36 | * 37 | */ 38 | @TableId(type = IdType.INPUT) 39 | private String id; 40 | /** 41 | * 用户ID 42 | */ 43 | @TableField(value = "deliveryman_id") 44 | private String deliverymanId; 45 | /** 46 | * 头像 47 | */ 48 | @TableField(value = "head_portrait") 49 | private String headPortrait; 50 | /** 51 | * 姓名 52 | */ 53 | @TableField(value = "name") 54 | private String name; 55 | /** 56 | * 昵称 57 | */ 58 | @TableField(value = "nickname") 59 | private String nickname; 60 | /** 61 | * 密码 62 | */ 63 | @TableField(value = "password") 64 | private String password; 65 | /** 66 | * 电话 67 | */ 68 | @TableField(value = "phone") 69 | private String phone; 70 | /** 71 | * 工作状态:0开工中,1休息 72 | */ 73 | @TableField(value = "status") 74 | private Integer status; 75 | 76 | @Override 77 | public void setUserId(String userId) { 78 | this.setDeliverymanId(userId); 79 | } 80 | 81 | @Override 82 | public String getUserId() { 83 | return this.getDeliverymanId(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/entity/Address.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.math.BigDecimal; 11 | import java.util.Date; 12 | 13 | import com.rfrongfei.onehammer.base.entity.Audit; 14 | import lombok.*; 15 | 16 | /** 17 | * 地址 18 | * 19 | * @author Jxlsx 20 | * @email iamlive@aliyun.com 21 | * @date 2019-12-23 15:33:55 22 | */ 23 | @Data 24 | @ToString 25 | @Builder 26 | @AllArgsConstructor 27 | @NoArgsConstructor 28 | @EqualsAndHashCode(callSuper = true) 29 | @TableName("rf_address") 30 | public class Address extends Audit { 31 | 32 | public static final String ID = "id"; 33 | public static final String ADDRESS_ID = "address_id"; 34 | public static final String DEFAULT_ENUM = "default_enum"; 35 | public static final String DETAIL = "detail"; 36 | public static final String LATITUDE = "latitude"; 37 | public static final String LONGITUDE = "longitude"; 38 | public static final String NAME = "name"; 39 | public static final String NUMBER = "number"; 40 | public static final String PHONE = "phone"; 41 | public static final String REGION = "region"; 42 | 43 | /** 44 | * 45 | */ 46 | @TableId 47 | private String id; 48 | /** 49 | * 地址ID 50 | */ 51 | @TableField(value = "address_id") 52 | private String addressId; 53 | /** 54 | * 默认 55 | */ 56 | @TableField(value = "default_enum") 57 | private Integer defaultEnum; 58 | /** 59 | * 收货人详细地址 60 | */ 61 | @TableField(value = "detail") 62 | private String detail; 63 | /** 64 | * 纬度 65 | */ 66 | @TableField(value = "latitude") 67 | private BigDecimal latitude; 68 | /** 69 | * 经度 70 | */ 71 | @TableField(value = "longitude") 72 | private BigDecimal longitude; 73 | /** 74 | * 收货人姓名 75 | */ 76 | @TableField(value = "name") 77 | private String name; 78 | /** 79 | * 门牌号 80 | */ 81 | @TableField(value = "number") 82 | private String number; 83 | /** 84 | * 收货人电话 85 | */ 86 | @TableField(value = "phone") 87 | private String phone; 88 | /** 89 | * 收货人所在区域 90 | */ 91 | @TableField(value = "region") 92 | private String region; 93 | 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/coupon/entity/Coupon.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.coupon.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.math.BigDecimal; 11 | import java.util.Date; 12 | 13 | import com.rfrongfei.onehammer.base.entity.Audit; 14 | import lombok.*; 15 | 16 | /** 17 | * 优惠券 18 | * 19 | * @author Jxlsx 20 | * @email iamlive@aliyun.com 21 | * @date 2019-12-23 15:33:55 22 | */ 23 | @Data 24 | @ToString 25 | @Builder 26 | @AllArgsConstructor 27 | @NoArgsConstructor 28 | @EqualsAndHashCode(callSuper = true) 29 | @TableName("rf_coupon") 30 | 31 | public class Coupon extends Audit { 32 | 33 | public static final String ID = "id"; 34 | public static final String COUNT = "count"; 35 | public static final String COUPON_ID = "coupon_id"; 36 | public static final String DISCOUNT = "discount"; 37 | public static final String END = "end"; 38 | public static final String REDUTION = "redution"; 39 | public static final String REDUTION_AMOUNT = "redution_amount"; 40 | public static final String START = "start"; 41 | public static final String STATUS = "status"; 42 | public static final String TYPE = "type"; 43 | 44 | /** 45 | * 46 | */ 47 | 48 | @TableId 49 | private String id; 50 | /** 51 | * 优惠券数量 52 | */ 53 | @TableField(value = "count") 54 | private Integer count; 55 | /** 56 | * 优惠券ID 57 | */ 58 | @TableField(value = "coupon_id") 59 | private String couponId; 60 | /** 61 | * 折扣数 62 | */ 63 | @TableField(value = "discount") 64 | private BigDecimal discount; 65 | /** 66 | * 优惠券过期时间 67 | */ 68 | @TableField(value = "end") 69 | private Date end; 70 | /** 71 | * 满减基准金额 72 | */ 73 | @TableField(value = "redution") 74 | private BigDecimal redution; 75 | /** 76 | * 满减金额 77 | */ 78 | @TableField(value = "redution_amount") 79 | private BigDecimal redutionAmount; 80 | /** 81 | * 优惠券发布时间 82 | */ 83 | @TableField(value = "start") 84 | private Date start; 85 | /** 86 | * 优惠券状态:0可用,1不可用 87 | */ 88 | @TableField(value = "status") 89 | private Integer status; 90 | /** 91 | * 优惠券类型:满减,折扣 92 | */ 93 | @TableField(value = "type") 94 | private Integer type; 95 | 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/entity/ConsumerInfo.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.*; 4 | 5 | 6 | import com.rfrongfei.onehammer.base.entity.Audit; 7 | import com.rfrongfei.onehammer.base.entity.UserInfo; 8 | import lombok.*; 9 | 10 | /** 11 | * 消费者信息 12 | * 13 | * @author Jxlsx 14 | * @email iamlive@aliyun.com 15 | * @date 2019-12-23 15:43:17 16 | */ 17 | @Data 18 | @ToString 19 | @Builder 20 | @AllArgsConstructor 21 | @NoArgsConstructor 22 | @EqualsAndHashCode(callSuper = true) 23 | @TableName("rf_consumer_info") 24 | @KeySequence(value = "commonIdGenerator",clazz = String.class) 25 | public class ConsumerInfo extends Audit implements UserInfo { 26 | 27 | public static final String ID = "id"; 28 | public static final String ACCOUNT = "account"; 29 | public static final String CONSUMER_ID = "consumer_id"; 30 | public static final String EMAIL = "email"; 31 | public static final String NAME = "name"; 32 | public static final String PASSWORD = "password"; 33 | public static final String PHONE = "phone"; 34 | public static final String USER_NICKNAME = "user_nickname"; 35 | public static final String USER_PORTRAIT = "user_portrait"; 36 | 37 | /** 38 | * 39 | */ 40 | 41 | @TableId(type = IdType.INPUT) 42 | private String id; 43 | /** 44 | * 账号 45 | */ 46 | @TableField(value = "account") 47 | private String account; 48 | /** 49 | * 用户ID 50 | */ 51 | @TableField(value = "consumer_id") 52 | private String consumerId; 53 | /** 54 | * email 55 | */ 56 | @TableField(value = "email") 57 | private String email; 58 | /** 59 | * 用户名 60 | */ 61 | @TableField(value = "name") 62 | private String name; 63 | /** 64 | * 用户密码 65 | */ 66 | @TableField(value = "password") 67 | private String password; 68 | /** 69 | * 用户手机号 70 | */ 71 | @TableField(value = "phone") 72 | private String phone; 73 | /** 74 | * 用户昵称 75 | */ 76 | @TableField(value = "user_nickname") 77 | private String userNickname; 78 | /** 79 | * 用户头像 80 | */ 81 | @TableField(value = "user_portrait") 82 | private String userPortrait; 83 | 84 | @Override 85 | public void setUserId(String userId) { 86 | this.setConsumerId(userId); 87 | } 88 | 89 | @Override 90 | public String getUserId() { 91 | return this.getConsumerId(); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/config/durid/DruidDataSourceConfig.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.config.durid; 2 | 3 | import com.alibaba.druid.pool.DruidDataSource; 4 | import com.alibaba.druid.support.http.StatViewServlet; 5 | import com.alibaba.druid.support.http.WebStatFilter; 6 | import org.springframework.boot.context.properties.ConfigurationProperties; 7 | import org.springframework.boot.web.servlet.FilterRegistrationBean; 8 | import org.springframework.boot.web.servlet.ServletRegistrationBean; 9 | import org.springframework.context.annotation.Bean; 10 | import org.springframework.context.annotation.Configuration; 11 | import org.springframework.context.annotation.PropertySource; 12 | 13 | import javax.sql.DataSource; 14 | 15 | @Configuration 16 | @PropertySource(value = "classpath:application.yml") 17 | public class DruidDataSourceConfig { 18 | 19 | 20 | @Bean(destroyMethod = "close", initMethod = "init") 21 | @ConfigurationProperties(prefix = "spring.datasource") 22 | public DataSource druidDataSource(){ 23 | return new DruidDataSource(); 24 | } 25 | 26 | /** 27 | * druid 28 | * 注册一个StatViewServlet 29 | * @return 30 | */ 31 | @Bean 32 | public ServletRegistrationBean druidStatViewServlet(){ 33 | //org.springframework.boot.context.embedded.ServletRegistrationBean提供类的进行注册. 34 | ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(),"/druid/*"); 35 | 36 | //添加初始化参数:initParams 37 | //白名单: 38 | servletRegistrationBean.addInitParameter("allow","127.0.0.1"); 39 | //IP黑名单 (存在共同时,deny优先于allow) : 如果满足deny的话提示:Sorry, you are not permitted to view this page. 40 | //servletRegistrationBean.addInitParameter("deny","192.168.1.73"); 41 | //登录查看信息的账号密码. 42 | servletRegistrationBean.addInitParameter("loginUsername","sysmanagement"); 43 | servletRegistrationBean.addInitParameter("loginPassword","123456"); 44 | //是否能够重置数据. 45 | servletRegistrationBean.addInitParameter("resetEnable","false"); 46 | return servletRegistrationBean; 47 | } 48 | 49 | /** 50 | * druid过滤器 51 | * 注册一个:filterRegistrationBean 52 | * @return 53 | */ 54 | @Bean 55 | public FilterRegistrationBean druidStatFilter(){ 56 | FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new WebStatFilter()); 57 | //添加过滤规则. 58 | filterRegistrationBean.addUrlPatterns("/*"); 59 | //添加不需要忽略的格式信息. 60 | filterRegistrationBean.addInitParameter("exclusions","*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*"); 61 | return filterRegistrationBean; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/shoppingcart/entity/ShoppingCart.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.shoppingcart.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.math.BigDecimal; 11 | import java.util.Date; 12 | 13 | import com.rfrongfei.onehammer.base.entity.Audit; 14 | import lombok.*; 15 | 16 | /** 17 | * 购物车 18 | * 19 | * @author Jxlsx 20 | * @email iamlive@aliyun.com 21 | * @date 2019-12-23 15:43:16 22 | */ 23 | @Data 24 | @ToString 25 | @Builder 26 | @AllArgsConstructor 27 | @NoArgsConstructor 28 | @EqualsAndHashCode(callSuper = true) 29 | @TableName("rf_shopping_cart") 30 | 31 | public class ShoppingCart extends Audit { 32 | 33 | public static final String ID = "id"; 34 | public static final String CONSUMER_ID = "consumer_id"; 35 | public static final String COUNT = "count"; 36 | public static final String GOODS_ID = "goods_id"; 37 | public static final String GOODS_SIZE = "goods_size"; 38 | public static final String GOODS_SIZE_ID = "goods_size_id"; 39 | public static final String MERCHANTS_ID = "merchants_id"; 40 | public static final String NAME = "name"; 41 | public static final String PIC = "pic"; 42 | public static final String PRICE = "price"; 43 | public static final String SHOPPING_CART_ID = "shopping_cart_id"; 44 | 45 | /** 46 | * 47 | */ 48 | 49 | @TableId 50 | private String id; 51 | /** 52 | * 用户ID 53 | */ 54 | @TableField(value = "consumer_id") 55 | private String consumerId; 56 | /** 57 | * 商品数量 58 | */ 59 | @TableField(value = "count") 60 | private Integer count; 61 | /** 62 | * 商品ID 63 | */ 64 | @TableField(value = "goods_id") 65 | private String goodsId; 66 | /** 67 | * 商品规格 68 | */ 69 | @TableField(value = "goods_size") 70 | private String goodsSize; 71 | /** 72 | * 商品规格ID 73 | */ 74 | @TableField(value = "goods_size_id") 75 | private String goodsSizeId; 76 | /** 77 | * 商户ID 78 | */ 79 | @TableField(value = "merchants_id") 80 | private String merchantsId; 81 | /** 82 | * 商品名 83 | */ 84 | @TableField(value = "name") 85 | private String name; 86 | /** 87 | * 商品图片 88 | */ 89 | @TableField(value = "pic") 90 | private String pic; 91 | /** 92 | * 商品价格 93 | */ 94 | @TableField(value = "price") 95 | private BigDecimal price; 96 | /** 97 | * 购物车ID 98 | */ 99 | @TableField(value = "shopping_cart_id") 100 | private String shoppingCartId; 101 | 102 | } 103 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/service/UserInfoServiceHolder.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.service; 2 | 3 | import com.rfrongfei.onehammer.base.entity.UserInfo; 4 | import com.rfrongfei.onehammer.common.enums.UserType; 5 | import com.rfrongfei.onehammer.common.input.UserInput; 6 | import com.rfrongfei.onehammer.common.vo.InfoVO; 7 | import com.rfrongfei.onehammer.common.vo.UserInfoVO; 8 | import com.rfrongfei.onehammer.deliveryman.entity.DeliverymanInfo; 9 | import com.rfrongfei.onehammer.merchants.entity.MerchantsInfo; 10 | import com.rfrongfei.onehammer.user.entity.ConsumerInfo; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Component; 13 | 14 | import javax.annotation.PostConstruct; 15 | import java.util.Map; 16 | import java.util.concurrent.ConcurrentHashMap; 17 | 18 | @Component 19 | public class UserInfoServiceHolder { 20 | 21 | @Autowired 22 | private Map loginServices = new ConcurrentHashMap<>(3); 23 | 24 | private ConcurrentHashMap> userInfoMap = new ConcurrentHashMap<>(); 25 | 26 | private String userType; 27 | 28 | public void setUserType(Integer userType) { 29 | this.userType = userType.toString(); 30 | } 31 | 32 | @PostConstruct 33 | public void init() { 34 | userInfoMap.put(UserType.CONSUMER.getCode().toString(), ConsumerInfo.class); 35 | userInfoMap.put(UserType.DELIVERYMAN.getCode().toString(), DeliverymanInfo.class); 36 | userInfoMap.put(UserType.MERCHANTS.getCode().toString(), MerchantsInfo.class); 37 | } 38 | 39 | public UserInfoVO login(UserInput userInput) { 40 | return loginServices.get(this.userType).phoneLogin(userInput); 41 | } 42 | 43 | public UserInfo getUserInfoPhone(String phone) { 44 | return loginServices.get(this.userType).getUserInfoPhone(phone); 45 | } 46 | 47 | public UserInfo getUserInfoUserId(String userId) { 48 | return loginServices.get(this.userType).getUserInfoUserId(userId); 49 | } 50 | 51 | public void updateUser(InfoVO infoVO) { 52 | loginServices.get(this.userType).updateUser(getUserInfo(infoVO)); 53 | } 54 | 55 | public void deleteUser(InfoVO infoVO){ 56 | loginServices.get(this.userType).deleteUser(getUserInfo(infoVO)); 57 | } 58 | 59 | private UserInfo getUserInfo(InfoVO infoVO){ 60 | if (UserType.CONSUMER.getCode().equals(this.userType)) { 61 | return infoVO.getConsumerInfo(); 62 | } 63 | if (UserType.MERCHANTS.getCode().equals(this.userType)) { 64 | return infoVO.getMerchantsInfo(); 65 | } 66 | if (UserType.DELIVERYMAN.getCode().equals(this.userType)) { 67 | return infoVO.getDeliverymanInfo(); 68 | } 69 | return null; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/order/entity/Order.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.order.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableId; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | 7 | 8 | 9 | 10 | import java.math.BigDecimal; 11 | import java.util.Date; 12 | 13 | import com.rfrongfei.onehammer.base.entity.Audit; 14 | import lombok.*; 15 | 16 | /** 17 | * 订单 18 | * 19 | * @author Jxlsx 20 | * @email iamlive@aliyun.com 21 | * @date 2019-12-23 15:43:16 22 | */ 23 | @Data 24 | @ToString 25 | @Builder 26 | @AllArgsConstructor 27 | @NoArgsConstructor 28 | @EqualsAndHashCode(callSuper = true) 29 | @TableName("rf_order") 30 | 31 | public class Order extends Audit { 32 | 33 | public static final String ID = "id"; 34 | public static final String ACTIVITY_AMOUNT = "activity_amount"; 35 | public static final String ACTIVITY_ID = "activity_id"; 36 | public static final String ADDRESS_ID = "address_id"; 37 | public static final String COMMENT = "comment"; 38 | public static final String CONSUMER_ID = "consumer_id"; 39 | public static final String COUPON_AMOUNT = "coupon_amount"; 40 | public static final String COUPON_ID = "coupon_id"; 41 | public static final String DELIVERY_AMOUNT = "delivery_amount"; 42 | public static final String MERCHANTS_ID = "merchants_id"; 43 | public static final String ORDER_ID = "order_id"; 44 | public static final String PAY_AMOUNT = "pay_amount"; 45 | public static final String TOTAL = "total"; 46 | 47 | /** 48 | * 49 | */ 50 | 51 | @TableId 52 | private String id; 53 | /** 54 | * 商家活动优惠金额 55 | */ 56 | @TableField(value = "activity_amount") 57 | private BigDecimal activityAmount; 58 | /** 59 | * 商家活动ID 60 | */ 61 | @TableField(value = "activity_id") 62 | private String activityId; 63 | /** 64 | * 用户地址 65 | */ 66 | @TableField(value = "address_id") 67 | private String addressId; 68 | /** 69 | * 订单备注 70 | */ 71 | @TableField(value = "comment") 72 | private String comment; 73 | /** 74 | * 用户ID 75 | */ 76 | @TableField(value = "consumer_id") 77 | private String consumerId; 78 | /** 79 | * 订单优惠总金额 80 | */ 81 | @TableField(value = "coupon_amount") 82 | private BigDecimal couponAmount; 83 | /** 84 | * 优惠券ID 85 | */ 86 | @TableField(value = "coupon_id") 87 | private String couponId; 88 | /** 89 | * 订单配送金额 90 | */ 91 | @TableField(value = "delivery_amount") 92 | private BigDecimal deliveryAmount; 93 | /** 94 | * 商家ID 95 | */ 96 | @TableField(value = "merchants_id") 97 | private String merchantsId; 98 | /** 99 | * 订单ID 100 | */ 101 | @TableField(value = "order_id") 102 | private String orderId; 103 | /** 104 | * 订单实付金额 105 | */ 106 | @TableField(value = "pay_amount") 107 | private BigDecimal payAmount; 108 | /** 109 | * 订单总价 110 | */ 111 | @TableField(value = "total") 112 | private BigDecimal total; 113 | 114 | } 115 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/util/RedisHelper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.util; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.data.redis.core.RedisTemplate; 6 | import org.springframework.stereotype.Component; 7 | import org.springframework.util.CollectionUtils; 8 | 9 | import java.util.HashMap; 10 | import java.util.Set; 11 | import java.util.concurrent.TimeUnit; 12 | 13 | 14 | /** 15 | * @description: redis工具类 16 | */ 17 | @Component 18 | @Slf4j 19 | public class RedisHelper { 20 | 21 | @Autowired 22 | private RedisTemplate redisTemplate; 23 | 24 | /** 25 | * 指定缓存失效时间 26 | * 27 | * @param key 键 28 | * @param time 时间(秒) 29 | * @return 30 | */ 31 | public boolean expire(String key, long time) { 32 | try { 33 | if (time > 0) { 34 | redisTemplate.expire(key, time, TimeUnit.SECONDS); 35 | } 36 | return true; 37 | } catch (Exception e) { 38 | log.error("设置redis key expire 失败!", e); 39 | return false; 40 | } 41 | } 42 | 43 | /** 44 | * 判断key是否存在 45 | * 46 | * @param key 键 47 | * @return true 存在 false不存在 48 | */ 49 | @SuppressWarnings("ConstantConditions") 50 | public boolean hasKey(String key) { 51 | try { 52 | return redisTemplate.hasKey(key); 53 | } catch (Exception e) { 54 | return false; 55 | } 56 | } 57 | 58 | /** 59 | * 删除缓存 60 | * 61 | * @param key 可以传一个值 或多个 62 | */ 63 | @SuppressWarnings("unchecked") 64 | public void del(String... key) { 65 | if (key != null && key.length > 0) { 66 | if (key.length == 1) { 67 | redisTemplate.delete(key[0]); 68 | } else { 69 | redisTemplate.delete(CollectionUtils.arrayToList(key)); 70 | } 71 | } 72 | } 73 | 74 | /** 75 | * 普通缓存获取 76 | * 77 | * @param key 键 78 | * @return 值 79 | */ 80 | public Object get(String key) { 81 | return key == null ? null : redisTemplate.opsForValue().get(key); 82 | } 83 | 84 | @SuppressWarnings("unchecked") 85 | public T get(String key, Class clazz) { 86 | Object o = get(key); 87 | if (o != null) { 88 | return (T) o; 89 | } 90 | return null; 91 | } 92 | 93 | /** 94 | * 普通缓存放入 95 | * 96 | * @param key 键 97 | * @param value 值 98 | * @return true成功 false失败 99 | */ 100 | public boolean set(String key, Object value) { 101 | try { 102 | redisTemplate.opsForValue().set(key, value); 103 | return true; 104 | } catch (Exception e) { 105 | return false; 106 | } 107 | } 108 | 109 | /** 110 | * 普通缓存放入并设置时间 111 | * 112 | * @param key 键 113 | * @param value 值 114 | * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期 115 | * @return true成功 false 失败 116 | */ 117 | public boolean set(String key, Object value, long time) { 118 | try { 119 | if (time > 0) { 120 | redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); 121 | } else { 122 | set(key, value); 123 | } 124 | return true; 125 | } catch (Exception e) { 126 | return false; 127 | } 128 | } 129 | 130 | } 131 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/entity/MerchantsInfo.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.*; 4 | 5 | 6 | import java.math.BigDecimal; 7 | 8 | import com.rfrongfei.onehammer.base.entity.Audit; 9 | import com.rfrongfei.onehammer.base.entity.UserInfo; 10 | import lombok.*; 11 | 12 | /** 13 | * 商家信息 14 | * 15 | * @author Jxlsx 16 | * @email iamlive@aliyun.com 17 | * @date 2019-12-23 15:43:16 18 | */ 19 | @Data 20 | @ToString 21 | @Builder 22 | @AllArgsConstructor 23 | @NoArgsConstructor 24 | @EqualsAndHashCode(callSuper = true) 25 | @TableName("rf_merchants_info") 26 | @KeySequence(value = "commonIdGenerator",clazz = String.class) 27 | public class MerchantsInfo extends Audit implements UserInfo { 28 | 29 | public static final String ID = "id"; 30 | public static final String AVG_DELIVERY_TIME = "avg_delivery_time"; 31 | public static final String BGPIC = "bgpic"; 32 | public static final String CATEGORY_ID = "category_id"; 33 | public static final String DESCRIPTION = "description"; 34 | public static final String DETAIL = "detail"; 35 | public static final String END = "end"; 36 | public static final String HEAD_PORTRAIT = "head_portrait"; 37 | public static final String HOTLINE = "hotline"; 38 | public static final String LATITUDE = "latitude"; 39 | public static final String LONGITUDE = "longitude"; 40 | public static final String MERCHANTS_ID = "merchants_id"; 41 | public static final String NOTICE = "notice"; 42 | public static final String PASSWORD = "password"; 43 | public static final String PHONE = "phone"; 44 | public static final String REGION_ID = "region_id"; 45 | public static final String START = "start"; 46 | public static final String STORE_NAME = "store_name"; 47 | 48 | /** 49 | * 50 | */ 51 | 52 | @TableId(type = IdType.INPUT) 53 | private String id; 54 | /** 55 | * 平均配送时间 56 | */ 57 | @TableField(value = "avg_delivery_time") 58 | private Integer avgDeliveryTime; 59 | /** 60 | * 商户背景图 61 | */ 62 | @TableField(value = "bgpic") 63 | private String bgpic; 64 | /** 65 | * 商户所属分类 66 | */ 67 | @TableField(value = "category_id") 68 | private String categoryId; 69 | /** 70 | * 商户简介 71 | */ 72 | @TableField(value = "description") 73 | private String description; 74 | /** 75 | * 商户详细地址 76 | */ 77 | @TableField(value = "detail") 78 | private String detail; 79 | /** 80 | * 营业结束时间 81 | */ 82 | @TableField(value = "end") 83 | private String end; 84 | /** 85 | * 商户头像 86 | */ 87 | @TableField(value = "head_portrait") 88 | private String headPortrait; 89 | /** 90 | * 外卖热线 91 | */ 92 | @TableField(value = "hotline") 93 | private String hotline; 94 | /** 95 | * 商户地址纬度 96 | */ 97 | @TableField(value = "latitude") 98 | private BigDecimal latitude; 99 | /** 100 | * 商户地址经度 101 | */ 102 | @TableField(value = "longitude") 103 | private BigDecimal longitude; 104 | /** 105 | * 用户ID 106 | */ 107 | @TableField(value = "merchants_id") 108 | private String merchantsId; 109 | /** 110 | * 商户公告 111 | */ 112 | @TableField(value = "notice") 113 | private String notice; 114 | /** 115 | * 商户密码 116 | */ 117 | @TableField(value = "password") 118 | private String password; 119 | /** 120 | * 商户电话 121 | */ 122 | @TableField(value = "phone") 123 | private String phone; 124 | /** 125 | * 商户区域 126 | */ 127 | @TableField(value = "region_id") 128 | private String regionId; 129 | /** 130 | * 营业开始时间 131 | */ 132 | @TableField(value = "start") 133 | private String start; 134 | /** 135 | * 商户店名 136 | */ 137 | @TableField(value = "store_name") 138 | private String storeName; 139 | 140 | @Override 141 | public void setUserId(String userId) { 142 | this.setMerchantsId(userId); 143 | } 144 | 145 | @Override 146 | public String getUserId() { 147 | return this.getMerchantsId(); 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/util/JwtTokenHelper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.util; 2 | 3 | import com.rfrongfei.onehammer.base.exception.OnehammerException; 4 | import com.rfrongfei.onehammer.base.properties.TokenProperties; 5 | import io.jsonwebtoken.Claims; 6 | import io.jsonwebtoken.JwtBuilder; 7 | import io.jsonwebtoken.Jwts; 8 | import io.jsonwebtoken.SignatureAlgorithm; 9 | 10 | import java.io.InputStream; 11 | import java.security.KeyStore; 12 | import java.security.PrivateKey; 13 | import java.security.PublicKey; 14 | import java.sql.Timestamp; 15 | import java.util.Date; 16 | import java.util.HashMap; 17 | 18 | /** 19 | * @description: jwt生成token 20 | */ 21 | public class JwtTokenHelper { 22 | 23 | public static TokenProperties tokenProperties; 24 | 25 | // 寻找证书文件 26 | private static InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("jwt.jks"); // 寻找证书文件 27 | private static PrivateKey privateKey = null; 28 | private static PublicKey publicKey = null; 29 | 30 | static { // 将证书文件里边的私钥公钥拿出来 31 | tokenProperties = SpringContextHelper.getBean(TokenProperties.class); 32 | try { 33 | KeyStore keyStore = KeyStore.getInstance("JKS"); // java key store 固定常量 34 | keyStore.load(inputStream, "123456".toCharArray()); 35 | privateKey = (PrivateKey) keyStore.getKey("jwt", "123456".toCharArray()); // jwt 为 命令生成整数文件时的别名 36 | publicKey = keyStore.getCertificate("jwt").getPublicKey(); 37 | } catch (Exception e) { 38 | throw new OnehammerException(JwtTokenHelper.class,"static init","初始化JWT证书文件失败"); 39 | } 40 | } 41 | 42 | /** 43 | * 生成token 44 | * @param userId (主体信息) 45 | * @param claims 自定义身份信息 46 | * @return String 47 | */ 48 | public static String generate(String userId, Integer userTpye) { 49 | // 生成JWT的时间 50 | long nowMillis = System.currentTimeMillis(); 51 | Date now = new Date(nowMillis); 52 | final HashMap claims = new HashMap<>(); 53 | claims.put("userType",userTpye); 54 | // 下面就是在为payload添加各种标准声明和私有声明了 55 | JwtBuilder builder = Jwts.builder() // 这里其实就是new一个JwtBuilder,设置jwt的body 56 | .setClaims(claims) // 如果有私有声明,一定要先设置这个自己创建的私有的声明,这个是给builder的claim赋值,一旦写在标准的声明赋值之后,就是覆盖了那些标准的声明的 57 | .setId(Constant.JWT_ID) // 设置jti(JWT ID):是JWT的唯一标识,根据业务需要,这个可以设置为一个不重复的值,主要用来作为一次性token,从而回避重放攻击。 58 | .setIssuedAt(now) // iat: jwt的签发时间 59 | .setIssuer("www.rfrongfei.com") // issuer:jwt签发人 60 | .setSubject(userId) // sub(Subject):代表这个JWT的主体,即它的所有人,这个是一个json格式的字符串,可以存放什么userid,roldid之类的,作为什么用户的唯一标志。 61 | .signWith(SignatureAlgorithm.HS256, privateKey); // 设置签名使用的签名算法和签名使用的秘钥 62 | // 设置过期时间 63 | if (tokenProperties.getExpire() >= 0) { 64 | long expMillis = nowMillis + tokenProperties.getExpire()*24000*3600; // 15天过期 65 | Date exp = new Date(expMillis); 66 | builder.setExpiration(exp); 67 | } 68 | return builder.compact(); 69 | } 70 | 71 | // 是否已过期 72 | public static boolean isExpiration(String expirationTime){ 73 | return DateUtil.compareDate(DateUtil.getTime(), expirationTime); 74 | } 75 | 76 | public static String getUserId(String token){ 77 | final Claims tokenBody = getTokenBody(token); 78 | return tokenBody.getSubject(); 79 | } 80 | 81 | public static Integer getUserType(String token){ 82 | final Claims tokenBody = getTokenBody(token); 83 | return Integer.parseInt(tokenBody.get("userType").toString()); 84 | } 85 | 86 | public static String flush(String token){ 87 | final Claims tokenBody = getTokenBody(token); 88 | final String expirationTime = new Timestamp(tokenBody.getExpiration().getTime()).toString(); 89 | if (isExpiration(expirationTime)) { 90 | return generate(getUserId(token),getUserType(token)); 91 | } 92 | return token; 93 | } 94 | 95 | private static Claims getTokenBody(String token){ 96 | return Jwts.parser() 97 | .setSigningKey(publicKey) 98 | .parseClaimsJws(token) 99 | .getBody(); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/util/DateUtil.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.util; 2 | 3 | import java.text.DateFormat; 4 | import java.text.ParseException; 5 | import java.text.SimpleDateFormat; 6 | import java.util.Date; 7 | import java.util.GregorianCalendar; 8 | 9 | /** 10 | * @description: 时间工具类 11 | */ 12 | public class DateUtil { 13 | 14 | private final static SimpleDateFormat sdfTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 15 | private final static SimpleDateFormat simpleTime = new SimpleDateFormat("yyyy-MM-dd"); 16 | 17 | /** 18 | * 获取当前时间的YYYY-MM-DD HH:mm:ss格式 19 | * 20 | * @return 21 | */ 22 | public static String getTime() { 23 | return sdfTime.format(new Date()); 24 | } 25 | 26 | /** 27 | * 获取年月日格式的日期 2019-10-11 28 | * 29 | * @return : {@link String} 30 | */ 31 | public static String getSimpleTime() { 32 | return simpleTime.format(new Date()); 33 | } 34 | 35 | public static String getSimpleTime(Date time) { 36 | return simpleTime.format(time); 37 | } 38 | 39 | public static Date time() { 40 | return getTime(getTime()); 41 | } 42 | 43 | 44 | /** 45 | * 获取当前时间的YYYY-MM-DD HH:mm:ss格式 46 | * 47 | * @return 48 | */ 49 | public static Date getTime(String dateStr) { 50 | try { 51 | return sdfTime.parse(dateStr); 52 | } catch (ParseException e) { 53 | e.printStackTrace(); 54 | } 55 | throw new RuntimeException("获取yyyy-MM-dd HH:mm:ss格式时间失败"); 56 | } 57 | 58 | /** 59 | * 日期比较,如果s>=e 返回true 否则返回false 60 | * 61 | * @param s 62 | * @param e 63 | * @return 64 | */ 65 | public static boolean compareDate(String s, String e) { 66 | if (fomatDate(s) == null || fomatDate(e) == null) { 67 | return false; 68 | } 69 | return s.compareTo(e) > 0; 70 | } 71 | 72 | /** 73 | * 格式化日期 74 | * 75 | * @param date 76 | * @return 77 | */ 78 | public static Date fomatDate(String date) { 79 | DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); 80 | try { 81 | return fmt.parse(date); 82 | } catch (ParseException e) { 83 | e.printStackTrace(); 84 | return null; 85 | } 86 | } 87 | 88 | /** 89 | * 获取当前时间的后i天 90 | * 91 | * @param i 92 | * @return 93 | */ 94 | public static String getAddDay(int i) { 95 | String currentTime = DateUtil.getTime(); 96 | GregorianCalendar gCal = new GregorianCalendar( 97 | Integer.parseInt(currentTime.substring(0, 4)), 98 | Integer.parseInt(currentTime.substring(5, 7)) - 1, 99 | Integer.parseInt(currentTime.substring(8, 10))); 100 | gCal.add(GregorianCalendar.DATE, i); 101 | return simpleTime.format(gCal.getTime()); 102 | } 103 | 104 | /** 105 | * 获取当前时间的后i天 106 | * 精确到秒 107 | * 108 | * @param i 109 | * @return 110 | */ 111 | public static String getAddDayTime(int i) { 112 | Date date = new Date(System.currentTimeMillis() + i * 24 * 60 * 60 * 1000); 113 | return sdfTime.format(date); 114 | } 115 | 116 | /** 117 | * 获取当前时间的+多少秒 118 | * 精确到秒 119 | * 120 | * @param i 121 | * @return 122 | */ 123 | public static String getAddDaySecond(int i) { 124 | Date date = new Date(System.currentTimeMillis() + i * 1000); 125 | return sdfTime.format(date); 126 | } 127 | 128 | /** 129 | * 获取两个时间之间有多少天 130 | * 131 | * @param strTime1 : 132 | * @param strTime2 : 133 | * @return : {@link Date} 134 | */ 135 | public static Integer timeDiff(String strTime1, String strTime2) { 136 | //格式日期格式,在此我用的是"2018-01-24 19:49:50"这种格式 137 | //可以更改为自己使用的格式,例如:yyyy/MM/dd HH:mm:ss 。。。 138 | try { 139 | Date now = sdfTime.parse(strTime1); 140 | Date date = sdfTime.parse(strTime2); 141 | long l = now.getTime() - date.getTime(); //获取时间差 142 | return Math.toIntExact(l / (24 * 60 * 60 * 1000)); 143 | } catch (Exception e) { 144 | throw new RuntimeException("获取时间差值失败"); 145 | } 146 | } 147 | 148 | public static Integer timeDiff(String[] strs) { 149 | return timeDiff(strs[0],strs[1]); 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/user/service/impl/ConsumerInfoServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.user.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.google.common.collect.ImmutableMap; 6 | import com.rfrongfei.onehammer.base.entity.UserInfo; 7 | import com.rfrongfei.onehammer.base.exception.OnehammerException; 8 | import com.rfrongfei.onehammer.base.key.IdGenerator; 9 | import com.rfrongfei.onehammer.base.util.BeanHelper; 10 | import com.rfrongfei.onehammer.base.util.EntityHelper; 11 | import com.rfrongfei.onehammer.common.input.UserInput; 12 | import com.rfrongfei.onehammer.common.service.IUserInfoService; 13 | import com.rfrongfei.onehammer.common.vo.UserInfoVO; 14 | import com.rfrongfei.onehammer.user.mapper.ConsumerInfoMapper; 15 | import com.rfrongfei.onehammer.user.entity.ConsumerInfo; 16 | import com.rfrongfei.onehammer.user.service.IConsumerInfoService; 17 | import lombok.extern.slf4j.Slf4j; 18 | import org.springframework.stereotype.Service; 19 | 20 | @Service("0") 21 | @Slf4j 22 | public class ConsumerInfoServiceImpl extends ServiceImpl 23 | implements IConsumerInfoService, IUserInfoService { 24 | @Override 25 | public UserInfoVO phoneLogin(UserInput userInput) { 26 | ConsumerInfo consumerInfo = BeanHelper.create(userInput, ConsumerInfo.class); 27 | consumerInfo = getOne(EntityHelper.query(consumerInfo), true); 28 | if (consumerInfo == null) { 29 | consumerInfo = BeanHelper.create(userInput, ConsumerInfo.class); 30 | consumerInfo.setConsumerId(IdGenerator.nextUserId(userInput.getUserType())); 31 | consumerInfo.setAccount(IdGenerator.account(userInput.getPhone())); 32 | if (!save(consumerInfo)) { 33 | throw new OnehammerException(this.getClass(),"phoneLogin","保存用户信息失败",consumerInfo); 34 | } 35 | } 36 | return UserInfoVO.builder().userInfo(consumerInfo).build(); 37 | } 38 | 39 | @Override 40 | public UserInfo getUserInfoPhone(String phone) { 41 | ConsumerInfo consumerInfo = new ConsumerInfo(); 42 | consumerInfo.setPhone(phone); 43 | return getOne(EntityHelper.query(consumerInfo),true); 44 | } 45 | 46 | @Override 47 | public UserInfo getUserInfoUserId(String userId) { 48 | ConsumerInfo consumerInfo = new ConsumerInfo(); 49 | consumerInfo.setConsumerId(userId); 50 | return getOne(EntityHelper.query(consumerInfo),true); 51 | } 52 | 53 | @Override 54 | public void updateUser(UserInfo userInfo) { 55 | ConsumerInfo consumerInfo = (ConsumerInfo) userInfo; 56 | if (consumerInfo.getId() != null) { 57 | if (!updateById(consumerInfo)) { 58 | throw new OnehammerException(this.getClass(),"updateUser","更新用户信息失败",userInfo); 59 | } 60 | }else{ 61 | UpdateWrapper infoUpdateWrapper = EntityHelper.update(ConsumerInfo.class, ImmutableMap.of( 62 | ConsumerInfo.CONSUMER_ID, consumerInfo.getConsumerId(), 63 | ConsumerInfo.PHONE, consumerInfo.getPhone() 64 | )); 65 | if (!update(consumerInfo, infoUpdateWrapper)) { 66 | throw new OnehammerException(this.getClass(),"updateUser","更新用户信息失败",userInfo); 67 | } 68 | } 69 | log.info("更新:table:['{}'],params:[{}]",EntityHelper.tableName(consumerInfo),consumerInfo); 70 | } 71 | 72 | @Override 73 | public void deleteUser(UserInfo userInfo) { 74 | ConsumerInfo consumerInfo = (ConsumerInfo) userInfo; 75 | if (consumerInfo.getId() != null) { 76 | if (!removeById(consumerInfo.getId())) { 77 | throw new OnehammerException(this.getClass(),"updateUser","删除用户信息失败",userInfo); 78 | } 79 | }else{ 80 | UpdateWrapper infoUpdateWrapper = EntityHelper.update(ConsumerInfo.class, ImmutableMap.of( 81 | ConsumerInfo.CONSUMER_ID, consumerInfo.getConsumerId(), 82 | ConsumerInfo.PHONE, consumerInfo.getPhone() 83 | )); 84 | if (!remove(infoUpdateWrapper)) { 85 | throw new OnehammerException(this.getClass(),"updateUser","删除用户信息失败",userInfo); 86 | } 87 | } 88 | log.info("删除:table:['{}'],params:[{}]",EntityHelper.tableName(consumerInfo),consumerInfo); 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/merchants/service/impl/MerchantsInfoServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.merchants.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.google.common.collect.ImmutableMap; 6 | import com.rfrongfei.onehammer.base.entity.UserInfo; 7 | import com.rfrongfei.onehammer.base.exception.OnehammerException; 8 | import com.rfrongfei.onehammer.base.key.IdGenerator; 9 | import com.rfrongfei.onehammer.base.util.BeanHelper; 10 | import com.rfrongfei.onehammer.base.util.EntityHelper; 11 | import com.rfrongfei.onehammer.common.input.UserInput; 12 | import com.rfrongfei.onehammer.common.service.IUserInfoService; 13 | import com.rfrongfei.onehammer.common.vo.UserInfoVO; 14 | import com.rfrongfei.onehammer.merchants.mapper.MerchantsInfoMapper; 15 | import com.rfrongfei.onehammer.merchants.entity.MerchantsInfo; 16 | import com.rfrongfei.onehammer.merchants.service.IMerchantsInfoService; 17 | import lombok.extern.slf4j.Slf4j; 18 | import org.springframework.stereotype.Service; 19 | 20 | @Service("1") 21 | @Slf4j 22 | public class MerchantsInfoServiceImpl extends ServiceImpl 23 | implements IMerchantsInfoService, IUserInfoService { 24 | @Override 25 | public UserInfoVO phoneLogin(UserInput userInput) { 26 | MerchantsInfo merchantsInfo = BeanHelper.create(userInput, MerchantsInfo.class); 27 | merchantsInfo = getOne(EntityHelper.query(merchantsInfo), true); 28 | if (merchantsInfo == null) { 29 | merchantsInfo = BeanHelper.create(userInput, MerchantsInfo.class); 30 | merchantsInfo.setMerchantsId(IdGenerator.nextUserId(userInput.getUserType())); 31 | if (!save(merchantsInfo)) { 32 | throw new OnehammerException(this.getClass(),"phoneLogin","保存用户信息失败",merchantsInfo); 33 | } 34 | } 35 | return UserInfoVO.builder().userInfo(merchantsInfo).build(); 36 | } 37 | 38 | @Override 39 | public UserInfo getUserInfoPhone(String phone) { 40 | MerchantsInfo merchantsInfo = new MerchantsInfo(); 41 | merchantsInfo.setPhone(phone); 42 | return getOne(EntityHelper.query(merchantsInfo),true); 43 | } 44 | 45 | @Override 46 | public UserInfo getUserInfoUserId(String userId) { 47 | MerchantsInfo merchantsInfo = new MerchantsInfo(); 48 | merchantsInfo.setMerchantsId(userId); 49 | return getOne(EntityHelper.query(merchantsInfo),true); 50 | } 51 | 52 | @Override 53 | public void updateUser(UserInfo userInfo) { 54 | MerchantsInfo merchantsInfo = (MerchantsInfo) userInfo; 55 | if (merchantsInfo.getId() != null) { 56 | if (!updateById(merchantsInfo)) { 57 | throw new OnehammerException(this.getClass(),"updateUser","更新用户信息失败",userInfo); 58 | } 59 | }else{ 60 | UpdateWrapper infoUpdateWrapper = EntityHelper.update(MerchantsInfo.class, ImmutableMap.of( 61 | MerchantsInfo.MERCHANTS_ID, merchantsInfo.getMerchantsId(), 62 | MerchantsInfo.PHONE, merchantsInfo.getPhone() 63 | )); 64 | if (!update(merchantsInfo, infoUpdateWrapper)) { 65 | throw new OnehammerException(this.getClass(),"updateUser","更新用户信息失败",userInfo); 66 | } 67 | } 68 | log.info("更新:table:['{}'],params:[{}]",EntityHelper.tableName(merchantsInfo),merchantsInfo); 69 | } 70 | 71 | @Override 72 | public void deleteUser(UserInfo userInfo) { 73 | MerchantsInfo merchantsInfo = (MerchantsInfo) userInfo; 74 | if (merchantsInfo.getId() != null) { 75 | if (!removeById(merchantsInfo.getId())) { 76 | throw new OnehammerException(this.getClass(),"updateUser","删除用户信息失败",userInfo); 77 | } 78 | }else{ 79 | UpdateWrapper infoUpdateWrapper = EntityHelper.update(MerchantsInfo.class, ImmutableMap.of( 80 | MerchantsInfo.MERCHANTS_ID, merchantsInfo.getMerchantsId(), 81 | MerchantsInfo.PHONE, merchantsInfo.getPhone() 82 | )); 83 | if (!remove(infoUpdateWrapper)) { 84 | throw new OnehammerException(this.getClass(),"updateUser","删除用户信息失败",userInfo); 85 | } 86 | } 87 | log.info("删除:table:['{}'],params:[{}]",EntityHelper.tableName(merchantsInfo),merchantsInfo); 88 | } 89 | 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/deliveryman/service/impl/DeliverymanInfoServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.deliveryman.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.google.common.collect.ImmutableMap; 6 | import com.rfrongfei.onehammer.base.entity.UserInfo; 7 | import com.rfrongfei.onehammer.base.exception.OnehammerException; 8 | import com.rfrongfei.onehammer.base.key.IdGenerator; 9 | import com.rfrongfei.onehammer.base.util.BeanHelper; 10 | import com.rfrongfei.onehammer.base.util.EntityHelper; 11 | import com.rfrongfei.onehammer.common.input.UserInput; 12 | import com.rfrongfei.onehammer.common.service.IUserInfoService; 13 | import com.rfrongfei.onehammer.common.vo.UserInfoVO; 14 | import com.rfrongfei.onehammer.deliveryman.mapper.DeliverymanInfoMapper; 15 | import com.rfrongfei.onehammer.deliveryman.entity.DeliverymanInfo; 16 | import com.rfrongfei.onehammer.deliveryman.service.IDeliverymanInfoService; 17 | import lombok.extern.slf4j.Slf4j; 18 | import org.springframework.stereotype.Service; 19 | 20 | @Service("2") 21 | @Slf4j 22 | public class DeliverymanInfoServiceImpl extends ServiceImpl 23 | implements IDeliverymanInfoService, IUserInfoService { 24 | @Override 25 | public UserInfoVO phoneLogin(UserInput userInput) { 26 | DeliverymanInfo deliverymanInfo = BeanHelper.create(userInput, DeliverymanInfo.class); 27 | deliverymanInfo = getOne(EntityHelper.query(deliverymanInfo), true); 28 | if (deliverymanInfo == null) { 29 | deliverymanInfo = BeanHelper.create(userInput, DeliverymanInfo.class); 30 | deliverymanInfo.setDeliverymanId(IdGenerator.nextUserId(userInput.getUserType())); 31 | if (!save(deliverymanInfo)) { 32 | throw new OnehammerException(this.getClass(), "phoneLogin", "保存用户信息失败", deliverymanInfo); 33 | } 34 | } 35 | return UserInfoVO.builder().userInfo(deliverymanInfo).build(); 36 | } 37 | 38 | @Override 39 | public UserInfo getUserInfoPhone(String phone) { 40 | DeliverymanInfo deliverymanInfo = new DeliverymanInfo(); 41 | deliverymanInfo.setPhone(phone); 42 | return getOne(EntityHelper.query(deliverymanInfo),true); 43 | } 44 | 45 | @Override 46 | public UserInfo getUserInfoUserId(String userId) { 47 | DeliverymanInfo deliverymanInfo = new DeliverymanInfo(); 48 | deliverymanInfo.setDeliverymanId(userId); 49 | return getOne(EntityHelper.query(deliverymanInfo),true); 50 | } 51 | 52 | @Override 53 | public void updateUser(UserInfo userInfo) { 54 | DeliverymanInfo deliverymanInfo = (DeliverymanInfo) userInfo; 55 | if (deliverymanInfo.getId() != null) { 56 | if (!updateById(deliverymanInfo)) { 57 | throw new OnehammerException(this.getClass(),"updateUser","更新用户信息失败",userInfo); 58 | } 59 | }else{ 60 | UpdateWrapper infoUpdateWrapper = EntityHelper.update(DeliverymanInfo.class, ImmutableMap.of( 61 | DeliverymanInfo.DELIVERYMAN_ID, deliverymanInfo.getDeliverymanId(), 62 | DeliverymanInfo.PHONE, deliverymanInfo.getPhone() 63 | )); 64 | if (!update(deliverymanInfo, infoUpdateWrapper)) { 65 | throw new OnehammerException(this.getClass(),"updateUser","更新用户信息失败",userInfo); 66 | } 67 | } 68 | log.info("更新:table:['{}'],params:[{}]",EntityHelper.tableName(deliverymanInfo),deliverymanInfo); 69 | } 70 | 71 | @Override 72 | public void deleteUser(UserInfo userInfo) { 73 | DeliverymanInfo deliverymanInfo = (DeliverymanInfo) userInfo; 74 | if (deliverymanInfo.getId() != null) { 75 | if (!removeById(deliverymanInfo.getId())) { 76 | throw new OnehammerException(this.getClass(),"updateUser","删除用户信息失败",userInfo); 77 | } 78 | }else{ 79 | UpdateWrapper infoUpdateWrapper = EntityHelper.update(DeliverymanInfo.class, ImmutableMap.of( 80 | DeliverymanInfo.DELIVERYMAN_ID, deliverymanInfo.getDeliverymanId(), 81 | DeliverymanInfo.PHONE, deliverymanInfo.getPhone() 82 | )); 83 | if (!remove(infoUpdateWrapper)) { 84 | throw new OnehammerException(this.getClass(),"updateUser","删除用户信息失败",userInfo); 85 | } 86 | } 87 | log.info("删除:table:['{}'],params:[{}]",EntityHelper.tableName(deliverymanInfo),deliverymanInfo); 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/util/EntityHelper.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.util; 2 | 3 | import cn.hutool.core.collection.CollUtil; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 6 | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; 7 | import com.rfrongfei.onehammer.base.entity.Audit; 8 | import com.rfrongfei.onehammer.base.exception.OnehammerException; 9 | import lombok.Data; 10 | import lombok.extern.slf4j.Slf4j; 11 | 12 | import java.lang.reflect.Field; 13 | import java.util.*; 14 | import java.util.stream.Collectors; 15 | 16 | /** 17 | * @ClassName EntityUtil 18 | * @Author Jxlsx 19 | * @Date 2019/12/17 下午4:48 20 | * @Version 1.0 21 | */ 22 | @Slf4j 23 | public class EntityHelper { 24 | 25 | 26 | /** 27 | * 根据实体创建query对象 28 | * 29 | * @param entity : 30 | * @return : {@link QueryWrapper} 31 | */ 32 | public static QueryWrapper query(T entity) { 33 | QueryWrapper queryWrapper = new QueryWrapper(); 34 | nonNullColumn(entity).parallelStream() 35 | .forEach(column -> { 36 | queryWrapper.eq(StringHelper.toHump(column.getName()), column.getValue()); 37 | }); 38 | return queryWrapper; 39 | } 40 | 41 | /** 42 | * 根据实体创建update 对象 43 | * 44 | * @param entity : 45 | * @return : {@link UpdateWrapper} 46 | */ 47 | public static UpdateWrapper update(T entity, List excludeColumns) { 48 | UpdateWrapper updateWrapper = new UpdateWrapper(); 49 | nonNullColumn(entity).parallelStream() 50 | .forEach(column -> { 51 | updateWrapper.eq(StringHelper.toHump(column.getName()), column.getValue()); 52 | }); 53 | return updateWrapper; 54 | } 55 | 56 | public static UpdateWrapper update(Class clazz, Map columns) { 57 | UpdateWrapper updateWrapper = new UpdateWrapper(); 58 | if (columns.size() == 0) { 59 | throw new OnehammerException(EntityHelper.class, "update", "构造更新条件失败", columns); 60 | } 61 | columns.forEach((name, value) -> { 62 | String columnName = !name.contains("_") ? name : StringHelper.toHump(name); 63 | updateWrapper.eq(columnName, value); 64 | }); 65 | return updateWrapper; 66 | } 67 | 68 | /** 69 | * 获取表名 70 | * @param entity : 71 | * @return : {@link String} 72 | */ 73 | public static String tableName(T entity) { 74 | return tableName(entity.getClass()); 75 | } 76 | 77 | /** 78 | * 获取表名 79 | * @param clazz 80 | * @return : {@link String} 81 | */ 82 | public static String tableName(Class clazz) { 83 | if (clazz.isAnnotationPresent(TableName.class)) { 84 | return clazz.getAnnotation(TableName.class).value(); 85 | } 86 | log.info("实体没有@TableName注解:{}",clazz.getName()); 87 | return null; 88 | } 89 | 90 | 91 | /** 92 | * 获取实体值不为null的列 93 | * 94 | * @param entity : 95 | * @return : {@link List} 96 | */ 97 | public static List nonNullColumn(T entity) { 98 | return column(entity).parallelStream() 99 | .filter(Objects::nonNull) 100 | .filter(column -> "".equals(column.getValue())) 101 | .filter(column -> "null".equals(column.getValue())) 102 | .filter(column -> column.getValue() != null) 103 | .collect(Collectors.toList()); 104 | } 105 | 106 | public static boolean isNull(T entity) { 107 | final List column = column(entity); 108 | return CollUtil.isNotEmpty(column); 109 | } 110 | 111 | /** 112 | * 获取参数实体的列信息 113 | * 114 | * @param entity : 115 | * @return : {@link List} 116 | */ 117 | public static List column(T entity) { 118 | final Class entityClass = entity.getClass(); 119 | final Field[] declaredFields = entityClass.getDeclaredFields(); 120 | return Arrays.asList(declaredFields).parallelStream() 121 | .map(field -> { 122 | final Column column = new Column(); 123 | field.setAccessible(true); 124 | try { 125 | final Object value; 126 | value = field.get(entity); 127 | column.setValue(value); 128 | final String name = field.getName(); 129 | column.setName(name); 130 | } catch (IllegalAccessException e) { 131 | throw new OnehammerException(EntityHelper.class, "column", "获取实体列信息失败!", entity); 132 | } 133 | return column; 134 | }).collect(Collectors.toList()); 135 | } 136 | 137 | @Data 138 | static class Column { 139 | /** 140 | * 列名 141 | */ 142 | private String name; 143 | /** 144 | * 列值 145 | */ 146 | private Object value; 147 | } 148 | 149 | } 150 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/common/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.common.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | 5 | import com.rfrongfei.onehammer.base.entity.UserInfo; 6 | import com.rfrongfei.onehammer.base.exception.OnehammerException; 7 | import com.rfrongfei.onehammer.base.util.*; 8 | import com.rfrongfei.onehammer.common.enums.LoginStatus; 9 | import com.rfrongfei.onehammer.common.input.UserInput; 10 | import com.rfrongfei.onehammer.common.mapper.UserMapper; 11 | import com.rfrongfei.onehammer.common.entity.User; 12 | import com.rfrongfei.onehammer.common.service.IUserService; 13 | import com.rfrongfei.onehammer.common.service.UserInfoServiceHolder; 14 | import com.rfrongfei.onehammer.common.vo.InfoVO; 15 | import com.rfrongfei.onehammer.common.vo.UserInfoVO; 16 | import lombok.AllArgsConstructor; 17 | import lombok.extern.slf4j.Slf4j; 18 | import org.apache.commons.lang3.StringUtils; 19 | import org.springframework.stereotype.Service; 20 | 21 | 22 | @Service 23 | @AllArgsConstructor 24 | @Slf4j 25 | public class UserServiceImpl extends ServiceImpl implements IUserService { 26 | 27 | private final UserInfoServiceHolder userInfoServiceHolder; 28 | 29 | private final SmsCodeService smsCodeService; 30 | 31 | @Override 32 | public User loginStatus(String userId) { 33 | User user = new User(); 34 | user.setUserId(userId); 35 | user = getOne(EntityHelper.query(user), true); 36 | String accessToken = user.getAccessToken(); 37 | user.setAccessToken(JwtTokenHelper.flush(accessToken)); 38 | return user; 39 | } 40 | 41 | @Override 42 | public String smsCode(String phone, Integer userType) { 43 | String smsCode = smsCodeService.getSmsCode(phone, userType); 44 | if (smsCode != null) { 45 | if (!smsCodeService.sendSmsCode(phone,smsCode)) { 46 | throw new OnehammerException(this.getClass(),"smsCode","发送验证码失败!",phone,userType); 47 | } 48 | } 49 | smsCode = smsCodeService.getMsgCode(); 50 | if (smsCodeService.sendSmsCode(phone,smsCode)) { 51 | if (!smsCodeService.setSmsCode(phone,userType,smsCode)) { 52 | throw new OnehammerException(this.getClass(),"smsCode","发送验证码失败!",phone,userType); 53 | } 54 | } 55 | return smsCode; 56 | } 57 | 58 | @Override 59 | public User login(UserInput userInput) { 60 | String smsCode = smsCodeService.getSmsCode(userInput.getPhone(), userInput.getUserType()); 61 | if (smsCode == null) { 62 | throw new OnehammerException(this.getClass(), "login", "验证码不存在", userInput); 63 | } 64 | if (!StringUtils.equalsIgnoreCase(smsCode, userInput.getSmsCode())) { 65 | throw new OnehammerException(this.getClass(), "login", "验证码错误", userInput); 66 | } 67 | userInfoServiceHolder.setUserType(userInput.getUserType()); 68 | UserInfoVO userInfoVO = userInfoServiceHolder.login(userInput); 69 | User user = new User(); 70 | String userId = userInfoVO.getUserInfo().getUserId(); 71 | user.setUserId(userId); 72 | String token = JwtTokenHelper.generate(userId, userInput.getUserType()); 73 | user.setAccessToken(token); 74 | user.setUserType(userInput.getUserType()); 75 | user.setLoginStatus(LoginStatus.LOGIN.getCode()); 76 | smsCodeService.clearSmsCode(userInput.getPhone(), userInput.getUserType()); 77 | return user; 78 | } 79 | 80 | @Override 81 | public UserInfo getUserInfoUserId(String userId) { 82 | userInfoServiceHolder.setUserType(getUserType(userId)); 83 | return userInfoServiceHolder.getUserInfoUserId(userId); 84 | } 85 | 86 | @Override 87 | public UserInfo getUserInfoPhone(String phone) { 88 | userInfoServiceHolder.setUserType(getUserType(phone)); 89 | return userInfoServiceHolder.getUserInfoPhone(phone); 90 | } 91 | 92 | @Override 93 | public InfoVO updateUser(InfoVO infoVO) { 94 | userInfoServiceHolder.setUserType(getUserType(infoVO)); 95 | userInfoServiceHolder.updateUser(infoVO); 96 | return infoVO; 97 | } 98 | 99 | @Override 100 | public InfoVO deleteUser(InfoVO infoVO) { 101 | userInfoServiceHolder.setUserType(getUserType(infoVO)); 102 | userInfoServiceHolder.deleteUser(infoVO); 103 | return infoVO; 104 | } 105 | 106 | private Integer getUserType(String identifier){ 107 | // 手机号码 108 | if (identifier.length() == 11) { 109 | return getOne(EntityHelper.query(User.builder().phone(identifier).build()),true).getUserType(); 110 | }else{ 111 | return Integer.valueOf(identifier.substring(0,1)); 112 | } 113 | } 114 | 115 | private Integer getUserType(InfoVO infoVO){ 116 | String identifier = null; 117 | if (infoVO.getConsumerInfo() != null) { 118 | identifier = infoVO.getConsumerInfo().getConsumerId(); 119 | } 120 | if (infoVO.getDeliverymanInfo() != null) { 121 | identifier = infoVO.getDeliverymanInfo().getDeliverymanId(); 122 | } 123 | if (infoVO.getMerchantsInfo() != null){ 124 | identifier = infoVO.getMerchantsInfo().getMerchantsId(); 125 | } 126 | if (identifier == null) { 127 | throw new OnehammerException(this.getClass(),"getUserType","获取用户类型失败",infoVO); 128 | } 129 | return getUserType(identifier); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /src/main/java/com/rfrongfei/onehammer/base/util/PkgUtil.java: -------------------------------------------------------------------------------- 1 | package com.rfrongfei.onehammer.base.util; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | 5 | import java.io.File; 6 | import java.io.IOException; 7 | import java.lang.reflect.Field; 8 | import java.lang.reflect.Modifier; 9 | import java.net.JarURLConnection; 10 | import java.net.URL; 11 | import java.net.URLDecoder; 12 | import java.util.Enumeration; 13 | import java.util.LinkedHashSet; 14 | import java.util.Set; 15 | import java.util.jar.JarEntry; 16 | import java.util.jar.JarFile; 17 | 18 | /** 19 | * Created by yihui on 2017/8/19. 20 | */ 21 | @Slf4j 22 | public class PkgUtil { 23 | 24 | 25 | /** 26 | * 扫描包路径下所有的class文件 27 | * 28 | * @param pkg 29 | * @return 30 | */ 31 | public static Set> getClzFromPkg(String pkg) { 32 | Set> classes = new LinkedHashSet<>(); 33 | 34 | String pkgDirName = pkg.replace('.', '/'); 35 | try { 36 | Enumeration urls = PkgUtil.class.getClassLoader().getResources(pkgDirName); 37 | while (urls.hasMoreElements()) { 38 | URL url = urls.nextElement(); 39 | String protocol = url.getProtocol(); 40 | if ("file".equals(protocol)) {// 如果是以文件的形式保存在服务器上 41 | String filePath = URLDecoder.decode(url.getFile(), "UTF-8");// 获取包的物理路径 42 | findClassesByFile(pkg, filePath, classes); 43 | } else if ("jar".equals(protocol)) {// 如果是jar包文件 44 | JarFile jar = ((JarURLConnection) url.openConnection()).getJarFile(); 45 | findClassesByJar(pkg, jar, classes); 46 | } 47 | } 48 | } catch (IOException e) { 49 | e.printStackTrace(); 50 | } 51 | 52 | return classes; 53 | } 54 | 55 | public static void main(String[] args) { 56 | Set> clzFromPkg = getClzFromPkg("com.rfrongfei.onehammer"); 57 | clzFromPkg.parallelStream() 58 | .filter(clazz -> clazz.getName().contains("entity")) 59 | .forEach(clazz->{ 60 | String clazzName = name(clazz.getName()); 61 | StringBuilder souts = new StringBuilder("type " + clazzName + "{"); 62 | Field[] declaredFields = clazz.getDeclaredFields(); 63 | for (Field declaredField : declaredFields) { 64 | boolean aStatic = Modifier.isStatic(declaredField.getModifiers()); 65 | if (!aStatic) { 66 | String fieldName = declaredField.getName(); 67 | souts.append(fieldName).append(":"); 68 | if ("id".equalsIgnoreCase(fieldName)) { 69 | souts.append("ID").append(","); 70 | }else{ 71 | Class type = declaredField.getType(); 72 | souts.append(name(type.getName())).append(","); 73 | } 74 | } 75 | } 76 | String toString = souts.toString(); 77 | String s = toString.substring(0, toString.length() - 1) + "}"; 78 | System.out.println(s); 79 | }); 80 | } 81 | 82 | private static String name(String str){ 83 | return str.substring(str.lastIndexOf(".")+1); 84 | } 85 | 86 | 87 | /** 88 | * 扫描包路径下的所有class文件 89 | * 90 | * @param pkgName 包名 91 | * @param pkgPath 包对应的绝对地址 92 | * @param classes 保存包路径下class的集合 93 | */ 94 | private static void findClassesByFile(String pkgName, String pkgPath, Set> classes) { 95 | File dir = new File(pkgPath); 96 | if (!dir.exists() || !dir.isDirectory()) { 97 | return; 98 | } 99 | 100 | 101 | // 过滤获取目录,or class文件 102 | File[] dirfiles = dir.listFiles(pathname -> pathname.isDirectory() || pathname.getName().endsWith("class")); 103 | 104 | 105 | if (dirfiles == null || dirfiles.length == 0) { 106 | return; 107 | } 108 | 109 | 110 | String className; 111 | Class clz; 112 | for (File f : dirfiles) { 113 | if (f.isDirectory()) { 114 | findClassesByFile(pkgName + "." + f.getName(), 115 | pkgPath + "/" + f.getName(), 116 | classes); 117 | continue; 118 | } 119 | 120 | 121 | // 获取类名,干掉 ".class" 后缀 122 | className = f.getName(); 123 | className = className.substring(0, className.length() - 6); 124 | 125 | // 加载类 126 | clz = loadClass(pkgName + "." + className); 127 | if (clz != null) { 128 | classes.add(clz); 129 | } 130 | } 131 | } 132 | 133 | 134 | /** 135 | * 扫描包路径下的所有class文件 136 | * 137 | * @param pkgName 包名 138 | * @param jar jar文件 139 | * @param classes 保存包路径下class的集合 140 | */ 141 | private static void findClassesByJar(String pkgName, JarFile jar, Set> classes) { 142 | String pkgDir = pkgName.replace(".", "/"); 143 | 144 | 145 | Enumeration entry = jar.entries(); 146 | 147 | JarEntry jarEntry; 148 | String name, className; 149 | Class claze; 150 | while (entry.hasMoreElements()) { 151 | jarEntry = entry.nextElement(); 152 | 153 | name = jarEntry.getName(); 154 | if (name.charAt(0) == '/') { 155 | name = name.substring(1); 156 | } 157 | 158 | 159 | if (jarEntry.isDirectory() || !name.startsWith(pkgDir) || !name.endsWith(".class")) { 160 | // 非指定包路径, 非class文件 161 | continue; 162 | } 163 | 164 | 165 | // 去掉后面的".class", 将路径转为package格式 166 | className = name.substring(0, name.length() - 6); 167 | claze = loadClass(className.replace("/", ".")); 168 | if (claze != null) { 169 | classes.add(claze); 170 | } 171 | } 172 | } 173 | 174 | 175 | private static Class loadClass(String fullClzName) { 176 | try { 177 | return Thread.currentThread().getContextClassLoader().loadClass(fullClzName); 178 | } catch (ClassNotFoundException e) { 179 | log.error("load class error! clz: {}, e:{}", fullClzName, e); 180 | } 181 | return null; 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.1.8.RELEASE 9 | 10 | 11 | com.rfrongfei 12 | onehammer 13 | 0.0.1-SNAPSHOT 14 | onehammer 15 | onehammer project 16 | 17 | 18 | UTF-8 19 | UTF-8 20 | 1.8 21 | 3.4.6 22 | 3.2.0 23 | 8.0.11 24 | 1.1.9 25 | 1.2.36 26 | 0.9.0 27 | 1.3.10 28 | 29 | 30 | 31 | 32 | 33 | org.mybatis.spring.boot 34 | mybatis-spring-boot-starter 35 | 2.1.0 36 | 37 | 38 | 39 | com.baomidou 40 | mybatis-plus-boot-starter 41 | ${mybatisPlus.version} 42 | 43 | 44 | 45 | mysql 46 | mysql-connector-java 47 | ${mysql.connector.version} 48 | 49 | 50 | org.springframework.boot 51 | spring-boot-starter-test 52 | test 53 | 54 | 55 | 56 | 57 | com.alibaba 58 | druid-spring-boot-starter 59 | ${druid.version} 60 | 61 | 62 | 63 | org.projectlombok 64 | lombok 65 | 66 | 67 | 68 | 69 | com.alibaba 70 | fastjson 71 | ${fastjson.version} 72 | 73 | 74 | 75 | com.aliyun 76 | aliyun-java-sdk-core 77 | 4.2.0 78 | 79 | 80 | com.aliyun 81 | aliyun-java-sdk-dysmsapi 82 | 1.1.0 83 | 84 | 85 | com.google.code.gson 86 | gson 87 | 2.8.5 88 | 89 | 90 | org.apache.httpcomponents 91 | httpcore 92 | 4.4.3 93 | 94 | 95 | org.apache.httpcomponents 96 | httpclient 97 | 4.5.1 98 | 99 | 100 | 101 | org.springframework.boot 102 | spring-boot-starter-aop 103 | 104 | 105 | 106 | cn.hutool 107 | hutool-all 108 | 4.5.10 109 | 110 | 111 | 112 | org.springframework.boot 113 | spring-boot-starter-data-redis 114 | 115 | 116 | 117 | 118 | io.jsonwebtoken 119 | jjwt 120 | ${jjwt.version} 121 | 122 | 123 | 124 | 125 | 126 | com.squareup.okhttp3 127 | okhttp 128 | 4.2.2 129 | 130 | 131 | 132 | 133 | commons-lang 134 | commons-lang 135 | 2.6 136 | 137 | 138 | 139 | com.github.binarywang 140 | weixin-java-mp 141 | 2.7.0 142 | 143 | 144 | 145 | cn.springboot 146 | best-pay-sdk 147 | 1.3.1 148 | 149 | 150 | 151 | 152 | com.aliyun.openservices 153 | ons-client 154 | 1.8.4.Final 155 | 156 | 157 | 158 | com.aliyun.oss 159 | aliyun-sdk-oss 160 | 3.8.0 161 | 162 | 163 | org.springframework.boot 164 | spring-boot-starter-web 165 | 166 | 167 | 168 | com.graphql-java-kickstart 169 | graphql-spring-boot-starter 170 | 5.5.0 171 | 172 | 173 | 174 | 175 | com.graphql-java-kickstart 176 | graphiql-spring-boot-starter 177 | 5.5.0 178 | runtime 179 | 180 | 181 | 182 | 183 | com.graphql-java-kickstart 184 | graphql-java-tools 185 | 5.5.0 186 | 187 | 188 | org.jetbrains.kotlin 189 | kotlin-stdlib 190 | ${kotlin.version} 191 | 192 | 193 | 194 | 195 | 196 | 197 | org.springframework.boot 198 | spring-boot-maven-plugin 199 | 200 | 201 | com.github.apiggs 202 | apiggs-maven-plugin 203 | 1.6 204 | 205 | 206 | compile 207 | 208 | apiggs 209 | 210 | 211 | 212 | 213 | 214 | onehammer-docs 215 | 荣飞后台接口文档 216 | 1.0 217 | 218 | 219 | 220 | 221 | 222 | 223 | --------------------------------------------------------------------------------