New file |
| | |
| | | package com.ruoyi.common.core.annotation; |
| | | |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | import java.math.BigDecimal; |
| | | import org.apache.poi.ss.usermodel.HorizontalAlignment; |
| | | import org.apache.poi.ss.usermodel.IndexedColors; |
| | | import com.ruoyi.common.core.utils.poi.ExcelHandlerAdapter; |
| | | |
| | | /** |
| | | * 自定义导出Excel数据注解 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Target(ElementType.FIELD) |
| | | public @interface Excel |
| | | { |
| | | /** |
| | | * 导出时在excel中排序 |
| | | */ |
| | | public int sort() default Integer.MAX_VALUE; |
| | | |
| | | /** |
| | | * 导出到Excel中的名字. |
| | | */ |
| | | public String name() default ""; |
| | | |
| | | /** |
| | | * 日期格式, 如: yyyy-MM-dd |
| | | */ |
| | | public String dateFormat() default ""; |
| | | |
| | | /** |
| | | * 读取内容转表达式 (如: 0=男,1=女,2=未知) |
| | | */ |
| | | public String readConverterExp() default ""; |
| | | |
| | | /** |
| | | * 分隔符,读取字符串组内容 |
| | | */ |
| | | public String separator() default ","; |
| | | |
| | | /** |
| | | * BigDecimal 精度 默认:-1(默认不开启BigDecimal格式化) |
| | | */ |
| | | public int scale() default -1; |
| | | |
| | | /** |
| | | * BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN |
| | | */ |
| | | public int roundingMode() default BigDecimal.ROUND_HALF_EVEN; |
| | | |
| | | /** |
| | | * 导出时在excel中每个列的高度 单位为字符 |
| | | */ |
| | | public double height() default 14; |
| | | |
| | | /** |
| | | * 导出时在excel中每个列的宽 单位为字符 |
| | | */ |
| | | public double width() default 16; |
| | | |
| | | /** |
| | | * 文字后缀,如% 90 变成90% |
| | | */ |
| | | public String suffix() default ""; |
| | | |
| | | /** |
| | | * 当值为空时,字段的默认值 |
| | | */ |
| | | public String defaultValue() default ""; |
| | | |
| | | /** |
| | | * 提示信息 |
| | | */ |
| | | public String prompt() default ""; |
| | | |
| | | /** |
| | | * 设置只能选择不能输入的列内容. |
| | | */ |
| | | public String[] combo() default {}; |
| | | |
| | | /** |
| | | * 是否需要纵向合并单元格,应对需求:含有list集合单元格) |
| | | */ |
| | | public boolean needMerge() default false; |
| | | |
| | | /** |
| | | * 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写. |
| | | */ |
| | | public boolean isExport() default true; |
| | | |
| | | /** |
| | | * 另一个类中的属性名称,支持多级获取,以小数点隔开 |
| | | */ |
| | | public String targetAttr() default ""; |
| | | |
| | | /** |
| | | * 是否自动统计数据,在最后追加一行统计数据总和 |
| | | */ |
| | | public boolean isStatistics() default false; |
| | | |
| | | /** |
| | | * 导出类型(0数字 1字符串) |
| | | */ |
| | | public ColumnType cellType() default ColumnType.STRING; |
| | | |
| | | /** |
| | | * 导出列头背景色 |
| | | */ |
| | | public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT; |
| | | |
| | | /** |
| | | * 导出列头字体颜色 |
| | | */ |
| | | public IndexedColors headerColor() default IndexedColors.WHITE; |
| | | |
| | | /** |
| | | * 导出单元格背景色 |
| | | */ |
| | | public IndexedColors backgroundColor() default IndexedColors.WHITE; |
| | | |
| | | /** |
| | | * 导出单元格字体颜色 |
| | | */ |
| | | public IndexedColors color() default IndexedColors.BLACK; |
| | | |
| | | /** |
| | | * 导出字段对齐方式 |
| | | */ |
| | | public HorizontalAlignment align() default HorizontalAlignment.CENTER; |
| | | |
| | | /** |
| | | * 自定义数据处理器 |
| | | */ |
| | | public Class<?> handler() default ExcelHandlerAdapter.class; |
| | | |
| | | /** |
| | | * 自定义数据处理器参数 |
| | | */ |
| | | public String[] args() default {}; |
| | | |
| | | /** |
| | | * 字段类型(0:导出导入;1:仅导出;2:仅导入) |
| | | */ |
| | | Type type() default Type.ALL; |
| | | |
| | | public enum Type |
| | | { |
| | | ALL(0), EXPORT(1), IMPORT(2); |
| | | private final int value; |
| | | |
| | | Type(int value) |
| | | { |
| | | this.value = value; |
| | | } |
| | | |
| | | public int value() |
| | | { |
| | | return this.value; |
| | | } |
| | | } |
| | | |
| | | public enum ColumnType |
| | | { |
| | | NUMERIC(0), STRING(1), IMAGE(2); |
| | | private final int value; |
| | | |
| | | ColumnType(int value) |
| | | { |
| | | this.value = value; |
| | | } |
| | | |
| | | public int value() |
| | | { |
| | | return this.value; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.annotation; |
| | | |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | /** |
| | | * Excel注解集 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Target(ElementType.FIELD) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | public @interface Excels |
| | | { |
| | | Excel[] value(); |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum ApproveConfigEnum { |
| | | |
| | | /*审批类型 1=交车审批、2=续约审批、3=退车审批*/ |
| | | |
| | | DELIVERY_APPROVAL(1, "交车审批"), |
| | | RENEWAL_APPROVAL(2, "续约审批"), |
| | | RETURN_APPROVAL(3, "退车审批"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | ApproveConfigEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static ApproveConfigEnum fromCode(Integer code) { |
| | | ApproveConfigEnum[] resultTypes = ApproveConfigEnum.values(); |
| | | for (ApproveConfigEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum AuditStateEnum { |
| | | |
| | | /*审核状态 0待审批 1通过 2驳回 3已撤回*/ |
| | | |
| | | PENDING_APPROVAL(0, "待审批"), |
| | | APPROVED(1, "审批通过"), |
| | | APPROVAL_REJECTION(2, "审批驳回"), |
| | | WITHDRAWN(3, "已撤回"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | AuditStateEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static AuditStateEnum fromCode(Integer code) { |
| | | AuditStateEnum[] resultTypes = AuditStateEnum.values(); |
| | | for (AuditStateEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum AuditTypeEnum { |
| | | |
| | | /*审核类型 1交车申请 2续约申请 3退车申请 4事故账单申请*/ |
| | | |
| | | DELIVERY_APPLICATION(1, "交车申请"), |
| | | RENEWAL_APPLICATION(2, "续约申请"), |
| | | RETURN_APPLICATION(3, "退车申请"), |
| | | ACCIDENT_BILL_APPLICATION(4, "事故账单申请"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | AuditTypeEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static AuditTypeEnum fromCode(Integer code) { |
| | | AuditTypeEnum[] resultTypes = AuditTypeEnum.values(); |
| | | for (AuditTypeEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum CarStateEnum { |
| | | |
| | | /*状态1= 待上户、2=待办证、3=待整备、4=待租、5=已租、6=已处置*/ |
| | | |
| | | PENDING_REGISTRATION(1, "待上户"), |
| | | PENDING_CERTIFICATE(2, "待办证"), |
| | | TO_BE_PREPARED(3, "待整备"), |
| | | FOR_RENT(4, "待租"), |
| | | RENTED(5, "已租"), |
| | | DISPOSED(6, "已处置"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | CarStateEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static CarStateEnum fromCode(Integer code) { |
| | | CarStateEnum[] resultTypes = CarStateEnum.values(); |
| | | for (CarStateEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName Disable |
| | | * @Description |
| | | * @date 2022-06-08 16:55 |
| | | */ |
| | | public enum DelFlagEnum { |
| | | NO(0, "否"), |
| | | YES(1, "是"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | DelFlagEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static DelFlagEnum fromCode(Integer code) { |
| | | DelFlagEnum[] resultTypes = DelFlagEnum.values(); |
| | | for (DelFlagEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName Disable |
| | | * @Description |
| | | * @date 2022-06-08 16:55 |
| | | */ |
| | | public enum DisabledEnum { |
| | | NO(0, "否"), |
| | | YES(1, "是"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | DisabledEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static DisabledEnum fromCode(Integer code) { |
| | | DisabledEnum[] resultTypes = DisabledEnum.values(); |
| | | for (DisabledEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum HandoverStateEnum { |
| | | |
| | | /*交车状态 1待交车 2待审批 3已交车 4审批拒绝*/ |
| | | |
| | | VEHICLE_DELIVERED(1, "待交车"), |
| | | PENDING_APPROVAL(2, "待审批"), |
| | | DELIVERED(3, "已交车"), |
| | | APPROVAL_REJECTION(4, "审批拒绝"), |
| | | REVOKED(5, "已撤销"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | HandoverStateEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static HandoverStateEnum fromCode(Integer code) { |
| | | HandoverStateEnum[] resultTypes = HandoverStateEnum.values(); |
| | | for (HandoverStateEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum ImportTypeEnum { |
| | | |
| | | /*1=新车车辆导入 、2=已有车辆导入、3=上户导入、4=设备导入、5=违章导入、6=违章图片导入、7=保养记录导入、8=保单导入、9=合同导入*/ |
| | | |
| | | NEW_CAR(1, "新车车辆导入"), |
| | | EXIST_CAR(2, "已有车辆导入"), |
| | | WEALTHY(3, "上户导入"), |
| | | DEVICE(4, "设备导入"), |
| | | VIOLATION(5, "违章导入"), |
| | | VIOLATION_PICTURE(6, "违章图片导入"), |
| | | SERVICE(7, "保养记录导入"), |
| | | WARRANTY(8, "保单导入"), |
| | | CONTRACT(9, "合同导入"), |
| | | CERTIFICATE(10, "办证导入"), |
| | | INSPECTANNUALLY(11, "车辆年检导入"), |
| | | MAINTENANCE(12, "车辆维修导入"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | ImportTypeEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static ImportTypeEnum fromCode(Integer code) { |
| | | ImportTypeEnum[] resultTypes = ImportTypeEnum.values(); |
| | | for (ImportTypeEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum InsureTypeEnum { |
| | | |
| | | /*保险类型 1=商业险、2=交强险、3=承运人责任险、4=客伤险、5=盗抢险*/ |
| | | |
| | | COMMERCIAL_INSURANCE(1, "商业险"), |
| | | COMPULSORY_INSURANCE(2, "交强险"), |
| | | CARRIER_LIABILITY_INSURANCE(3, "承运人责任险"), |
| | | CUSTOMER_INJURY_INSURANCE(4, "客伤险"), |
| | | THEFT_INSURANCE(5, "盗抢险"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | InsureTypeEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static InsureTypeEnum fromCode(Integer code) { |
| | | InsureTypeEnum[] resultTypes = InsureTypeEnum.values(); |
| | | for (InsureTypeEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum ReturnCarTypeEnum { |
| | | |
| | | /*合同类型 合同到期、提前退车、强制收车*/ |
| | | EXPIRE(1, "合同到期"), |
| | | EARLY_WITHDRAWAL(2, "提前退车"), |
| | | COMPULSORY_COLLECTION(3, "强制收车"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | ReturnCarTypeEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static ReturnCarTypeEnum fromCode(Integer code) { |
| | | ReturnCarTypeEnum[] resultTypes = ReturnCarTypeEnum.values(); |
| | | for (ReturnCarTypeEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum ReturnStateEnum { |
| | | |
| | | /*退车状态 1=待验车 2=待生成账单 3=待审批 4=已退车 5=审批拒绝*/ |
| | | |
| | | VEHICLE_INSPECTED(1, "待验车"), |
| | | PENDING_BILL_GENERATION(2, "待生成账单"), |
| | | PENDING_APPROVAL(3, "待审批"), |
| | | RETURNED_VEHICLE(4, "已退车"), |
| | | APPROVAL_REJECTION(5, "审批拒绝"), |
| | | REVOKED(6, "已撤销"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | ReturnStateEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static ReturnStateEnum fromCode(Integer code) { |
| | | ReturnStateEnum[] resultTypes = ReturnStateEnum.values(); |
| | | for (ReturnStateEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums; |
| | | |
| | | /** |
| | | * 用户状态 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public enum UserStatus |
| | | { |
| | | OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除"); |
| | | |
| | | private final String code; |
| | | private final String info; |
| | | |
| | | UserStatus(String code, String info) |
| | | { |
| | | this.code = code; |
| | | this.info = info; |
| | | } |
| | | |
| | | public String getCode() |
| | | { |
| | | return code; |
| | | } |
| | | |
| | | public String getInfo() |
| | | { |
| | | return info; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum WarrantyStateEnum { |
| | | |
| | | /*保单状态 1正常 2已脱保 3已停保 4即将到期 5建议停保*/ |
| | | |
| | | NORMAL(1, "正常"), |
| | | DELISTED(2, "已脱保"), |
| | | DISCONTINUED_WARRANTY(3, "已停保"), |
| | | DUE(4, "即将到期"), |
| | | SUGGEST_DISCONTINUING_MAINTENANCE(5, "建议停保"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | WarrantyStateEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static WarrantyStateEnum fromCode(Integer code) { |
| | | WarrantyStateEnum[] resultTypes = WarrantyStateEnum.values(); |
| | | for (WarrantyStateEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums.status; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum AdvertisingStatusEnum { |
| | | |
| | | |
| | | NO(0, "否"), |
| | | YES(1, "是"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | AdvertisingStatusEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static AdvertisingStatusEnum fromCode(Integer code) { |
| | | AdvertisingStatusEnum[] resultTypes = AdvertisingStatusEnum.values(); |
| | | for (AdvertisingStatusEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums.status; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum AppUserStatusEnum { |
| | | |
| | | |
| | | NORMAL(1, "正常"), |
| | | FREEZE(2, "冻结"), |
| | | LOGOFF(3, "注销"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | AppUserStatusEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static AppUserStatusEnum fromCode(Integer code) { |
| | | AppUserStatusEnum[] resultTypes = AppUserStatusEnum.values(); |
| | | for (AppUserStatusEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums.status; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum ChargingGunModeEnum { |
| | | |
| | | |
| | | SUPER_SUFFICIENT(1, "超级快充"), |
| | | FAST_SUFFICIENT(2, "快充"), |
| | | SLOW_SUFFICIENT(3, "慢充"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | ChargingGunModeEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static ChargingGunModeEnum fromCode(Integer code) { |
| | | ChargingGunModeEnum[] resultTypes = ChargingGunModeEnum.values(); |
| | | for (ChargingGunModeEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums.status; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum ChargingGunStatusEnum { |
| | | |
| | | |
| | | OFFLINE(1, "离线"), |
| | | IDLE(2, "空闲"), |
| | | OCCUPATION_UNCHARGED(3, "占用(未充电)"), |
| | | OCCUPATION_CHARGING(4, "占用(充电中)"), |
| | | OCCUPATION_FULL(5, "占用(已充满)"), |
| | | OCCUPATION_LOCK(6, "占用(预约锁定)"), |
| | | FAULT(7, "故障"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | ChargingGunStatusEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static ChargingGunStatusEnum fromCode(Integer code) { |
| | | ChargingGunStatusEnum[] resultTypes = ChargingGunStatusEnum.values(); |
| | | for (ChargingGunStatusEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.enums.status; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @Description |
| | | * @Author xiaochen |
| | | * @Date 2023/6/8 16:42 |
| | | */ |
| | | public enum SiteStatusEnum { |
| | | |
| | | |
| | | NORMAL_USE(1, "正常使用"), |
| | | IN_MAINTENANCE(2, "维修中"), |
| | | CLOSE_OFFLINE(3, "关闭下线"); |
| | | |
| | | @Getter |
| | | private String desc; |
| | | |
| | | |
| | | @Getter |
| | | private int code; |
| | | |
| | | |
| | | SiteStatusEnum(int code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | /** |
| | | * 通过code获取枚举 |
| | | * |
| | | * @param code |
| | | * @return |
| | | */ |
| | | public static SiteStatusEnum fromCode(Integer code) { |
| | | SiteStatusEnum[] resultTypes = SiteStatusEnum.values(); |
| | | for (SiteStatusEnum resultType : resultTypes) { |
| | | if (code.equals(resultType.getCode())) { |
| | | return resultType; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.exception.auth; |
| | | |
| | | /** |
| | | * 未能通过的登录认证异常 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class NotLoginException extends RuntimeException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public NotLoginException(String message) |
| | | { |
| | | super(message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.exception.auth; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | /** |
| | | * 未能通过的权限认证异常 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class NotPermissionException extends RuntimeException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public NotPermissionException(String permission) |
| | | { |
| | | super(permission); |
| | | } |
| | | |
| | | public NotPermissionException(String[] permissions) |
| | | { |
| | | super(StringUtils.join(permissions, ",")); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.exception.base; |
| | | |
| | | /** |
| | | * 基础异常 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class BaseException extends RuntimeException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 所属模块 |
| | | */ |
| | | private String module; |
| | | |
| | | /** |
| | | * 错误码 |
| | | */ |
| | | private String code; |
| | | |
| | | /** |
| | | * 错误码对应的参数 |
| | | */ |
| | | private Object[] args; |
| | | |
| | | /** |
| | | * 错误消息 |
| | | */ |
| | | private String defaultMessage; |
| | | |
| | | public BaseException(String module, String code, Object[] args, String defaultMessage) |
| | | { |
| | | this.module = module; |
| | | this.code = code; |
| | | this.args = args; |
| | | this.defaultMessage = defaultMessage; |
| | | } |
| | | |
| | | public BaseException(String module, String code, Object[] args) |
| | | { |
| | | this(module, code, args, null); |
| | | } |
| | | |
| | | public BaseException(String module, String defaultMessage) |
| | | { |
| | | this(module, null, null, defaultMessage); |
| | | } |
| | | |
| | | public BaseException(String code, Object[] args) |
| | | { |
| | | this(null, code, args, null); |
| | | } |
| | | |
| | | public BaseException(String defaultMessage) |
| | | { |
| | | this(null, null, null, defaultMessage); |
| | | } |
| | | |
| | | public String getModule() |
| | | { |
| | | return module; |
| | | } |
| | | |
| | | public String getCode() |
| | | { |
| | | return code; |
| | | } |
| | | |
| | | public Object[] getArgs() |
| | | { |
| | | return args; |
| | | } |
| | | |
| | | public String getDefaultMessage() |
| | | { |
| | | return defaultMessage; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.exception.file; |
| | | |
| | | import com.ruoyi.common.core.exception.base.BaseException; |
| | | |
| | | /** |
| | | * 文件信息异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class FileException extends BaseException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public FileException(String code, Object[] args, String msg) |
| | | { |
| | | super("file", code, args, msg); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.exception.file; |
| | | |
| | | /** |
| | | * 文件名称超长限制异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class FileNameLengthLimitExceededException extends FileException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public FileNameLengthLimitExceededException(int defaultFileNameLength) |
| | | { |
| | | super("upload.filename.exceed.length", new Object[] { defaultFileNameLength }, "the filename is too long"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.exception.file; |
| | | |
| | | /** |
| | | * 文件名大小限制异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class FileSizeLimitExceededException extends FileException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public FileSizeLimitExceededException(long defaultMaxSize) |
| | | { |
| | | super("upload.exceed.maxSize", new Object[] { defaultMaxSize }, "the filesize is too large"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.exception.file; |
| | | |
| | | import java.io.PrintStream; |
| | | import java.io.PrintWriter; |
| | | |
| | | /** |
| | | * 文件上传异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class FileUploadException extends Exception |
| | | { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private final Throwable cause; |
| | | |
| | | public FileUploadException() |
| | | { |
| | | this(null, null); |
| | | } |
| | | |
| | | public FileUploadException(final String msg) |
| | | { |
| | | this(msg, null); |
| | | } |
| | | |
| | | public FileUploadException(String msg, Throwable cause) |
| | | { |
| | | super(msg); |
| | | this.cause = cause; |
| | | } |
| | | |
| | | @Override |
| | | public void printStackTrace(PrintStream stream) |
| | | { |
| | | super.printStackTrace(stream); |
| | | if (cause != null) |
| | | { |
| | | stream.println("Caused by:"); |
| | | cause.printStackTrace(stream); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void printStackTrace(PrintWriter writer) |
| | | { |
| | | super.printStackTrace(writer); |
| | | if (cause != null) |
| | | { |
| | | writer.println("Caused by:"); |
| | | cause.printStackTrace(writer); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Throwable getCause() |
| | | { |
| | | return cause; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.exception.file; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * 文件上传 误异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class InvalidExtensionException extends FileUploadException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private String[] allowedExtension; |
| | | private String extension; |
| | | private String filename; |
| | | |
| | | public InvalidExtensionException(String[] allowedExtension, String extension, String filename) |
| | | { |
| | | super("filename : [" + filename + "], extension : [" + extension + "], allowed extension : [" + Arrays.toString(allowedExtension) + "]"); |
| | | this.allowedExtension = allowedExtension; |
| | | this.extension = extension; |
| | | this.filename = filename; |
| | | } |
| | | |
| | | public String[] getAllowedExtension() |
| | | { |
| | | return allowedExtension; |
| | | } |
| | | |
| | | public String getExtension() |
| | | { |
| | | return extension; |
| | | } |
| | | |
| | | public String getFilename() |
| | | { |
| | | return filename; |
| | | } |
| | | |
| | | public static class InvalidImageExtensionException extends InvalidExtensionException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public InvalidImageExtensionException(String[] allowedExtension, String extension, String filename) |
| | | { |
| | | super(allowedExtension, extension, filename); |
| | | } |
| | | } |
| | | |
| | | public static class InvalidFlashExtensionException extends InvalidExtensionException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public InvalidFlashExtensionException(String[] allowedExtension, String extension, String filename) |
| | | { |
| | | super(allowedExtension, extension, filename); |
| | | } |
| | | } |
| | | |
| | | public static class InvalidMediaExtensionException extends InvalidExtensionException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public InvalidMediaExtensionException(String[] allowedExtension, String extension, String filename) |
| | | { |
| | | super(allowedExtension, extension, filename); |
| | | } |
| | | } |
| | | |
| | | public static class InvalidVideoExtensionException extends InvalidExtensionException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public InvalidVideoExtensionException(String[] allowedExtension, String extension, String filename) |
| | | { |
| | | super(allowedExtension, extension, filename); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.exception.user; |
| | | |
| | | /** |
| | | * 验证码失效异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class CaptchaExpireException extends UserException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public CaptchaExpireException() |
| | | { |
| | | super("user.jcaptcha.expire", null); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.exception.user; |
| | | |
| | | /** |
| | | * 学生端登录异常信息 |
| | | * |
| | | * @author HJL |
| | | * @version 1.0 |
| | | * @since 2024-05-24 11:35 |
| | | */ |
| | | public class UserAppletException extends RuntimeException { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 错误提示 |
| | | */ |
| | | private String message; |
| | | |
| | | /** |
| | | * 错误码 |
| | | */ |
| | | private int code; |
| | | |
| | | public UserAppletException() { |
| | | } |
| | | |
| | | public UserAppletException(String message, Integer code) { |
| | | this.message = message; |
| | | this.code = code; |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.exception.user; |
| | | |
| | | import com.ruoyi.common.core.exception.base.BaseException; |
| | | |
| | | /** |
| | | * 用户信息异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class UserException extends BaseException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public UserException(String code, Object[] args) |
| | | { |
| | | super("user", code, args, null); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.exception.user; |
| | | |
| | | /** |
| | | * 用户密码不正确或不符合规范异常类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class UserPasswordNotMatchException extends UserException |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public UserPasswordNotMatchException() |
| | | { |
| | | super("user.password.not.match", null); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.query; |
| | | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName TimeRangePageDTO |
| | | * @Description |
| | | * @date 2023-06-4 14:42 |
| | | */ |
| | | @ApiModel("时间范围分页dto") |
| | | public class TimeRangePageQuery extends BasePage { |
| | | @ApiModelProperty("开始时间 格式 yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date startTime; |
| | | |
| | | @ApiModelProperty("结束时间 格式 yyyy-MM-dd") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date endTime; |
| | | |
| | | public String getStartTime() { |
| | | if (Objects.nonNull(startTime)) { |
| | | return new SimpleDateFormat("yyyy-MM-dd").format(startTime) + " 00:00:00"; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public void setStartTime(Date startTime) { |
| | | this.startTime = startTime; |
| | | } |
| | | |
| | | public String getEndTime() { |
| | | if (Objects.nonNull(endTime)) { |
| | | return new SimpleDateFormat("yyyy-MM-dd").format(endTime) + " 23:59:59"; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public void setEndTime(Date endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.utils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Calendar; |
| | | |
| | | /** |
| | | * @Description 活动订单操作 |
| | | * @Author xiaochen |
| | | * @Date 2021/7/28 10:26 |
| | | */ |
| | | public class CodeGenerateUtils { |
| | | |
| | | /** |
| | | * @return |
| | | * @Description 获取商品编码 |
| | | * 商品编码规则:nanoTime(后5位)*5位随机数(10000~99999) |
| | | * @Author xiaochen |
| | | */ |
| | | public static String generateProductCode() { |
| | | long nanoPart = System.nanoTime() % 100000L; |
| | | if (nanoPart < 10000L) { |
| | | nanoPart += 10000L; |
| | | } |
| | | long randomPart = (long) (Math.random() * (90000) + 10000); |
| | | String code = "0" + String.valueOf((new BigDecimal(nanoPart).multiply(new BigDecimal(randomPart)))); |
| | | return code.substring(code.length() - 10); |
| | | } |
| | | |
| | | /** |
| | | * @param id: 用户id |
| | | * @return |
| | | * @Description 生成订单编号 |
| | | * 订单编号规则:(10位):(年末尾*月,取后2位)+(用户ID%3.33*日取整后2位)+(timestamp*10000以内随机数,取后6位) |
| | | * @Author xiaochen |
| | | */ |
| | | public static String generateOrderSn(long id) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | int year = calendar.get(Calendar.YEAR); |
| | | year = year % 10; |
| | | if (year == 0) year = 10; |
| | | int month = calendar.get(Calendar.MONTH) + 1; |
| | | int yearMonth = year * month; |
| | | String yearMonthPart = "0" + yearMonth; |
| | | yearMonthPart = yearMonthPart.substring(yearMonthPart.length() - 2); |
| | | |
| | | int day = calendar.get(Calendar.DAY_OF_MONTH); |
| | | int dayNum = (int) ((id % 3.33) * day); |
| | | String dayPart = "0" + dayNum; |
| | | dayPart = dayPart.substring(dayPart.length() - 2); |
| | | |
| | | String timestampPart = "" + (Math.random() * 10000) * (System.currentTimeMillis() / 10000); |
| | | timestampPart = timestampPart.replace(".", "").replace("E", ""); |
| | | timestampPart = timestampPart.substring(0, 6); |
| | | return yearMonthPart + dayPart + timestampPart; |
| | | } |
| | | |
| | | /** |
| | | * @return |
| | | * @Description 生成统一支付单号 规则:年(2)月(2)日(2)时(2)分(2)+timestamp*5位随机整数取后5位 |
| | | * @Author xiaochen |
| | | */ |
| | | public static String generateVolumeSn() { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddhhmmss"); |
| | | String dateTime = dateFormat.format(calendar.getTime()); |
| | | dateTime = dateTime.substring(2); |
| | | String timestampPart = "" + (Math.random() * 10000) * (System.currentTimeMillis() / 10000); |
| | | timestampPart = timestampPart.replace(".", "").replace("E", ""); |
| | | timestampPart = timestampPart.substring(0, 5); |
| | | return dateTime + timestampPart; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | for (long i = 0; i < 20; i++) { |
| | | //String timestampPart = ""+(Math.random() * 10000) * (System.currentTimeMillis()/10000); |
| | | //System.out.println(timestampPart); |
| | | //System.out.println(generateOrderSn(i)); |
| | | long l = System.currentTimeMillis() * Long.valueOf(CodeGenerateUtils.generateProductCode().substring(0, 5)); |
| | | System.out.println(String.valueOf(l).substring(0,10)); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * @description id补0生成编号 |
| | | * @author jqs |
| | | * @date 2024/4/17 14:19 |
| | | * @param totalLength |
| | | * @param id |
| | | * @return String |
| | | */ |
| | | public static String toFillZeroCode(int totalLength, Long id) { |
| | | String idStr = id.toString(); |
| | | int length = idStr.length(); |
| | | if(totalLength <= length){ |
| | | return idStr; |
| | | } |
| | | int fillLength = totalLength - length; |
| | | StringBuilder idsbs = new StringBuilder(); |
| | | for (int i = 0; i < fillLength; i++) { |
| | | idsbs.append("0"); |
| | | } |
| | | return idsbs.append(idStr).toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.utils; |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.io.StringWriter; |
| | | import org.apache.commons.lang3.exception.ExceptionUtils; |
| | | |
| | | /** |
| | | * 错误信息处理类。 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class ExceptionUtil |
| | | { |
| | | /** |
| | | * 获取exception的详细错误信息。 |
| | | */ |
| | | public static String getExceptionMessage(Throwable e) |
| | | { |
| | | StringWriter sw = new StringWriter(); |
| | | e.printStackTrace(new PrintWriter(sw, true)); |
| | | return sw.toString(); |
| | | } |
| | | |
| | | public static String getRootErrorMessage(Exception e) |
| | | { |
| | | Throwable root = ExceptionUtils.getRootCause(e); |
| | | root = (root == null ? e : root); |
| | | if (root == null) |
| | | { |
| | | return ""; |
| | | } |
| | | String msg = root.getMessage(); |
| | | if (msg == null) |
| | | { |
| | | return "null"; |
| | | } |
| | | return StringUtils.defaultString(msg); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.utils; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.ruoyi.common.core.constant.MsgConstants; |
| | | import com.ruoyi.common.core.utils.req.SubmitTempletReq; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | |
| | | import java.util.concurrent.ThreadLocalRandom; |
| | | |
| | | public class MsgUtil { |
| | | |
| | | public final static String ecName= "四川明星新能源科技有限公司"; |
| | | public final static String secretKey= "MX_xny2023?9"; |
| | | public final static String sign= "1PUAVuY2b"; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 更换手机号:【签名】验证码:XXX,用于更换手机号。请勿转发。 |
| | | * @param phone 手机号 |
| | | * @param code 验证码 |
| | | * @return |
| | | */ |
| | | public static String codeMsg(String phone,String code){ |
| | | SubmitTempletReq submitReq = new SubmitTempletReq(); |
| | | String[] paramss = {code}; |
| | | submitReq.setApId(MsgConstants.CODE_AP_ID); |
| | | submitReq.setEcName(ecName); |
| | | submitReq.setSecretKey(secretKey); |
| | | submitReq.setParams(JSON.toJSONString(paramss)); |
| | | submitReq.setMobiles(phone); |
| | | submitReq.setAddSerial(""); |
| | | submitReq.setSign(sign); |
| | | submitReq.setTemplateId(MsgConstants.CODE_TEMPLATE_ID); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append(submitReq.getEcName()); |
| | | stringBuffer.append(submitReq.getApId()); |
| | | stringBuffer.append(submitReq.getSecretKey()); |
| | | stringBuffer.append(submitReq.getTemplateId()); |
| | | stringBuffer.append(submitReq.getMobiles()); |
| | | stringBuffer.append(submitReq.getParams()); |
| | | stringBuffer.append(submitReq.getSign()); |
| | | stringBuffer.append(submitReq.getAddSerial()); |
| | | submitReq.setMac(MD5Util.getMD5(stringBuffer.toString())); |
| | | String reqText = JSON.toJSONString(submitReq); |
| | | //加密 |
| | | String encode = Base64.encodeBase64String(reqText.getBytes()); |
| | | System.err.println(encode); |
| | | return encode; |
| | | } |
| | | |
| | | /** |
| | | * 更换手机号:【签名】验证码:XXX,用于更换手机号。请勿转发。 |
| | | * @param phone 手机号 |
| | | * @param code 验证码 |
| | | * @return |
| | | */ |
| | | public static String applyCodeMsg(String phone,String code){ |
| | | SubmitTempletReq submitReq = new SubmitTempletReq(); |
| | | String[] paramss = {code}; |
| | | submitReq.setApId(MsgConstants.APPLY_AP_ID); |
| | | submitReq.setEcName(ecName); |
| | | submitReq.setSecretKey(secretKey); |
| | | submitReq.setParams(JSON.toJSONString(paramss)); |
| | | submitReq.setMobiles(phone); |
| | | submitReq.setAddSerial(""); |
| | | submitReq.setSign(sign); |
| | | submitReq.setTemplateId(MsgConstants.APPLY_TEMPLATE_ID); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append(submitReq.getEcName()); |
| | | stringBuffer.append(submitReq.getApId()); |
| | | stringBuffer.append(submitReq.getSecretKey()); |
| | | stringBuffer.append(submitReq.getTemplateId()); |
| | | stringBuffer.append(submitReq.getMobiles()); |
| | | stringBuffer.append(submitReq.getParams()); |
| | | stringBuffer.append(submitReq.getSign()); |
| | | stringBuffer.append(submitReq.getAddSerial()); |
| | | submitReq.setMac(MD5Util.getMD5(stringBuffer.toString())); |
| | | String reqText = JSON.toJSONString(submitReq); |
| | | //加密 |
| | | String encode = Base64.encodeBase64String(reqText.getBytes()); |
| | | System.err.println(encode); |
| | | return encode; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 停车占位提醒:车辆已在3小时前完成充电,请及时取车,避免长时间占用充电资源。 |
| | | * @param phone 手机号 |
| | | * @return |
| | | */ |
| | | public static String stopMsg(String phone){ |
| | | SubmitTempletReq submitReq = new SubmitTempletReq(); |
| | | submitReq.setTemplateId(MsgConstants.STOP_TEMPLATE_ID); |
| | | submitReq.setApId(MsgConstants.STOP_AP_ID); |
| | | submitReq.setEcName(ecName); |
| | | submitReq.setSecretKey(secretKey); |
| | | submitReq.setMobiles(phone); |
| | | submitReq.setAddSerial(""); |
| | | submitReq.setSign(sign); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append(submitReq.getEcName()); |
| | | stringBuffer.append(submitReq.getApId()); |
| | | stringBuffer.append(submitReq.getSecretKey()); |
| | | stringBuffer.append(submitReq.getTemplateId()); |
| | | stringBuffer.append(submitReq.getMobiles()); |
| | | stringBuffer.append(submitReq.getParams()); |
| | | stringBuffer.append(submitReq.getSign()); |
| | | stringBuffer.append(submitReq.getAddSerial()); |
| | | submitReq.setMac(MD5Util.getMD5(stringBuffer.toString())); |
| | | String reqText = JSON.toJSONString(submitReq); |
| | | //加密 |
| | | String encode = Base64.encodeBase64String(reqText.getBytes()); |
| | | System.err.println(encode); |
| | | return encode; |
| | | } |
| | | |
| | | /** |
| | | * 充电结束:车辆充电结束,请及时取车。 |
| | | * @param phone 手机号 |
| | | * @return |
| | | */ |
| | | public static String chargeStopMsg(String phone){ |
| | | SubmitTempletReq submitReq = new SubmitTempletReq(); |
| | | submitReq.setTemplateId(MsgConstants.CHARGE_TEMPLATE_ID); |
| | | submitReq.setApId(MsgConstants.CHARGE_AP_ID); |
| | | submitReq.setEcName(ecName); |
| | | submitReq.setSecretKey(secretKey); |
| | | submitReq.setMobiles(phone); |
| | | submitReq.setAddSerial(""); |
| | | submitReq.setSign(sign); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append(submitReq.getEcName()); |
| | | stringBuffer.append(submitReq.getApId()); |
| | | stringBuffer.append(submitReq.getSecretKey()); |
| | | stringBuffer.append(submitReq.getTemplateId()); |
| | | stringBuffer.append(submitReq.getMobiles()); |
| | | stringBuffer.append(submitReq.getParams()); |
| | | stringBuffer.append(submitReq.getSign()); |
| | | stringBuffer.append(submitReq.getAddSerial()); |
| | | submitReq.setMac(MD5Util.getMD5(stringBuffer.toString())); |
| | | String reqText = JSON.toJSONString(submitReq); |
| | | //加密 |
| | | String encode = Base64.encodeBase64String(reqText.getBytes()); |
| | | System.err.println(encode); |
| | | return encode; |
| | | } |
| | | |
| | | /** phone 单词可拼接5000个号码 |
| | | * 桩故障(自动/手动):检测到【电站1】【编号】号桩设备离线,请及时查看处理! |
| | | * @param phone 手机号 |
| | | * @param site 站点名称 |
| | | * @param chargeGun 桩编号 |
| | | * @return |
| | | */ |
| | | public static String faultMsg(String phone,String site,String chargeGun){ |
| | | SubmitTempletReq submitReq = new SubmitTempletReq(); |
| | | if(site.length()<=10){ |
| | | String[] paramss = {site,chargeGun}; |
| | | submitReq.setParams(JSON.toJSONString(paramss)); |
| | | }else{ |
| | | String work1 = site.substring(0,10); |
| | | String[] paramss = {work1,chargeGun}; |
| | | submitReq.setParams(JSON.toJSONString(paramss)); |
| | | } |
| | | submitReq.setTemplateId(MsgConstants.FAULT_TEMPLATE_ID); |
| | | submitReq.setApId(MsgConstants.FAULT_AP_ID); |
| | | submitReq.setEcName(ecName); |
| | | submitReq.setSecretKey(secretKey); |
| | | submitReq.setMobiles(phone); |
| | | submitReq.setAddSerial(""); |
| | | submitReq.setSign(sign); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append(submitReq.getEcName()); |
| | | stringBuffer.append(submitReq.getApId()); |
| | | stringBuffer.append(submitReq.getSecretKey()); |
| | | stringBuffer.append(submitReq.getTemplateId()); |
| | | stringBuffer.append(submitReq.getMobiles()); |
| | | stringBuffer.append(submitReq.getParams()); |
| | | stringBuffer.append(submitReq.getSign()); |
| | | stringBuffer.append(submitReq.getAddSerial()); |
| | | submitReq.setMac(MD5Util.getMD5(stringBuffer.toString())); |
| | | String reqText = JSON.toJSONString(submitReq); |
| | | //加密 |
| | | String encode = Base64.encodeBase64String(reqText.getBytes()); |
| | | System.err.println(encode); |
| | | return encode; |
| | | } |
| | | /** |
| | | * 生成验证码 |
| | | * @return |
| | | */ |
| | | public static String createCode(){ |
| | | return String.valueOf(ThreadLocalRandom.current().nextInt(100000, 999999)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.utils; |
| | | |
| | | import com.obs.services.ObsClient; |
| | | import com.obs.services.model.ObjectMetadata; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.UUID; |
| | | |
| | | public class ObsUploadUtil { |
| | | |
| | | public static String endPoint = "obs.cn-southwest-2.myhuaweicloud.com"; |
| | | public static String accessKeyId = "LP9N1TLAYN8ERS1PVIYK"; |
| | | public static String accessKeySecret = "bV55lFHi1cG0SYBvnab8yIgDX6etKRSLh5j1gkPR"; |
| | | public static String bucketName = "haitunyingyu"; |
| | | public static String oss_domain = "https://haitunyingyu.obs.cn-southwest-2.myhuaweicloud.com/"; |
| | | // 创建ObsClient实例 |
| | | public static ObsClient obsClient = new ObsClient(accessKeyId, accessKeySecret, endPoint); |
| | | |
| | | public static String obsUpload(MultipartFile file) throws IOException{ |
| | | //CommonsMultipartFile file = (CommonsMultipartFile)multipartFile; |
| | | String fileName = ""; |
| | | if(file!=null && !"".equals(file.getOriginalFilename()) && file.getOriginalFilename()!=null){ |
| | | InputStream content = file.getInputStream();//获得指定文件的输入流 |
| | | ObjectMetadata meta = new ObjectMetadata();// 创建上传Object的Metadata |
| | | meta.setContentLength(file.getSize()); // 必须设置ContentLength |
| | | String originalFilename = file.getOriginalFilename(); |
| | | if (originalFilename.contains("apk")){ |
| | | fileName = "bf2fe5c5499341e5bc0d56c0c7d5fb2e.apk"; |
| | | System.err.println("apk"); |
| | | }else{ |
| | | fileName = UUID.randomUUID().toString().replaceAll("-","") + originalFilename.subSequence(originalFilename.lastIndexOf("."), originalFilename.length()); |
| | | } |
| | | obsClient.putObject(bucketName,"admin/"+fileName,content,meta);// 上传Object. |
| | | if(fileName != null && !"".equals(fileName)){ |
| | | System.out.println(fileName); |
| | | fileName = oss_domain+"admin/"+fileName; |
| | | } |
| | | } |
| | | return fileName; |
| | | } |
| | | |
| | | /** |
| | | * 删除某个Object |
| | | * |
| | | * @param bucketUrl |
| | | * @return |
| | | */ |
| | | public static boolean deleteObject(String bucketUrl) { |
| | | try { |
| | | bucketUrl=bucketUrl.replace(oss_domain+"web",""); |
| | | // 删除Object. |
| | | obsClient.deleteObject(bucketName, bucketUrl); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } finally { |
| | | //ossClient.shutdown(); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | // public static void createBucket(String bucketName) |
| | | // { |
| | | // //初始化 OSSClient |
| | | //// ossClient = new OssClient(endPoint, accessKeyId, accessKeySecret); |
| | | // |
| | | // // 新建一个Bucket |
| | | // Bucket bucket = ossClient.createBucket(bucketName); |
| | | // System.out.println(bucket.getName()); |
| | | // System.out.println(bucket.getCreationDate()); |
| | | // } |
| | | // |
| | | // public static void main(String[] args) { |
| | | // OssUploadUtil.createBucket("ssfdfsd"); |
| | | // } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.utils; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.springframework.util.AntPathMatcher; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.text.StrFormatter; |
| | | |
| | | /** |
| | | * 字符串工具类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class StringUtils extends org.apache.commons.lang3.StringUtils |
| | | { |
| | | /** 空字符串 */ |
| | | private static final String NULLSTR = ""; |
| | | |
| | | /** 下划线 */ |
| | | private static final char SEPARATOR = '_'; |
| | | |
| | | /** |
| | | * 获取参数不为空值 |
| | | * |
| | | * @param value defaultValue 要判断的value |
| | | * @return value 返回值 |
| | | */ |
| | | public static <T> T nvl(T value, T defaultValue) |
| | | { |
| | | return value != null ? value : defaultValue; |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个Collection是否为空, 包含List,Set,Queue |
| | | * |
| | | * @param coll 要判断的Collection |
| | | * @return true:为空 false:非空 |
| | | */ |
| | | public static boolean isEmpty(Collection<?> coll) |
| | | { |
| | | return isNull(coll) || coll.isEmpty(); |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个Collection是否非空,包含List,Set,Queue |
| | | * |
| | | * @param coll 要判断的Collection |
| | | * @return true:非空 false:空 |
| | | */ |
| | | public static boolean isNotEmpty(Collection<?> coll) |
| | | { |
| | | return !isEmpty(coll); |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个对象数组是否为空 |
| | | * |
| | | * @param objects 要判断的对象数组 |
| | | ** @return true:为空 false:非空 |
| | | */ |
| | | public static boolean isEmpty(Object[] objects) |
| | | { |
| | | return isNull(objects) || (objects.length == 0); |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个对象数组是否非空 |
| | | * |
| | | * @param objects 要判断的对象数组 |
| | | * @return true:非空 false:空 |
| | | */ |
| | | public static boolean isNotEmpty(Object[] objects) |
| | | { |
| | | return !isEmpty(objects); |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个Map是否为空 |
| | | * |
| | | * @param map 要判断的Map |
| | | * @return true:为空 false:非空 |
| | | */ |
| | | public static boolean isEmpty(Map<?, ?> map) |
| | | { |
| | | return isNull(map) || map.isEmpty(); |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个Map是否为空 |
| | | * |
| | | * @param map 要判断的Map |
| | | * @return true:非空 false:空 |
| | | */ |
| | | public static boolean isNotEmpty(Map<?, ?> map) |
| | | { |
| | | return !isEmpty(map); |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个字符串是否为空串 |
| | | * |
| | | * @param str String |
| | | * @return true:为空 false:非空 |
| | | */ |
| | | public static boolean isEmpty(String str) |
| | | { |
| | | return isNull(str) || NULLSTR.equals(str.trim()); |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个字符串是否为非空串 |
| | | * |
| | | * @param str String |
| | | * @return true:非空串 false:空串 |
| | | */ |
| | | public static boolean isNotEmpty(String str) |
| | | { |
| | | return !isEmpty(str); |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个对象是否为空 |
| | | * |
| | | * @param object Object |
| | | * @return true:为空 false:非空 |
| | | */ |
| | | public static boolean isNull(Object object) |
| | | { |
| | | return object == null; |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个对象是否非空 |
| | | * |
| | | * @param object Object |
| | | * @return true:非空 false:空 |
| | | */ |
| | | public static boolean isNotNull(Object object) |
| | | { |
| | | return !isNull(object); |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个对象是否是数组类型(Java基本型别的数组) |
| | | * |
| | | * @param object 对象 |
| | | * @return true:是数组 false:不是数组 |
| | | */ |
| | | public static boolean isArray(Object object) |
| | | { |
| | | return isNotNull(object) && object.getClass().isArray(); |
| | | } |
| | | |
| | | /** |
| | | * 去空格 |
| | | */ |
| | | public static String trim(String str) |
| | | { |
| | | return (str == null ? "" : str.trim()); |
| | | } |
| | | |
| | | /** |
| | | * 截取字符串 |
| | | * |
| | | * @param str 字符串 |
| | | * @param start 开始 |
| | | * @return 结果 |
| | | */ |
| | | public static String substring(final String str, int start) |
| | | { |
| | | if (str == null) |
| | | { |
| | | return NULLSTR; |
| | | } |
| | | |
| | | if (start < 0) |
| | | { |
| | | start = str.length() + start; |
| | | } |
| | | |
| | | if (start < 0) |
| | | { |
| | | start = 0; |
| | | } |
| | | if (start > str.length()) |
| | | { |
| | | return NULLSTR; |
| | | } |
| | | |
| | | return str.substring(start); |
| | | } |
| | | |
| | | /** |
| | | * 截取字符串 |
| | | * |
| | | * @param str 字符串 |
| | | * @param start 开始 |
| | | * @param end 结束 |
| | | * @return 结果 |
| | | */ |
| | | public static String substring(final String str, int start, int end) |
| | | { |
| | | if (str == null) |
| | | { |
| | | return NULLSTR; |
| | | } |
| | | |
| | | if (end < 0) |
| | | { |
| | | end = str.length() + end; |
| | | } |
| | | if (start < 0) |
| | | { |
| | | start = str.length() + start; |
| | | } |
| | | |
| | | if (end > str.length()) |
| | | { |
| | | end = str.length(); |
| | | } |
| | | |
| | | if (start > end) |
| | | { |
| | | return NULLSTR; |
| | | } |
| | | |
| | | if (start < 0) |
| | | { |
| | | start = 0; |
| | | } |
| | | if (end < 0) |
| | | { |
| | | end = 0; |
| | | } |
| | | |
| | | return str.substring(start, end); |
| | | } |
| | | |
| | | /** |
| | | * 判断是否为空,并且不是空白字符 |
| | | * |
| | | * @param str 要判断的value |
| | | * @return 结果 |
| | | */ |
| | | public static boolean hasText(String str) |
| | | { |
| | | return (str != null && !str.isEmpty() && containsText(str)); |
| | | } |
| | | |
| | | private static boolean containsText(CharSequence str) |
| | | { |
| | | int strLen = str.length(); |
| | | for (int i = 0; i < strLen; i++) |
| | | { |
| | | if (!Character.isWhitespace(str.charAt(i))) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 格式化文本, {} 表示占位符<br> |
| | | * 此方法只是简单将占位符 {} 按照顺序替换为参数<br> |
| | | * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br> |
| | | * 例:<br> |
| | | * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br> |
| | | * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br> |
| | | * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br> |
| | | * |
| | | * @param template 文本模板,被替换的部分用 {} 表示 |
| | | * @param params 参数值 |
| | | * @return 格式化后的文本 |
| | | */ |
| | | public static String format(String template, Object... params) |
| | | { |
| | | if (isEmpty(params) || isEmpty(template)) |
| | | { |
| | | return template; |
| | | } |
| | | return StrFormatter.format(template, params); |
| | | } |
| | | |
| | | /** |
| | | * 是否为http(s)://开头 |
| | | * |
| | | * @param link 链接 |
| | | * @return 结果 |
| | | */ |
| | | public static boolean ishttp(String link) |
| | | { |
| | | return StringUtils.startsWithAny(link, Constants.HTTP, Constants.HTTPS); |
| | | } |
| | | |
| | | /** |
| | | * 判断给定的collection列表中是否包含数组array 判断给定的数组array中是否包含给定的元素value |
| | | * |
| | | * @param collection 给定的集合 |
| | | * @param array 给定的数组 |
| | | * @return boolean 结果 |
| | | */ |
| | | public static boolean containsAny(Collection<String> collection, String... array) |
| | | { |
| | | if (isEmpty(collection) || isEmpty(array)) |
| | | { |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | for (String str : array) |
| | | { |
| | | if (collection.contains(str)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 驼峰转下划线命名 |
| | | */ |
| | | public static String toUnderScoreCase(String str) |
| | | { |
| | | if (str == null) |
| | | { |
| | | return null; |
| | | } |
| | | StringBuilder sb = new StringBuilder(); |
| | | // 前置字符是否大写 |
| | | boolean preCharIsUpperCase = true; |
| | | // 当前字符是否大写 |
| | | boolean curreCharIsUpperCase = true; |
| | | // 下一字符是否大写 |
| | | boolean nexteCharIsUpperCase = true; |
| | | for (int i = 0; i < str.length(); i++) |
| | | { |
| | | char c = str.charAt(i); |
| | | if (i > 0) |
| | | { |
| | | preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1)); |
| | | } |
| | | else |
| | | { |
| | | preCharIsUpperCase = false; |
| | | } |
| | | |
| | | curreCharIsUpperCase = Character.isUpperCase(c); |
| | | |
| | | if (i < (str.length() - 1)) |
| | | { |
| | | nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1)); |
| | | } |
| | | |
| | | if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) |
| | | { |
| | | sb.append(SEPARATOR); |
| | | } |
| | | else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) |
| | | { |
| | | sb.append(SEPARATOR); |
| | | } |
| | | sb.append(Character.toLowerCase(c)); |
| | | } |
| | | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 是否包含字符串 |
| | | * |
| | | * @param str 验证字符串 |
| | | * @param strs 字符串组 |
| | | * @return 包含返回true |
| | | */ |
| | | public static boolean inStringIgnoreCase(String str, String... strs) |
| | | { |
| | | if (str != null && strs != null) |
| | | { |
| | | for (String s : strs) |
| | | { |
| | | if (str.equalsIgnoreCase(trim(s))) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld |
| | | * |
| | | * @param name 转换前的下划线大写方式命名的字符串 |
| | | * @return 转换后的驼峰式命名的字符串 |
| | | */ |
| | | public static String convertToCamelCase(String name) |
| | | { |
| | | StringBuilder result = new StringBuilder(); |
| | | // 快速检查 |
| | | if (name == null || name.isEmpty()) |
| | | { |
| | | // 没必要转换 |
| | | return ""; |
| | | } |
| | | else if (!name.contains("_")) |
| | | { |
| | | // 不含下划线,仅将首字母大写 |
| | | return name.substring(0, 1).toUpperCase() + name.substring(1); |
| | | } |
| | | // 用下划线将原始字符串分割 |
| | | String[] camels = name.split("_"); |
| | | for (String camel : camels) |
| | | { |
| | | // 跳过原始字符串中开头、结尾的下换线或双重下划线 |
| | | if (camel.isEmpty()) |
| | | { |
| | | continue; |
| | | } |
| | | // 首字母大写 |
| | | result.append(camel.substring(0, 1).toUpperCase()); |
| | | result.append(camel.substring(1).toLowerCase()); |
| | | } |
| | | return result.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 驼峰式命名法 |
| | | * 例如:user_name->userName |
| | | */ |
| | | public static String toCamelCase(String s) |
| | | { |
| | | if (s == null) |
| | | { |
| | | return null; |
| | | } |
| | | if (s.indexOf(SEPARATOR) == -1) |
| | | { |
| | | return s; |
| | | } |
| | | s = s.toLowerCase(); |
| | | StringBuilder sb = new StringBuilder(s.length()); |
| | | boolean upperCase = false; |
| | | for (int i = 0; i < s.length(); i++) |
| | | { |
| | | char c = s.charAt(i); |
| | | |
| | | if (c == SEPARATOR) |
| | | { |
| | | upperCase = true; |
| | | } |
| | | else if (upperCase) |
| | | { |
| | | sb.append(Character.toUpperCase(c)); |
| | | upperCase = false; |
| | | } |
| | | else |
| | | { |
| | | sb.append(c); |
| | | } |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 查找指定字符串是否匹配指定字符串列表中的任意一个字符串 |
| | | * |
| | | * @param str 指定字符串 |
| | | * @param strs 需要检查的字符串数组 |
| | | * @return 是否匹配 |
| | | */ |
| | | public static boolean matches(String str, List<String> strs) |
| | | { |
| | | if (isEmpty(str) || isEmpty(strs)) |
| | | { |
| | | return false; |
| | | } |
| | | for (String pattern : strs) |
| | | { |
| | | if (isMatch(pattern, str)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 判断url是否与规则配置: |
| | | * ? 表示单个字符; |
| | | * * 表示一层路径内的任意字符串,不可跨层级; |
| | | * ** 表示任意层路径; |
| | | * |
| | | * @param pattern 匹配规则 |
| | | * @param url 需要匹配的url |
| | | * @return |
| | | */ |
| | | public static boolean isMatch(String pattern, String url) |
| | | { |
| | | AntPathMatcher matcher = new AntPathMatcher(); |
| | | return matcher.match(pattern, url); |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | public static <T> T cast(Object obj) |
| | | { |
| | | return (T) obj; |
| | | } |
| | | |
| | | /** |
| | | * 数字左边补齐0,使之达到指定长度。注意,如果数字转换为字符串后,长度大于size,则只保留 最后size个字符。 |
| | | * |
| | | * @param num 数字对象 |
| | | * @param size 字符串指定长度 |
| | | * @return 返回数字的字符串格式,该字符串为指定长度。 |
| | | */ |
| | | public static final String padl(final Number num, final int size) |
| | | { |
| | | return padl(num.toString(), size, '0'); |
| | | } |
| | | |
| | | /** |
| | | * 字符串左补齐。如果原始字符串s长度大于size,则只保留最后size个字符。 |
| | | * |
| | | * @param s 原始字符串 |
| | | * @param size 字符串指定长度 |
| | | * @param c 用于补齐的字符 |
| | | * @return 返回指定长度的字符串,由原字符串左补齐或截取得到。 |
| | | */ |
| | | public static final String padl(final String s, final int size, final char c) |
| | | { |
| | | final StringBuilder sb = new StringBuilder(size); |
| | | if (s != null) |
| | | { |
| | | final int len = s.length(); |
| | | if (s.length() <= size) |
| | | { |
| | | for (int i = size - len; i > 0; i--) |
| | | { |
| | | sb.append(c); |
| | | } |
| | | sb.append(s); |
| | | } |
| | | else |
| | | { |
| | | return s.substring(len - size, len); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (int i = size; i > 0; i--) |
| | | { |
| | | sb.append(c); |
| | | } |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.utils.ip; |
| | | |
| | | import java.net.InetAddress; |
| | | import java.net.UnknownHostException; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import com.ruoyi.common.core.utils.ServletUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | |
| | | /** |
| | | * 获取IP方法 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class IpUtils |
| | | { |
| | | public final static String REGX_0_255 = "(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]\\d|\\d)"; |
| | | // 匹配 ip |
| | | public final static String REGX_IP = "((" + REGX_0_255 + "\\.){3}" + REGX_0_255 + ")"; |
| | | public final static String REGX_IP_WILDCARD = "(((\\*\\.){3}\\*)|(" + REGX_0_255 + "(\\.\\*){3})|(" + REGX_0_255 + "\\." + REGX_0_255 + ")(\\.\\*){2}" + "|((" + REGX_0_255 + "\\.){3}\\*))"; |
| | | // 匹配网段 |
| | | public final static String REGX_IP_SEG = "(" + REGX_IP + "\\-" + REGX_IP + ")"; |
| | | |
| | | /** |
| | | * 获取客户端IP |
| | | * |
| | | * @return IP地址 |
| | | */ |
| | | public static String getIpAddr() |
| | | { |
| | | return getIpAddr(ServletUtils.getRequest()); |
| | | } |
| | | |
| | | /** |
| | | * 获取客户端IP |
| | | * |
| | | * @param request 请求对象 |
| | | * @return IP地址 |
| | | */ |
| | | public static String getIpAddr(HttpServletRequest request) |
| | | { |
| | | if (request == null) |
| | | { |
| | | return "unknown"; |
| | | } |
| | | String ip = request.getHeader("x-forwarded-for"); |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) |
| | | { |
| | | ip = request.getHeader("Proxy-Client-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) |
| | | { |
| | | ip = request.getHeader("X-Forwarded-For"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) |
| | | { |
| | | ip = request.getHeader("WL-Proxy-Client-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) |
| | | { |
| | | ip = request.getHeader("X-Real-IP"); |
| | | } |
| | | |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) |
| | | { |
| | | ip = request.getRemoteAddr(); |
| | | } |
| | | |
| | | return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : getMultistageReverseProxyIp(ip); |
| | | } |
| | | |
| | | /** |
| | | * 检查是否为内部IP地址 |
| | | * |
| | | * @param ip IP地址 |
| | | * @return 结果 |
| | | */ |
| | | public static boolean internalIp(String ip) |
| | | { |
| | | byte[] addr = textToNumericFormatV4(ip); |
| | | return internalIp(addr) || "127.0.0.1".equals(ip); |
| | | } |
| | | |
| | | /** |
| | | * 检查是否为内部IP地址 |
| | | * |
| | | * @param addr byte地址 |
| | | * @return 结果 |
| | | */ |
| | | private static boolean internalIp(byte[] addr) |
| | | { |
| | | if (StringUtils.isNull(addr) || addr.length < 2) |
| | | { |
| | | return true; |
| | | } |
| | | final byte b0 = addr[0]; |
| | | final byte b1 = addr[1]; |
| | | // 10.x.x.x/8 |
| | | final byte SECTION_1 = 0x0A; |
| | | // 172.16.x.x/12 |
| | | final byte SECTION_2 = (byte) 0xAC; |
| | | final byte SECTION_3 = (byte) 0x10; |
| | | final byte SECTION_4 = (byte) 0x1F; |
| | | // 192.168.x.x/16 |
| | | final byte SECTION_5 = (byte) 0xC0; |
| | | final byte SECTION_6 = (byte) 0xA8; |
| | | switch (b0) |
| | | { |
| | | case SECTION_1: |
| | | return true; |
| | | case SECTION_2: |
| | | if (b1 >= SECTION_3 && b1 <= SECTION_4) |
| | | { |
| | | return true; |
| | | } |
| | | case SECTION_5: |
| | | switch (b1) |
| | | { |
| | | case SECTION_6: |
| | | return true; |
| | | } |
| | | default: |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 将IPv4地址转换成字节 |
| | | * |
| | | * @param text IPv4地址 |
| | | * @return byte 字节 |
| | | */ |
| | | public static byte[] textToNumericFormatV4(String text) |
| | | { |
| | | if (text.length() == 0) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | byte[] bytes = new byte[4]; |
| | | String[] elements = text.split("\\.", -1); |
| | | try |
| | | { |
| | | long l; |
| | | int i; |
| | | switch (elements.length) |
| | | { |
| | | case 1: |
| | | l = Long.parseLong(elements[0]); |
| | | if ((l < 0L) || (l > 4294967295L)) |
| | | { |
| | | return null; |
| | | } |
| | | bytes[0] = (byte) (int) (l >> 24 & 0xFF); |
| | | bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF); |
| | | bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); |
| | | bytes[3] = (byte) (int) (l & 0xFF); |
| | | break; |
| | | case 2: |
| | | l = Integer.parseInt(elements[0]); |
| | | if ((l < 0L) || (l > 255L)) |
| | | { |
| | | return null; |
| | | } |
| | | bytes[0] = (byte) (int) (l & 0xFF); |
| | | l = Integer.parseInt(elements[1]); |
| | | if ((l < 0L) || (l > 16777215L)) |
| | | { |
| | | return null; |
| | | } |
| | | bytes[1] = (byte) (int) (l >> 16 & 0xFF); |
| | | bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); |
| | | bytes[3] = (byte) (int) (l & 0xFF); |
| | | break; |
| | | case 3: |
| | | for (i = 0; i < 2; ++i) |
| | | { |
| | | l = Integer.parseInt(elements[i]); |
| | | if ((l < 0L) || (l > 255L)) |
| | | { |
| | | return null; |
| | | } |
| | | bytes[i] = (byte) (int) (l & 0xFF); |
| | | } |
| | | l = Integer.parseInt(elements[2]); |
| | | if ((l < 0L) || (l > 65535L)) |
| | | { |
| | | return null; |
| | | } |
| | | bytes[2] = (byte) (int) (l >> 8 & 0xFF); |
| | | bytes[3] = (byte) (int) (l & 0xFF); |
| | | break; |
| | | case 4: |
| | | for (i = 0; i < 4; ++i) |
| | | { |
| | | l = Integer.parseInt(elements[i]); |
| | | if ((l < 0L) || (l > 255L)) |
| | | { |
| | | return null; |
| | | } |
| | | bytes[i] = (byte) (int) (l & 0xFF); |
| | | } |
| | | break; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | catch (NumberFormatException e) |
| | | { |
| | | return null; |
| | | } |
| | | return bytes; |
| | | } |
| | | |
| | | /** |
| | | * 获取IP地址 |
| | | * |
| | | * @return 本地IP地址 |
| | | */ |
| | | public static String getHostIp() |
| | | { |
| | | try |
| | | { |
| | | return InetAddress.getLocalHost().getHostAddress(); |
| | | } |
| | | catch (UnknownHostException e) |
| | | { |
| | | } |
| | | return "127.0.0.1"; |
| | | } |
| | | |
| | | /** |
| | | * 获取主机名 |
| | | * |
| | | * @return 本地主机名 |
| | | */ |
| | | public static String getHostName() |
| | | { |
| | | try |
| | | { |
| | | return InetAddress.getLocalHost().getHostName(); |
| | | } |
| | | catch (UnknownHostException e) |
| | | { |
| | | } |
| | | return "未知"; |
| | | } |
| | | |
| | | /** |
| | | * 从多级反向代理中获得第一个非unknown IP地址 |
| | | * |
| | | * @param ip 获得的IP地址 |
| | | * @return 第一个非unknown IP地址 |
| | | */ |
| | | public static String getMultistageReverseProxyIp(String ip) |
| | | { |
| | | // 多级反向代理检测 |
| | | if (ip != null && ip.indexOf(",") > 0) |
| | | { |
| | | final String[] ips = ip.trim().split(","); |
| | | for (String subIp : ips) |
| | | { |
| | | if (false == isUnknown(subIp)) |
| | | { |
| | | ip = subIp; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return StringUtils.substring(ip, 0, 255); |
| | | } |
| | | |
| | | /** |
| | | * 检测给定字符串是否为未知,多用于检测HTTP请求相关 |
| | | * |
| | | * @param checkString 被检测的字符串 |
| | | * @return 是否未知 |
| | | */ |
| | | public static boolean isUnknown(String checkString) |
| | | { |
| | | return StringUtils.isBlank(checkString) || "unknown".equalsIgnoreCase(checkString); |
| | | } |
| | | |
| | | /** |
| | | * 是否为IP |
| | | */ |
| | | public static boolean isIP(String ip) |
| | | { |
| | | return StringUtils.isNotBlank(ip) && ip.matches(REGX_IP); |
| | | } |
| | | |
| | | /** |
| | | * 是否为IP,或 *为间隔的通配符地址 |
| | | */ |
| | | public static boolean isIpWildCard(String ip) |
| | | { |
| | | return StringUtils.isNotBlank(ip) && ip.matches(REGX_IP_WILDCARD); |
| | | } |
| | | |
| | | /** |
| | | * 检测参数是否在ip通配符里 |
| | | */ |
| | | public static boolean ipIsInWildCardNoCheck(String ipWildCard, String ip) |
| | | { |
| | | String[] s1 = ipWildCard.split("\\."); |
| | | String[] s2 = ip.split("\\."); |
| | | boolean isMatchedSeg = true; |
| | | for (int i = 0; i < s1.length && !s1[i].equals("*"); i++) |
| | | { |
| | | if (!s1[i].equals(s2[i])) |
| | | { |
| | | isMatchedSeg = false; |
| | | break; |
| | | } |
| | | } |
| | | return isMatchedSeg; |
| | | } |
| | | |
| | | /** |
| | | * 是否为特定格式如:“10.10.10.1-10.10.10.99”的ip段字符串 |
| | | */ |
| | | public static boolean isIPSegment(String ipSeg) |
| | | { |
| | | return StringUtils.isNotBlank(ipSeg) && ipSeg.matches(REGX_IP_SEG); |
| | | } |
| | | |
| | | /** |
| | | * 判断ip是否在指定网段中 |
| | | */ |
| | | public static boolean ipIsInNetNoCheck(String iparea, String ip) |
| | | { |
| | | int idx = iparea.indexOf('-'); |
| | | String[] sips = iparea.substring(0, idx).split("\\."); |
| | | String[] sipe = iparea.substring(idx + 1).split("\\."); |
| | | String[] sipt = ip.split("\\."); |
| | | long ips = 0L, ipe = 0L, ipt = 0L; |
| | | for (int i = 0; i < 4; ++i) |
| | | { |
| | | ips = ips << 8 | Integer.parseInt(sips[i]); |
| | | ipe = ipe << 8 | Integer.parseInt(sipe[i]); |
| | | ipt = ipt << 8 | Integer.parseInt(sipt[i]); |
| | | } |
| | | if (ips > ipe) |
| | | { |
| | | long t = ips; |
| | | ips = ipe; |
| | | ipe = t; |
| | | } |
| | | return ips <= ipt && ipt <= ipe; |
| | | } |
| | | |
| | | /** |
| | | * 校验ip是否符合过滤串规则 |
| | | * |
| | | * @param filter 过滤IP列表,支持后缀'*'通配,支持网段如:`10.10.10.1-10.10.10.99` |
| | | * @param ip 校验IP地址 |
| | | * @return boolean 结果 |
| | | */ |
| | | public static boolean isMatchedIp(String filter, String ip) |
| | | { |
| | | if (StringUtils.isEmpty(filter) || StringUtils.isEmpty(ip)) |
| | | { |
| | | return false; |
| | | } |
| | | String[] ips = filter.split(";"); |
| | | for (String iStr : ips) |
| | | { |
| | | if (isIP(iStr) && iStr.equals(ip)) |
| | | { |
| | | return true; |
| | | } |
| | | else if (isIpWildCard(iStr) && ipIsInWildCardNoCheck(iStr, ip)) |
| | | { |
| | | return true; |
| | | } |
| | | else if (isIPSegment(iStr) && ipIsInNetNoCheck(iStr, ip)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.redis.annotation; |
| | | |
| | | import java.lang.annotation.*; |
| | | |
| | | /** |
| | | * @Descreption: 分布式锁注解 |
| | | * @Author: luofl |
| | | * @Date: 2024/11/26 16:43 |
| | | */ |
| | | @Target({ElementType.METHOD}) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | @Documented |
| | | public @interface DistributedLock { |
| | | |
| | | /** |
| | | * 锁名字(没有EL解析) |
| | | */ |
| | | String lockName() default ""; |
| | | |
| | | /** |
| | | * 锁前缀(有EL解析) |
| | | */ |
| | | String lockNamePre() default ""; |
| | | |
| | | /** |
| | | * 锁后缀(有EL解析) |
| | | */ |
| | | String lockNamePost() default ""; |
| | | |
| | | /** |
| | | * 锁前后缀拼接分隔符 |
| | | */ |
| | | String separator() default "_"; |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.redis.configure; |
| | | |
| | | import java.nio.charset.Charset; |
| | | import org.springframework.data.redis.serializer.RedisSerializer; |
| | | import org.springframework.data.redis.serializer.SerializationException; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONReader; |
| | | import com.alibaba.fastjson2.JSONWriter; |
| | | |
| | | /** |
| | | * Redis使用FastJson序列化 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class FastJson2JsonRedisSerializer<T> implements RedisSerializer<T> |
| | | { |
| | | public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); |
| | | |
| | | private Class<T> clazz; |
| | | |
| | | |
| | | public FastJson2JsonRedisSerializer(Class<T> clazz) |
| | | { |
| | | super(); |
| | | this.clazz = clazz; |
| | | } |
| | | |
| | | @Override |
| | | public byte[] serialize(T t) throws SerializationException |
| | | { |
| | | if (t == null) |
| | | { |
| | | return new byte[0]; |
| | | } |
| | | return JSON.toJSONString(t, JSONWriter.Feature.WriteClassName).getBytes(DEFAULT_CHARSET); |
| | | } |
| | | |
| | | @Override |
| | | public T deserialize(byte[] bytes) throws SerializationException |
| | | { |
| | | if (bytes == null || bytes.length <= 0) |
| | | { |
| | | return null; |
| | | } |
| | | String str = new String(bytes, DEFAULT_CHARSET); |
| | | |
| | | return JSON.parseObject(str, clazz, JSONReader.Feature.SupportAutoType); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.redis.configure; |
| | | |
| | | import org.springframework.boot.autoconfigure.AutoConfigureBefore; |
| | | import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; |
| | | import org.springframework.cache.annotation.CachingConfigurerSupport; |
| | | import org.springframework.cache.annotation.EnableCaching; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.data.redis.connection.RedisConnectionFactory; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.serializer.StringRedisSerializer; |
| | | |
| | | /** |
| | | * redis配置 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Configuration |
| | | @EnableCaching |
| | | @AutoConfigureBefore(RedisAutoConfiguration.class) |
| | | public class RedisConfig extends CachingConfigurerSupport |
| | | { |
| | | @Bean |
| | | @SuppressWarnings(value = { "unchecked", "rawtypes" }) |
| | | public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory) |
| | | { |
| | | RedisTemplate<Object, Object> template = new RedisTemplate<>(); |
| | | template.setConnectionFactory(connectionFactory); |
| | | |
| | | FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class); |
| | | |
| | | // 使用StringRedisSerializer来序列化和反序列化redis的key值 |
| | | template.setKeySerializer(new StringRedisSerializer()); |
| | | template.setValueSerializer(serializer); |
| | | |
| | | // Hash的key也采用StringRedisSerializer的序列化方式 |
| | | template.setHashKeySerializer(new StringRedisSerializer()); |
| | | template.setHashValueSerializer(serializer); |
| | | |
| | | template.afterPropertiesSet(); |
| | | return template; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.redis.service; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.concurrent.TimeUnit; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.BoundSetOperations; |
| | | import org.springframework.data.redis.core.HashOperations; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.data.redis.core.ValueOperations; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * spring redis 工具类 |
| | | * |
| | | * @author ruoyi |
| | | **/ |
| | | @SuppressWarnings(value = { "unchecked", "rawtypes" }) |
| | | @Component |
| | | public class RedisService |
| | | { |
| | | @Autowired |
| | | public RedisTemplate redisTemplate; |
| | | |
| | | /** |
| | | * 缓存基本的对象,Integer、String、实体类等 |
| | | * |
| | | * @param key 缓存的键值 |
| | | * @param value 缓存的值 |
| | | */ |
| | | public <T> void setCacheObject(final String key, final T value) |
| | | { |
| | | redisTemplate.opsForValue().set(key, value); |
| | | } |
| | | |
| | | /** |
| | | * 缓存基本的对象,Integer、String、实体类等 |
| | | * |
| | | * @param key 缓存的键值 |
| | | * @param value 缓存的值 |
| | | * @param timeout 时间 |
| | | * @param timeUnit 时间颗粒度 |
| | | */ |
| | | public <T> void setCacheObject(final String key, final T value, final Long timeout, final TimeUnit timeUnit) |
| | | { |
| | | redisTemplate.opsForValue().set(key, value, timeout, timeUnit); |
| | | } |
| | | |
| | | /** |
| | | * 设置有效时间 |
| | | * |
| | | * @param key Redis键 |
| | | * @param timeout 超时时间 |
| | | * @return true=设置成功;false=设置失败 |
| | | */ |
| | | public boolean expire(final String key, final long timeout) |
| | | { |
| | | return expire(key, timeout, TimeUnit.SECONDS); |
| | | } |
| | | |
| | | /** |
| | | * 设置有效时间 |
| | | * |
| | | * @param key Redis键 |
| | | * @param timeout 超时时间 |
| | | * @param unit 时间单位 |
| | | * @return true=设置成功;false=设置失败 |
| | | */ |
| | | public boolean expire(final String key, final long timeout, final TimeUnit unit) |
| | | { |
| | | return redisTemplate.expire(key, timeout, unit); |
| | | } |
| | | |
| | | /** |
| | | * 获取有效时间 |
| | | * |
| | | * @param key Redis键 |
| | | * @return 有效时间 |
| | | */ |
| | | public long getExpire(final String key) |
| | | { |
| | | return redisTemplate.getExpire(key); |
| | | } |
| | | |
| | | /** |
| | | * 判断 key是否存在 |
| | | * |
| | | * @param key 键 |
| | | * @return true 存在 false不存在 |
| | | */ |
| | | public Boolean hasKey(String key) |
| | | { |
| | | return redisTemplate.hasKey(key); |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的基本对象。 |
| | | * |
| | | * @param key 缓存键值 |
| | | * @return 缓存键值对应的数据 |
| | | */ |
| | | public <T> T getCacheObject(final String key) |
| | | { |
| | | ValueOperations<String, T> operation = redisTemplate.opsForValue(); |
| | | return operation.get(key); |
| | | } |
| | | |
| | | /** |
| | | * 删除单个对象 |
| | | * |
| | | * @param key |
| | | */ |
| | | public boolean deleteObject(final String key) |
| | | { |
| | | return redisTemplate.delete(key); |
| | | } |
| | | |
| | | /** |
| | | * 删除集合对象 |
| | | * |
| | | * @param collection 多个对象 |
| | | * @return |
| | | */ |
| | | public boolean deleteObject(final Collection collection) |
| | | { |
| | | return redisTemplate.delete(collection) > 0; |
| | | } |
| | | |
| | | /** |
| | | * 缓存List数据 |
| | | * |
| | | * @param key 缓存的键值 |
| | | * @param dataList 待缓存的List数据 |
| | | * @return 缓存的对象 |
| | | */ |
| | | public <T> long setCacheList(final String key, final List<T> dataList) |
| | | { |
| | | Long count = redisTemplate.opsForList().rightPushAll(key, dataList); |
| | | return count == null ? 0 : count; |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的list对象 |
| | | * |
| | | * @param key 缓存的键值 |
| | | * @return 缓存键值对应的数据 |
| | | */ |
| | | public <T> List<T> getCacheList(final String key) |
| | | { |
| | | return redisTemplate.opsForList().range(key, 0, -1); |
| | | } |
| | | |
| | | /** |
| | | * 缓存Set |
| | | * |
| | | * @param key 缓存键值 |
| | | * @param dataSet 缓存的数据 |
| | | * @return 缓存数据的对象 |
| | | */ |
| | | public <T> BoundSetOperations<String, T> setCacheSet(final String key, final Set<T> dataSet) |
| | | { |
| | | BoundSetOperations<String, T> setOperation = redisTemplate.boundSetOps(key); |
| | | Iterator<T> it = dataSet.iterator(); |
| | | while (it.hasNext()) |
| | | { |
| | | setOperation.add(it.next()); |
| | | } |
| | | return setOperation; |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的set |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public <T> Set<T> getCacheSet(final String key) |
| | | { |
| | | return redisTemplate.opsForSet().members(key); |
| | | } |
| | | |
| | | /** |
| | | * 缓存Map |
| | | * |
| | | * @param key |
| | | * @param dataMap |
| | | */ |
| | | public <T> void setCacheMap(final String key, final Map<String, T> dataMap) |
| | | { |
| | | if (dataMap != null) { |
| | | redisTemplate.opsForHash().putAll(key, dataMap); |
| | | } |
| | | } |
| | | |
| | | public <T> void setCacheMap(final String key, final Map<String, T> dataMap, long timeout) |
| | | { |
| | | if (dataMap != null) { |
| | | redisTemplate.opsForHash().putAll(key, dataMap); |
| | | redisTemplate.expire(key, timeout, TimeUnit.SECONDS); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的Map |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public <T> Map<String, T> getCacheMap(final String key) |
| | | { |
| | | return redisTemplate.opsForHash().entries(key); |
| | | } |
| | | |
| | | /** |
| | | * 往Hash中存入数据 |
| | | * |
| | | * @param key Redis键 |
| | | * @param hKey Hash键 |
| | | * @param value 值 |
| | | */ |
| | | public <T> void setCacheMapValue(final String key, final String hKey, final T value) |
| | | { |
| | | redisTemplate.opsForHash().put(key, hKey, value); |
| | | } |
| | | |
| | | /** |
| | | * 获取Hash中的数据 |
| | | * |
| | | * @param key Redis键 |
| | | * @param hKey Hash键 |
| | | * @return Hash中的对象 |
| | | */ |
| | | public <T> T getCacheMapValue(final String key, final String hKey) |
| | | { |
| | | HashOperations<String, String, T> opsForHash = redisTemplate.opsForHash(); |
| | | return opsForHash.get(key, hKey); |
| | | } |
| | | |
| | | /** |
| | | * 获取多个Hash中的数据 |
| | | * |
| | | * @param key Redis键 |
| | | * @param hKeys Hash键集合 |
| | | * @return Hash对象集合 |
| | | */ |
| | | public <T> List<T> getMultiCacheMapValue(final String key, final Collection<Object> hKeys) |
| | | { |
| | | return redisTemplate.opsForHash().multiGet(key, hKeys); |
| | | } |
| | | |
| | | /** |
| | | * 删除Hash中的某条数据 |
| | | * |
| | | * @param key Redis键 |
| | | * @param hKey Hash键 |
| | | * @return 是否成功 |
| | | */ |
| | | public boolean deleteCacheMapValue(final String key, final String hKey) |
| | | { |
| | | return redisTemplate.opsForHash().delete(key, hKey) > 0; |
| | | } |
| | | |
| | | /** |
| | | * 获得缓存的基本对象列表 |
| | | * |
| | | * @param pattern 字符串前缀 |
| | | * @return 对象列表 |
| | | */ |
| | | public Collection<String> keys(final String pattern) |
| | | { |
| | | return redisTemplate.keys(pattern); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other; |
| | | |
| | | import com.ruoyi.common.security.annotation.EnableCustomConfig; |
| | | import com.ruoyi.common.security.annotation.EnableRyFeignClients; |
| | | import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.web.servlet.ServletComponentScan; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | /** |
| | | * 账户模块 |
| | | * @author ruoyi |
| | | */ |
| | | @EnableCustomConfig |
| | | @MapperScan({"com.ruoyi.other.mapper"}) |
| | | @EnableCustomSwagger2 |
| | | @EnableRyFeignClients |
| | | @SpringBootApplication |
| | | @EnableScheduling//开启定时任务 |
| | | @ServletComponentScan |
| | | @EnableTransactionManagement//开启事务 |
| | | public class RuoYiOtherApplication { |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(RuoYiOtherApplication.class, args); |
| | | System.out.println("(♥◠‿◠)ノ゙ 基础模块启动成功 ლ(´ڡ`ლ)゙ \n" + |
| | | " .-------. ____ __ \n" + |
| | | " | _ _ \\ \\ \\ / / \n" + |
| | | " | ( ' ) | \\ _. / ' \n" + |
| | | " |(_ o _) / _( )_ .' \n" + |
| | | " | (_,_).' __ ___(_ o _)' \n" + |
| | | " | |\\ \\ | || |(_,_)' \n" + |
| | | " | | \\ `' /| `-' / \n" + |
| | | " | | \\ / \\ / \n" + |
| | | " ''-' `'-' `-..-' "); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.config; |
| | | |
| | | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName DataUpdateInterceptor |
| | | * @Description 数据更新操作处理 |
| | | * @date 2021-12-15 |
| | | * <p> |
| | | * 注意,之前在此处注入了 JwtTokenUtils |
| | | * <p> |
| | | * 造成spring循环依赖,项目支棱不起来 |
| | | */ |
| | | @Slf4j |
| | | @Configuration |
| | | public class DataUpdateHandlerConfig implements MetaObjectHandler { |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | /** |
| | | * 新增数据执行 |
| | | * |
| | | * @param metaObject |
| | | */ |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | this.setFieldValByName("createTime", LocalDateTime.now(), metaObject); |
| | | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
| | | } |
| | | |
| | | /** |
| | | * 修改数据执行 |
| | | * |
| | | * @param metaObject |
| | | */ |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.config; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.web.client.RestTemplateBuilder; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | /** |
| | | * http请求工具配置 |
| | | * |
| | | * @author: KingKong |
| | | * @create: 2018-11-14 10:47 |
| | | **/ |
| | | @Configuration |
| | | public class HttpConfig { |
| | | |
| | | @Autowired |
| | | private RestTemplateBuilder builder; |
| | | |
| | | @Bean |
| | | public RestTemplate restTemplate() { |
| | | return builder.build(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.config; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.DbType; |
| | | import com.baomidou.mybatisplus.core.config.GlobalConfig; |
| | | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName MybatisPlusConfig |
| | | * @Description MybatisPlus相关配置 |
| | | * @date 2020-09-22 11:22、 |
| | | * 直接以实现类作为bean的注入(有事务管理的类) |
| | | * @EnableTransactionManagement(proxyTargetClass = true) |
| | | */ |
| | | @Configuration |
| | | public class MybatisPlusConfig { |
| | | private final DataUpdateHandlerConfig dataUpdateHandler; |
| | | |
| | | @Autowired |
| | | public MybatisPlusConfig(DataUpdateHandlerConfig dataUpdateHandler) { |
| | | this.dataUpdateHandler = dataUpdateHandler; |
| | | } |
| | | |
| | | /** |
| | | * 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题 |
| | | */ |
| | | @Bean |
| | | public MybatisPlusInterceptor mybatisPlusInterceptor() { |
| | | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
| | | interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); |
| | | return interceptor; |
| | | } |
| | | |
| | | /** |
| | | * 自动填充功能 |
| | | * |
| | | * @return |
| | | */ |
| | | @Bean |
| | | public GlobalConfig globalConfig() { |
| | | GlobalConfig globalConfig = new GlobalConfig(); |
| | | globalConfig.setMetaObjectHandler(dataUpdateHandler); |
| | | return globalConfig; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.common.core.web.page.TableDataInfo; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.service.GoodsService; |
| | | import com.ruoyi.other.vo.GoodsVO; |
| | |
| | | */ |
| | | @GetMapping("/goodsList") |
| | | @ApiOperation(value = "商品列表", tags = {"小程序-商城-首页-热门商品列表", "首页热门商品-小程序"}) |
| | | public R<List<GoodsVO>> goodsList(Goods goods){ |
| | | public R<TableDataInfo> goodsList(Goods goods){ |
| | | startPage(); |
| | | return R.ok(goodsService.goodsList(goods)); |
| | | return R.ok(getDataTable(goodsService.goodsList(goods))); |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.other.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | public enum GoodsStatus { |
| | | DOWN(0, "下架"), |
| | | UP(1, "上架"); |
| | | |
| | | private final Integer code; |
| | | private final String desc; |
| | | |
| | | GoodsStatus(Integer code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | public enum PhoneType { |
| | | PLATFORM(1, "平台"), |
| | | SHOP(2, "门店"); |
| | | |
| | | private final Integer code; |
| | | private final String desc; |
| | | |
| | | PhoneType(Integer code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | public enum ShareAddType { |
| | | PLATFORM(1, "平台添加"), |
| | | PROMPOTERS(2, "推广人添加"), |
| | | STORE(3, "门店添加"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |
| | | |
| | | ShareAddType(Integer code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | public enum ShareAuditStatus { |
| | | WAIT(0, "待审核"), |
| | | SUCCESS(1, "审核通过"), |
| | | FAIL(2, "审核失败"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |
| | | |
| | | ShareAuditStatus(Integer code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | public enum ShopStatus { |
| | | SHOP_STATUS_NORMAL(1, "正常"), |
| | | SHOP_STATUS_FREEZE(2, "冻结"); |
| | | |
| | | private final Integer code; |
| | | private final String message; |
| | | |
| | | ShopStatus(Integer code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | public enum TechnicianErrorCode { |
| | | TECHNICIAN_ALREADY_SUBSCRIBED(1001, "该技师已被预约"), |
| | | ; |
| | | |
| | | private final int code; |
| | | private final String message; |
| | | |
| | | TechnicianErrorCode(int code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | @Getter |
| | | public enum TechnicianStatus { |
| | | UNSUBSCRIBE(0, "待服务"), |
| | | SERVE(1, "已服务"), |
| | | CANCEL(2, "已取消"); |
| | | private final Integer code; |
| | | private final String message; |
| | | |
| | | TechnicianStatus(Integer code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | public static String getMessage(Integer code) { |
| | | for (TechnicianStatus value : TechnicianStatus.values()) { |
| | | if (value.getCode().equals(code)) { |
| | | return value.getMessage(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.filter; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.common.core.constant.TokenConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.apache.logging.log4j.core.config.Order; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.*; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/23 11:22 |
| | | */ |
| | | @Order(-200) |
| | | @Component |
| | | public class AuthFilter implements Filter { |
| | | private static final Logger log = LoggerFactory.getLogger(AuthFilter.class); |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Lazy |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | | HttpServletResponse response = (HttpServletResponse) servletResponse; |
| | | String userid = request.getHeader("user_id"); |
| | | if(StringUtils.isEmpty(userid)){ |
| | | filterChain.doFilter(servletRequest, servletResponse); |
| | | return; |
| | | } |
| | | String userType = request.getHeader("user_type"); |
| | | //管理后台用户 |
| | | if ("system".equals(userType)) { |
| | | SysUser sysUser = sysUserClient.getSysUser(Long.valueOf(userid)).getData(); |
| | | if(null == sysUser || "2".equals(sysUser.getDelFlag())){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"无效的账户"); |
| | | return; |
| | | } |
| | | if("1".equals(sysUser.getStatus())){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"账户已被停用,请联系系统管理员!"); |
| | | return; |
| | | } |
| | | } |
| | | //小程序用户 |
| | | if ("applet".equals(userType)) { |
| | | AppUser appUser = appUserClient.getAppUserById(Long.valueOf(userid)); |
| | | if(null == appUser || appUser.getDelFlag() || 3 == appUser.getStatus()){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"无效的账户"); |
| | | return; |
| | | } |
| | | if(2 == appUser.getStatus()){ |
| | | log.error("[账户异常处理]请求账户id:{}", userid); |
| | | unauthorizedResponse(response,"账户已被冻结,请联系系统管理员!"); |
| | | return; |
| | | } |
| | | } |
| | | filterChain.doFilter(servletRequest, servletResponse); |
| | | } |
| | | |
| | | |
| | | |
| | | private void unauthorizedResponse(HttpServletResponse response, String msg) { |
| | | response.setStatus(HttpStatus.OK.value()); |
| | | response.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE); |
| | | PrintWriter writer = null; |
| | | try { |
| | | writer = response.getWriter(); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | writer.println(JSON.toJSONString(R.fail(msg))); |
| | | writer.flush(); |
| | | writer.close(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取请求token |
| | | */ |
| | | private String getToken(HttpServletRequest request) { |
| | | String token = request.getHeader(TokenConstants.AUTHENTICATION); |
| | | // 如果前端设置了令牌前缀,则裁剪掉前缀 |
| | | if (StringUtils.isNotEmpty(token) && token.startsWith(TokenConstants.PREFIX)) { |
| | | token = token.replaceFirst(TokenConstants.PREFIX, StringUtils.EMPTY); |
| | | } |
| | | return token; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.Agreement; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/11/21 10:46 |
| | | */ |
| | | public interface AgreementMapper extends BaseMapper<Agreement> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.Banner; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface BannerMapper extends BaseMapper<Banner> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.BaseSetting; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface BaseSettingMapper extends BaseMapper<BaseSetting> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.CouponInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface CouponInfoMapper extends BaseMapper<CouponInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.GoodsAppUser; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsAppUserMapper extends BaseMapper<GoodsAppUser> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.GoodsArea; |
| | | |
| | | public interface GoodsAreaMapper extends BaseMapper<GoodsArea> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.GoodsBargainPriceDetail; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsBargainPriceDetailMapper extends BaseMapper<GoodsBargainPriceDetail> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.GoodsBargainPrice; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsBargainPriceMapper extends BaseMapper<GoodsBargainPrice> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.GoodsCategory; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsCategoryMapper extends BaseMapper<GoodsCategory> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.GoodsEvaluate; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsEvaluateMapper extends BaseMapper<GoodsEvaluate> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsMapper extends BaseMapper<Goods> { |
| | | List<Goods> selectListByShopId(Integer shopId, Integer vip); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.GoodsSeckill; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsSeckillMapper extends BaseMapper<GoodsSeckill> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.GoodsShop; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsShopMapper extends BaseMapper<GoodsShop> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.GoodsVip; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsVipMapper extends BaseMapper<GoodsVip> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.OrderActivityInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface OrderActivityInfoMapper extends BaseMapper<OrderActivityInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.ruoyi.other.api.domain.Phone; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface PhoneMapper extends BaseMapper<Phone> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.PointSetting; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface PointSettingMapper extends BaseMapper<PointSetting> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.RechargeSet; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface RechargeSetMapper extends BaseMapper<RechargeSet> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.RedPackegeSet; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface RedPackegeSetMapper extends BaseMapper<RedPackegeSet> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.Region; |
| | | |
| | | public interface RegionMapper extends BaseMapper<Region> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.api.domain.SeckillActivityInfo; |
| | | import com.ruoyi.other.vo.SeckillActivityDetailVO; |
| | | import com.ruoyi.other.vo.SeckillActivityVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface SeckillActivityInfoMapper extends BaseMapper<SeckillActivityInfo> { |
| | | |
| | | List<SeckillActivityVO> listSeckillActivity(Goods goods); |
| | | |
| | | SeckillActivityDetailVO selectDetail(Integer seckillActivityId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.Share; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface ShareMapper extends BaseMapper<Share> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.ShopBalanceStatement; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface ShopBalanceStatementMapper extends BaseMapper<ShopBalanceStatement> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.vo.NearbyShopVO; |
| | | import com.ruoyi.other.vo.ShopDetailVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface ShopMapper extends BaseMapper<Shop> { |
| | | |
| | | List<NearbyShopVO> selectNearbyShopList(@Param("longitude") String longitude,@Param("latitude") String latitude); |
| | | |
| | | ShopDetailVO selectShopDetail(Integer shopId); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.ShopPoint; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface ShopPointMapper extends BaseMapper<ShopPoint> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.ShopWithdraw; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface ShopWithdrawMapper extends BaseMapper<ShopWithdraw> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.SystemConfig; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface SystemConfigMapper extends BaseMapper<SystemConfig> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.Technician; |
| | | import com.ruoyi.other.vo.TechnicianDetailVO; |
| | | import com.ruoyi.other.vo.TechnicianVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface TechnicianMapper extends BaseMapper<Technician> { |
| | | |
| | | List<TechnicianVO> selectTechnicianListByShopId(Long shopId); |
| | | |
| | | TechnicianDetailVO selectTechnicianDetail(Long technicianId); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.TechnicianSubscribe; |
| | | import com.ruoyi.other.vo.TechnicianSubscribeVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface TechnicianSubscribeMapper extends BaseMapper<TechnicianSubscribe> { |
| | | |
| | | /** |
| | | * 查看用户预约记录 |
| | | * @param shopId |
| | | * @return |
| | | */ |
| | | public List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(@Param("userId") Long userId, |
| | | @Param("shopId") Long shopId); |
| | | public List<TechnicianSubscribeVO> getTechnicianSubscribeByUser(@Param("userId") Long userId, |
| | | @Param("status") Integer status); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.other.api.domain.VipGood; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface VipGoodMapper extends BaseMapper<VipGood> { |
| | | |
| | | /** |
| | | * 查询指定商品的指定会员价格 |
| | | */ |
| | | VipGood selectVipGood(Long goodsId, Integer vipId); |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.mapper; |
| | | |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface VipSettingMapper extends BaseMapper<VipSetting> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.Agreement; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface AgreementService extends IService<Agreement> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.Banner; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface BannerService extends IService<Banner> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.BaseSetting; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface BaseSettingService extends IService<BaseSetting> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.CouponInfo; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface CouponInfoService extends IService<CouponInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.GoodsAppUser; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsAppUserService extends IService<GoodsAppUser> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.GoodsArea; |
| | | |
| | | public interface GoodsAreaService extends IService<GoodsArea> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.GoodsBargainPriceDetail; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsBargainPriceDetailService extends IService<GoodsBargainPriceDetail> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.GoodsBargainPrice; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsBargainPriceService extends IService<GoodsBargainPrice> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.GoodsCategory; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsCategoryService extends IService<GoodsCategory> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.GoodsEvaluate; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsEvaluateService extends IService<GoodsEvaluate> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.GoodsSeckill; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsSeckillService extends IService<GoodsSeckill> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.vo.GoodsVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsService extends IService<Goods> { |
| | | |
| | | List<GoodsVO> goodsList(Goods goods); |
| | | |
| | | GoodsVO goodsDetail(Long goodsId); |
| | | |
| | | List<Goods> getGoodsListByShopId(Integer shopId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.GoodsShop; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsShopService extends IService<GoodsShop> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.GoodsVip; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface GoodsVipService extends IService<GoodsVip> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.Agreement; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/11/21 10:46 |
| | | */ |
| | | public interface IAgreementService extends IService<Agreement> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.ruoyi.other.api.domain.OrderActivityInfo; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface OrderActivityInfoService extends IService<OrderActivityInfo> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.Phone; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface PhoneService extends IService<Phone> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.PointSetting; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface PointSettingService extends IService<PointSetting> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.RechargeSet; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface RechargeSetService extends IService<RechargeSet> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.ruoyi.other.api.domain.RedPackegeSet; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface RedPackegeSetService extends IService<RedPackegeSet> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.Region; |
| | | |
| | | public interface RegionService extends IService<Region> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.api.domain.SeckillActivityInfo; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.vo.SeckillActivityDetailVO; |
| | | import com.ruoyi.other.vo.SeckillActivityVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface SeckillActivityInfoService extends IService<SeckillActivityInfo> { |
| | | |
| | | List<SeckillActivityVO> listSeckillActivity(Goods goods); |
| | | |
| | | SeckillActivityDetailVO detail(Integer seckillActivityId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.ruoyi.other.api.domain.Share; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface ShareService extends IService<Share> { |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.ShopBalanceStatement; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface ShopBalanceStatementService extends IService<ShopBalanceStatement> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.ShopPoint; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface ShopPointService extends IService<ShopPoint> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.vo.NearbyShopVO; |
| | | import com.ruoyi.other.vo.ShopDetailVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface ShopService extends IService<Shop> { |
| | | |
| | | List<NearbyShopVO> nearbyShopList(String longitude, String latitude); |
| | | |
| | | ShopDetailVO getShopDetail(Integer shopId,String longitude, String latitude); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.ShopWithdraw; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface ShopWithdrawService extends IService<ShopWithdraw> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.SystemConfig; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface SystemConfigService extends IService<SystemConfig> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.Technician; |
| | | import com.ruoyi.other.vo.TechnicianDetailVO; |
| | | import com.ruoyi.other.vo.TechnicianVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface TechnicianService extends IService<Technician> { |
| | | List<TechnicianVO> getTechnicianListByShopId(Long shopId); |
| | | |
| | | TechnicianDetailVO technicianDetail(Long technicianId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.TechnicianSubscribe; |
| | | import com.ruoyi.other.vo.TechnicianSubscribeVO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface TechnicianSubscribeService extends IService<TechnicianSubscribe> { |
| | | |
| | | /** |
| | | * 查询用于指定门店的相关预约记录 |
| | | */ |
| | | List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(Long userId, Long shopId); |
| | | |
| | | List<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Long userId, Integer status); |
| | | |
| | | void subscribe(TechnicianSubscribe technicianSubscribe, Long technicianId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.VipGood; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface VipGoodService extends IService<VipGood> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | public interface VipSettingService extends IService<VipSetting> { |
| | | |
| | | VipSetting getVipSettingByUserId(Long userId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.api.domain.Agreement; |
| | | import com.ruoyi.other.mapper.AgreementMapper; |
| | | import com.ruoyi.other.service.IAgreementService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/11/21 10:48 |
| | | */ |
| | | @Service |
| | | public class AgreementServiceImpl extends ServiceImpl<AgreementMapper, Agreement> implements IAgreementService { |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.mapper.BaseSettingMapper; |
| | | import com.ruoyi.other.api.domain.BaseSetting; |
| | | import com.ruoyi.other.service.BaseSettingService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class BaseSettingServiceImpl extends ServiceImpl<BaseSettingMapper, BaseSetting> implements BaseSettingService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.ruoyi.other.api.domain.GoodsAppUser; |
| | | import com.ruoyi.other.service.GoodsAppUserService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.mapper.GoodsAppUserMapper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class GoodsAppUserServiceImpl extends ServiceImpl<GoodsAppUserMapper, GoodsAppUser> implements GoodsAppUserService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.api.domain.GoodsArea; |
| | | import com.ruoyi.other.mapper.GoodsAreaMapper; |
| | | import com.ruoyi.other.service.GoodsAreaService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Service |
| | | public class GoodsAreaServiceImpl extends ServiceImpl<GoodsAreaMapper, GoodsArea> implements GoodsAreaService { |
| | | @Resource |
| | | private GoodsAreaMapper goodsAreaMapper; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.mapper.GoodsBargainPriceMapper; |
| | | import com.ruoyi.other.api.domain.GoodsBargainPrice; |
| | | import com.ruoyi.other.service.GoodsBargainPriceService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class GoodsBargainPriceServiceImpl extends ServiceImpl<GoodsBargainPriceMapper, GoodsBargainPrice> implements GoodsBargainPriceService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.mapper.GoodsEvaluateMapper; |
| | | import com.ruoyi.other.api.domain.GoodsEvaluate; |
| | | import com.ruoyi.other.service.GoodsEvaluateService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class GoodsEvaluateServiceImpl extends ServiceImpl<GoodsEvaluateMapper, GoodsEvaluate> implements GoodsEvaluateService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.ruoyi.other.api.domain.GoodsSeckill; |
| | | import com.ruoyi.other.mapper.GoodsSeckillMapper; |
| | | import com.ruoyi.other.service.GoodsSeckillService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class GoodsSeckillServiceImpl extends ServiceImpl<GoodsSeckillMapper, GoodsSeckill> implements GoodsSeckillService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import cn.hutool.json.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.bean.BeanUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.api.domain.GoodsArea; |
| | | import com.ruoyi.other.api.domain.GoodsVip; |
| | | import com.ruoyi.other.api.domain.VipSetting; |
| | | import com.ruoyi.other.enums.GoodsStatus; |
| | | import com.ruoyi.other.mapper.GoodsAreaMapper; |
| | | import com.ruoyi.other.mapper.GoodsMapper; |
| | | import com.ruoyi.other.service.GoodsService; |
| | | import com.ruoyi.other.service.GoodsVipService; |
| | | import com.ruoyi.other.service.VipSettingService; |
| | | import com.ruoyi.other.vo.GoodsVO; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements GoodsService { |
| | | @Resource |
| | | private GoodsMapper goodsMapper; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private VipSettingService vipSettingService; |
| | | @Resource |
| | | private GoodsAreaMapper goodsAreaMapper; |
| | | @Resource |
| | | private GoodsVipService goodsVipService; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Override |
| | | public List<GoodsVO> goodsList(Goods search) { |
| | | List<Goods> goodsList = this.list(new LambdaQueryWrapper<Goods>() |
| | | .eq(Goods::getStatus, GoodsStatus.UP) |
| | | .eq(Objects.nonNull(search.getGoodsCategoryId()), Goods::getGoodsCategoryId, search.getGoodsCategoryId()) |
| | | .like(StringUtils.isNotEmpty(search.getName()), Goods::getName, search.getName())); |
| | | |
| | | List<GoodsVO> result = new ArrayList<>(); |
| | | for (Goods goods : goodsList) { |
| | | GoodsVO goodsVO = new GoodsVO(); |
| | | BeanUtils.copyBeanProp(goodsVO, goods); |
| | | result.add(goodsVO); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public GoodsVO goodsDetail(Long goodsId) { |
| | | if (goodsId == null || goodsId <= 0) { |
| | | throw new NullPointerException("商品ID不能为空"); |
| | | } |
| | | |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | AppUser appUser = appUserClient.getAppUserById(loginUserApplet.getUserid()); |
| | | BigDecimal sellingPrice; |
| | | Integer integral; |
| | | |
| | | GoodsArea goodsArea = goodsAreaMapper.selectOne(new LambdaQueryWrapper<GoodsArea>() |
| | | .eq(GoodsArea::getGoodsId, goodsId) |
| | | .eq(GoodsArea::getProvinceCode, appUser.getProvinceCode()) |
| | | .eq(StringUtils.isNotEmpty(appUser.getCityCode()), GoodsArea::getCityCode, appUser.getCityCode()) |
| | | .eq(StringUtils.isNotEmpty(appUser.getDistrictCode()), GoodsArea::getDistrictsCode, appUser.getDistrictCode())); |
| | | |
| | | if (Objects.nonNull(goodsArea)){ |
| | | sellingPrice = goodsArea.getSellingPrice(); |
| | | integral = goodsArea.getIntegral(); |
| | | }else { |
| | | VipSetting vipSetting = vipSettingService.getVipSettingByUserId(loginUserApplet.getUserid()); |
| | | GoodsVip goodsVip = goodsVipService.getOne(new LambdaQueryWrapper<GoodsVip>() |
| | | .eq(GoodsVip::getVip, vipSetting.getId()) |
| | | .eq(GoodsVip::getGoodsId, goodsId)); |
| | | |
| | | sellingPrice = goodsVip.getSellingPrice(); |
| | | integral = goodsVip.getIntegral(); |
| | | } |
| | | |
| | | Goods goods = this.getById(goodsId); |
| | | GoodsVO goodsVO = new GoodsVO(); |
| | | BeanUtils.copyBeanProp(goodsVO, goods); |
| | | goodsVO.setSellingPrice(sellingPrice); |
| | | goodsVO.setIntegral(integral); |
| | | return goodsVO; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<Goods> getGoodsListByShopId(Integer shopId) { |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | VipSetting vipSetting = vipSettingService.getVipSettingByUserId(loginUserApplet.getUserid()); |
| | | return goodsMapper.selectListByShopId(shopId, vipSetting.getId()); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.mapper.GoodsShopMapper; |
| | | import com.ruoyi.other.api.domain.GoodsShop; |
| | | import com.ruoyi.other.service.GoodsShopService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class GoodsShopServiceImpl extends ServiceImpl<GoodsShopMapper, GoodsShop> implements GoodsShopService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.mapper.GoodsVipMapper; |
| | | import com.ruoyi.other.api.domain.GoodsVip; |
| | | import com.ruoyi.other.service.GoodsVipService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class GoodsVipServiceImpl extends ServiceImpl<GoodsVipMapper, GoodsVip> implements GoodsVipService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.mapper.PhoneMapper; |
| | | import com.ruoyi.other.api.domain.Phone; |
| | | import com.ruoyi.other.service.PhoneService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class PhoneServiceImpl extends ServiceImpl<PhoneMapper, Phone> implements PhoneService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.mapper.RechargeSetMapper; |
| | | import com.ruoyi.other.api.domain.RechargeSet; |
| | | import com.ruoyi.other.service.RechargeSetService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class RechargeSetServiceImpl extends ServiceImpl<RechargeSetMapper, RechargeSet> implements RechargeSetService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.mapper.RedPackegeSetMapper; |
| | | import com.ruoyi.other.api.domain.RedPackegeSet; |
| | | import com.ruoyi.other.service.RedPackegeSetService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class RedPackegeSetServiceImpl extends ServiceImpl<RedPackegeSetMapper, RedPackegeSet> implements RedPackegeSetService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.api.domain.GoodsShop; |
| | | import com.ruoyi.other.api.domain.SeckillActivityInfo; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.mapper.GoodsShopMapper; |
| | | import com.ruoyi.other.mapper.SeckillActivityInfoMapper; |
| | | import com.ruoyi.other.mapper.ShopMapper; |
| | | import com.ruoyi.other.service.SeckillActivityInfoService; |
| | | import com.ruoyi.other.vo.SeckillActivityDetailVO; |
| | | import com.ruoyi.other.vo.SeckillActivityVO; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class SeckillActivityInfoServiceImpl extends ServiceImpl<SeckillActivityInfoMapper, SeckillActivityInfo> implements SeckillActivityInfoService { |
| | | @Resource |
| | | private SeckillActivityInfoMapper seckillActivityInfoMapper; |
| | | @Resource |
| | | private GoodsShopMapper goodsShopMapper; |
| | | @Resource |
| | | private ShopMapper shopMapper; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Override |
| | | public List<SeckillActivityVO> listSeckillActivity(Goods goods) { |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | AppUser appUser = appUserClient.getAppUserById(loginUserApplet.getUserid()); |
| | | goods.setVipId(appUser.getVipId()); |
| | | return seckillActivityInfoMapper.listSeckillActivity(goods); |
| | | } |
| | | |
| | | @Override |
| | | public SeckillActivityDetailVO detail(Integer seckillActivityId) { |
| | | SeckillActivityDetailVO seckillActivityDetailVO = seckillActivityInfoMapper.selectDetail(seckillActivityId); |
| | | Long goodsId = seckillActivityDetailVO.getGoodsId(); |
| | | |
| | | List<Integer> shopIdList = goodsShopMapper.selectList(new LambdaQueryWrapper<GoodsShop>() |
| | | .eq(GoodsShop::getGoodsId, goodsId)).stream().map(GoodsShop::getShopId).collect(Collectors.toList()); |
| | | |
| | | List<String> shopNames = shopMapper.selectObjs(new LambdaQueryWrapper<Shop>() |
| | | .select(Shop::getName) |
| | | .in(Shop::getId, shopIdList)) |
| | | .stream() |
| | | .map(Object::toString) |
| | | .collect(Collectors.toList()); |
| | | seckillActivityDetailVO.setShopList(shopNames); |
| | | return seckillActivityDetailVO; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.mapper.ShareMapper; |
| | | import com.ruoyi.other.api.domain.Share; |
| | | import com.ruoyi.other.service.ShareService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class ShareServiceImpl extends ServiceImpl<ShareMapper, Share> implements ShareService { |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.mapper.ShopPointMapper; |
| | | import com.ruoyi.other.api.domain.ShopPoint; |
| | | import com.ruoyi.other.service.ShopPointService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class ShopPointServiceImpl extends ServiceImpl<ShopPointMapper, ShopPoint> implements ShopPointService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.GeodesyUtil; |
| | | import com.ruoyi.other.api.domain.Goods; |
| | | import com.ruoyi.other.mapper.GoodsMapper; |
| | | import com.ruoyi.other.mapper.ShopMapper; |
| | | import com.ruoyi.other.api.domain.Shop; |
| | | import com.ruoyi.other.service.ShopService; |
| | | import com.ruoyi.other.vo.NearbyShopVO; |
| | | import com.ruoyi.other.vo.ShopDetailVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.NoSuchElementException; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class ShopServiceImpl extends ServiceImpl<ShopMapper, Shop> implements ShopService { |
| | | @Resource |
| | | private ShopMapper shopMapper; |
| | | |
| | | @Override |
| | | public List<NearbyShopVO> nearbyShopList(String longitude, String latitude) { |
| | | return shopMapper.selectNearbyShopList(longitude,latitude); |
| | | } |
| | | |
| | | @Override |
| | | public ShopDetailVO getShopDetail(Integer shopId, String longitude, String latitude) { |
| | | // 查询店铺详情 |
| | | ShopDetailVO shopDetailVO = shopMapper.selectShopDetail(shopId); |
| | | if (shopDetailVO == null) { |
| | | throw new ServiceException("查询店铺不存在"); |
| | | } |
| | | |
| | | // 计算距离 |
| | | String shopLocation = String.format("%s,%s", shopDetailVO.getLongitude(), shopDetailVO.getLatitude()); |
| | | String userLocation = String.format("%s,%s", longitude, latitude); |
| | | Map<String, Double> distanceMap = GeodesyUtil.getDistance(userLocation, shopLocation); |
| | | Double wGs84 = distanceMap.get("WGs84"); |
| | | shopDetailVO.setDistance(wGs84); |
| | | return shopDetailVO; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.mapper.TechnicianMapper; |
| | | import com.ruoyi.other.api.domain.Technician; |
| | | import com.ruoyi.other.service.TechnicianService; |
| | | import com.ruoyi.other.vo.TechnicianDetailVO; |
| | | import com.ruoyi.other.vo.TechnicianVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class TechnicianServiceImpl extends ServiceImpl<TechnicianMapper, Technician> implements TechnicianService { |
| | | @Resource |
| | | private TechnicianMapper technicianMapper; |
| | | |
| | | @Override |
| | | public List<TechnicianVO> getTechnicianListByShopId(Long shopId) { |
| | | return technicianMapper.selectTechnicianListByShopId(shopId); |
| | | } |
| | | |
| | | @Override |
| | | public TechnicianDetailVO technicianDetail(Long technicianId) { |
| | | return technicianMapper.selectTechnicianDetail(technicianId); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.redis.annotation.DistributedLock; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.domain.TechnicianSubscribe; |
| | | import com.ruoyi.other.enums.TechnicianErrorCode; |
| | | import com.ruoyi.other.enums.TechnicianStatus; |
| | | import com.ruoyi.other.mapper.TechnicianMapper; |
| | | import com.ruoyi.other.mapper.TechnicianSubscribeMapper; |
| | | import com.ruoyi.other.service.TechnicianSubscribeService; |
| | | import com.ruoyi.other.vo.TechnicianSubscribeVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class TechnicianSubscribeServiceImpl extends ServiceImpl<TechnicianSubscribeMapper, TechnicianSubscribe> implements TechnicianSubscribeService { |
| | | @Resource |
| | | private TechnicianSubscribeMapper technicianSubscribeMapper; |
| | | @Resource |
| | | private TechnicianMapper technicianMapper; |
| | | |
| | | @Override |
| | | public List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(Long userId, Long shopId) { |
| | | return technicianSubscribeMapper.getTechnicianSubscribeByUserAndShop(userId, shopId); |
| | | } |
| | | @Override |
| | | public List<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Long userId, Integer status) { |
| | | return technicianSubscribeMapper.getTechnicianSubscribeByUser(userId, status); |
| | | } |
| | | |
| | | @Override |
| | | // @DistributedLock(lockNamePre = "#technician_subscribe_lock", lockNamePost = "#technicianId") |
| | | public void subscribe(TechnicianSubscribe subscribe, Long technicianId) { |
| | | // Long count = technicianSubscribeMapper.selectCount(new LambdaQueryWrapper<TechnicianSubscribe>() |
| | | // .eq(TechnicianSubscribe::getTechnicianId, technicianId) |
| | | // .eq(TechnicianSubscribe::getSubscribeTime, subscribe.getSubscribeTime()) |
| | | // .eq(TechnicianSubscribe::getStatus, TechnicianStatus.UNSUBSCRIBE.getCode())); |
| | | // if (count > 0) { |
| | | // throw new ServiceException("当前时间段已被预约", TechnicianErrorCode.TECHNICIAN_ALREADY_SUBSCRIBED.getCode()); |
| | | // } |
| | | // 创建技师预约单 |
| | | Long userId = SecurityUtils.getUserId(); |
| | | subscribe.setAppUserId(userId); |
| | | subscribe.setStatus(TechnicianStatus.UNSUBSCRIBE.getCode()); |
| | | subscribe.setDelFlag(0); |
| | | subscribe.setCreateTime(LocalDateTime.now()); |
| | | technicianSubscribeMapper.insert(subscribe); |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.other.mapper.VipGoodMapper; |
| | | import com.ruoyi.other.api.domain.VipGood; |
| | | import com.ruoyi.other.service.VipGoodService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author luodangjia |
| | | * @since 2024-11-20 |
| | | */ |
| | | @Service |
| | | public class VipGoodServiceImpl extends ServiceImpl<VipGoodMapper, VipGood> implements VipGoodService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @ApiModel(value="商品热销对象", description="热门商品") |
| | | @Data |
| | | public class GoodsVO { |
| | | |
| | | @ApiModelProperty(value = "商品id") |
| | | private Long goodsId; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "限购数量(-1不限购)") |
| | | private Integer purchaseLimit; |
| | | |
| | | @ApiModelProperty(value = "类型(1=服务商品,2=单品商品)") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "商品简介") |
| | | private String introduction; |
| | | |
| | | @ApiModelProperty(value = "商品详情") |
| | | private String detail; |
| | | |
| | | @ApiModelProperty(value = "封面图") |
| | | private String homePagePicture; |
| | | |
| | | @ApiModelProperty(value = "详情图,多个逗号分隔") |
| | | private String detailPicture; |
| | | |
| | | @ApiModelProperty(value = "积分支付(0=否,1=是)") |
| | | private Integer pointPayment; |
| | | |
| | | @ApiModelProperty(value = "基础积分") |
| | | @TableField("integral") |
| | | private Integer integral; |
| | | |
| | | @ApiModelProperty(value = "划线价") |
| | | private BigDecimal originalPrice; |
| | | |
| | | @ApiModelProperty(value = "基础售价") |
| | | private BigDecimal sellingPrice; |
| | | |
| | | @ApiModelProperty(value = "已售数量") |
| | | private Integer saleNum; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value="首页用户信息", description="") |
| | | public class Home { |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long userId; |
| | | /** |
| | | * 头像 |
| | | */ |
| | | @ApiModelProperty(value = "头像") |
| | | private String avatar; |
| | | /** |
| | | * 上级 |
| | | */ |
| | | @ApiModelProperty(value = "上级") |
| | | private String parentName; |
| | | /** |
| | | * 绑定店铺 |
| | | */ |
| | | @ApiModelProperty(value = "绑定店铺") |
| | | private String shopName; |
| | | |
| | | /** |
| | | * 普通会员数量 |
| | | */ |
| | | @ApiModelProperty(value = "普通会员数量") |
| | | private Integer ordinaryMemberNum; |
| | | |
| | | /** |
| | | * 黄金会员数量 |
| | | */ |
| | | @ApiModelProperty(value = "黄金会员数量") |
| | | private Integer goldenMemberNum; |
| | | |
| | | /** |
| | | * 钻石会员数量 |
| | | */ |
| | | @ApiModelProperty(value = "钻石会员数量") |
| | | private Integer diamondMemberNum; |
| | | |
| | | /** |
| | | * 代理数量 |
| | | */ |
| | | @ApiModelProperty(value = "代理数量") |
| | | private Integer agentNum; |
| | | |
| | | /** |
| | | * 准代理数量 |
| | | */ |
| | | @ApiModelProperty(value = "准代理数量") |
| | | private Integer proxyNum; |
| | | |
| | | /** |
| | | * 总代理数量 |
| | | */ |
| | | @ApiModelProperty(value = "总代理数量") |
| | | private Integer totalAgentNum; |
| | | |
| | | /** |
| | | * 合伙人数量 |
| | | */ |
| | | @ApiModelProperty(value = "合伙人数量") |
| | | private Integer partnerNum; |
| | | |
| | | /** |
| | | * 营业时间 |
| | | */ |
| | | @ApiModelProperty(value = "营业星期") |
| | | private String businessDate; |
| | | |
| | | /** |
| | | * 评分 |
| | | */ |
| | | @ApiModelProperty(value = "评分") |
| | | private BigDecimal score; |
| | | |
| | | /** |
| | | * 经度 |
| | | */ |
| | | @ApiModelProperty(value = "经度") |
| | | private String longitude; |
| | | |
| | | /** |
| | | * 纬度 |
| | | */ |
| | | @ApiModelProperty(value = "纬度") |
| | | private String latitude; |
| | | |
| | | /** |
| | | * 地址 |
| | | */ |
| | | @ApiModelProperty(value = "地址") |
| | | private String address; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class NearbyShopVO { |
| | | |
| | | @ApiModelProperty(value = "门店id") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "封面图片") |
| | | private String homePicture; |
| | | |
| | | @ApiModelProperty(value = "门店名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "详细地址") |
| | | private String address; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class SeckillActivityDetailVO extends SeckillActivityVO{ |
| | | |
| | | @ApiModelProperty(value = "产品id") |
| | | private Long goodsId; |
| | | |
| | | @ApiModelProperty(value = "详情图,多个逗号分隔") |
| | | private String detailPicture; |
| | | |
| | | @ApiModelProperty(value = "活动结束日期") |
| | | private LocalDateTime endTime; |
| | | |
| | | @ApiModelProperty(value = "可用门店") |
| | | private List<String> shopList; |
| | | |
| | | @ApiModelProperty(value = "商品详情") |
| | | private String detail; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class SeckillActivityVO { |
| | | |
| | | @ApiModelProperty(value = "活动id") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String goodsName; |
| | | |
| | | @ApiModelProperty(value = "商品简介") |
| | | private String introduction; |
| | | |
| | | @ApiModelProperty(value = "封面图") |
| | | private String homePagePicture; |
| | | |
| | | @ApiModelProperty(value = "划线价") |
| | | private BigDecimal originalPrice; |
| | | |
| | | @ApiModelProperty(value = "基础售价") |
| | | private BigDecimal sellingPrice; |
| | | |
| | | @ApiModelProperty(value = "已售数量") |
| | | private Integer saleNum; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Integer startTime; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "门店详情") |
| | | public class ShopDetailVO { |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @ApiModelProperty(value = "主键") |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 门店名称 |
| | | */ |
| | | @ApiModelProperty(value = "门店名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "详情图,多个逗号分隔") |
| | | private String detailsPicture; |
| | | |
| | | @ApiModelProperty(value = "资质证书图片") |
| | | private String certification; |
| | | |
| | | @ApiModelProperty(value = "营业星期(1,2,3,4,5,6,7)") |
| | | private String businessDate; |
| | | |
| | | @ApiModelProperty(value = "开始时间(HH:mm)") |
| | | private String startTime; |
| | | |
| | | @ApiModelProperty(value = "结束时间(HH:mm)") |
| | | private String endTime; |
| | | |
| | | /** |
| | | * 联系电话 |
| | | */ |
| | | @ApiModelProperty(value = "联系电话") |
| | | private List<String> phones; |
| | | |
| | | /** |
| | | * 评分 |
| | | */ |
| | | @ApiModelProperty(value = "评分") |
| | | private BigDecimal score; |
| | | |
| | | /** |
| | | * 地址 |
| | | */ |
| | | @ApiModelProperty(value = "地址") |
| | | private String address; |
| | | |
| | | /** |
| | | * 距离 |
| | | */ |
| | | @ApiModelProperty(value = "距离") |
| | | private Double distance; |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | private String longitude; |
| | | |
| | | @ApiModelProperty(value = "纬度") |
| | | private String latitude; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class TechnicianDetailVO { |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @ApiModelProperty(value = "主键") |
| | | private Long id; |
| | | |
| | | /** |
| | | * 技师姓名 |
| | | */ |
| | | @ApiModelProperty(value = "技师姓名") |
| | | private String name; |
| | | |
| | | /** |
| | | * 服务次数 |
| | | */ |
| | | @ApiModelProperty(value = "服务次数") |
| | | private Integer serviceCount; |
| | | |
| | | /** |
| | | * 评分 |
| | | */ |
| | | @ApiModelProperty(value = "评分") |
| | | private BigDecimal score; |
| | | |
| | | /** |
| | | * 简介 |
| | | */ |
| | | @ApiModelProperty(value = "简介") |
| | | private String introduction; |
| | | |
| | | /** |
| | | * 技师封面图 |
| | | */ |
| | | @ApiModelProperty(value = "技师封面图") |
| | | private String homePicture; |
| | | |
| | | @ApiModelProperty(value = "技师详情图") |
| | | private String infoPicture; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel(value="技师预约对象", description="") |
| | | public class TechnicianSubscribeVO { |
| | | |
| | | /** |
| | | * 门店名称 |
| | | */ |
| | | @ApiModelProperty(value = "门店名称") |
| | | private String shopName; |
| | | |
| | | /** |
| | | * 门店地址 |
| | | */ |
| | | @ApiModelProperty(value = "门店地址") |
| | | private String shopAddress; |
| | | |
| | | /** |
| | | * 用户地址 |
| | | */ |
| | | @ApiModelProperty(value = "用户地址") |
| | | private String userAddress; |
| | | |
| | | /** |
| | | * 技师名字 |
| | | */ |
| | | @ApiModelProperty(value = "技师名字") |
| | | private String technicianName; |
| | | |
| | | /** |
| | | * 预约时间 |
| | | */ |
| | | @ApiModelProperty(value = "预约时间") |
| | | private LocalDateTime subscribeTime; |
| | | |
| | | /** |
| | | * 服务方式:1=上门服务,2=到店服务 |
| | | */ |
| | | @ApiModelProperty(value = "服务方式:1=上门服务,2=到店服务") |
| | | private Integer serviceMode; |
| | | |
| | | /** |
| | | * 预约状态:0=待服务,1=已服务,2=已取消 |
| | | */ |
| | | @ApiModelProperty(value = "预约状态:0=待服务,1=已服务,2=已取消 4 已到期") |
| | | private Integer status; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class TechnicianVO { |
| | | @ApiModelProperty(value = "主键") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "技师姓名") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "简介") |
| | | private String introduction; |
| | | |
| | | @ApiModelProperty(value = "服务次数") |
| | | private Integer serviceCount; |
| | | |
| | | @ApiModelProperty(value = "技师封面图") |
| | | private String homePicture; |
| | | |
| | | @ApiModelProperty(value = "评分") |
| | | private BigDecimal score; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/11/25 12:08 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class VerifiableShopVo { |
| | | @ApiModelProperty("门店id") |
| | | private Integer id; |
| | | @ApiModelProperty("门店名称") |
| | | private String name; |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @ApiModel(value="变更明细", description="") |
| | | public class WalletChangeVO { |
| | | |
| | | @ApiModelProperty(value = "变更类型:1-充值 2-提现 3-红包 4-分佣 5商城购物") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "变更时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date changeTime; |
| | | |
| | | @ApiModelProperty(value = "分佣消费金额") |
| | | private BigDecimal price; |
| | | } |