Sfoglia il codice sorgente

实体类提出共通 提交

zjy 1 mese fa
parent
commit
527eb00302

+ 28 - 0
alien-gateway/pom.xml

@@ -36,6 +36,17 @@
             <artifactId>spring-cloud-starter-gateway</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.fasterxml.jackson.core</groupId>
+                    <artifactId>jackson-databind</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
         <!--loadBalancer负载均衡-->
         <dependency>
             <groupId>org.springframework.cloud</groupId>
@@ -136,6 +147,23 @@
             <version>3.4.0</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+
+        <!--redis连接池需要此依赖-->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-pool2</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
+
+
 <!--        <dependency>-->
 <!--            <groupId>shop.alien</groupId>-->
 <!--            <artifactId>alien-util</artifactId>-->

+ 1 - 0
alien-gateway/src/main/java/shop/alien/gateway/config/BaseRedisService.java

@@ -1,6 +1,7 @@
 package shop.alien.gateway.config;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.geo.*;
 import org.springframework.data.redis.connection.RedisGeoCommands;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Component;

+ 1 - 1
alien-gateway/src/main/java/shop/alien/gateway/config/JWTInterceptor.java

@@ -13,7 +13,7 @@ import org.springframework.stereotype.Component;
 import org.springframework.web.cors.CorsUtils;
 import org.springframework.web.servlet.HandlerInterceptor;
 import shop.alien.entity.store.StoreUser;
-import shop.alien.store.mapper.StoreUserMapper;
+import shop.alien.gateway.mapper.StoreUserMapper;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;

+ 28 - 0
alien-gateway/src/main/java/shop/alien/gateway/entity/dto/NearMeDto.java

@@ -0,0 +1,28 @@
+package shop.alien.gateway.entity.dto;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+/**
+ * 二期-门店信息
+ *
+ * @author ssk
+ * @since 2024-12-05
+ */
+@Data
+@AllArgsConstructor
+@JsonInclude
+@ApiModel(value = "NearMeDto对象", description = "我附近的商家")
+public class NearMeDto {
+
+    @ApiModelProperty(value = "内容")
+    private String conent;
+
+    @ApiModelProperty(value = "距离/km")
+    private Double distance;
+
+
+}

+ 53 - 0
alien-gateway/src/main/java/shop/alien/gateway/entity/vo/LifeFansVo.java

@@ -0,0 +1,53 @@
+package shop.alien.gateway.entity.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@JsonInclude
+@NoArgsConstructor
+@ApiModel(value = "LifeFansVo对象", description = "关注相关")
+public class LifeFansVo {
+
+    @ApiModelProperty(value = "用户id")
+    public String id;
+
+    @ApiModelProperty(value = "名称")
+    public String name;
+
+    @ApiModelProperty(value = "简介")
+    public String blurb;
+
+    @ApiModelProperty(value = "头像")
+    public String image;
+
+    @ApiModelProperty(value = "唯一标识")
+    public String phoneId;
+
+    @ApiModelProperty(value = "对方是否关注我 0-未关注 1-已关注")
+    public String isFollowMe;
+
+    @ApiModelProperty(value = "我是否关注对方 0-未关注 1-已关注")
+    public String isFollowThis;
+
+    @ApiModelProperty(value = "粉丝数量")
+    public String fansNum;
+
+    @ApiModelProperty(value = "关注数量")
+    public String followNum;
+
+    @ApiModelProperty(value = "好友数量")
+    public String friendNum;
+
+    @ApiModelProperty(value = "动态数量")
+    public String dynamicsNum;
+
+    @ApiModelProperty(value = "是否拉黑")
+    public String isBlocked;
+
+    @ApiModelProperty(value = "拉黑id")
+    public String blackListid;
+}

+ 82 - 0
alien-gateway/src/main/java/shop/alien/gateway/entity/vo/LifeUserOrderVo.java

