├── .gitignore ├── LICENSE ├── README.md ├── img ├── 9c0cf17cdc9069d3267153fd0d41f456c4376591.jpg ├── WechatIMG46.png ├── WechatIMG47.png ├── WechatIMG48.png ├── WechatIMG49.png ├── ż¨„».png ├── ԤԼ.png ├── 常见问题.png ├── 提交订单.png ├── 订单-已完成.png ├── 订单筛选页面.png ├── 订单详情.png ├── 门店详情.png └── 首页.png ├── pom.xml ├── sql └── trigger.sql └── src └── main ├── java └── com │ └── geekuniverse │ └── cac │ ├── Application.java │ ├── common │ ├── bean │ │ └── wxpay │ │ │ └── PayInfoDto.java │ ├── constants │ │ ├── Constants.java │ │ ├── DBTypeConstants.java │ │ ├── ErrCode.java │ │ ├── FastDataConstants.java │ │ └── RedisConstants.java │ ├── enums │ │ ├── FastDataCodeEnum.java │ │ └── SystemError.java │ └── utils │ │ ├── DateUtil.java │ │ ├── KeyUtil.java │ │ ├── NetworkUtil.java │ │ └── TokenUtil.java │ ├── config │ ├── CodeDataListner.java │ ├── CorsConfig.java │ ├── Knife4jConfig.java │ ├── MyWxPayProperties.java │ ├── MybatisPlusConfig.java │ ├── RedissonConfig.java │ ├── WhiteListConfig.java │ ├── WxMaConfiguration.java │ ├── WxPayConfiguration.java │ ├── WxProperties.java │ └── apiversion │ │ ├── ApiRequestMappingHandlerMapping.java │ │ ├── ApiVersionCondition.java │ │ └── WebMvcRegistrationsConfig.java │ ├── controller │ ├── BalanceController.java │ ├── DeviceController.java │ ├── FaviconController.java │ ├── IncomeRecordController.java │ ├── LabelController.java │ ├── OrderController.java │ ├── RechargeRecordController.java │ ├── StoreBoxController.java │ ├── StoreBoxLabelController.java │ ├── StoreController.java │ ├── UserAdminController.java │ ├── UserController.java │ ├── VipSetupController.java │ └── WithdrawalApplicationController.java │ ├── core │ ├── annotation │ │ └── ApiVersion.java │ ├── exception │ │ ├── BusinessException.java │ │ ├── GlobalExceptionHandler.java │ │ └── MainsiteErrorController.java │ ├── filter │ │ └── AuthFilter.java │ ├── model │ │ └── TokenUser.java │ ├── req │ │ └── PageReq.java │ ├── result │ │ └── Result.java │ └── support │ │ └── BaseController.java │ ├── dto │ ├── AdminStoreDTO.java │ ├── LabelDTO.java │ ├── OrderDetailDTO.java │ ├── OrderListDTO.java │ ├── Outfall.java │ ├── StoreBoxDTO.java │ ├── StoreDTO.java │ ├── StoreDetailDTO.java │ ├── UsagePeriodDTO.java │ ├── UserAdminDTO.java │ ├── UserListAdminDTO.java │ └── WithdrawalApplicationDTO.java │ ├── entity │ ├── Balance.java │ ├── IncomeRecord.java │ ├── Label.java │ ├── Order.java │ ├── RechargeRecord.java │ ├── Store.java │ ├── StoreBox.java │ ├── StoreBoxLabel.java │ ├── UserAdmin.java │ ├── UserWechat.java │ ├── VipSetup.java │ └── WithdrawalApplication.java │ ├── generator │ └── AutoGenerator.java │ ├── mapper │ ├── BalanceMapper.java │ ├── IncomeRecordMapper.java │ ├── LabelMapper.java │ ├── OrderMapper.java │ ├── RechargeRecordMapper.java │ ├── StoreBoxLabelMapper.java │ ├── StoreBoxMapper.java │ ├── StoreMapper.java │ ├── UserAdminMapper.java │ ├── UserWechatMapper.java │ ├── VipSetupMapper.java │ └── WithdrawalApplicationMapper.java │ ├── req │ ├── AdminLoginReq.java │ ├── OrderListReq.java │ ├── OrderReq.java │ ├── PayVipReq.java │ ├── StoreAddReq.java │ ├── StoreBoxAddReq.java │ ├── StoreReq.java │ ├── UserEditReq.java │ ├── VipSetupReq.java │ └── WxLoginReq.java │ ├── service │ ├── IBalanceService.java │ ├── IIncomeRecordService.java │ ├── ILabelService.java │ ├── IOrderService.java │ ├── IRechargeRecordService.java │ ├── IStoreBoxLabelService.java │ ├── IStoreBoxService.java │ ├── IStoreService.java │ ├── IUserAdminService.java │ ├── IUserWechatService.java │ ├── IVipSetupService.java │ ├── IWithdrawalApplicationService.java │ └── impl │ │ ├── BalanceServiceImpl.java │ │ ├── IncomeRecordServiceImpl.java │ │ ├── LabelServiceImpl.java │ │ ├── OrderServiceImpl.java │ │ ├── RechargeRecordServiceImpl.java │ │ ├── StoreBoxLabelServiceImpl.java │ │ ├── StoreBoxServiceImpl.java │ │ ├── StoreServiceImpl.java │ │ ├── UserAdminServiceImpl.java │ │ ├── UserWechatServiceImpl.java │ │ ├── VipSetupServiceImpl.java │ │ └── WithdrawalApplicationServiceImpl.java │ ├── task │ ├── DeviceStatusChecker.java │ └── OrderRemindTask.java │ └── thirdparty │ ├── ihuyi │ └── api │ │ └── IhuyiApi.java │ ├── unisoft │ ├── api │ │ └── UnisoftApi.java │ └── response │ │ └── DeviceListDTO.java │ └── wechat │ ├── api │ └── WeChatApi.java │ ├── requery │ └── UserSessionReq.java │ └── response │ └── UserSessionDTO.java └── resources ├── application-dev.yml ├── application-local.yml ├── application-prod.yml ├── application.yml ├── config └── apiclient_cert.p12 ├── mapper ├── BalanceMapper.xml ├── IncomeRecordMapper.xml ├── LabelMapper.xml ├── OrderMapper.xml ├── RechargeRecordMapper.xml ├── StoreBoxLabelMapper.xml ├── StoreBoxMapper.xml ├── StoreMapper.xml ├── UserAdminMapper.xml ├── UserWechatMapper.xml ├── VipSetupMapper.xml └── WithdrawalApplicationMapper.xml ├── payWx.properties ├── redisson-config.yml └── wx.properties /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 24小时无人自助棋牌室 2 | - 共享棋牌室是互联网+棋牌室的一种新型业态,通过小程序和智能硬件的相互链接,打造店面无人值守,客户在线预约,远程操控管理的无人共享休闲娱乐社交空间。 3 | 顾客通过小程序在线预约,到店之后,点击确认到店,门禁就会打开,同时包房内的所有电器设备全部通电。订单结束前会提示剩余时间,订单结束后房间会自动断电,顾客携带好自己的随身物品离店即可。 4 | ## 功能介绍 5 | ![9c0cf17cdc9069d3267153fd0d41f456c4376591.jpg](https://github.com/cisco-xie/cac-api/blob/main/img/9c0cf17cdc9069d3267153fd0d41f456c4376591.jpg) 6 | - 门店管理 7 | - > 支持多门店管理 8 | - 包厢管理 9 | - > 支持指定多台iot设备并支持自动&手动开关设置,如门禁/总控等 10 | - 设备管理 11 | - > 用户下单后可自由控制包厢设备 12 | - 订单管理 13 | - > 用户下单,支付,短信到期提醒 14 | - 用户管理 15 | - 会员体系 16 | - > 配置会员等级,充值,会员折扣,合伙收益 17 | - 微信支付 18 | - > 在线支付,在线退款 19 | ## 小程序UI 20 | ![首页.png](https://github.com/cisco-xie/cac-api/blob/main/img/首页.png) 21 | ![ż¨„».png](https://github.com/cisco-xie/cac-api/blob/main/img/门店详情.png)![ԤԼ.png](https://github.com/cisco-xie/cac-api/blob/main/img/ԤԼ.png)![订单详情.png](https://github.com/cisco-xie/cac-api/blob/main/img/订单详情.png)![订单已完成.png](https://github.com/cisco-xie/cac-api/blob/main/img/订单-已完成.png)![常见问题.png](https://github.com/cisco-xie/cac-api/blob/main/img/常见问题.png) 22 | ## 后台UI 23 | ![WechatIMG49.png](https://github.com/cisco-xie/cac-api/blob/main/img/WechatIMG46.png)![WechatIMG46.png](https://github.com/cisco-xie/cac-api/blob/main/img/WechatIMG47.png)![WechatIMG48.png](https://github.com/cisco-xie/cac-api/blob/main/img/WechatIMG48.png)![WechatIMG47.png](https://github.com/cisco-xie/cac-api/blob/main/img/WechatIMG49.png) 24 | -------------------------------------------------------------------------------- /img/9c0cf17cdc9069d3267153fd0d41f456c4376591.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cisco-xie/cac-api/c0e80dba0edec55ceb95f9b437de3f0b247bc6b8/img/9c0cf17cdc9069d3267153fd0d41f456c4376591.jpg -------------------------------------------------------------------------------- /img/WechatIMG46.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cisco-xie/cac-api/c0e80dba0edec55ceb95f9b437de3f0b247bc6b8/img/WechatIMG46.png -------------------------------------------------------------------------------- /img/WechatIMG47.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cisco-xie/cac-api/c0e80dba0edec55ceb95f9b437de3f0b247bc6b8/img/WechatIMG47.png -------------------------------------------------------------------------------- /img/WechatIMG48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cisco-xie/cac-api/c0e80dba0edec55ceb95f9b437de3f0b247bc6b8/img/WechatIMG48.png -------------------------------------------------------------------------------- /img/WechatIMG49.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cisco-xie/cac-api/c0e80dba0edec55ceb95f9b437de3f0b247bc6b8/img/WechatIMG49.png -------------------------------------------------------------------------------- /img/ż¨„».png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cisco-xie/cac-api/c0e80dba0edec55ceb95f9b437de3f0b247bc6b8/img/ż¨„».png -------------------------------------------------------------------------------- /img/ԤԼ.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cisco-xie/cac-api/c0e80dba0edec55ceb95f9b437de3f0b247bc6b8/img/ԤԼ.png -------------------------------------------------------------------------------- /img/常见问题.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cisco-xie/cac-api/c0e80dba0edec55ceb95f9b437de3f0b247bc6b8/img/常见问题.png -------------------------------------------------------------------------------- /img/提交订单.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cisco-xie/cac-api/c0e80dba0edec55ceb95f9b437de3f0b247bc6b8/img/提交订单.png -------------------------------------------------------------------------------- /img/订单-已完成.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cisco-xie/cac-api/c0e80dba0edec55ceb95f9b437de3f0b247bc6b8/img/订单-已完成.png -------------------------------------------------------------------------------- /img/订单筛选页面.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cisco-xie/cac-api/c0e80dba0edec55ceb95f9b437de3f0b247bc6b8/img/订单筛选页面.png -------------------------------------------------------------------------------- /img/订单详情.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cisco-xie/cac-api/c0e80dba0edec55ceb95f9b437de3f0b247bc6b8/img/订单详情.png -------------------------------------------------------------------------------- /img/门店详情.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cisco-xie/cac-api/c0e80dba0edec55ceb95f9b437de3f0b247bc6b8/img/门店详情.png -------------------------------------------------------------------------------- /img/首页.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cisco-xie/cac-api/c0e80dba0edec55ceb95f9b437de3f0b247bc6b8/img/首页.png -------------------------------------------------------------------------------- /sql/trigger.sql: -------------------------------------------------------------------------------- 1 | -- 创建预约门店订单表的触发器,用于校验预约时间是否与现有预约时间交集 2 | CREATE TRIGGER check_store_order_overlap 3 | BEFORE INSERT ON t_order 4 | FOR EACH ROW 5 | BEGIN 6 | IF EXISTS ( 7 | SELECT 1 FROM t_order 8 | WHERE store_id = NEW.store_id AND box_id = NEW.box_id 9 | AND ((NEW.start_time >= start_time AND NEW.start_time < end_time) 10 | OR (NEW.end_time > start_time AND NEW.end_time <= end_time) 11 | OR (NEW.start_time <= start_time AND NEW.end_time >= end_time)) 12 | ) THEN 13 | SIGNAL SQLSTATE '45000' 14 | SET MESSAGE_TEXT = '预约时间与他人预约时间重叠,请重新选择预约时间'; 15 | END IF; 16 | END; -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/Application.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.scheduling.annotation.EnableScheduling; 6 | 7 | 8 | @EnableScheduling 9 | @SpringBootApplication 10 | public class Application { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(Application.class, args); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/common/bean/wxpay/PayInfoDto.java: -------------------------------------------------------------------------------- 1 | 2 | package com.geekuniverse.cac.common.bean.wxpay; 3 | 4 | import lombok.Data; 5 | 6 | /** 7 | * 支付信息 8 | * @author 谢诗宏 9 | */ 10 | @Data 11 | public class PayInfoDto { 12 | 13 | /** 14 | * 支付信息,如商品名称 15 | */ 16 | private String body; 17 | 18 | /** 19 | * 支付单号 20 | */ 21 | private String payNo; 22 | 23 | /** 24 | * 付款金额 25 | */ 26 | private Double payAmount; 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/common/constants/Constants.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.common.constants; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * @author 谢诗宏 7 | * @description 基础常量 8 | * @date 2022/11/16 9 | */ 10 | public class Constants { 11 | 12 | /** 13 | * 认证信息Http请求头 14 | */ 15 | public static final String JWT_TOKEN_HEADER = "authorization"; 16 | 17 | /** 18 | * 令牌前缀 19 | */ 20 | public static final String JWT_TOKEN_PREFIX = "Bearer "; 21 | 22 | /** 23 | * 分隔符 24 | */ 25 | public static class Separator { 26 | /* 默认分隔符 */ 27 | public static final String DEFAULT = ","; 28 | public static final String VERTICAL = "\\|"; 29 | public static final String COMMA = ","; 30 | public static final String BAR = "-"; 31 | public static final String COLON = ":"; 32 | public static final String UNDERLINE = "_"; 33 | public static final String QUESTION = "?"; 34 | public static final String SEMICOLON = ";"; 35 | public static final String EQUAL = "="; 36 | public static final String LIKE = "*"; 37 | public static final String AND = "&"; 38 | } 39 | 40 | /** 41 | * 语言 42 | */ 43 | public enum Language { 44 | ZH_CN, 45 | EN_US, 46 | } 47 | 48 | /** 49 | * 直播状态 50 | */ 51 | @Getter 52 | public enum LiveStatus { 53 | 54 | // 在线 55 | ONLINE(1), 56 | // 离线 57 | OFFLINE(0), 58 | ; 59 | 60 | private final int value; 61 | 62 | LiveStatus(int value) { 63 | this.value = value; 64 | } 65 | } 66 | 67 | /** 68 | * 设备电源状态 69 | */ 70 | @Getter 71 | public enum DevicePower { 72 | 73 | // 打开 74 | OPEN(1), 75 | // 关闭 76 | CLOSE(0), 77 | ; 78 | 79 | private final int value; 80 | 81 | DevicePower(int value) { 82 | this.value = value; 83 | } 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/common/constants/DBTypeConstants.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.common.constants; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * @author 谢诗宏 7 | * @description 数据库基础类型常量 8 | * @date 2022/11/16 9 | */ 10 | public class DBTypeConstants { 11 | 12 | /** 13 | * 数据状态类型枚举 14 | */ 15 | @Getter 16 | public enum StatusEnum { 17 | 18 | DISABLE(0), 19 | ENABLE(1), 20 | 21 | ; 22 | 23 | private final Integer value; 24 | 25 | StatusEnum(Integer value) { 26 | this.value = value; 27 | } 28 | } 29 | 30 | /** 31 | * 国家模块类型枚举 32 | */ 33 | @Getter 34 | public enum CountryModelTypeEnum { 35 | 36 | GOODS(1), 37 | AUTHOR(2), 38 | SHOP(3), 39 | VIDEO(4), 40 | LIVE(5), 41 | 42 | ; 43 | 44 | private final Integer value; 45 | 46 | CountryModelTypeEnum(Integer value) { 47 | this.value = value; 48 | } 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/common/constants/ErrCode.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.common.constants; 2 | 3 | public interface ErrCode { 4 | Integer getCode(); 5 | String getMsg(); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/common/constants/FastDataConstants.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.common.constants; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * @author 谢诗宏 7 | * @description FastData基础常量 8 | * @date 2022/11/26 9 | */ 10 | public class FastDataConstants { 11 | 12 | /** 13 | * 语言 14 | */ 15 | public enum Language { 16 | ZH_CN, 17 | EN_US, 18 | } 19 | 20 | /** 21 | * 请求日期类型 22 | */ 23 | @Getter 24 | public enum QueryDateType { 25 | 26 | // 日榜 27 | DAILY(1), 28 | // 周榜 29 | WEEKLY(2), 30 | // 月榜 31 | MONTHLY(3), 32 | ; 33 | 34 | private final int value; 35 | 36 | QueryDateType(int value) { 37 | this.value = value; 38 | } 39 | } 40 | 41 | /** 42 | * 达人榜单类型 43 | */ 44 | @Getter 45 | public enum QueryAuthorType { 46 | 47 | // 涨粉榜 48 | FOLLOWER(1), 49 | // 蓝V榜 50 | VERIIED(2), 51 | // 热门榜 52 | TOP(3), 53 | ; 54 | 55 | private final int value; 56 | 57 | QueryAuthorType(int value) { 58 | this.value = value; 59 | } 60 | } 61 | 62 | /** 63 | * Response状态码 64 | */ 65 | @Getter 66 | public enum ResponseCode { 67 | 68 | SUCCESS("200"), 69 | // 权限不足 70 | MAG_AUTH_3004("MAG_AUTH_3004"), 71 | ; 72 | 73 | private final String value; 74 | 75 | ResponseCode(String value) { 76 | this.value = value; 77 | } 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/common/constants/RedisConstants.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.common.constants; 2 | 3 | public interface RedisConstants { 4 | 5 | /** 6 | * 令牌前缀 7 | */ 8 | String JWT_TOKEN_PREFIX = "user:token"; 9 | 10 | /** 11 | * 管理后台token令牌前缀 12 | */ 13 | String JWT_ADMIN_TOKEN_PREFIX = "user:admin:token"; 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/common/enums/FastDataCodeEnum.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.common.enums; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * @author 谢诗宏 7 | * @description FastData response code枚举 8 | * @date 2022/11/16 9 | */ 10 | @Getter 11 | public enum FastDataCodeEnum { 12 | 13 | SUCCESS("200"), 14 | // 权限不足 15 | MAG_AUTH_3004("MAG_AUTH_3004"), 16 | // 权限不足 17 | MAG_AUTH_3006("MAG_AUTH_3006"), 18 | ; 19 | 20 | private final String value; 21 | 22 | FastDataCodeEnum(String value) { 23 | this.value = value; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/common/enums/SystemError.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.common.enums; 2 | 3 | import com.geekuniverse.cac.common.constants.ErrCode; 4 | 5 | /** 6 | * @author 谢诗宏 7 | * @description 统一异常码 8 | * @date 2022/12/10 9 | */ 10 | public enum SystemError implements ErrCode { 11 | 12 | /** 13 | * 基础异常 14 | */ 15 | SYS_500(500, "服务器繁忙,请稍后重试!"), 16 | SYS_502(502, "系统维护中"), 17 | SYS_503(503, "未找到[%s]微服务,请检查服务是否可用"), 18 | SYS_504(504, "未找到微服务"), 19 | 20 | SYS_400(400, "错误的请求"), 21 | SYS_401(401, "没有权限"), 22 | SYS_402(402, "参数不完整"), 23 | SYS_404(404, "Not Found"), 24 | 25 | SYS_409(409, "缺少请求参数[%s]"), 26 | SYS_410(410, "请求方式错误"), 27 | SYS_411(411, "当前数据不存在"), 28 | SYS_418(418, "请求参数[%s]格式错误"), 29 | 30 | /** 31 | * 用户相关异常--1000起 32 | */ 33 | USER_1000(1000, "未登录"), 34 | USER_1001(1001, "没有权限"), 35 | USER_1002(1002, "用户不存在"), 36 | USER_1003(1003, "token错误"), 37 | USER_1004(1004, "登录过期"), 38 | USER_1005(1005, "微信登录异常"), 39 | USER_1006(1006, "密码错误"), 40 | 41 | USER_VIP_1100(1100, "合伙人盈利比率不能为空"), 42 | 43 | /** 44 | * 订单相关异常--2000起 45 | */ 46 | ORDER_2000(2000, "所选时间和他人预约时间冲突!请重新选择预约时间"), 47 | ORDER_2001(2001, "预约时间必须大于%s小时"), 48 | ORDER_2002(2002, "钱包余额不足"), 49 | ORDER_2003(2003, "续费订单必须从原订单的结束时间开始"), 50 | ORDER_2404(2404, "订单不存在"), 51 | ORDER_2405(2405, "订单门店不存在"), 52 | ORDER_2406(2406, "订单已失效,请重新下单预约"), 53 | ORDER_2407(2407, "订单已开始无法申请退款"), 54 | ORDER_2408(2408, "该订单不属于当前用户"), 55 | ORDER_2409(2409, "订单只可提前30分钟开门,请耐心等待"), 56 | 57 | ORDER_WITHDRAWAL_2500(2500, "可提现余额不足"), 58 | 59 | /** 60 | * 设备相关异常--3000起 61 | */ 62 | DEVICE_3000(3000, "开门失败!请稍后重试"), 63 | DEVICE_3001(3001, "插座启动失败!请稍后重试"), 64 | 65 | STORE_4000(4000, "暂不支持直接创建门店!需联系开发者服务商"), 66 | ; 67 | 68 | private final Integer code; 69 | private final String msg; 70 | 71 | SystemError(Integer code, String msg) { 72 | this.code = code; 73 | this.msg = msg; 74 | } 75 | 76 | @Override 77 | public Integer getCode() { 78 | return code; 79 | } 80 | 81 | @Override 82 | public String getMsg() { 83 | return msg; 84 | } 85 | 86 | public static SystemError getDefined(Integer code) { 87 | for (SystemError err : SystemError.values()) { 88 | if (err.code.equals(code)) { 89 | return err; 90 | } 91 | } 92 | return SystemError.SYS_500; 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/common/utils/KeyUtil.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.common.utils; 2 | 3 | /** 4 | * @description redis key 5 | * @author 谢诗宏 6 | * @date 2023/1/4 7 | */ 8 | public class KeyUtil { 9 | 10 | public static final String SPLITSTR = ":"; 11 | public static final String LIKE = "*"; 12 | 13 | /** 14 | * 组织key 15 | * 16 | * @param moduleKey 17 | * @param keys 18 | * @return 19 | */ 20 | public static String genKey(String moduleKey, String... keys) { 21 | StringBuilder sb = new StringBuilder(); 22 | sb.append(moduleKey); 23 | for (String key : keys) { 24 | sb.append(SPLITSTR); 25 | sb.append(key); 26 | } 27 | return sb.toString(); 28 | } 29 | 30 | /** 31 | * 模糊组织key 32 | * 33 | * @param moduleKey 34 | * @param keys 35 | * @return 36 | */ 37 | public static String genLikeKey(String moduleKey, String... keys) { 38 | StringBuilder sb = new StringBuilder(); 39 | sb.append(moduleKey); 40 | for (String key : keys) { 41 | sb.append(SPLITSTR); 42 | sb.append(key); 43 | } 44 | sb.append(SPLITSTR); 45 | sb.append(LIKE); 46 | return sb.toString(); 47 | } 48 | 49 | /** 50 | * 组织key 51 | * 52 | * @param moduleKey 53 | * @param subModule 54 | * @param key 55 | * @return 56 | */ 57 | public static String genKey(String moduleKey, String subModule, String key) { 58 | StringBuilder sb = new StringBuilder(); 59 | sb.append(moduleKey).append(SPLITSTR).append(subModule).append(SPLITSTR).append(key); 60 | return sb.toString(); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/common/utils/NetworkUtil.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.common.utils; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | import java.io.BufferedReader; 5 | import java.io.InputStream; 6 | import java.io.InputStreamReader; 7 | import java.net.*; 8 | 9 | /** 10 | * @author 谢诗宏 11 | * @description 网络工具类 12 | * @date 2022/11/24 13 | */ 14 | public class NetworkUtil { 15 | 16 | /** 17 | * 获取真实ip地址,不返回内网地址 18 | * 19 | * @param request 20 | * @return 21 | */ 22 | public static String getIpAddr(HttpServletRequest request) { 23 | //目前则是网关ip 24 | String ip = request.getHeader("X-Real-IP"); 25 | if (ip != null && !"".equals(ip) && !"unknown".equalsIgnoreCase(ip)) { 26 | return ip; 27 | } 28 | ip = request.getHeader("X-Forwarded-For"); 29 | if (ip != null && !"".equals(ip) && !"unknown".equalsIgnoreCase(ip)) { 30 | int index = ip.indexOf(','); 31 | if (index != -1) { 32 | //只获取第一个值 33 | return ip.substring(0, index); 34 | } else { 35 | return ip; 36 | } 37 | } else { 38 | //取不到真实ip则返回空,不能返回内网地址。 39 | return ""; 40 | } 41 | } 42 | 43 | /** 44 | * 获取ip,会返回内网地址 45 | * @param request 46 | * @return 47 | */ 48 | public static String getIpAddrLAN(HttpServletRequest request) { 49 | String ipAddress = null; 50 | try { 51 | ipAddress = request.getHeader("x-forwarded-for"); 52 | if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { 53 | ipAddress = request.getHeader("Proxy-Client-IP"); 54 | } 55 | if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { 56 | ipAddress = request.getHeader("WL-Proxy-Client-IP"); 57 | } 58 | if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) { 59 | ipAddress = request.getRemoteAddr(); 60 | if (ipAddress.equals("127.0.0.1")) { 61 | // 根据网卡取本机配置的IP 62 | InetAddress inet = null; 63 | try { 64 | inet = InetAddress.getLocalHost(); 65 | } catch (UnknownHostException e) { 66 | e.printStackTrace(); 67 | } 68 | ipAddress = inet.getHostAddress(); 69 | } 70 | } 71 | // 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割 72 | if (ipAddress != null && ipAddress.length() > 15) { 73 | // "***.***.***.***".length() 74 | // = 15 75 | if (ipAddress.indexOf(",") > 0) { 76 | ipAddress = ipAddress.substring(0, ipAddress.indexOf(",")); 77 | } 78 | } 79 | } catch (Exception e) { 80 | ipAddress=""; 81 | } 82 | return ipAddress; 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/common/utils/TokenUtil.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.common.utils; 2 | 3 | import cn.hutool.core.bean.BeanUtil; 4 | import cn.hutool.jwt.JWT; 5 | import cn.hutool.jwt.JWTUtil; 6 | import com.alibaba.fastjson2.JSON; 7 | import com.geekuniverse.cac.core.model.TokenUser; 8 | 9 | import java.util.Map; 10 | 11 | /** 12 | * @author 谢诗宏 13 | * @description token工具类 - jwt 14 | * @date 2022/11/24 15 | */ 16 | public class TokenUtil { 17 | // 密钥 18 | private static final byte[] KEY = "dance-data-2022".getBytes(); 19 | 20 | public static String create(TokenUser tokenUser) { 21 | Map map = BeanUtil.beanToMap(tokenUser); 22 | return JWTUtil.createToken(map, KEY); 23 | } 24 | 25 | public static TokenUser parse(String token) { 26 | final JWT jwt = JWTUtil.parseToken(token); 27 | //return JSON.parseObject(JSON.toJSONString(String.valueOf(jwt.getPayload())), TokenUser.class); 28 | return BeanUtil.toBean(jwt.getPayload().getClaimsJson(), TokenUser.class); 29 | } 30 | 31 | public static boolean verify(String token) { 32 | return JWTUtil.verify(token, KEY); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/config/CodeDataListner.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.config; 2 | 3 | import com.alibaba.excel.context.AnalysisContext; 4 | import com.alibaba.excel.event.AnalysisEventListener; 5 | import com.alibaba.excel.util.ListUtils; 6 | import com.geekuniverse.cac.dto.Outfall; 7 | import lombok.extern.slf4j.Slf4j; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | /** 13 | * @name: CodeDataListner 14 | * @author: 谢诗宏 15 | * @date: 2023-05-25 16:31 16 | **/ 17 | @Slf4j 18 | public class CodeDataListner extends AnalysisEventListener { 19 | /** 20 | * 缓存的数据 21 | */ 22 | private static final List cachedDataList = new ArrayList<>(); 23 | /** 24 | * 读取 25 | * @param code 26 | * @param analysisContext 27 | */ 28 | @Override 29 | public void invoke(Outfall code, AnalysisContext analysisContext) { 30 | log.info("=========start========={}",code); 31 | cachedDataList.add(code); 32 | } 33 | 34 | /** 35 | * 执行完毕 36 | * @param analysisContext 37 | */ 38 | @Override 39 | public void doAfterAllAnalysed(AnalysisContext analysisContext) { 40 | log.info("=========end=========Code(扫累了)",Outfall.class); 41 | } 42 | 43 | public static List getData() { 44 | return cachedDataList; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/config/CorsConfig.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.cors.CorsConfiguration; 6 | import org.springframework.web.cors.UrlBasedCorsConfigurationSource; 7 | import org.springframework.web.filter.CorsFilter; 8 | 9 | /** 10 | * 跨域访问 11 | * 12 | * @name: CorsConfig 13 | * @author: 谢诗宏 14 | * @date: 2023-05-25 21:58 15 | **/ 16 | @Configuration 17 | public class CorsConfig { 18 | @Bean 19 | public CorsFilter corsFilter() { 20 | CorsConfiguration corsConfig = new CorsConfiguration(); 21 | corsConfig.addAllowedOriginPattern("*"); // 设置允许跨域访问的源 22 | corsConfig.addAllowedMethod("*"); // 设置允许的请求方法,如 GET、POST、PUT、DELETE 等 23 | corsConfig.addAllowedHeader("*"); // 设置允许的请求头 24 | corsConfig.setAllowCredentials(true); // 设置是否允许发送 Cookie 25 | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); 26 | source.registerCorsConfiguration("/**", corsConfig); // 设置过滤路径,这里设置为所有路径 27 | return new CorsFilter(source); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/config/Knife4jConfig.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.config; 2 | 3 | import io.swagger.annotations.ApiOperation; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import springfox.documentation.builders.ApiInfoBuilder; 7 | import springfox.documentation.builders.PathSelectors; 8 | import springfox.documentation.builders.RequestHandlerSelectors; 9 | import springfox.documentation.service.Contact; 10 | import springfox.documentation.spi.DocumentationType; 11 | import springfox.documentation.spring.web.plugins.Docket; 12 | import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc; 13 | 14 | @Configuration 15 | @EnableSwagger2WebMvc 16 | public class Knife4jConfig { 17 | 18 | @Bean(value = "dockerBean") 19 | public Docket dockerBean() { 20 | //指定使用Swagger2规范 21 | Docket docket=new Docket(DocumentationType.SWAGGER_2) 22 | .apiInfo(new ApiInfoBuilder() 23 | //描述字段支持Markdown语法 24 | .description("# 棋牌室CAC RESTful APIs") 25 | .termsOfServiceUrl("http://120.24.20.3:8081/") 26 | .contact(new Contact("谢诗宏",null,"1264108131@qq.com")) 27 | .version("1.0") 28 | .build()) 29 | //分组名称 30 | .groupName("API服务") 31 | .select() 32 | //这里指定Controller扫描包路径 33 | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) 34 | .paths(PathSelectors.any()) 35 | .build(); 36 | return docket; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/config/MyWxPayProperties.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.config; 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 | * 支付相关配置文件 10 | * @author 谢诗宏 11 | */ 12 | @Data 13 | @Component 14 | @PropertySource("classpath:payWx.properties") 15 | @ConfigurationProperties(prefix = "pay") 16 | public class MyWxPayProperties { 17 | 18 | /** 19 | * 设置微信公众号或者小程序等的appid 20 | */ 21 | private String appId; 22 | 23 | /** 24 | * 微信支付商户号 25 | */ 26 | private String mchId; 27 | 28 | /** 29 | * 微信支付商户密钥 30 | */ 31 | private String mchKey; 32 | 33 | /** 34 | * 服务商模式下的子商户公众账号ID,普通模式请不要配置,请在配置文件中将对应项删除 35 | */ 36 | private String subAppId; 37 | 38 | /** 39 | * 服务商模式下的子商户号,普通模式请不要配置,最好是请在配置文件中将对应项删除 40 | */ 41 | private String subMchId; 42 | 43 | /** 44 | * apiclient_cert.p12文件的绝对路径,或者如果放在项目中,请以classpath:开头指定 45 | */ 46 | private String keyPath; 47 | /** 48 | * 服务端IP 49 | */ 50 | private String spbillCreateIp; 51 | /** 52 | * 回调通知URL 53 | */ 54 | private String notifyUrl; 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.config; 2 | 3 | import com.baomidou.mybatisplus.annotation.DbType; 4 | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; 5 | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; 6 | import org.mybatis.spring.annotation.MapperScan; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | 10 | @Configuration 11 | @MapperScan("com.geekuniverse.cac.mapper") 12 | public class MybatisPlusConfig { 13 | 14 | /** 15 | * 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题(该属性会在旧插件移除后一同移除) 16 | */ 17 | @Bean 18 | public MybatisPlusInterceptor mybatisPlusInterceptor() { 19 | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); 20 | interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); 21 | return interceptor; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/config/RedissonConfig.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.config; 2 | 3 | import cn.hutool.core.util.StrUtil; 4 | import org.redisson.Redisson; 5 | import org.redisson.api.RedissonClient; 6 | import org.redisson.client.codec.StringCodec; 7 | import org.redisson.config.Config; 8 | import org.springframework.beans.factory.annotation.Value; 9 | import org.springframework.context.annotation.Bean; 10 | import org.springframework.context.annotation.Configuration; 11 | 12 | import java.io.IOException; 13 | 14 | /** 15 | * @description Redisson配置 16 | * @author 谢诗宏 17 | * @date 2022/12/10 18 | */ 19 | @Configuration 20 | public class RedissonConfig { 21 | 22 | @Value("${spring.redis.host}") 23 | public String host; 24 | 25 | @Value("${spring.redis.port}") 26 | public Integer port; 27 | 28 | @Value("${spring.redis.password}") 29 | public String password; 30 | 31 | @Value("${spring.redis.database}") 32 | public Integer database; 33 | 34 | /** 35 | * 默认redisson实例 36 | */ 37 | @Bean 38 | public RedissonClient redissonClient() throws IOException { 39 | Config config = Config.fromYAML(RedissonConfig.class.getClassLoader().getResource("redisson-config.yml")); 40 | config.useSingleServer() 41 | .setAddress("redis://" + host + ":" + port) 42 | .setPassword(StrUtil.isNotBlank(password) ? password : null) 43 | .setDatabase(database); 44 | config.setCodec(new StringCodec()); 45 | return Redisson.create(config); 46 | } 47 | 48 | } -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/config/WhiteListConfig.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @description url白名单配置 11 | * @author 谢诗宏 12 | * @date 2022/12/10 13 | */ 14 | @Data 15 | @Configuration 16 | @ConfigurationProperties(prefix = "whitelist") 17 | public class WhiteListConfig { 18 | 19 | private List urls; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/config/WxMaConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.config; 2 | 3 | 4 | import cn.binarywang.wx.miniapp.api.WxMaImmediateDeliveryService; 5 | import cn.binarywang.wx.miniapp.api.WxMaQrcodeService; 6 | import cn.binarywang.wx.miniapp.api.WxMaService; 7 | import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; 8 | import cn.binarywang.wx.miniapp.bean.WxMaKefuMessage; 9 | import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage; 10 | import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; 11 | import cn.binarywang.wx.miniapp.message.WxMaMessageHandler; 12 | import cn.binarywang.wx.miniapp.message.WxMaMessageRouter; 13 | import com.google.common.collect.Lists; 14 | import lombok.extern.slf4j.Slf4j; 15 | import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; 16 | import me.chanjar.weixin.common.error.WxErrorException; 17 | import me.chanjar.weixin.common.error.WxRuntimeException; 18 | import org.springframework.beans.factory.annotation.Autowired; 19 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 20 | import org.springframework.context.annotation.Bean; 21 | import org.springframework.context.annotation.Configuration; 22 | 23 | import java.io.File; 24 | import java.util.List; 25 | import java.util.stream.Collectors; 26 | 27 | /** 28 | * @author Binary Wang 29 | */ 30 | @Slf4j 31 | @Configuration 32 | @EnableConfigurationProperties(WxProperties.class) 33 | public class WxMaConfiguration { 34 | private final WxProperties properties; 35 | 36 | @Autowired 37 | public WxMaConfiguration(WxProperties properties) { 38 | this.properties = properties; 39 | } 40 | 41 | @Bean 42 | public WxMaService wxMaService() { 43 | List configs = this.properties.getConfigs(); 44 | if (configs == null) { 45 | throw new WxRuntimeException("大哥,拜托先看下项目首页的说明(readme文件),添加下相关配置,注意别配错了!"); 46 | } 47 | WxMaService maService = new WxMaServiceImpl(); 48 | maService.setMultiConfigs( 49 | configs.stream() 50 | .map(a -> { 51 | WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); 52 | // WxMaDefaultConfigImpl config = new WxMaRedisConfigImpl(new JedisPool()); 53 | // 使用上面的配置时,需要同时引入jedis-lock的依赖,否则会报类无法找到的异常 54 | config.setAppid(a.getAppid()); 55 | config.setSecret(a.getSecret()); 56 | config.setToken(a.getToken()); 57 | config.setAesKey(a.getAesKey()); 58 | config.setMsgDataFormat(a.getMsgDataFormat()); 59 | return config; 60 | }).collect(Collectors.toMap(WxMaDefaultConfigImpl::getAppid, a -> a, (o, n) -> o))); 61 | return maService; 62 | } 63 | 64 | @Bean 65 | public WxMaMessageRouter wxMaMessageRouter(WxMaService wxMaService) { 66 | final WxMaMessageRouter router = new WxMaMessageRouter(wxMaService); 67 | router 68 | .rule().handler(logHandler).next() 69 | .rule().async(false).content("订阅消息").handler(subscribeMsgHandler).end() 70 | .rule().async(false).content("文本").handler(textHandler).end() 71 | .rule().async(false).content("图片").handler(picHandler).end() 72 | .rule().async(false).content("二维码").handler(qrcodeHandler).end(); 73 | return router; 74 | } 75 | @Bean 76 | public WxMaImmediateDeliveryService wxMaImmediateDeliveryService(WxMaService wxMaService) { 77 | return wxMaService.getWxMaImmediateDeliveryService(); 78 | } 79 | private final WxMaMessageHandler subscribeMsgHandler = (wxMessage, context, service, sessionManager) -> { 80 | service.getMsgService().sendSubscribeMsg(WxMaSubscribeMessage.builder() 81 | .templateId("此处更换为自己的模板id") 82 | .data(Lists.newArrayList( 83 | new WxMaSubscribeMessage.MsgData("keyword1", "339208499"))) 84 | .toUser(wxMessage.getFromUser()) 85 | .build()); 86 | return null; 87 | }; 88 | 89 | private final WxMaMessageHandler logHandler = (wxMessage, context, service, sessionManager) -> { 90 | log.info("收到消息:" + wxMessage.toString()); 91 | // wxMessage.getEvent(); 92 | // service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("欢迎进入客服系统,如需转人工服务,请输入 “人工服务”" ) 93 | // .toUser(wxMessage.getFromUser()).build()); 94 | return null; 95 | }; 96 | 97 | private final WxMaMessageHandler textHandler = (wxMessage, context, service, sessionManager) -> { 98 | service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("回复文本消息") 99 | .toUser(wxMessage.getFromUser()).build()); 100 | return null; 101 | }; 102 | 103 | private final WxMaMessageHandler picHandler = (wxMessage, context, service, sessionManager) -> { 104 | try { 105 | WxMediaUploadResult uploadResult = service.getMediaService() 106 | .uploadMedia("image", "png", 107 | ClassLoader.getSystemResourceAsStream("tmp.png")); 108 | service.getMsgService().sendKefuMsg( 109 | WxMaKefuMessage 110 | .newImageBuilder() 111 | .mediaId(uploadResult.getMediaId()) 112 | .toUser(wxMessage.getFromUser()) 113 | .build()); 114 | } catch (WxErrorException e) { 115 | e.printStackTrace(); 116 | } 117 | 118 | return null; 119 | }; 120 | 121 | private final WxMaMessageHandler qrcodeHandler = (wxMessage, context, service, sessionManager) -> { 122 | try { 123 | final File file = service.getQrcodeService().createQrcode("123", 430); 124 | WxMediaUploadResult uploadResult = service.getMediaService().uploadMedia("image", file); 125 | service.getMsgService().sendKefuMsg( 126 | WxMaKefuMessage 127 | .newImageBuilder() 128 | .mediaId(uploadResult.getMediaId()) 129 | .toUser(wxMessage.getFromUser()) 130 | .build()); 131 | } catch (WxErrorException e) { 132 | e.printStackTrace(); 133 | } 134 | 135 | return null; 136 | }; 137 | 138 | } -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/config/WxPayConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.config; 2 | 3 | import com.github.binarywang.wxpay.service.WxPayService; 4 | import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; 5 | import lombok.RequiredArgsConstructor; 6 | import org.apache.commons.lang3.StringUtils; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 9 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; 10 | import org.springframework.context.annotation.Bean; 11 | import org.springframework.context.annotation.Configuration; 12 | 13 | /** 14 | * @author Binary Wang 15 | */ 16 | @Configuration 17 | @ConditionalOnClass(WxPayService.class) 18 | @RequiredArgsConstructor //无参构造 19 | public class WxPayConfiguration { 20 | @Autowired 21 | private MyWxPayProperties properties; 22 | 23 | public MyWxPayProperties getProperties() { 24 | return properties; 25 | } 26 | @Bean 27 | @ConditionalOnMissingBean 28 | public WxPayService wxService() { 29 | com.github.binarywang.wxpay.config.WxPayConfig payConfig = new com.github.binarywang.wxpay.config.WxPayConfig(); 30 | payConfig.setAppId(StringUtils.trimToNull(this.properties.getAppId())); 31 | payConfig.setMchId(StringUtils.trimToNull(this.properties.getMchId())); 32 | payConfig.setMchKey(StringUtils.trimToNull(this.properties.getMchKey())); 33 | payConfig.setSubAppId(StringUtils.trimToNull(this.properties.getSubAppId())); 34 | payConfig.setSubMchId(StringUtils.trimToNull(this.properties.getSubMchId())); 35 | payConfig.setKeyPath(StringUtils.trimToNull(this.properties.getKeyPath())); 36 | //微信支付openId 37 | // 可以指定是否使用沙箱环境 38 | payConfig.setUseSandboxEnv(false); 39 | 40 | WxPayService wxPayService = new WxPayServiceImpl(); 41 | wxPayService.setConfig(payConfig); 42 | return wxPayService; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/config/WxProperties.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.config; 2 | 3 | 4 | import lombok.Data; 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | 7 | import java.util.List; 8 | 9 | @Data 10 | @ConfigurationProperties(prefix = "thirdparty.wechat.miniapp") 11 | public class WxProperties { 12 | 13 | private List configs; 14 | 15 | /** 16 | * 司机订阅消息模板id 17 | */ 18 | private String driverTemplateId; 19 | 20 | /** 21 | * 管理端装载通知模板id 22 | */ 23 | private String loadTemplateId; 24 | 25 | /** 26 | * 管理端签收通知模板id 27 | */ 28 | private String unLoadTemplateId; 29 | 30 | @Data 31 | public static class Config { 32 | /** 33 | * 设置微信小程序的appid 34 | */ 35 | private String appid; 36 | 37 | /** 38 | * 设置微信小程序的Secret 39 | */ 40 | private String secret; 41 | 42 | /** 43 | * 设置微信小程序消息服务器配置的token 44 | */ 45 | private String token; 46 | 47 | /** 48 | * 设置微信小程序消息服务器配置的EncodingAESKey 49 | */ 50 | private String aesKey; 51 | 52 | /** 53 | * 消息格式,XML或者JSON 54 | */ 55 | private String msgDataFormat; 56 | 57 | /** 58 | * 小程序名称 59 | */ 60 | private String name; 61 | 62 | } 63 | } -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/config/apiversion/ApiRequestMappingHandlerMapping.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.config.apiversion; 2 | 3 | import com.geekuniverse.cac.core.annotation.ApiVersion; 4 | import org.springframework.core.annotation.AnnotationUtils; 5 | import org.springframework.web.servlet.mvc.condition.RequestCondition; 6 | import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; 7 | 8 | import java.lang.reflect.Method; 9 | 10 | /** 11 | * @description 注解识别 12 | * @author 谢诗宏 13 | * @date 2023/1/1 14 | */ 15 | public class ApiRequestMappingHandlerMapping extends RequestMappingHandlerMapping { 16 | 17 | @Override 18 | protected RequestCondition getCustomTypeCondition(Class handlerType) { 19 | ApiVersion apiVersion = AnnotationUtils.findAnnotation(handlerType, ApiVersion.class); 20 | return createCondition(apiVersion); 21 | } 22 | 23 | @Override 24 | protected RequestCondition getCustomMethodCondition(Method method) { 25 | ApiVersion apiVersion = AnnotationUtils.findAnnotation(method, ApiVersion.class); 26 | return createCondition(apiVersion); 27 | } 28 | 29 | /** 30 | * 实例化RequestCondition 31 | */ 32 | private RequestCondition createCondition(ApiVersion apiVersion) { 33 | return apiVersion == null ? null : new ApiVersionCondition(apiVersion.value()); 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/config/apiversion/ApiVersionCondition.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.config.apiversion; 2 | 3 | 4 | import org.springframework.web.servlet.mvc.condition.RequestCondition; 5 | 6 | import javax.servlet.http.HttpServletRequest; 7 | import java.util.regex.Matcher; 8 | import java.util.regex.Pattern; 9 | 10 | /** 11 | * @description API版本匹配 12 | * @author 谢诗宏 13 | * @date 2023/1/1 14 | */ 15 | public class ApiVersionCondition implements RequestCondition { 16 | // 路径中版本的前缀, 这里用 /v[1-9]/的形式 17 | private final static Pattern VERSION_PREFIX_PATTERN = Pattern.compile("/v(\\d+).*"); 18 | 19 | private final int apiVersion; 20 | 21 | ApiVersionCondition(int apiVersion){ 22 | this.apiVersion = apiVersion; 23 | } 24 | 25 | public int getApiVersion() { 26 | return apiVersion; 27 | } 28 | 29 | /** 30 | * 将不同的筛选条件合并,这里采用的覆盖,即后来的规则生效 31 | * @param other 32 | * @return 33 | */ 34 | public ApiVersionCondition combine(ApiVersionCondition other) { 35 | return new ApiVersionCondition(other.getApiVersion()); 36 | } 37 | 38 | /** 39 | * 根据request查找匹配到的筛选条件 40 | * @param request 41 | * @return 42 | */ 43 | public ApiVersionCondition getMatchingCondition(HttpServletRequest request) { 44 | Matcher m = VERSION_PREFIX_PATTERN.matcher(request.getRequestURI()); 45 | if (m.find()) { 46 | int version = Integer.parseInt(m.group(1)); 47 | // 如果请求的版本号大于配置版本号, 则满足,即与请求的 48 | if (version >= this.apiVersion) { 49 | return this; 50 | } 51 | } 52 | return null; 53 | } 54 | 55 | /** 56 | * 实现不同条件类的比较,从而实现优先级排序 57 | * @param other 58 | * @param request 59 | * @return 60 | */ 61 | public int compareTo(ApiVersionCondition other, HttpServletRequest request) { 62 | return other.getApiVersion() - this.apiVersion; 63 | } 64 | 65 | } -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/config/apiversion/WebMvcRegistrationsConfig.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.config.apiversion; 2 | 3 | import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; 6 | 7 | /** 8 | * @author 谢诗宏 9 | * @description com.adnetera.adio.config.apiversion 10 | * @date 2023/1/1 11 | */ 12 | @Configuration 13 | public class WebMvcRegistrationsConfig implements WebMvcRegistrations { 14 | @Override 15 | public RequestMappingHandlerMapping getRequestMappingHandlerMapping() { 16 | return new ApiRequestMappingHandlerMapping(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/controller/BalanceController.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | /** 7 | *