@@ -0,0 +1,82 @@
+package shop.alien.gateway.entity.vo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 用户订单
+ */
+@Data
+@JsonInclude
+public class LifeUserOrderVo {
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private String id;
+
+    private String userId;
+
+    private String storeId;
+
+    private String quanId;
+
+    private String quanCode;
+
+    private String orderNo;
+
+    private Integer status;
+
+    private Integer purchaseQuantity;
+
+    private Integer couponId;
+
+    private String userPhone;
+
+    private String type;
+
+    private BigDecimal totalFinalPrice;
+
+    private String couponName;
+
+    private String price;
+
+    private String finalPrice;
+
+    private Date buyTime;
+
+    private Date payTime;
+
+    private String payMethod;
+
+    private Date usedTime;
+
+    private Date refundTime;
+
+    @ApiModelProperty(value = "删除标记, 0:未删除, 1:已删除")
+    @TableField("delete_flag")
+    @TableLogic
+    private Integer deleteFlag;
+
+    @ApiModelProperty(value = "创建时间")
+    @TableField(value = "created_time", fill = FieldFill.INSERT)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createdTime;
+
+    @ApiModelProperty(value = "创建人ID")
+    @TableField("created_user_id")
+    private Integer createdUserId;
+
+    @ApiModelProperty(value = "修改时间")
+    @TableField(value = "updated_time", fill = FieldFill.UPDATE)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date updatedTime;
+
+    @ApiModelProperty(value = "修改人ID")
+    @TableField("updated_user_id")
+    private Integer updatedUserId;
+}

+ 1 - 1
alien-gateway/src/main/java/shop/alien/gateway/mapper/LifeFansMapper.java

@@ -8,7 +8,7 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import shop.alien.entity.store.LifeFans;
-import shop.alien.store.entity.vo.LifeFansVo;
+import shop.alien.gateway.entity.vo.LifeFansVo;
 
 import java.util.List;
 

+ 2 - 2
alien-gateway/src/main/java/shop/alien/gateway/mapper/LifeMessageMapper.java

@@ -9,8 +9,8 @@ import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
 import shop.alien.entity.store.LifeMessage;
-import shop.alien.store.entity.vo.LifeFansVo;
-import shop.alien.store.entity.vo.LifeMessageVo;
+import shop.alien.gateway.entity.vo.LifeFansVo;
+import shop.alien.gateway.entity.vo.LifeMessageVo;
 
 import java.util.List;
 

+ 3 - 3
alien-gateway/src/main/java/shop/alien/gateway/mapper/LifeUserMapper.java

@@ -8,9 +8,9 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import shop.alien.entity.store.LifeUser;
-import shop.alien.store.entity.vo.LifeFansVo;
-import shop.alien.store.entity.vo.LifeUserOrderVo;
-import shop.alien.store.entity.vo.LifeUserVo;
+import shop.alien.gateway.entity.vo.LifeFansVo;
+import shop.alien.gateway.entity.vo.LifeUserOrderVo;
+import shop.alien.gateway.entity.vo.LifeUserVo;
 
 import java.util.List;
 

+ 37 - 0
alien-gateway/src/main/java/shop/alien/gateway/mapper/StoreUserMapper.java

@@ -0,0 +1,37 @@
+package shop.alien.gateway.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import shop.alien.entity.store.StoreUser;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 门店用户 Mapper 接口
+ * </p>
+ *
+ * @author ssk
+ * @since 2024-12-11
+ */
+public interface StoreUserMapper extends BaseMapper<StoreUser> {
+
+    @Select("SELECT\n" +
+            "\t`user`.phone,\n" +
+            "\t`user`.id,\n" +
+            "\tinfo.store_name as storeName,\n" +
+            "\timg.img_url as imgUrl \n" +
+            "FROM\n" +
+            "\tstore_user AS `user`\n" +
+            "\tLEFT JOIN store_info AS info ON `user`.store_id = info.id\n" +
+            "\tLEFT JOIN store_img AS img ON img.store_id = info.id \n" +
+            "WHERE\n" +
+            "\t`user`.phone IN (${userPhones}) \n" +
+            "\tAND `user`.delete_flag = 0 \n" +
+            "\tAND img.img_type = 10")
+    List<Map<String,Object>> selectStore(@Param("userPhones") String userPhones);
+
+    StoreUser getRemoveUser(@Param("id") String id);
+}

+ 2 - 2
alien-gateway/src/main/java/shop/alien/gateway/util/FunctionMagic.java

@@ -10,8 +10,8 @@ import org.springframework.data.redis.connection.RedisGeoCommands;
 import org.springframework.util.CollectionUtils;
 import shop.alien.entity.store.LifeUser;
 import shop.alien.entity.store.StoreUser;
-import shop.alien.store.entity.dto.NearMeDto;
-import shop.alien.store.util.constant.Constant;
+import shop.alien.gateway.entity.dto.NearMeDto;
+import shop.alien.gateway.util.constant.Constant;
 
 import java.util.*;
 import java.util.function.*;

+ 39 - 0
alien-gateway/src/main/java/shop/alien/gateway/util/constant/Constant.java

@@ -0,0 +1,39 @@
+package shop.alien.gateway.util.constant;
+
+/**
+ * 常量
+ */
+public class Constant {
+
+    // 主键
+    public static final String GEO_STORE_PRIMARY = "GEO_STORE_PRIMARY";
+
+    // name
+    public static final String GEO_STORE_NAME = "GEO_STORE_NAME";
+
+    public static final Integer LIMIT_COUNT = 100;
+
+
+    // 举报用户类型(1:商户,2:用户)
+    public static final String REPORTING_USER_TYPE = "reporting_user_type";
+
+    // 举报用户ID
+    public static final String REPORTING_USER_ID = "reporting_user_id";
+
+
+    public static final String PROCESSING_STATUS = "processing_status";
+
+    // 序列
+    public static final String SEQUENCE_1 = "1";
+    public static final String SEQUENCE_2 = "2";
+
+
+    // 序列
+    public static final Integer SEQUENCE_NUM_1 = 1;
+    public static final Integer SEQUENCE_NUM_2 = 2;
+
+    // 符号
+    public static final String SYMBOL_1  = ",";
+
+
+}

+ 82 - 0
alien-gateway/src/main/java/shop/alien/gateway/util/constant/DiscountCouponEnum.java

@@ -0,0 +1,82 @@
+package shop.alien.gateway.util.constant;
+
+/**
+ * 优惠券相关功能枚举
+ * */
+public enum DiscountCouponEnum {
+    /**用户优惠券状态*/
+    //待使用
+    WAITING_USED("0"),
+    //已使用
+    HAVE_BEEN_USED("1"),
+    //已作废
+    HAVE_BEEN_VOIDED("2"),
+
+    /**商家优惠券状态*/
+    //进行中
+    UNDER_WAY("0"),
+    //已结束
+    FINISHED("1"),
+    //未开始
+    HAVE_NOT_STARTED("2"),
+    //暂停领取
+    SUSPEND_GET("3"),
+    //已售罄
+    HAVE_SOLD_OUT("4"),
+
+    /**限制使用规则*/
+    //周规则限制
+    WEEKDAY_UNAVAILABLE("weekday_unavailable"),
+    //节日规则限制
+    HOLIDAY_UNAVAILABLE("holiday_unavailable"),
+
+    /**领取规则*/
+    CLAIM_RULE("claim_rule"),
+    //每日一领
+    DAY("day"),
+    //每周一领
+    WEEK("WEEK"),
+    //每月一领
+    MONTH("MONTH"),
+    //每年一领
+    YEAR("year"),
+
+    /**条件类型*/
+    //所有
+    ALL("0"),
+    //即将过期
+    BE_ABOUT_TO_EXPORE("1"),
+    //已使用
+    HAVE_ALREADY_APPLIED("2"),
+    //已过期
+    HAVE_EXPIRED("3"),
+
+    /**优惠券领取规则*/
+    //可以领取
+    CAN_GET("1"),
+    //不可以领取
+    NO_GET("0"),
+
+    //占位最后一位
+    KEY("VALUE");
+
+    // 属性值
+    private final String description;
+    // 构造方法,用于初始化描述信息
+    DiscountCouponEnum(String description) {
+        this.description = description;
+    }
+    // 获取Value的方法
+    public String getValue() {
+        return description;
+    }
+
+// 测试带属性和方法的枚举的使用
+    public static void main(String[] args) {
+        DiscountCouponEnum discountCouponEnum = DiscountCouponEnum.WAITING_USED;
+        System.out.println("用户优惠券状态:" + discountCouponEnum);
+        System.out.println("值是:" + discountCouponEnum.getValue());
+    }
+
+}
+