8 | * 用户余额表 前端控制器 9 | *

10 | * 11 | * @author 谢诗宏 12 | * @since 2023-07-20 13 | */ 14 | @RestController 15 | @RequestMapping("/cac/balance") 16 | public class BalanceController { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/controller/DeviceController.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.controller; 2 | 3 | import com.alibaba.fastjson2.JSONObject; 4 | import com.geekuniverse.cac.common.constants.Constants; 5 | import com.geekuniverse.cac.common.enums.SystemError; 6 | import com.geekuniverse.cac.core.exception.BusinessException; 7 | import com.geekuniverse.cac.core.result.Result; 8 | import com.geekuniverse.cac.core.support.BaseController; 9 | import com.geekuniverse.cac.entity.Order; 10 | import com.geekuniverse.cac.entity.StoreBox; 11 | import com.geekuniverse.cac.service.IOrderService; 12 | import com.geekuniverse.cac.service.IStoreBoxService; 13 | import com.geekuniverse.cac.thirdparty.unisoft.api.UnisoftApi; 14 | import io.swagger.annotations.Api; 15 | import io.swagger.annotations.ApiImplicitParam; 16 | import io.swagger.annotations.ApiImplicitParams; 17 | import io.swagger.annotations.ApiOperation; 18 | import lombok.extern.slf4j.Slf4j; 19 | import org.apache.commons.lang3.StringUtils; 20 | import org.springframework.web.bind.annotation.*; 21 | 22 | import javax.annotation.Resource; 23 | import java.time.LocalDateTime; 24 | 25 | /** 26 | *

27 | * 设备 前端控制器 28 | *

29 | * 30 | * @author 谢诗宏 31 | * @since 2023-05-15 32 | */ 33 | @Slf4j 34 | @Api(tags = "设备模块") 35 | @RestController 36 | @RequestMapping("/device") 37 | public class DeviceController extends BaseController { 38 | 39 | @Resource 40 | private IStoreBoxService storeBoxService; 41 | 42 | @Resource 43 | private IOrderService orderService; 44 | 45 | @ApiOperation(value = "开门") 46 | @PostMapping("/{id}/{status}") 47 | @ApiImplicitParams 48 | ({ 49 | @ApiImplicitParam(name = "id", value = "订单ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class), 50 | @ApiImplicitParam(name = "status", value = "状态1开门0离店", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class) 51 | }) 52 | public Result list(@PathVariable Integer id, @PathVariable Integer status) { 53 | Order order = orderService.getById(id); 54 | LocalDateTime now = LocalDateTime.now(); 55 | 56 | if (order.getStartTime().isAfter(now) && order.getStartTime().isAfter(now.plusMinutes(30))) { 57 | throw new BusinessException(SystemError.ORDER_2409); 58 | } 59 | if (order.getEndTime().isBefore(now)) { 60 | throw new BusinessException(SystemError.ORDER_2406); 61 | } 62 | if (order.getPayStatus() == 2) { 63 | throw new BusinessException(SystemError.ORDER_2406); 64 | } 65 | StoreBox storeBox = storeBoxService.getById(order.getBoxId()); 66 | if (storeBox == null) { 67 | throw new BusinessException(SystemError.ORDER_2405); 68 | } 69 | int socket10a = Constants.DevicePower.OPEN.getValue(); 70 | int socket16a = Constants.DevicePower.OPEN.getValue(); 71 | if (status == 0) { 72 | socket10a = Constants.DevicePower.OPEN.getValue(); 73 | socket16a = Constants.DevicePower.CLOSE.getValue(); 74 | } else if (status == 1) { 75 | socket10a = Constants.DevicePower.CLOSE.getValue(); 76 | socket16a = Constants.DevicePower.OPEN.getValue(); 77 | } 78 | 79 | /** 包厢设备控制 0000表示没有门禁设备 start */ 80 | if (!"0000".equals(storeBox.getDeviceSocket10a()) && StringUtils.isNotBlank(storeBox.getDeviceSocket10a())) { 81 | // 第一步:关闭出门开关,用于断电开门,并在10秒后延时打开 82 | JSONObject result = UnisoftApi.control(storeBox.getDeviceSocket10a(), socket10a, 10000L); 83 | if (200 == result.getInteger("code")) { 84 | log.info("开门成功:用户ID[{}],订单ID[{}]", order.getUserId(), id); 85 | } else { 86 | log.info("开门失败:用户ID[{}],订单ID[{}],异常信息[{}]", order.getUserId(), id, result); 87 | throw new BusinessException(SystemError.SYS_500); 88 | } 89 | } 90 | 91 | // 第二步:打开墙壁插座 92 | if (StringUtils.isNotBlank(storeBox.getDeviceSocket16a())) { 93 | JSONObject resultSocket = UnisoftApi.control(storeBox.getDeviceSocket16a(), socket16a, 0L); 94 | if (200 == resultSocket.getInteger("code")) { 95 | log.info("打开墙壁插座成功:用户ID[{}],订单ID[{}]", order.getUserId(), id); 96 | } else { 97 | log.info("打开墙壁插座失败:用户ID[{}],订单ID[{}],异常信息[{}]", order.getUserId(), id, resultSocket); 98 | throw new BusinessException(SystemError.SYS_500); 99 | } 100 | } 101 | /** 包厢设备控制 end */ 102 | return Result.success(); 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/controller/FaviconController.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.controller; 2 | 3 | import org.springframework.web.bind.annotation.*; 4 | import springfox.documentation.annotations.ApiIgnore; 5 | 6 | /** 7 | *

8 | * 定义favicon请求 让favicon消失,解决访问文档时404异常,虽然不影响业务,但是一直提示异常不舒服 9 | *

10 | * 11 | * @author 谢诗宏 12 | * @since 2022-12-07 13 | */ 14 | @ApiIgnore 15 | @RestController 16 | @RequestMapping("/favicon.ico") 17 | public class FaviconController { 18 | 19 | @GetMapping("") 20 | void returnNoFavicon() { 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/controller/IncomeRecordController.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | /** 7 | *

8 | * 合伙人收益记录表 前端控制器 9 | *

10 | * 11 | * @author 谢诗宏 12 | * @since 2023-06-10 13 | */ 14 | @RestController 15 | @RequestMapping("/cac/incomeRecord") 16 | public class IncomeRecordController { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/controller/LabelController.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | /** 7 | *

8 | * 标签表 前端控制器 9 | *

10 | * 11 | * @author 谢诗宏 12 | * @since 2023-05-15 13 | */ 14 | @RestController 15 | @RequestMapping("/cac/label") 16 | public class LabelController { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/controller/RechargeRecordController.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | /** 7 | *

8 | * 会员充值记录表 前端控制器 9 | *

10 | * 11 | * @author 谢诗宏 12 | * @since 2023-06-06 13 | */ 14 | @RestController 15 | @RequestMapping("/cac/rechargeRecord") 16 | public class RechargeRecordController { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/controller/StoreBoxController.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.controller; 2 | 3 | import cn.hutool.core.bean.BeanUtil; 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; 5 | import com.geekuniverse.cac.common.enums.SystemError; 6 | import com.geekuniverse.cac.core.exception.BusinessException; 7 | import com.geekuniverse.cac.core.result.Result; 8 | import com.geekuniverse.cac.dto.StoreBoxDTO; 9 | import com.geekuniverse.cac.dto.StoreDTO; 10 | import com.geekuniverse.cac.entity.Store; 11 | import com.geekuniverse.cac.entity.StoreBox; 12 | import com.geekuniverse.cac.req.StoreAddReq; 13 | import com.geekuniverse.cac.req.StoreBoxAddReq; 14 | import com.geekuniverse.cac.service.IStoreBoxService; 15 | import com.geekuniverse.cac.service.IStoreService; 16 | import io.swagger.annotations.ApiOperation; 17 | import org.springframework.validation.annotation.Validated; 18 | import org.springframework.web.bind.annotation.*; 19 | 20 | import javax.annotation.Resource; 21 | import java.util.ArrayList; 22 | import java.util.Arrays; 23 | import java.util.List; 24 | 25 | /** 26 | *

27 | * 包厢表 前端控制器 28 | *

29 | * 30 | * @author 谢诗宏 31 | * @since 2023-05-15 32 | */ 33 | @RestController 34 | @RequestMapping("/box") 35 | public class StoreBoxController { 36 | 37 | @Resource 38 | private IStoreService storeService; 39 | 40 | @Resource 41 | private IStoreBoxService storeBoxService; 42 | 43 | @GetMapping("") 44 | public Result> list(@RequestParam(required = false) Integer storeId){ 45 | List boxs = storeBoxService.list(Wrappers.lambdaQuery().eq(storeId != null, StoreBox::getStoreId, storeId)); 46 | List result = BeanUtil.copyToList(boxs, StoreBoxDTO.class); 47 | result.forEach(box -> { 48 | Store store = storeService.getById(box.getStoreId()); 49 | box.setStoreName(store.getName()); 50 | }); 51 | return Result.success(result); 52 | } 53 | 54 | @PostMapping("") 55 | public Result add(@RequestBody @Validated StoreBoxAddReq req){ 56 | StoreBox box = BeanUtil.copyProperties(req, StoreBox.class); 57 | return Result.success(storeBoxService.save(box)); 58 | } 59 | 60 | @PutMapping("") 61 | public Result put(@RequestBody @Validated StoreBoxAddReq req){ 62 | if (req.getId() == null) throw new BusinessException(SystemError.SYS_409, "id"); 63 | StoreBox box = BeanUtil.copyProperties(req, StoreBox.class); 64 | box.setId(req.getId()); 65 | return Result.success(storeBoxService.updateById(box)); 66 | } 67 | 68 | @DeleteMapping("/{ids}") 69 | public Result remove(@PathVariable Integer[] ids) 70 | { 71 | return Result.success(storeBoxService.removeByIds(Arrays.asList(ids))); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/controller/StoreBoxLabelController.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | /** 7 | *

8 | * 包厢标签中间表 前端控制器 9 | *

10 | * 11 | * @author 谢诗宏 12 | * @since 2023-05-15 13 | */ 14 | @RestController 15 | @RequestMapping("/cac/storeBoxLabel") 16 | public class StoreBoxLabelController { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/controller/StoreController.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.controller; 2 | 3 | import cn.hutool.core.bean.BeanUtil; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; 6 | import com.geekuniverse.cac.common.enums.SystemError; 7 | import com.geekuniverse.cac.core.exception.BusinessException; 8 | import com.geekuniverse.cac.core.result.Result; 9 | import com.geekuniverse.cac.core.support.BaseController; 10 | import com.geekuniverse.cac.dto.StoreDTO; 11 | import com.geekuniverse.cac.dto.StoreDetailDTO; 12 | import com.geekuniverse.cac.entity.Store; 13 | import com.geekuniverse.cac.req.StoreAddReq; 14 | import com.geekuniverse.cac.req.StoreReq; 15 | import com.geekuniverse.cac.service.IStoreService; 16 | import io.swagger.annotations.Api; 17 | import io.swagger.annotations.ApiOperation; 18 | import lombok.extern.java.Log; 19 | import org.springframework.http.ResponseEntity; 20 | import org.springframework.validation.annotation.Validated; 21 | import org.springframework.web.bind.annotation.*; 22 | import org.springframework.web.multipart.MultipartFile; 23 | 24 | import javax.annotation.Resource; 25 | import java.util.Arrays; 26 | import java.util.List; 27 | import java.util.stream.Collectors; 28 | 29 | /** 30 | *

31 | * 门店表 前端控制器 32 | *

33 | * 34 | * @author 谢诗宏 35 | * @since 2023-05-15 36 | */ 37 | @Api(tags = "门店模块") 38 | @RestController 39 | @RequestMapping("/stores") 40 | public class StoreController extends BaseController { 41 | 42 | @Resource 43 | private IStoreService storeService; 44 | 45 | @ApiOperation(value = "门店列表") 46 | @PostMapping("") 47 | public Result> list(@RequestBody @Validated StoreReq req){ 48 | return Result.success(storeService.listPagesByName(req)); 49 | } 50 | 51 | @ApiOperation(value = "门店列表-管理后台接口使用") 52 | @GetMapping("") 53 | public Result> list(){ 54 | List stores = storeService.list(); 55 | return Result.success(BeanUtil.copyToList(stores, StoreDTO.class)); 56 | } 57 | 58 | @ApiOperation(value = "门店详情") 59 | @GetMapping("/{id}") 60 | public Result detail(@PathVariable Integer id){ 61 | return Result.success(storeService.selectById(id)); 62 | } 63 | 64 | @ApiOperation(value = "新增门店") 65 | @PostMapping("/add") 66 | public Result add(@RequestBody @Validated StoreAddReq req){ 67 | return Result.failed(SystemError.STORE_4000); 68 | //Store store = BeanUtil.copyProperties(req, Store.class); 69 | //return Result.success(storeService.save(store)); 70 | } 71 | 72 | @ApiOperation(value = "修改门店") 73 | @PutMapping("") 74 | public Result put(@RequestBody @Validated StoreAddReq req){ 75 | if (req.getId() == null) throw new BusinessException(SystemError.SYS_409, "id"); 76 | Store store = BeanUtil.copyProperties(req, Store.class); 77 | store.setId(req.getId()); 78 | return Result.success(storeService.updateById(store)); 79 | } 80 | 81 | @ApiOperation("删除门店") 82 | @DeleteMapping("/{ids}") 83 | public Result remove(@PathVariable Integer[] ids) 84 | { 85 | return Result.success(storeService.removeByIds(Arrays.asList(ids))); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/controller/UserAdminController.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.controller; 2 | 3 | import com.geekuniverse.cac.core.result.Result; 4 | import com.geekuniverse.cac.core.support.BaseController; 5 | import com.geekuniverse.cac.dto.UserAdminDTO; 6 | import com.geekuniverse.cac.entity.UserAdmin; 7 | import com.geekuniverse.cac.req.AdminLoginReq; 8 | import com.geekuniverse.cac.service.IUserAdminService; 9 | import org.springframework.validation.annotation.Validated; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestBody; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RestController; 14 | 15 | import javax.annotation.Resource; 16 | 17 | /** 18 | *

19 | * 前端控制器 20 | *

21 | * 22 | * @author 谢诗宏 23 | * @since 2023-05-25 24 | */ 25 | @RestController 26 | @RequestMapping("/user") 27 | public class UserAdminController extends BaseController { 28 | 29 | @Resource 30 | private IUserAdminService userAdminService; 31 | 32 | @PostMapping("/login") 33 | public Result login(@RequestBody @Validated AdminLoginReq req) { 34 | return Result.success(userAdminService.login(getResponse(), req)); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/controller/VipSetupController.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.controller; 2 | 3 | import cn.hutool.core.bean.BeanUtil; 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; 5 | import com.geekuniverse.cac.common.enums.SystemError; 6 | import com.geekuniverse.cac.core.exception.BusinessException; 7 | import com.geekuniverse.cac.core.result.Result; 8 | import com.geekuniverse.cac.dto.WithdrawalApplicationDTO; 9 | import com.geekuniverse.cac.entity.UserWechat; 10 | import com.geekuniverse.cac.entity.VipSetup; 11 | import com.geekuniverse.cac.entity.WithdrawalApplication; 12 | import com.geekuniverse.cac.req.VipSetupReq; 13 | import com.geekuniverse.cac.service.IVipSetupService; 14 | import io.swagger.annotations.ApiImplicitParam; 15 | import io.swagger.annotations.ApiImplicitParams; 16 | import io.swagger.annotations.ApiOperation; 17 | import org.springframework.validation.annotation.Validated; 18 | import org.springframework.web.bind.annotation.*; 19 | 20 | import javax.annotation.Resource; 21 | import java.math.BigDecimal; 22 | import java.util.List; 23 | 24 | /** 25 | *

26 | * 会员充值字典表 前端控制器 27 | *

28 | * 29 | * @author 谢诗宏 30 | * @since 2023-07-22 31 | */ 32 | @RestController 33 | @RequestMapping("/vip/rules") 34 | public class VipSetupController { 35 | 36 | @Resource 37 | private IVipSetupService vipSetupService; 38 | 39 | @GetMapping("") 40 | @ApiOperation(value = "规则列表", notes = "会员规则列表") 41 | public Result> applications() { 42 | List vipSetup = vipSetupService.list(); 43 | return Result.success(vipSetup); 44 | } 45 | 46 | @PutMapping("") 47 | @ApiOperation(value = "修改", notes = "修改会员规则") 48 | public Result edit(@RequestBody @Validated VipSetupReq req) { 49 | VipSetup vipSetup = vipSetupService.getById(req.getId()); 50 | if (vipSetup.getVipLevel() == 2 && req.getIncomeScale() == null) { 51 | throw new BusinessException(SystemError.USER_VIP_1100); 52 | } 53 | vipSetup.setRechargeAmount(req.getRechargeAmount()); 54 | vipSetup.setDiscountScale(req.getDiscountScale()); 55 | vipSetup.setIncomeScale(req.getIncomeScale()); 56 | vipSetupService.updateById(vipSetup); 57 | return Result.success(); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/controller/WithdrawalApplicationController.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.controller; 2 | 3 | import cn.hutool.core.bean.BeanUtil; 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; 5 | import com.geekuniverse.cac.common.enums.SystemError; 6 | import com.geekuniverse.cac.core.exception.BusinessException; 7 | import com.geekuniverse.cac.core.result.Result; 8 | import com.geekuniverse.cac.dto.WithdrawalApplicationDTO; 9 | import com.geekuniverse.cac.entity.Balance; 10 | import com.geekuniverse.cac.entity.UserWechat; 11 | import com.geekuniverse.cac.entity.WithdrawalApplication; 12 | import com.geekuniverse.cac.service.IBalanceService; 13 | import com.geekuniverse.cac.service.IUserWechatService; 14 | import com.geekuniverse.cac.service.IWithdrawalApplicationService; 15 | import io.swagger.annotations.ApiImplicitParam; 16 | import io.swagger.annotations.ApiImplicitParams; 17 | import io.swagger.annotations.ApiOperation; 18 | import org.springframework.web.bind.annotation.*; 19 | 20 | import javax.annotation.Resource; 21 | import java.math.BigDecimal; 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | /** 26 | *

27 | * 用户提现申请表 前端控制器 28 | *

29 | * 30 | * @author 谢诗宏 31 | * @since 2023-07-20 32 | */ 33 | @RestController 34 | @RequestMapping("/application/withdrawal") 35 | public class WithdrawalApplicationController { 36 | 37 | @Resource 38 | private IUserWechatService userWechatService; 39 | 40 | @Resource 41 | private IWithdrawalApplicationService withdrawalApplicationService; 42 | 43 | @GetMapping("") 44 | @ApiOperation(value = "提现申请列表", notes = "用户提现申请列表接口") 45 | @ApiImplicitParams 46 | ({ 47 | @ApiImplicitParam(name = "amount", value = "提现金额", required = true, dataType = "int", dataTypeClass = BigDecimal.class), 48 | @ApiImplicitParam(name = "qrcode", value = "收款二维码地址", required = true, dataType = "string", dataTypeClass = String.class) 49 | }) 50 | public Result> applications() { 51 | List applications = withdrawalApplicationService.list(Wrappers.lambdaQuery().orderByAsc(WithdrawalApplication::getStatus).orderByDesc(WithdrawalApplication::getCreateTime)); 52 | List result = BeanUtil.copyToList(applications, WithdrawalApplicationDTO.class); 53 | result.forEach(dto -> { 54 | UserWechat userWechat = userWechatService.getById(dto.getUserId()); 55 | dto.setAvatarUrl(userWechat.getAvatarUrl()); 56 | dto.setNickname(userWechat.getNickName()); 57 | dto.setPhone(userWechat.getPhone()); 58 | }); 59 | return Result.success(result); 60 | } 61 | 62 | @PutMapping("/pass/{id}/{status}") 63 | @ApiOperation(value = "通过申请", notes = "通过申请") 64 | @ApiImplicitParams 65 | ({ 66 | @ApiImplicitParam(name = "id", value = "申请ID", required = true, dataType = "int", dataTypeClass = Integer.class), 67 | @ApiImplicitParam(name = "status", value = "状态", required = true, dataType = "int", dataTypeClass = Integer.class) 68 | }) 69 | public Result pass(@PathVariable Integer id, @PathVariable Integer status) { 70 | WithdrawalApplication app = new WithdrawalApplication(); 71 | app.setId(id); 72 | app.setStatus(status); 73 | withdrawalApplicationService.updateById(app); 74 | return Result.success(); 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/core/annotation/ApiVersion.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.core.annotation; 2 | 3 | import org.springframework.web.bind.annotation.Mapping; 4 | 5 | import java.lang.annotation.*; 6 | 7 | /** 8 | * @description 自定义注解接口版本管理 9 | * @author 谢诗宏 10 | * @date 2023/1/1 11 | */ 12 | @Target({ElementType.METHOD, ElementType.TYPE}) // Annotation所修饰的对象范围,METHOD:用于描述方法,TYPE:用于描述类、接口(包括注解类型) 或enum声明 13 | @Retention(RetentionPolicy.RUNTIME) // 定义了该Annotation被保留的时间长短,RUNTIME:在运行时有效(即运行时保留 14 | @Documented // 用于描述其它类型的annotation应该被作为被标注的程序成员的公共API 15 | @Mapping 16 | public @interface ApiVersion { 17 | /** 18 | * 版本号,默认1 19 | * @return 20 | */ 21 | int value() default 1; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/core/exception/BusinessException.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.core.exception; 2 | 3 | import com.geekuniverse.cac.common.constants.ErrCode; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * @author 谢诗宏 9 | * @description user相关异常 10 | * @date 2022/12/15 11 | */ 12 | @Data 13 | @NoArgsConstructor 14 | public class BusinessException extends RuntimeException { 15 | 16 | private Integer code; 17 | 18 | public BusinessException(ErrCode errCode, Object... format) { 19 | super(String.format(errCode.getMsg(), format)); 20 | this.code = errCode.getCode(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/core/exception/GlobalExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.core.exception; 2 | 3 | import com.geekuniverse.cac.common.enums.SystemError; 4 | import com.geekuniverse.cac.core.result.Result; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.validation.BindException; 7 | import org.springframework.web.HttpRequestMethodNotSupportedException; 8 | import org.springframework.web.bind.MethodArgumentNotValidException; 9 | import org.springframework.web.bind.MissingServletRequestParameterException; 10 | import org.springframework.web.bind.annotation.ExceptionHandler; 11 | import org.springframework.web.bind.annotation.RestControllerAdvice; 12 | 13 | import javax.servlet.http.HttpServletRequest; 14 | import javax.servlet.http.HttpServletResponse; 15 | import java.util.Objects; 16 | 17 | /** 18 | * @Description: 全局异常处理 19 | * @author: 谢诗宏 20 | * @data: 2022-12-15 21 | */ 22 | @Slf4j 23 | @RestControllerAdvice 24 | public class GlobalExceptionHandler { 25 | 26 | /** 27 | * 绑定异常 28 | * 29 | * @param e 30 | * @return 31 | */ 32 | @ExceptionHandler(BindException.class) 33 | public Result defaultErrorHandler(BindException e) { 34 | /*log.error("【异常】{}", e);*/ 35 | Result result = new Result<>(); 36 | result.setCode(SystemError.SYS_402.getCode()); 37 | result.setMsg(Objects.requireNonNull(e.getBindingResult().getFieldError()).getDefaultMessage()); 38 | 39 | return result; 40 | } 41 | 42 | /** 43 | * 捕获Validator产生的异常错误,Bean 校验异常 Validate 44 | * 45 | * @param e 46 | * @return 47 | */ 48 | @ExceptionHandler(MethodArgumentNotValidException.class) 49 | public Result defaultErrorHandler(MethodArgumentNotValidException e) { 50 | /*log.error("【异常】{}", e);*/ 51 | Result result = new Result<>(); 52 | result.setCode(SystemError.SYS_402.getCode()); 53 | result.setMsg(Objects.requireNonNull(e.getBindingResult().getFieldError()).getDefaultMessage()); 54 | 55 | return result; 56 | } 57 | 58 | /** 59 | * 访问接口参数不全 60 | * 61 | * @param e 62 | * @return 63 | */ 64 | @ExceptionHandler(MissingServletRequestParameterException.class) 65 | public Result missingServletRequestParameterException(MissingServletRequestParameterException e) { 66 | Result result = new Result<>(); 67 | result.setCode(SystemError.SYS_409.getCode()); 68 | result.setMsg(String.format(SystemError.SYS_409.getMsg(), e.getParameterName())); 69 | return result; 70 | } 71 | 72 | /** 73 | * HttpRequestMethodNotSupportedException 请求方式错误处理 74 | * 75 | * @param e 76 | * @return 77 | */ 78 | @ExceptionHandler(HttpRequestMethodNotSupportedException.class) 79 | public Result httpRequestMethodNotSupportedException(HttpRequestMethodNotSupportedException e) { 80 | return Result.failed(SystemError.SYS_410); 81 | } 82 | 83 | /** 84 | * 系统异常处理 85 | * 86 | * @param request 87 | * @param e 88 | * @return 89 | * @throws Exception 90 | */ 91 | @ExceptionHandler(Exception.class) 92 | public Result defaultErrorHandler(HttpServletRequest request, HttpServletResponse response, Exception e) { 93 | log.error("【全局系统异常】", e); 94 | Result result; 95 | 96 | if (e instanceof BusinessException) { 97 | BusinessException businessException = (BusinessException) e; 98 | result = Result.failed(businessException); 99 | } else { 100 | if (e instanceof org.springframework.web.servlet.NoHandlerFoundException) { 101 | result = Result.failed(SystemError.SYS_404); 102 | } else if (e instanceof org.springframework.http.converter.HttpMessageNotReadableException && e.getMessage().contains("Required request body is missing:")) { 103 | result = Result.failed(SystemError.SYS_402); 104 | } else if (e instanceof org.springframework.http.converter.HttpMessageNotReadableException && e.getMessage().contains("JSON parse error:")) { 105 | int beginIndex = e.getMessage().indexOf("[\""); 106 | int endIndex = e.getMessage().indexOf("\"])", beginIndex); 107 | result = new Result<>(); 108 | result.setCode(SystemError.SYS_418.getCode()); 109 | result.setMsg(String.format(SystemError.SYS_418.getMsg(), e.getMessage().substring(beginIndex + 2, endIndex))); 110 | } else { 111 | result = Result.failed(SystemError.SYS_500); 112 | result.setErrDesc(e.getMessage()); 113 | } 114 | } 115 | 116 | return result; 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/core/exception/MainsiteErrorController.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.core.exception; 2 | 3 | import com.geekuniverse.cac.common.enums.SystemError; 4 | import org.springframework.boot.web.servlet.error.ErrorController; 5 | import org.springframework.http.HttpStatus; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | import springfox.documentation.annotations.ApiIgnore; 9 | 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | 13 | @ApiIgnore 14 | @RestController 15 | public class MainsiteErrorController implements ErrorController { 16 | private static final String ERROR_PATH = "/error"; 17 | 18 | @RequestMapping(value=ERROR_PATH) 19 | public void handleError(HttpServletRequest request, HttpServletResponse response, Exception e) { 20 | HttpStatus status = getStatus(request); 21 | Throwable throwable = (Throwable)request.getAttribute("javax.servlet.error.exception"); 22 | if (throwable != null) { 23 | String message = throwable.getMessage(); 24 | } else { 25 | SystemError result = SystemError.getDefined(status.value()); 26 | throw new BusinessException(result); 27 | } 28 | } 29 | 30 | /** 31 | * 获取错误编码 32 | * @param request 33 | * @return 34 | */ 35 | private HttpStatus getStatus(HttpServletRequest request) { 36 | Integer statusCode = (Integer) request 37 | .getAttribute("javax.servlet.error.status_code"); 38 | if (statusCode == null) { 39 | return HttpStatus.INTERNAL_SERVER_ERROR; 40 | } 41 | try { 42 | return HttpStatus.valueOf(statusCode); 43 | } catch (Exception ex) { 44 | return HttpStatus.INTERNAL_SERVER_ERROR; 45 | } 46 | } 47 | 48 | @Override 49 | public String getErrorPath() { 50 | return ERROR_PATH; 51 | } 52 | } -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/core/model/TokenUser.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.core.model; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | import java.time.LocalDateTime; 7 | 8 | /** 9 | * @description 用户token信息 10 | * @author 谢诗宏 11 | * @date 2022/12/18 12 | */ 13 | @Data 14 | public class TokenUser implements Serializable { 15 | 16 | private static final long serialVersionUID = 1L; 17 | 18 | private Integer id; 19 | 20 | /** 21 | * 设备id 22 | */ 23 | private String deviceId; 24 | 25 | /** 26 | * 账号 27 | */ 28 | private String account; 29 | 30 | /** 31 | * 用户昵称 32 | */ 33 | private String nickName; 34 | 35 | /** 36 | * 用户头像 37 | */ 38 | private String avatarUrl; 39 | 40 | /** 41 | * 账号平台类型。1:google;2:facebook 42 | */ 43 | private Integer type; 44 | 45 | /** 46 | * 1=free免费版,2=Basic edition基础版,3=professional edition专业版,4=Flagship旗舰版 47 | */ 48 | private Integer role; 49 | 50 | /** 51 | * 平台用户最后登录时间 52 | */ 53 | private LocalDateTime lastLoginTime; 54 | 55 | /** 56 | * 平台用户最后修改时间 57 | */ 58 | private LocalDateTime gmtModified; 59 | 60 | /** 61 | * 登录类型,APP/PC 62 | */ 63 | private Integer loginType; 64 | 65 | private String openid; 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/core/req/PageReq.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.core.req; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | 5 | /** 6 | * 页面分页请求 7 | * 8 | * @author 谢诗宏 9 | * @date 2023/05/15 10 | */ 11 | public abstract class PageReq { 12 | private static final long serialVersionUID = 1L; 13 | 14 | public static final String ASC = "ASC"; 15 | 16 | public static final String DESC = "DESC"; 17 | 18 | private static final int DEFAULT_PAGE_SIZE = 10; 19 | 20 | @ApiModelProperty("每页大小") 21 | private int pageSize = DEFAULT_PAGE_SIZE; 22 | 23 | @ApiModelProperty("页码") 24 | private int pageIndex = 1; 25 | 26 | private String orderBy; 27 | 28 | private String orderDirection = DESC; 29 | 30 | private String groupBy; 31 | 32 | private boolean needTotalCount = true; 33 | 34 | public int getPageIndex() { 35 | if (pageIndex < 1) { 36 | return 1; 37 | } 38 | return pageIndex; 39 | } 40 | 41 | public PageReq setPageIndex(int pageIndex) { 42 | this.pageIndex = pageIndex; 43 | return this; 44 | } 45 | 46 | public int getPageSize() { 47 | if (pageSize < 1) { 48 | pageSize = DEFAULT_PAGE_SIZE; 49 | } 50 | return pageSize; 51 | } 52 | 53 | public PageReq setPageSize(int pageSize) { 54 | if (pageSize < 1) { 55 | pageSize = DEFAULT_PAGE_SIZE; 56 | } 57 | this.pageSize = pageSize; 58 | return this; 59 | } 60 | 61 | public int getOffset() { 62 | return (getPageIndex() - 1) * getPageSize(); 63 | } 64 | 65 | public String getOrderBy() { 66 | return orderBy; 67 | } 68 | 69 | public PageReq setOrderBy(String orderBy) { 70 | this.orderBy = orderBy; 71 | return this; 72 | } 73 | 74 | public String getOrderDirection() { 75 | return orderDirection; 76 | } 77 | 78 | public PageReq setOrderDirection(String orderDirection) { 79 | if (ASC.equalsIgnoreCase(orderDirection) || DESC.equalsIgnoreCase(orderDirection)) { 80 | this.orderDirection = orderDirection; 81 | } 82 | return this; 83 | } 84 | 85 | public String getGroupBy() { 86 | return groupBy; 87 | } 88 | 89 | public void setGroupBy(String groupBy) { 90 | this.groupBy = groupBy; 91 | } 92 | 93 | public boolean isNeedTotalCount() { 94 | return needTotalCount; 95 | } 96 | 97 | public void setNeedTotalCount(boolean needTotalCount) { 98 | this.needTotalCount = needTotalCount; 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/core/result/Result.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.core.result; 2 | 3 | import com.geekuniverse.cac.common.constants.ErrCode; 4 | import com.geekuniverse.cac.common.enums.SystemError; 5 | import com.geekuniverse.cac.core.exception.BusinessException; 6 | import lombok.Data; 7 | import org.springframework.util.CollectionUtils; 8 | 9 | import java.io.Serializable; 10 | import java.util.Collection; 11 | 12 | /** 13 | * @author 谢诗宏 14 | * @description 统一响应格式 15 | * @date 2022/12/10 16 | */ 17 | @Data 18 | public class Result implements Serializable { 19 | 20 | private int code = 0; 21 | private String msg = "成功"; 22 | private String errDesc; 23 | private T data; 24 | 25 | public Result() { 26 | 27 | } 28 | 29 | public Result(T data) { 30 | setData(data); 31 | } 32 | 33 | public static Result success() { 34 | return new Result<>(); 35 | } 36 | 37 | public static Result success(T data) { 38 | return new Result<>(data); 39 | } 40 | 41 | public static Result failed(Result c) { 42 | return new Result<>(c.getCode(), c.getMsg()); 43 | } 44 | 45 | public static Result failed(int code, String msg) { 46 | return new Result<>(code, msg); 47 | } 48 | 49 | public static Result failed(ErrCode err, Object... format) { 50 | String msg = format.length > 0 ? String.format(err.getMsg(), format) : err.getMsg(); 51 | return new Result<>(err.getCode(), msg); 52 | } 53 | 54 | public static Result failed(BusinessException e) { 55 | return new Result<>(e.getCode(), e.getMessage()); 56 | } 57 | 58 | 59 | public Result(int code, String msg) { 60 | this.code = code; 61 | this.msg = msg; 62 | } 63 | 64 | public Result(int code, String msg, String errDesc) { 65 | this.code = code; 66 | this.msg = msg; 67 | this.errDesc = errDesc; 68 | } 69 | 70 | public Result(int code, String msg, T data) { 71 | setCode(code); 72 | setMsg(msg); 73 | setData(data); 74 | } 75 | 76 | public Result(BusinessException e) { 77 | this.code = e.getCode(); 78 | this.msg = e.getMessage(); 79 | } 80 | 81 | public boolean isSuccess() { 82 | return this.code == 0; 83 | } 84 | 85 | /** 86 | * 是否操作成功 87 | * 88 | * @param 89 | * @return 90 | */ 91 | public T ok() { 92 | if (this.code == 0) 93 | return this.data; 94 | throw new BusinessException(SystemError.getDefined(this.code)); 95 | } 96 | 97 | /** 98 | * 是否操作成功,且存在数据 99 | * 100 | * @param 101 | * @return 102 | */ 103 | public T okExist() { 104 | ok(); 105 | if (this.data == null) 106 | throw new BusinessException(SystemError.SYS_411); 107 | if (this.data instanceof Collection && CollectionUtils.isEmpty((Collection) this.data)) 108 | throw new BusinessException(SystemError.SYS_411); 109 | return this.data; 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/core/support/BaseController.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.core.support; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.geekuniverse.cac.common.constants.Constants; 5 | import com.geekuniverse.cac.common.utils.TokenUtil; 6 | import com.geekuniverse.cac.core.model.TokenUser; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.apache.commons.lang3.StringUtils; 9 | import org.apache.logging.log4j.util.Strings; 10 | import org.springframework.web.context.request.RequestContextHolder; 11 | import org.springframework.web.context.request.ServletRequestAttributes; 12 | 13 | import javax.servlet.http.HttpServletRequest; 14 | import javax.servlet.http.HttpServletResponse; 15 | import java.util.*; 16 | 17 | /** 18 | * @description 公共controller基类 19 | * @author 谢诗宏 20 | * @date 2022/12/18 21 | */ 22 | @Slf4j 23 | public class BaseController { 24 | 25 | /** 26 | * 得到request对象 27 | */ 28 | public HttpServletRequest getRequest() { 29 | return ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest(); 30 | } 31 | 32 | /** 33 | * 得到response对象 34 | */ 35 | public HttpServletResponse getResponse() { 36 | return ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getResponse(); 37 | } 38 | 39 | /** 40 | * id字符串转换成idList 41 | * @param ids ids 42 | * @return 43 | */ 44 | public List formatIds(String ids) { 45 | if (ids == null) { 46 | return null; 47 | } 48 | List id = new ArrayList<>(); 49 | String[] strings = ids.split(","); 50 | for (String string : strings) { 51 | id.add(Long.valueOf(string)); 52 | } 53 | return id; 54 | } 55 | 56 | /** 57 | * 时间查询区间字符串转换 58 | * @param startTime 59 | * @return 60 | */ 61 | public Map formatStartTime(String startTime) { 62 | Map map = new HashMap(); 63 | if (StringUtils.isNotBlank(startTime)) { 64 | String[] parts = startTime.split(" - "); 65 | map.put("startTime", parts[0]); 66 | map.put("endTime", parts[1]); 67 | } 68 | return map; 69 | } 70 | 71 | /** 72 | * 获取当前用户token 73 | * @return 74 | */ 75 | public TokenUser getUser() { 76 | String token = getRequest().getHeader(Constants.JWT_TOKEN_HEADER); 77 | return TokenUtil.parse(token); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/dto/AdminStoreDTO.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.dto; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | import java.io.Serializable; 8 | import java.math.BigDecimal; 9 | 10 | /** 11 | *

12 | * 门店表 13 | *

14 | * 15 | * @author 谢诗宏 16 | * @since 2023-05-15 17 | */ 18 | @Getter 19 | @Setter 20 | public class AdminStoreDTO implements Serializable { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | private Integer id; 25 | 26 | @ApiModelProperty("门店名") 27 | private String name; 28 | 29 | @ApiModelProperty("门店封面") 30 | private String cover; 31 | 32 | @ApiModelProperty("地址") 33 | private String address; 34 | 35 | @ApiModelProperty("经度") 36 | private BigDecimal lng; 37 | 38 | @ApiModelProperty("纬度") 39 | private BigDecimal lat; 40 | 41 | @ApiModelProperty("电话") 42 | private String phone; 43 | 44 | @ApiModelProperty("距离,单位km") 45 | private Double distance; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/dto/LabelDTO.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.dto; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import io.swagger.annotations.ApiModel; 7 | import io.swagger.annotations.ApiModelProperty; 8 | import lombok.Getter; 9 | import lombok.Setter; 10 | import lombok.experimental.Accessors; 11 | 12 | import java.io.Serializable; 13 | 14 | /** 15 | *

16 | * 标签表 17 | *

18 | * 19 | * @author 谢诗宏 20 | * @since 2023-05-15 21 | */ 22 | @Getter 23 | @Setter 24 | @ApiModel(value = "Label对象", description = "标签表") 25 | public class LabelDTO implements Serializable { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | @ApiModelProperty("标签") 30 | private String label; 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/dto/OrderDetailDTO.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.dto; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | import java.io.Serializable; 8 | import java.math.BigDecimal; 9 | import java.time.LocalDateTime; 10 | 11 | /** 12 | *

13 | * 订单详情 14 | *

15 | * 16 | * @author 谢诗宏 17 | * @since 2023-05-15 18 | */ 19 | @Getter 20 | @Setter 21 | public class OrderDetailDTO implements Serializable { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | private Integer id; 26 | 27 | @ApiModelProperty("包厢名称") 28 | private String boxName; 29 | 30 | @ApiModelProperty("门店名称") 31 | private String storeName; 32 | 33 | @ApiModelProperty("包厢id") 34 | private Integer boxId; 35 | 36 | @ApiModelProperty("门店id") 37 | private Integer storeId; 38 | 39 | @ApiModelProperty("地址") 40 | private String address; 41 | 42 | @ApiModelProperty("经度") 43 | private BigDecimal lng; 44 | 45 | @ApiModelProperty("纬度") 46 | private BigDecimal lat; 47 | 48 | @ApiModelProperty("总时长") 49 | private BigDecimal duration; 50 | 51 | @ApiModelProperty("电话") 52 | private String phone; 53 | 54 | @ApiModelProperty("实际付款金额") 55 | private BigDecimal paymentAmount; 56 | 57 | @ApiModelProperty("包厢图,多个逗号分隔") 58 | private String imgs; 59 | 60 | @ApiModelProperty("用户名") 61 | private String nickName; 62 | 63 | @ApiModelProperty("下单时间") 64 | private LocalDateTime createTime; 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/dto/OrderListDTO.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | import java.io.Serializable; 9 | import java.math.BigDecimal; 10 | import java.time.LocalDateTime; 11 | 12 | /** 13 | *

14 | * 订单列表 15 | *

16 | * 17 | * @author 谢诗宏 18 | * @since 2023-05-15 19 | */ 20 | @Getter 21 | @Setter 22 | public class OrderListDTO implements Serializable { 23 | 24 | private static final long serialVersionUID = 1L; 25 | 26 | private Integer id; 27 | 28 | @ApiModelProperty("订单号") 29 | private String orderNo; 30 | 31 | @ApiModelProperty("包厢名称") 32 | private String boxName; 33 | 34 | @ApiModelProperty("包厢封面") 35 | private String boxCover; 36 | 37 | @ApiModelProperty("门店名称") 38 | private String storeName; 39 | 40 | @ApiModelProperty("包厢id") 41 | private Integer boxId; 42 | 43 | @ApiModelProperty("门店id") 44 | private Integer storeId; 45 | 46 | @ApiModelProperty("地址") 47 | private String address; 48 | 49 | @ApiModelProperty("经度") 50 | private BigDecimal lng; 51 | 52 | @ApiModelProperty("纬度") 53 | private BigDecimal lat; 54 | 55 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 56 | @ApiModelProperty("开始时间") 57 | private LocalDateTime startTime; 58 | 59 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 60 | @ApiModelProperty("结束时间") 61 | private LocalDateTime endTime; 62 | 63 | @ApiModelProperty("总时长") 64 | private BigDecimal duration; 65 | 66 | @ApiModelProperty("电话") 67 | private String phone; 68 | 69 | @ApiModelProperty("实际付款金额") 70 | private BigDecimal paymentAmount; 71 | 72 | @ApiModelProperty("用户ID") 73 | private Integer userId; 74 | 75 | @ApiModelProperty("用户昵称") 76 | private String nickName; 77 | 78 | @ApiModelProperty(value = "支付状态,1=已支付,2=已退款") 79 | private Integer payStatus; 80 | 81 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 82 | @ApiModelProperty("创建时间") 83 | private LocalDateTime createTime; 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/dto/Outfall.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.dto; 2 | 3 | import com.alibaba.excel.annotation.ExcelProperty; 4 | import lombok.Data; 5 | 6 | import java.math.BigDecimal; 7 | 8 | /** 9 | * @name: Outfall 10 | * @author: 谢诗宏 11 | * @date: 2023-05-25 15:58 12 | **/ 13 | @Data 14 | public class Outfall { 15 | 16 | @ExcelProperty("排口编号") 17 | private String outfallId; 18 | 19 | @ExcelProperty("排口名称") 20 | private String outfallName; 21 | 22 | @ExcelProperty("经度") 23 | private BigDecimal lng; 24 | 25 | @ExcelProperty("纬度") 26 | private BigDecimal lat; 27 | 28 | @ExcelProperty("排口类型") 29 | private String outfallType; 30 | 31 | @ExcelProperty("所属河流") 32 | private String riverName; 33 | 34 | @ExcelProperty("排口尺寸") 35 | private String outfallSize; 36 | 37 | @ExcelProperty("项目编号") 38 | private Integer projectCode; 39 | 40 | @ExcelProperty("现场照片") 41 | private String img; 42 | 43 | @ExcelProperty("整改前") 44 | private String rectifyBefore; 45 | 46 | @ExcelProperty("整改后") 47 | private String rectifyAfter; 48 | 49 | @ExcelProperty("排口类型id") 50 | private Integer outfallTypeId; 51 | 52 | @ExcelProperty("河流id") 53 | private Integer riverId; 54 | 55 | @ExcelProperty("省id") 56 | private Integer province; 57 | 58 | @ExcelProperty("市id") 59 | private Integer city; 60 | 61 | @ExcelProperty("区id") 62 | private Integer area; 63 | 64 | @ExcelProperty("地址") 65 | private String address; 66 | 67 | @ExcelProperty("上传人员") 68 | private String uploader; 69 | 70 | @ExcelProperty("上传人员手机号") 71 | private String uploaderPhone; 72 | 73 | @ExcelProperty("有无水") 74 | private String havaWater; 75 | 76 | @ExcelProperty("单位") 77 | private String company; 78 | 79 | @ExcelProperty("左右岸") 80 | private String banks; 81 | 82 | @ExcelProperty("是否整治") 83 | private String isRectify; 84 | 85 | @ExcelProperty("整治措施") 86 | private String rectifyMethod; 87 | 88 | @ExcelProperty("水质等级") 89 | private String waterGrades; 90 | 91 | @ExcelProperty("水温") 92 | private String waterTemp; 93 | 94 | @ExcelProperty("ph") 95 | private String ph; 96 | 97 | @ExcelProperty("电导率") 98 | private String cond; 99 | 100 | @ExcelProperty("溶解氧") 101 | private String DO; 102 | 103 | @ExcelProperty("化学需氧量") 104 | private String cod; 105 | 106 | @ExcelProperty("氨氮") 107 | private String NH3N; 108 | 109 | @ExcelProperty("浊度") 110 | private String td; 111 | 112 | @ExcelProperty("总氮") 113 | private String tn; 114 | 115 | @ExcelProperty("总磷") 116 | private String tp; 117 | 118 | @ExcelProperty("排口受水区(格式需与样例格式相同)") 119 | private String receivingArea; 120 | 121 | @ExcelProperty("污染河段") 122 | private String pits; 123 | 124 | @ExcelProperty("重点污染企业名称(包括污水处理厂)") 125 | private String pollutingEnterprisesName; 126 | 127 | @ExcelProperty("重点污染企业经度") 128 | private String pollutingEnterprisesLng; 129 | 130 | @ExcelProperty("重点污染企业纬度") 131 | private String pollutingEnterprisesLat; 132 | 133 | @ExcelProperty("重点污染企业地址") 134 | private String pollutingEnterprisesAddress; 135 | 136 | @ExcelProperty("权属单位") 137 | private String ownershipUnit; 138 | 139 | @ExcelProperty("收纳水体") 140 | private String receivingWater; 141 | 142 | @ExcelProperty("容量") 143 | private String capacity; 144 | 145 | @ExcelProperty("工艺") 146 | private String technology; 147 | 148 | @ExcelProperty("摄入量") 149 | private String intake; 150 | 151 | @ExcelProperty("服务人数") 152 | private String serviceNumber; 153 | 154 | @ExcelProperty("管理员") 155 | private String administrator; 156 | 157 | @ExcelProperty("土地利用类型(打包发给录入人员。图层字段需包括type(1生活、2鱼塘、3农田、4湖泊、5湿地、6荒地。)site_id(点位id))") 158 | private String landUseType; 159 | } 160 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/dto/StoreBoxDTO.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.dto; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableField; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | 9 | import java.io.Serializable; 10 | import java.math.BigDecimal; 11 | import java.time.LocalDateTime; 12 | import java.util.List; 13 | 14 | /** 15 | *

16 | * 包厢 17 | *

18 | * 19 | * @author 谢诗宏 20 | * @since 2023-05-15 21 | */ 22 | @Getter 23 | @Setter 24 | public class StoreBoxDTO implements Serializable { 25 | 26 | private static final long serialVersionUID = 1L; 27 | 28 | private Integer id; 29 | 30 | @ApiModelProperty("包厢名") 31 | private String name; 32 | 33 | @ApiModelProperty("门店ID") 34 | private Integer storeId; 35 | 36 | @ApiModelProperty("所属门店") 37 | private String storeName; 38 | 39 | @ApiModelProperty("包厢图片,多个逗号分隔") 40 | private String imgs; 41 | 42 | @ApiModelProperty("包厢简介") 43 | private String intro; 44 | 45 | @ApiModelProperty("每小时单价") 46 | private BigDecimal hourlyPrice; 47 | 48 | @ApiModelProperty("出门开关设备ID") 49 | private String deviceSocket10a; 50 | 51 | @ApiModelProperty("插座16A设备ID") 52 | private String deviceSocket16a; 53 | 54 | @ApiModelProperty("最少几小时起") 55 | private Integer minHours; 56 | 57 | @ApiModelProperty("自动关闭设备,0否1是") 58 | private Integer autoClose; 59 | 60 | @ApiModelProperty("包厢状态,1=空闲 2=已售") 61 | private Integer status = 1; 62 | 63 | @ApiModelProperty("标签") 64 | private List labels; 65 | 66 | @ApiModelProperty("不可用时间段") 67 | private List usagePeriod; 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/dto/StoreDTO.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.dto; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | import java.io.Serializable; 8 | import java.math.BigDecimal; 9 | 10 | /** 11 | *

12 | * 门店表 13 | *

14 | * 15 | * @author 谢诗宏 16 | * @since 2023-05-15 17 | */ 18 | @Getter 19 | @Setter 20 | public class StoreDTO implements Serializable { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | private Integer id; 25 | 26 | @ApiModelProperty("门店名") 27 | private String name; 28 | 29 | @ApiModelProperty("门店封面") 30 | private String cover; 31 | 32 | @ApiModelProperty("地址") 33 | private String address; 34 | 35 | @ApiModelProperty("经度") 36 | private BigDecimal lng; 37 | 38 | @ApiModelProperty("纬度") 39 | private BigDecimal lat; 40 | 41 | @ApiModelProperty("最少几小时起") 42 | private Integer minHours; 43 | 44 | @ApiModelProperty("电话") 45 | private String phone; 46 | 47 | @ApiModelProperty("距离,单位km") 48 | private Double distance; 49 | 50 | @ApiModelProperty("包厢数量") 51 | private Integer boxCount; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/dto/StoreDetailDTO.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.dto; 2 | 3 | import io.swagger.annotations.ApiModelProperty; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | import java.io.Serializable; 8 | import java.math.BigDecimal; 9 | import java.util.List; 10 | 11 | /** 12 | *

13 | * 门店表 14 | *

15 | * 16 | * @author 谢诗宏 17 | * @since 2023-05-15 18 | */ 19 | @Getter 20 | @Setter 21 | public class StoreDetailDTO implements Serializable { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | private Integer id; 26 | 27 | @ApiModelProperty("门店名") 28 | private String name; 29 | 30 | @ApiModelProperty("门店封面") 31 | private String cover; 32 | 33 | @ApiModelProperty("地址") 34 | private String address; 35 | 36 | @ApiModelProperty("经度") 37 | private BigDecimal lng; 38 | 39 | @ApiModelProperty("纬度") 40 | private BigDecimal lat; 41 | 42 | @ApiModelProperty("电话") 43 | private String phone; 44 | 45 | @ApiModelProperty("最少几小时起") 46 | private Integer minHours; 47 | 48 | @ApiModelProperty("包厢集合") 49 | private List boxs; 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/dto/UsagePeriodDTO.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | import java.time.LocalDateTime; 8 | 9 | /** 10 | * 包厢不可用时间段 11 | * 12 | * @name: UsagePeriodDTO 13 | * @author: 谢诗宏 14 | * @date: 2023-05-20 18:19 15 | **/ 16 | @Data 17 | public class UsagePeriodDTO { 18 | 19 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm") 20 | @ApiModelProperty("不可用时间段-开始时间") 21 | private LocalDateTime startTime; 22 | 23 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm") 24 | @ApiModelProperty("不可用时间段-结束时间") 25 | private LocalDateTime endTime; 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/dto/UserAdminDTO.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.dto; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import com.fasterxml.jackson.annotation.JsonFormat; 7 | import com.fasterxml.jackson.annotation.JsonIgnore; 8 | import io.swagger.annotations.ApiModel; 9 | import io.swagger.annotations.ApiModelProperty; 10 | import lombok.Getter; 11 | import lombok.Setter; 12 | import lombok.experimental.Accessors; 13 | 14 | import java.io.Serializable; 15 | import java.time.LocalDateTime; 16 | 17 | /** 18 | *

19 | * 20 | *

21 | * 22 | * @author 谢诗宏 23 | * @since 2023-05-25 24 | */ 25 | @Getter 26 | @Setter 27 | @Accessors(chain = true) 28 | public class UserAdminDTO implements Serializable { 29 | 30 | private static final long serialVersionUID = 1L; 31 | 32 | @TableId(value = "id", type = IdType.AUTO) 33 | private Integer id; 34 | 35 | @ApiModelProperty("账号") 36 | private String account; 37 | 38 | @ApiModelProperty("密码") 39 | @JsonIgnore 40 | private String password; 41 | 42 | @ApiModelProperty("昵称") 43 | private String nickname; 44 | 45 | @ApiModelProperty("token") 46 | private String token; 47 | 48 | @ApiModelProperty("token过期时间") 49 | private Long failureTime; 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/dto/UserListAdminDTO.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.dto; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.fasterxml.jackson.annotation.JsonFormat; 7 | import com.fasterxml.jackson.annotation.JsonIgnore; 8 | import io.swagger.annotations.ApiModelProperty; 9 | import lombok.Getter; 10 | import lombok.Setter; 11 | import lombok.experimental.Accessors; 12 | 13 | import java.io.Serializable; 14 | import java.math.BigDecimal; 15 | import java.time.LocalDateTime; 16 | 17 | /** 18 | *

19 | * 20 | *

21 | * 22 | * @author 谢诗宏 23 | * @since 2023-05-25 24 | */ 25 | @Getter 26 | @Setter 27 | @Accessors(chain = true) 28 | public class UserListAdminDTO implements Serializable { 29 | 30 | private static final long serialVersionUID = 1L; 31 | 32 | @TableId(value = "id", type = IdType.AUTO) 33 | private Integer id; 34 | 35 | @ApiModelProperty("头像") 36 | private String avatarUrl; 37 | 38 | @ApiModelProperty("手机号") 39 | private String phone; 40 | 41 | @ApiModelProperty("昵称") 42 | private String nickName; 43 | 44 | @ApiModelProperty("0=普通用户,1=普通会员,2=经营合伙人") 45 | private Integer vipLevel; 46 | 47 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 48 | @ApiModelProperty("会员开通时间") 49 | private LocalDateTime vipOpening; 50 | 51 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 52 | @ApiModelProperty("会员到期时间") 53 | private LocalDateTime vipExpire; 54 | 55 | @ApiModelProperty("充值余额") 56 | @TableField(exist = false) 57 | private BigDecimal rechargeBalance = BigDecimal.ZERO; 58 | 59 | @ApiModelProperty("盈利余额") 60 | @TableField(exist = false) 61 | private BigDecimal incomeBalance = BigDecimal.ZERO; 62 | 63 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 64 | @ApiModelProperty("注册时间") 65 | private LocalDateTime createTime; 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/dto/WithdrawalApplicationDTO.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.dto; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import com.fasterxml.jackson.annotation.JsonFormat; 7 | import io.swagger.annotations.ApiModel; 8 | import io.swagger.annotations.ApiModelProperty; 9 | import lombok.Getter; 10 | import lombok.Setter; 11 | import lombok.experimental.Accessors; 12 | 13 | import java.io.Serializable; 14 | import java.math.BigDecimal; 15 | import java.time.LocalDateTime; 16 | 17 | /** 18 | *

19 | * 用户提现申请表 20 | *

21 | * 22 | * @author 谢诗宏 23 | * @since 2023-07-20 24 | */ 25 | @Getter 26 | @Setter 27 | @Accessors(chain = true) 28 | public class WithdrawalApplicationDTO implements Serializable { 29 | 30 | private static final long serialVersionUID = 1L; 31 | 32 | private Integer id; 33 | 34 | @ApiModelProperty("用户ID") 35 | private Integer userId; 36 | 37 | @ApiModelProperty("用户头像") 38 | private String avatarUrl; 39 | 40 | @ApiModelProperty("用户名") 41 | private String nickname; 42 | 43 | @ApiModelProperty("手机号") 44 | private String phone; 45 | 46 | @ApiModelProperty("申请提现金额") 47 | private BigDecimal withdrawalAmount; 48 | 49 | @ApiModelProperty("用户收款二维码") 50 | private String paymentCode; 51 | 52 | @ApiModelProperty("1提现申请中,2拒绝提现,3提现成功") 53 | private Integer status; 54 | 55 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 56 | @ApiModelProperty("创建时间") 57 | private LocalDateTime createTime; 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/entity/Balance.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import java.io.Serializable; 7 | import java.math.BigDecimal; 8 | import java.time.LocalDateTime; 9 | import io.swagger.annotations.ApiModel; 10 | import io.swagger.annotations.ApiModelProperty; 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import lombok.experimental.Accessors; 14 | 15 | /** 16 | *

17 | * 用户余额表 18 | *

19 | * 20 | * @author 谢诗宏 21 | * @since 2023-07-20 22 | */ 23 | @Getter 24 | @Setter 25 | @Accessors(chain = true) 26 | @TableName("t_balance") 27 | @ApiModel(value = "Balance对象", description = "用户余额表") 28 | public class Balance implements Serializable { 29 | 30 | private static final long serialVersionUID = 1L; 31 | 32 | @TableId(value = "id", type = IdType.AUTO) 33 | private Integer id; 34 | 35 | @ApiModelProperty("用户ID") 36 | private Integer userId; 37 | 38 | @ApiModelProperty("充值余额") 39 | private BigDecimal rechargeBalance; 40 | 41 | @ApiModelProperty("盈利余额") 42 | private BigDecimal incomeBalance; 43 | 44 | @ApiModelProperty("创建时间") 45 | private LocalDateTime createTime; 46 | 47 | @ApiModelProperty("更新时间") 48 | private LocalDateTime updateTime; 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/entity/IncomeRecord.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import java.io.Serializable; 7 | import java.math.BigDecimal; 8 | import java.time.LocalDateTime; 9 | import io.swagger.annotations.ApiModel; 10 | import io.swagger.annotations.ApiModelProperty; 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import lombok.experimental.Accessors; 14 | 15 | /** 16 | *

17 | * 合伙人收益记录表 18 | *

19 | * 20 | * @author 谢诗宏 21 | * @since 2023-06-10 22 | */ 23 | @Getter 24 | @Setter 25 | @Accessors(chain = true) 26 | @TableName("t_income_record") 27 | @ApiModel(value = "IncomeRecord对象", description = "合伙人收益记录表") 28 | public class IncomeRecord implements Serializable { 29 | 30 | private static final long serialVersionUID = 1L; 31 | 32 | @TableId(value = "id", type = IdType.AUTO) 33 | private Integer id; 34 | 35 | @ApiModelProperty("合伙人用户ID") 36 | private Integer userId; 37 | 38 | @ApiModelProperty("收益金额") 39 | private BigDecimal incomeAmount; 40 | 41 | @ApiModelProperty("收益比例") 42 | private BigDecimal incomeScale; 43 | 44 | @ApiModelProperty("来源订单ID") 45 | private Integer orderId; 46 | 47 | @ApiModelProperty("来源订单金额") 48 | private BigDecimal orderAmount; 49 | 50 | @ApiModelProperty("来源下单用户ID") 51 | private Integer orderUserId; 52 | 53 | @ApiModelProperty("下单时间") 54 | private LocalDateTime orderTime; 55 | 56 | @ApiModelProperty("创建时间") 57 | private LocalDateTime createTime; 58 | 59 | @ApiModelProperty("更新时间") 60 | private LocalDateTime updateTime; 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/entity/Label.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import java.io.Serializable; 7 | import io.swagger.annotations.ApiModel; 8 | import io.swagger.annotations.ApiModelProperty; 9 | import lombok.Getter; 10 | import lombok.Setter; 11 | import lombok.experimental.Accessors; 12 | 13 | /** 14 | *

15 | * 标签表 16 | *

17 | * 18 | * @author 谢诗宏 19 | * @since 2023-05-15 20 | */ 21 | @Getter 22 | @Setter 23 | @Accessors(chain = true) 24 | @TableName("t_label") 25 | @ApiModel(value = "Label对象", description = "标签表") 26 | public class Label implements Serializable { 27 | 28 | private static final long serialVersionUID = 1L; 29 | 30 | @TableId(value = "id", type = IdType.AUTO) 31 | private Integer id; 32 | 33 | @ApiModelProperty("标签") 34 | private String label; 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/entity/Order.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import java.io.Serializable; 7 | import java.math.BigDecimal; 8 | import java.time.LocalDateTime; 9 | import io.swagger.annotations.ApiModel; 10 | import io.swagger.annotations.ApiModelProperty; 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import lombok.experimental.Accessors; 14 | 15 | /** 16 | *

17 | * 订单表 18 | *

19 | * 20 | * @author 谢诗宏 21 | * @since 2023-05-17 22 | */ 23 | @Getter 24 | @Setter 25 | @Accessors(chain = true) 26 | @TableName("t_order") 27 | @ApiModel(value = "Order对象", description = "订单表") 28 | public class Order implements Serializable { 29 | 30 | private static final long serialVersionUID = 1L; 31 | 32 | @TableId(value = "id", type = IdType.AUTO) 33 | private Integer id; 34 | 35 | @ApiModelProperty("订单号") 36 | private String orderNo; 37 | 38 | @ApiModelProperty("退款单号") 39 | private String refundNo; 40 | 41 | @ApiModelProperty("门店ID") 42 | private Integer storeId; 43 | 44 | @ApiModelProperty("包厢ID") 45 | private Integer boxId; 46 | 47 | @ApiModelProperty("用户ID") 48 | private Integer userId; 49 | 50 | @ApiModelProperty("包厢名称") 51 | private String boxName; 52 | 53 | @ApiModelProperty("门店名称") 54 | private String storeName; 55 | 56 | @ApiModelProperty("门店地址") 57 | private String address; 58 | 59 | @ApiModelProperty("经度") 60 | private BigDecimal lng; 61 | 62 | @ApiModelProperty("纬度") 63 | private BigDecimal lat; 64 | 65 | @ApiModelProperty("手机号") 66 | private String phone; 67 | 68 | @ApiModelProperty("开始时间") 69 | private LocalDateTime startTime; 70 | 71 | @ApiModelProperty("结束时间") 72 | private LocalDateTime endTime; 73 | 74 | @ApiModelProperty("总时长") 75 | private BigDecimal duration; 76 | 77 | @ApiModelProperty("实际付款金额") 78 | private BigDecimal paymentAmount; 79 | 80 | @ApiModelProperty("微信支付订单号") 81 | private String transactionId; 82 | 83 | @ApiModelProperty(value = "支付状态,1=已支付,2=已退款") 84 | private Integer payStatus; 85 | 86 | @ApiModelProperty(value = "支付方式,1=微信支付,2=钱包支付", hidden = true) 87 | private Integer payment; 88 | 89 | @ApiModelProperty("创建时间") 90 | private LocalDateTime createTime; 91 | 92 | @ApiModelProperty("更新时间") 93 | private LocalDateTime updateTime; 94 | } 95 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/entity/RechargeRecord.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import java.io.Serializable; 7 | import java.math.BigDecimal; 8 | import java.time.LocalDateTime; 9 | import io.swagger.annotations.ApiModel; 10 | import io.swagger.annotations.ApiModelProperty; 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import lombok.experimental.Accessors; 14 | 15 | /** 16 | *

17 | * 会员充值记录表 18 | *

19 | * 20 | * @author 谢诗宏 21 | * @since 2023-06-06 22 | */ 23 | @Getter 24 | @Setter 25 | @Accessors(chain = true) 26 | @TableName("t_recharge_record") 27 | @ApiModel(value = "RechargeRecord对象", description = "会员充值记录表") 28 | public class RechargeRecord implements Serializable { 29 | 30 | private static final long serialVersionUID = 1L; 31 | 32 | @TableId(value = "id", type = IdType.AUTO) 33 | private Integer id; 34 | 35 | @ApiModelProperty("订单号") 36 | private String orderNo; 37 | 38 | private Integer userId; 39 | 40 | @ApiModelProperty("充值金额") 41 | private BigDecimal rechargeAmount; 42 | 43 | @ApiModelProperty("充值会员等级") 44 | private Integer rechargeVipLevel; 45 | 46 | @ApiModelProperty("充值时间") 47 | private LocalDateTime rechargeTime; 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/entity/Store.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import java.io.Serializable; 7 | import java.math.BigDecimal; 8 | import java.time.LocalDateTime; 9 | import io.swagger.annotations.ApiModel; 10 | import io.swagger.annotations.ApiModelProperty; 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import lombok.experimental.Accessors; 14 | 15 | /** 16 | *

17 | * 门店表 18 | *

19 | * 20 | * @author 谢诗宏 21 | * @since 2023-05-15 22 | */ 23 | @Getter 24 | @Setter 25 | @Accessors(chain = true) 26 | @TableName("t_store") 27 | @ApiModel(value = "Store对象", description = "门店表") 28 | public class Store implements Serializable { 29 | 30 | private static final long serialVersionUID = 1L; 31 | 32 | @TableId(value = "id", type = IdType.AUTO) 33 | private Integer id; 34 | 35 | @ApiModelProperty("门店名") 36 | private String name; 37 | 38 | @ApiModelProperty("门店封面") 39 | private String cover; 40 | 41 | @ApiModelProperty("地址") 42 | private String address; 43 | 44 | @ApiModelProperty("经度") 45 | private BigDecimal lng; 46 | 47 | @ApiModelProperty("纬度") 48 | private BigDecimal lat; 49 | 50 | @ApiModelProperty("电话") 51 | private String phone; 52 | 53 | @ApiModelProperty("最少几小时起") 54 | private Integer minHours; 55 | 56 | @ApiModelProperty("创建时间") 57 | private LocalDateTime createTime; 58 | 59 | @ApiModelProperty("更新时间") 60 | private LocalDateTime updateTime; 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/entity/StoreBox.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import java.io.Serializable; 8 | import java.math.BigDecimal; 9 | import java.time.LocalDateTime; 10 | import io.swagger.annotations.ApiModel; 11 | import io.swagger.annotations.ApiModelProperty; 12 | import lombok.Getter; 13 | import lombok.Setter; 14 | import lombok.experimental.Accessors; 15 | 16 | /** 17 | *

18 | * 包厢表 19 | *

20 | * 21 | * @author 谢诗宏 22 | * @since 2023-05-15 23 | */ 24 | @Getter 25 | @Setter 26 | @Accessors(chain = true) 27 | @TableName("t_store_box") 28 | @ApiModel(value = "StoreBox对象", description = "包厢表") 29 | public class StoreBox implements Serializable { 30 | 31 | private static final long serialVersionUID = 1L; 32 | 33 | @TableId(value = "id", type = IdType.AUTO) 34 | private Integer id; 35 | 36 | @ApiModelProperty("门店ID") 37 | private Integer storeId; 38 | 39 | @ApiModelProperty("包厢名称") 40 | private String name; 41 | 42 | @ApiModelProperty("包厢简介") 43 | private String intro; 44 | 45 | @ApiModelProperty("每小时单价") 46 | private BigDecimal hourlyPrice; 47 | 48 | @ApiModelProperty("包厢图片,多个逗号分隔") 49 | private String imgs; 50 | 51 | @ApiModelProperty("出门开关设备ID") 52 | private String deviceDoor; 53 | 54 | @ApiModelProperty("插座10A设备ID") 55 | @TableField("device_socket_10a") 56 | private String deviceSocket10a; 57 | 58 | @ApiModelProperty("插座16A设备ID") 59 | @TableField("device_socket_16a") 60 | private String deviceSocket16a; 61 | 62 | @ApiModelProperty("自动关闭设备,0否1是") 63 | private Integer autoClose; 64 | 65 | @ApiModelProperty("最少几小时起") 66 | private Integer minHours; 67 | 68 | @ApiModelProperty("创建时间") 69 | private LocalDateTime createTime; 70 | 71 | @ApiModelProperty("更新时间") 72 | private LocalDateTime updateTime; 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/entity/StoreBoxLabel.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import java.io.Serializable; 7 | import io.swagger.annotations.ApiModel; 8 | import io.swagger.annotations.ApiModelProperty; 9 | import lombok.Getter; 10 | import lombok.Setter; 11 | import lombok.experimental.Accessors; 12 | 13 | /** 14 | *

15 | * 包厢标签中间表 16 | *

17 | * 18 | * @author 谢诗宏 19 | * @since 2023-05-15 20 | */ 21 | @Getter 22 | @Setter 23 | @Accessors(chain = true) 24 | @TableName("t_store_box_label") 25 | @ApiModel(value = "StoreBoxLabel对象", description = "包厢标签中间表") 26 | public class StoreBoxLabel implements Serializable { 27 | 28 | private static final long serialVersionUID = 1L; 29 | 30 | @TableId(value = "id", type = IdType.AUTO) 31 | private Integer id; 32 | 33 | @ApiModelProperty("包厢ID") 34 | private Integer boxId; 35 | 36 | @ApiModelProperty("标签ID") 37 | private Integer labelId; 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/entity/UserAdmin.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import java.io.Serializable; 7 | import io.swagger.annotations.ApiModel; 8 | import io.swagger.annotations.ApiModelProperty; 9 | import lombok.Getter; 10 | import lombok.Setter; 11 | import lombok.experimental.Accessors; 12 | 13 | /** 14 | *

15 | * 16 | *

17 | * 18 | * @author 谢诗宏 19 | * @since 2023-05-25 20 | */ 21 | @Getter 22 | @Setter 23 | @Accessors(chain = true) 24 | @TableName("t_user_admin") 25 | @ApiModel(value = "UserAdmin对象", description = "") 26 | public class UserAdmin implements Serializable { 27 | 28 | private static final long serialVersionUID = 1L; 29 | 30 | @TableId(value = "id", type = IdType.AUTO) 31 | private Integer id; 32 | 33 | @ApiModelProperty("账号") 34 | private String account; 35 | 36 | @ApiModelProperty("密码") 37 | private String password; 38 | 39 | @ApiModelProperty("昵称") 40 | private String nickname; 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/entity/UserWechat.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import java.io.Serializable; 8 | import java.math.BigDecimal; 9 | import java.time.LocalDateTime; 10 | 11 | import com.fasterxml.jackson.annotation.JsonFormat; 12 | import io.swagger.annotations.ApiModel; 13 | import io.swagger.annotations.ApiModelProperty; 14 | import lombok.Getter; 15 | import lombok.Setter; 16 | import lombok.experimental.Accessors; 17 | 18 | /** 19 | *

20 | * 微信用户表 21 | *

22 | * 23 | * @author 谢诗宏 24 | * @since 2023-05-15 25 | */ 26 | @Getter 27 | @Setter 28 | @Accessors(chain = true) 29 | @TableName("t_user_wechat") 30 | @ApiModel(value = "UserWechat对象", description = "微信用户表") 31 | public class UserWechat implements Serializable { 32 | 33 | private static final long serialVersionUID = 1L; 34 | 35 | @TableId(value = "id", type = IdType.AUTO) 36 | private Integer id; 37 | 38 | @ApiModelProperty("微信openid") 39 | private String openid; 40 | 41 | @ApiModelProperty("微信unionid") 42 | private String unionid; 43 | 44 | @ApiModelProperty("微信session_key") 45 | private String sessionKey; 46 | 47 | @ApiModelProperty("微信昵称") 48 | private String nickName; 49 | 50 | @ApiModelProperty("微信头像") 51 | private String avatarUrl; 52 | 53 | @ApiModelProperty("手机号") 54 | private String phone; 55 | 56 | @ApiModelProperty("真实姓名") 57 | private String realName; 58 | 59 | @ApiModelProperty("身份证号") 60 | private String idCard; 61 | 62 | @ApiModelProperty("0=普通用户,1=普通会员,2=经营合伙人") 63 | private Integer vipLevel; 64 | 65 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 66 | @ApiModelProperty("会员开通时间") 67 | private LocalDateTime vipOpening; 68 | 69 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 70 | @ApiModelProperty("会员到期时间") 71 | private LocalDateTime vipExpire; 72 | 73 | @ApiModelProperty("推广二维码") 74 | private String shareQrCode; 75 | 76 | @ApiModelProperty("推荐人ID,分享二维码中的scene参数") 77 | private Integer referrerId; 78 | 79 | @ApiModelProperty("充值余额") 80 | @TableField(exist = false) 81 | private BigDecimal rechargeBalance = BigDecimal.ZERO; 82 | 83 | @ApiModelProperty("盈利余额") 84 | @TableField(exist = false) 85 | private BigDecimal incomeBalance = BigDecimal.ZERO; 86 | 87 | @ApiModelProperty("提现中余额") 88 | @TableField(exist = false) 89 | private BigDecimal withdrawingBalance; 90 | 91 | @ApiModelProperty("已提现余额") 92 | @TableField(exist = false) 93 | private BigDecimal withdrawnBalance; 94 | 95 | @ApiModelProperty("创建时间") 96 | private LocalDateTime createTime; 97 | 98 | @ApiModelProperty("更新时间") 99 | private LocalDateTime updateTime; 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/entity/VipSetup.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import java.io.Serializable; 7 | import java.math.BigDecimal; 8 | import java.time.LocalDateTime; 9 | import io.swagger.annotations.ApiModel; 10 | import io.swagger.annotations.ApiModelProperty; 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import lombok.experimental.Accessors; 14 | 15 | /** 16 | *

17 | * 会员充值字典表 18 | *

19 | * 20 | * @author 谢诗宏 21 | * @since 2023-07-22 22 | */ 23 | @Getter 24 | @Setter 25 | @Accessors(chain = true) 26 | @TableName("t_vip_setup") 27 | @ApiModel(value = "VipSetup对象", description = "会员充值字典表") 28 | public class VipSetup implements Serializable { 29 | 30 | private static final long serialVersionUID = 1L; 31 | 32 | @TableId(value = "id", type = IdType.AUTO) 33 | private Integer id; 34 | 35 | @ApiModelProperty("充值金额") 36 | private BigDecimal rechargeAmount; 37 | 38 | @ApiModelProperty("折扣比例") 39 | private BigDecimal discountScale; 40 | 41 | @ApiModelProperty("收益比例") 42 | private BigDecimal incomeScale; 43 | 44 | @ApiModelProperty("0=普通用户,1=普通会员,2=经营合伙人") 45 | private Integer vipLevel; 46 | 47 | @ApiModelProperty("创建时间") 48 | private LocalDateTime createTime; 49 | 50 | @ApiModelProperty("更新时间") 51 | private LocalDateTime updateTime; 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/entity/WithdrawalApplication.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.IdType; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import java.io.Serializable; 7 | import java.math.BigDecimal; 8 | import java.time.LocalDateTime; 9 | import io.swagger.annotations.ApiModel; 10 | import io.swagger.annotations.ApiModelProperty; 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | import lombok.experimental.Accessors; 14 | 15 | /** 16 | *

17 | * 用户提现申请表 18 | *

19 | * 20 | * @author 谢诗宏 21 | * @since 2023-07-20 22 | */ 23 | @Getter 24 | @Setter 25 | @Accessors(chain = true) 26 | @TableName("t_withdrawal_application") 27 | @ApiModel(value = "WithdrawalApplication对象", description = "用户提现申请表") 28 | public class WithdrawalApplication implements Serializable { 29 | 30 | private static final long serialVersionUID = 1L; 31 | 32 | @TableId(value = "id", type = IdType.AUTO) 33 | private Integer id; 34 | 35 | @ApiModelProperty("用户ID") 36 | private Integer userId; 37 | 38 | @ApiModelProperty("申请提现金额") 39 | private BigDecimal withdrawalAmount; 40 | 41 | @ApiModelProperty("用户收款二维码") 42 | private String paymentCode; 43 | 44 | @ApiModelProperty("1提现申请中,2拒绝提现,3提现成功") 45 | private Integer status; 46 | 47 | @ApiModelProperty("创建时间") 48 | private LocalDateTime createTime; 49 | 50 | @ApiModelProperty("更新时间") 51 | private LocalDateTime updateTime; 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/generator/AutoGenerator.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.generator; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldFill; 4 | import com.baomidou.mybatisplus.generator.FastAutoGenerator; 5 | import com.baomidou.mybatisplus.generator.config.DataSourceConfig; 6 | import com.baomidou.mybatisplus.generator.config.GlobalConfig; 7 | import com.baomidou.mybatisplus.generator.config.ITypeConvert; 8 | import com.baomidou.mybatisplus.generator.config.OutputFile; 9 | import com.baomidou.mybatisplus.generator.config.converts.MySqlTypeConvert; 10 | import com.baomidou.mybatisplus.generator.config.converts.TypeConverts; 11 | import com.baomidou.mybatisplus.generator.config.rules.DbColumnType; 12 | import com.baomidou.mybatisplus.generator.config.rules.IColumnType; 13 | import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; 14 | import com.baomidou.mybatisplus.generator.fill.Column; 15 | 16 | import java.sql.SQLException; 17 | import java.util.Arrays; 18 | import java.util.Collections; 19 | import java.util.List; 20 | 21 | public class AutoGenerator { 22 | 23 | /** 24 | * 数据源配置 25 | */ 26 | private static final DataSourceConfig.Builder DATA_SOURCE_CONFIG = new DataSourceConfig 27 | .Builder("jdbc:mysql://47.114.220.201:3306/cac", "nwtadmin", "nwtsoft2020") 28 | .typeConvert(new MySqlTypeConvert(){ 29 | @Override 30 | public DbColumnType processTypeConvert(GlobalConfig globalConfig, String fieldType) { 31 | System.out.println("转换类型:" + fieldType); 32 | // tinyint转换成Integer 33 | if (fieldType.toLowerCase().contains("tinyint")) { 34 | return DbColumnType.INTEGER; 35 | } 36 | return (DbColumnType) super.processTypeConvert(globalConfig, fieldType); 37 | } 38 | }); 39 | 40 | 41 | /** 42 | * 执行 43 | */ 44 | public static void main(String[] args) throws SQLException { 45 | FastAutoGenerator.create(DATA_SOURCE_CONFIG) 46 | .globalConfig(builder -> { 47 | builder.author("谢诗宏") // 设置作者 48 | .enableSwagger() // 不开启 swagger 模式 49 | .outputDir(System.getProperty("user.dir") + "/src/main/java") // 指定输出目录 50 | .disableOpenDir(); //禁止打开输出目录,默认打开 51 | }) 52 | .packageConfig(builder -> { 53 | builder.parent("com.geekuniverse") // 设置父包名 54 | .moduleName("cac") // 设置父包模块名 55 | .pathInfo(Collections.singletonMap(OutputFile.xml, System.getProperty("user.dir") + "/src/main/resources/mapper")); // 设置mapperXml生成路径 56 | }) 57 | // 策略配置 58 | .strategyConfig(builder -> { 59 | //实体类相关配置 60 | builder.entityBuilder() 61 | //.enableTableFieldAnnotation() // 开启实体类字段注解 62 | .enableLombok() // 开启lombok 63 | .enableChainModel() // 开启链式模式 64 | .enableFileOverride(); // 覆盖已生成文件 65 | }) 66 | .strategyConfig(builder -> { 67 | //mapper相关配置 68 | builder.mapperBuilder() 69 | .enableBaseResultMap() // 开启BaseResultMap 70 | .enableBaseColumnList() // 开启BaseColumnList 71 | .enableFileOverride(); // 开启覆盖已生成文件 72 | }) 73 | .strategyConfig(builder -> { 74 | //service相关配置 75 | builder.serviceBuilder() 76 | .enableFileOverride(); // 开启覆盖已生成文件 77 | }) 78 | .strategyConfig(builder -> { 79 | //controller相关配置 80 | builder.controllerBuilder() 81 | .enableRestStyle() //开启生成@RestController控制器 82 | //.enableHyphenStyle() // 开启驼峰转连字符 83 | .enableFileOverride(); // 覆盖已生成文件 84 | }) 85 | .strategyConfig((scanner, builder) -> { 86 | builder.addInclude(getTables(scanner.apply("请输入表名,多个英文逗号分隔?所有输入 all"))) // 设置需要生成的表名 87 | .addTablePrefix("t_", "c_"); // 设置过滤表前缀 88 | }) 89 | .templateEngine(new FreemarkerTemplateEngine()) // 使用Freemarker引擎模板,默认的是Velocity引擎模板 90 | .execute(); 91 | } 92 | 93 | // 处理 all 情况 94 | protected static List getTables(String tables) { 95 | return "all".equals(tables) ? Collections.emptyList() : Arrays.asList(tables.split(",")); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/mapper/BalanceMapper.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.mapper; 2 | 3 | import com.geekuniverse.cac.entity.Balance; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * 用户余额表 Mapper 接口 9 | *

10 | * 11 | * @author 谢诗宏 12 | * @since 2023-07-20 13 | */ 14 | public interface BalanceMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/mapper/IncomeRecordMapper.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.mapper; 2 | 3 | import com.geekuniverse.cac.entity.IncomeRecord; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * 合伙人收益记录表 Mapper 接口 9 | *

10 | * 11 | * @author 谢诗宏 12 | * @since 2023-06-10 13 | */ 14 | public interface IncomeRecordMapper extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/geekuniverse/cac/mapper/LabelMapper.java: -------------------------------------------------------------------------------- 1 | package com.geekuniverse.cac.mapper; 2 | 3 | import com.geekuniverse.cac.entity.Label; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | /** 7 | *

8 | * 标签表 Mapper 接口 9 | *

10 | * 11 | * @author 谢诗宏 12 | * @since 2023-05-15 13 | */ 14 | public interface LabelMapper extends BaseMapper