浏览代码

Merge branch 'sit' into uat

ssk 1 月之前
父节点
当前提交
3b4f109ffb
共有 100 个文件被更改,包括 3125 次插入320 次删除
  1. 2 0
      README.md
  2. 120 0
      alien-config/src/main/java/shop/alien/config/properties/RiskControlProperties.java
  3. 50 0
      alien-entity/src/main/java/shop/alien/entity/second/LifeUserLog.java
  4. 1 1
      alien-entity/src/main/java/shop/alien/entity/second/SecondGoodsCategory.java
  5. 91 0
      alien-entity/src/main/java/shop/alien/entity/second/SecondRiskControlRecord.java
  6. 7 10
      alien-entity/src/main/java/shop/alien/entity/second/SecondTradeOperation.java
  7. 55 0
      alien-entity/src/main/java/shop/alien/entity/second/SecondUserCredit.java
  8. 54 0
      alien-entity/src/main/java/shop/alien/entity/second/SecondUserCreditRecord.java
  9. 56 0
      alien-entity/src/main/java/shop/alien/entity/second/enums/RiskControlRuleTypeEnum.java
  10. 20 0
      alien-entity/src/main/java/shop/alien/entity/second/vo/BatchUnshelveGoodsDTO.java
  11. 18 0
      alien-entity/src/main/java/shop/alien/entity/second/vo/RiskControlGoodsIdsDTO.java
  12. 18 0
      alien-entity/src/main/java/shop/alien/entity/second/vo/RiskControlGoodsQueryDTO.java
  13. 6 0
      alien-entity/src/main/java/shop/alien/entity/second/vo/SecondGoodsVo.java
  14. 4 0
      alien-entity/src/main/java/shop/alien/entity/second/vo/SecondReportingVo.java
  15. 42 0
      alien-entity/src/main/java/shop/alien/entity/second/vo/SecondRiskControlRecordVo.java
  16. 30 0
      alien-entity/src/main/java/shop/alien/entity/second/vo/SecondRiskRecordVo.java
  17. 22 0
      alien-entity/src/main/java/shop/alien/entity/second/vo/SecondUserCreditVo.java
  18. 29 0
      alien-entity/src/main/java/shop/alien/entity/second/vo/SecondUserViolationDetailVo.java
  19. 40 13
      alien-entity/src/main/java/shop/alien/entity/second/vo/SecondUserViolationVo.java
  20. 4 0
      alien-entity/src/main/java/shop/alien/entity/store/ActivityInviteLog.java
  21. 1 1
      alien-entity/src/main/java/shop/alien/entity/store/ActivitySignInConfig.java
  22. 1 1
      alien-entity/src/main/java/shop/alien/entity/store/LifeCoupon.java
  23. 9 0
      alien-entity/src/main/java/shop/alien/entity/store/LifeUserOrder.java
  24. 6 2
      alien-entity/src/main/java/shop/alien/entity/store/LifeUserViolation.java
  25. 76 0
      alien-entity/src/main/java/shop/alien/entity/store/StoreAliPayErrorLog.java
  26. 2 0
      alien-entity/src/main/java/shop/alien/entity/store/StoreAliPayLog.java
  27. 63 0
      alien-entity/src/main/java/shop/alien/entity/store/StoreCommentSummaryInterest.java
  28. 1 1
      alien-entity/src/main/java/shop/alien/entity/store/StoreIncomeDetailsRecord.java
  29. 4 0
      alien-entity/src/main/java/shop/alien/entity/store/excelVo/LifeUserOrderExcelVo.java
  30. 15 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/ActivityInviteLogVo.java
  31. 6 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/LifeAppealManageVo.java
  32. 6 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/LifeFansVo.java
  33. 12 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/LifeGroupBuyMainVo.java
  34. 3 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/LifeGroupBuyThaliVo.java
  35. 4 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserOrderCommentVo.java
  36. 17 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserOrderVo.java
  37. 7 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserViolationVo.java
  38. 3 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserVo.java
  39. 1 1
      alien-entity/src/main/java/shop/alien/entity/store/vo/StoreCommentAppealVo.java
  40. 7 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/StoreCommentVo.java
  41. 4 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/StoreIncomeDetailsRecordVo.java
  42. 3 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/StoreInfoVo.java
  43. 3 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/StoreMainInfoVo.java
  44. 3 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/StoreUserVo.java
  45. 33 4
      alien-entity/src/main/java/shop/alien/mapper/ActivityInviteLogMapper.java
  46. 2 2
      alien-entity/src/main/java/shop/alien/mapper/LifeBrowseRecordMapper.java
  47. 16 0
      alien-entity/src/main/java/shop/alien/mapper/LifeCouponMapper.java
  48. 86 24
      alien-entity/src/main/java/shop/alien/mapper/LifeFansMapper.java
  49. 82 0
      alien-entity/src/main/java/shop/alien/mapper/LifeGroupBuyMainMapper.java
  50. 49 10
      alien-entity/src/main/java/shop/alien/mapper/LifeUserDynamicsMapper.java
  51. 17 15
      alien-entity/src/main/java/shop/alien/mapper/LifeUserMapper.java
  52. 45 8
      alien-entity/src/main/java/shop/alien/mapper/LifeUserOrderMapper.java
  53. 100 0
      alien-entity/src/main/java/shop/alien/mapper/LifeUserViolationMapper.java
  54. 15 0
      alien-entity/src/main/java/shop/alien/mapper/StoreAliPayErrorLogMapper.java
  55. 13 0
      alien-entity/src/main/java/shop/alien/mapper/StoreCashOutRecordMapper.java
  56. 1 1
      alien-entity/src/main/java/shop/alien/mapper/StoreCommentAppealMapper.java
  57. 40 4
      alien-entity/src/main/java/shop/alien/mapper/StoreCommentMapper.java
  58. 40 0
      alien-entity/src/main/java/shop/alien/mapper/StoreCommentSummaryInterestMapper.java
  59. 1 1
      alien-entity/src/main/java/shop/alien/mapper/StoreIncomeDetailsRecordMapper.java
  60. 20 0
      alien-entity/src/main/java/shop/alien/mapper/StoreInfoMapper.java
  61. 27 0
      alien-entity/src/main/java/shop/alien/mapper/second/LifeUserLogMapper.java
  62. 17 0
      alien-entity/src/main/java/shop/alien/mapper/second/SecondGoodsMapper.java
  63. 39 0
      alien-entity/src/main/java/shop/alien/mapper/second/SecondRiskControlRecordMapper.java
  64. 4 4
      alien-entity/src/main/java/shop/alien/mapper/second/SecondTradeRecordMapper.java
  65. 20 0
      alien-entity/src/main/java/shop/alien/mapper/second/SecondUserCreditMapper.java
  66. 12 0
      alien-entity/src/main/java/shop/alien/mapper/second/SecondUserCreditRecordMapper.java
  67. 20 0
      alien-entity/src/main/java/shop/alien/mapper/second/SecondUserViolationMapper.java
  68. 5 1
      alien-entity/src/main/resources/mapper/LifeAppealManageMapper.xml
  69. 86 0
      alien-entity/src/main/resources/mapper/LifeUserDynamicsMapper.xml
  70. 35 10
      alien-entity/src/main/resources/mapper/LifeUserOrderMapper.xml
  71. 235 134
      alien-entity/src/main/resources/mapper/ManagementInfoMapper.xml
  72. 5 4
      alien-entity/src/main/resources/mapper/PlatformLifeUserMapper.xml
  73. 3 0
      alien-entity/src/main/resources/mapper/second/SecondGoodsInfoMapper.xml
  74. 95 0
      alien-entity/src/main/resources/mapper/second/SecondUserViolationMapper.xml
  75. 13 0
      alien-gateway/pom.xml
  76. 4 2
      alien-gateway/src/main/java/shop/alien/gateway/AlienGatewayApplication.java
  77. 57 0
      alien-gateway/src/main/java/shop/alien/gateway/config/BeanConfig.java
  78. 4 4
      alien-gateway/src/main/java/shop/alien/gateway/config/JwtTokenFilter.java
  79. 120 0
      alien-gateway/src/main/java/shop/alien/gateway/config/RiskControlProperties.java
  80. 70 0
      alien-gateway/src/main/java/shop/alien/gateway/controller/CaptchaImageController.java
  81. 35 5
      alien-gateway/src/main/java/shop/alien/gateway/controller/LifeUserController.java
  82. 27 7
      alien-gateway/src/main/java/shop/alien/gateway/controller/StoreUserController.java
  83. 36 0
      alien-gateway/src/main/java/shop/alien/gateway/feign/SecondServiceFeign.java
  84. 1 1
      alien-gateway/src/main/java/shop/alien/gateway/mapper/LifeSysGatewayMapper.java
  85. 1 1
      alien-gateway/src/main/java/shop/alien/gateway/mapper/LifeUserGatewayMapper.java
  86. 27 0
      alien-gateway/src/main/java/shop/alien/gateway/mapper/LifeUserLogGatewayMapper.java
  87. 1 1
      alien-gateway/src/main/java/shop/alien/gateway/mapper/StoreInfoGatewayMapper.java
  88. 1 1
      alien-gateway/src/main/java/shop/alien/gateway/mapper/StoreUserGatewayMapper.java
  89. 15 0
      alien-gateway/src/main/java/shop/alien/gateway/service/ActivityInviteConfigService.java
  90. 119 35
      alien-gateway/src/main/java/shop/alien/gateway/service/LifeUserService.java
  91. 15 0
      alien-gateway/src/main/java/shop/alien/gateway/service/UserPointService.java
  92. 120 0
      alien-gateway/src/main/java/shop/alien/gateway/service/impl/ActivityInviteConfigServiceImpl.java
  93. 2 2
      alien-gateway/src/main/java/shop/alien/gateway/service/impl/StoreInfoServiceImpl.java
  94. 4 4
      alien-gateway/src/main/java/shop/alien/gateway/service/impl/StoreUserServiceImpl.java
  95. 2 2
      alien-gateway/src/main/java/shop/alien/gateway/service/impl/SystemServiceImpl.java
  96. 50 0
      alien-gateway/src/main/java/shop/alien/gateway/service/impl/UserPointServiceImpl.java
  97. 253 0
      alien-gateway/src/main/java/shop/alien/gateway/util/Base64.java
  98. 56 0
      alien-gateway/src/main/java/shop/alien/gateway/util/KaptchaTextCreator.java
  99. 2 2
      alien-gateway/src/main/resources/mapper/StoreUserGatewayMapper.xml
  100. 1 1
      alien-job/src/main/java/shop/alien/job/feign/AlienStoreFeign.java

+ 2 - 0
README.md

@@ -0,0 +1,2 @@
+## 测试发版记录
+2025-11-05

+ 120 - 0
alien-config/src/main/java/shop/alien/config/properties/RiskControlProperties.java

@@ -0,0 +1,120 @@
+package shop.alien.config.properties;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.stereotype.Component;
+
+@Data
+@Component
+@RefreshScope
+@ConfigurationProperties(prefix = "risk-control")
+public class RiskControlProperties {
+
+    /**
+     * 洗钱嫌疑规则配置
+     */
+    private MoneyLaundering moneyLaundering = new MoneyLaundering();
+
+    /**
+     * 账号异常规则配置
+     */
+    private AccountAbnormal accountAbnormal = new AccountAbnormal();
+
+    /**
+     * 交易欺诈规则配置
+     */
+    private TradeFraud tradeFraud = new TradeFraud();
+
+    /**
+     * 异常发布规则配置
+     */
+    private AbnormalPublish abnormalPublish = new AbnormalPublish();
+
+    @Data
+    public static class MoneyLaundering {
+        /**
+         * 每天交易次数阈值
+         */
+        private int dailyCount = 5;
+
+        /**
+         * 每笔交易金额阈值(元)
+         */
+        private double amountThreshold = 200.0;
+
+        /**
+         * 风险类型
+         */
+        private String riskType = "洗钱嫌疑";
+
+        /**
+         * 检测指标
+         */
+        private String detectIndicator = "高频高价交易";
+    }
+
+    @Data
+    public static class AccountAbnormal {
+        /**
+         * 24小时内同一设备/mac注册账号数量阈值
+         */
+        private int regCount24h = 3;
+
+        /**
+         * 风险类型
+         */
+        private String riskType = "账号异常";
+
+        /**
+         * 检测指标
+         */
+        private String detectIndicator = "同一设备24小时内注册超过3个账号";
+    }
+
+    @Data
+    public static class TradeFraud {
+        /**
+         * 24小时内发布成功记录次数阈值
+         */
+        private int publishCount24h = 3;
+
+        /**
+         * 时间窗口(小时)
+         */
+        private int timeWindowHours = 24;
+
+        /**
+         * 风险类型
+         */
+        private String riskType = "交易欺诈";
+
+        /**
+         * 检测指标
+         */
+        private String detectIndicator = "用户频繁修改商品";
+    }
+
+    @Data
+    public static class AbnormalPublish {
+        /**
+         * 24小时内发布同类商品数量阈值
+         */
+        private int sameCategoryCount24h = 10;
+        
+        /**
+         * 时间窗口(小时)
+         */
+        private int timeWindowHours = 24;
+
+        /**
+         * 风险类型
+         */
+        private String riskType = "异常发布";
+
+        /**
+         * 检测指标
+         */
+        private String detectIndicator = "短时间大量发布同类商品";
+    }
+}

+ 50 - 0
alien-entity/src/main/java/shop/alien/entity/second/LifeUserLog.java

@@ -0,0 +1,50 @@
+package shop.alien.entity.second;
+
+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.io.Serializable;
+import java.util.Date;
+
+/**
+ * 用户
+ */
+@Data
+@JsonInclude
+@TableName("life_user_log")
+public class LifeUserLog implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("user_id")
+    private Integer userId;
+
+    @TableField("user_name")
+    private String userName;
+
+    @TableField("mac_ip")
+    private String macIp;
+
+    @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-entity/src/main/java/shop/alien/entity/second/SecondGoodsCategory.java

@@ -66,5 +66,5 @@ public class SecondGoodsCategory implements Serializable {
     private Integer updatedUserId;
     private Integer updatedUserId;
 
 
     @TableField(exist = false)
     @TableField(exist = false)
-    private List<SecondGoodsCategory> children = new ArrayList<>();
+    private List<SecondGoodsCategory> children = null;
 }
 }

+ 91 - 0
alien-entity/src/main/java/shop/alien/entity/second/SecondRiskControlRecord.java

@@ -0,0 +1,91 @@
+package shop.alien.entity.second;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+@JsonInclude
+@TableName("second_risk_control_record")
+public class SecondRiskControlRecord extends Model<SecondRiskControlRecord> {
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    @ApiModelProperty(value = "主键ID")
+    private Integer id;
+
+    @TableField("user_id")
+    @ApiModelProperty(value = "用户ID")
+    private Integer userId;
+
+    @TableField("rule_type")
+    @ApiModelProperty(value = "规则类型 1:洗钱嫌疑 2:账号异常 3:交易欺诈 4:异常发布")
+    private Integer ruleType;
+
+    @TableField("rule_name")
+    @ApiModelProperty(value = "规则名称")
+    private String ruleName;
+
+    @TableField("risk_status")
+    @ApiModelProperty(value = "风控执行状态 0 未执行,1-已执行 2-已忽略")
+    private Integer riskStatus;
+
+//
+//    @TableField("trigger_count")
+//    @ApiModelProperty(value = "触发次数")
+//    private Integer triggerCount;
+//
+//    @TableField("time_window_hours")
+//    @ApiModelProperty(value = "时间窗口(小时)")
+//    private Integer timeWindowHours;
+//
+//    @TableField("threshold_value")
+//    @ApiModelProperty(value = "阈值")
+//    private Integer thresholdValue;
+//
+//    @TableField("actual_value")
+//    @ApiModelProperty(value = "实际值")
+//    private Integer actualValue;
+
+    @TableField("business_id")
+    @ApiModelProperty(value = "业务ID(如商品ID、交易ID等)")
+    private String businessId;
+
+//    @TableField("business_type")
+//    @ApiModelProperty(value = "业务类型 1:二手商品 2:交易记录")
+//    private Integer businessType;
+
+    @TableField("detail_info")
+    @ApiModelProperty(value = "详细信息(JSON格式)")
+    private String detailInfo;
+
+    @TableField("delete_flag")
+    @ApiModelProperty(value = "删除标记 0:未删除 1:已删除")
+    @TableLogic
+    private Integer deleteFlag;
+
+    @TableField(value = "created_time", fill = FieldFill.INSERT)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
+    private Date createdTime;
+
+    @TableField(value = "created_user_id", fill = FieldFill.INSERT)
+    @ApiModelProperty(value = "创建人ID")
+    private Integer createdUserId;
+
+    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "修改时间")
+    private Date updatedTime;
+
+    @TableField(value = "updated_user_id", fill = FieldFill.INSERT_UPDATE)
+    @ApiModelProperty(value = "修改人ID")
+    private Integer updatedUserId;
+}

+ 7 - 10
alien-entity/src/main/java/shop/alien/entity/second/SecondTradeOperation.java

@@ -1,9 +1,6 @@
 package shop.alien.entity.second;
 package shop.alien.entity.second;
 
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
@@ -41,21 +38,21 @@ public class SecondTradeOperation extends Model<SecondTradeOperation> {
     @ApiModelProperty(value = "删除标记 0:未删除 1:已删除")
     @ApiModelProperty(value = "删除标记 0:未删除 1:已删除")
     private Integer deleteFlag;
     private Integer deleteFlag;
 
 
-    @TableField("created_time")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @ApiModelProperty(value = "创建时间")
     @ApiModelProperty(value = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(value = "created_time", fill = FieldFill.INSERT)
     private Date createdTime;
     private Date createdTime;
 
 
-    @TableField("created_user_id")
     @ApiModelProperty(value = "创建人ID")
     @ApiModelProperty(value = "创建人ID")
+    @TableField(value = "created_user_id", fill = FieldFill.INSERT)
     private Integer createdUserId;
     private Integer createdUserId;
 
 
-    @TableField("updated_time")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @ApiModelProperty(value = "修改时间")
     @ApiModelProperty(value = "修改时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
     private Date updatedTime;
     private Date updatedTime;
 
 
-    @TableField("updated_user_id")
     @ApiModelProperty(value = "修改人ID")
     @ApiModelProperty(value = "修改人ID")
+    @TableField(value = "updated_user_id", fill = FieldFill.INSERT_UPDATE)
     private Integer updatedUserId;
     private Integer updatedUserId;
 }
 }

+ 55 - 0
alien-entity/src/main/java/shop/alien/entity/second/SecondUserCredit.java

@@ -0,0 +1,55 @@
+package shop.alien.entity.second;
+
+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.io.Serializable;
+import java.util.Date;
+
+/**
+ * 用户
+ */
+@Data
+@JsonInclude
+@TableName("second_user_credit")
+public class SecondUserCredit implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("user_id")
+    private Integer userId;
+
+    @TableField("user_points")
+    private Integer userPoints;
+
+    @TableField("delete_flag")
+    @TableLogic
+    private Integer deleteFlag;
+
+    @ApiModelProperty(value = "冻结时间")
+    @TableField("freeze_time")
+    private Date freezeTime;
+
+    @TableField(value = "created_time", fill = FieldFill.INSERT)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
+    private Date createdTime;
+
+    @TableField(value = "created_user_id", fill = FieldFill.INSERT)
+    @ApiModelProperty(value = "创建人ID")
+    private Integer createdUserId;
+
+    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "修改时间")
+    private Date updatedTime;
+
+    @TableField(value = "updated_user_id", fill = FieldFill.INSERT_UPDATE)
+    @ApiModelProperty(value = "修改人ID")
+    private Integer updatedUserId;
+}

+ 54 - 0
alien-entity/src/main/java/shop/alien/entity/second/SecondUserCreditRecord.java

@@ -0,0 +1,54 @@
+package shop.alien.entity.second;
+
+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.io.Serializable;
+import java.util.Date;
+
+/**
+ * 用户
+ */
+@Data
+@JsonInclude
+@TableName("second_user_credit_record")
+public class SecondUserCreditRecord implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("user_id")
+    private Integer userId;
+
+    @TableField("points")
+    private Integer points;
+
+    @TableField("points_type")
+    private Integer pointsType;
+
+    @TableField("delete_flag")
+    @TableLogic
+    private Integer deleteFlag;
+
+    @TableField(value = "created_time", fill = FieldFill.INSERT)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
+    private Date createdTime;
+
+    @TableField(value = "created_user_id", fill = FieldFill.INSERT)
+    @ApiModelProperty(value = "创建人ID")
+    private Integer createdUserId;
+
+    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty(value = "修改时间")
+    private Date updatedTime;
+
+    @TableField(value = "updated_user_id", fill = FieldFill.INSERT_UPDATE)
+    @ApiModelProperty(value = "修改人ID")
+    private Integer updatedUserId;
+}

+ 56 - 0
alien-entity/src/main/java/shop/alien/entity/second/enums/RiskControlRuleTypeEnum.java

@@ -0,0 +1,56 @@
+package shop.alien.entity.second.enums;
+
+import lombok.Getter;
+
+/**
+ * 风控规则类型枚举
+ * @see RiskControlRuleTypeEnum 风控规则类型枚举
+ */
+@Getter
+public enum RiskControlRuleTypeEnum {
+    /**
+     * 洗钱嫌疑: 高频高价交易(>5次/天,>200元/笔)
+     */
+    MONEY_LAUNDERING_SUSPICION(1, "洗钱嫌疑", "24h>5次>200元"),
+
+    /**
+     * 账号异常: 同一设备/mac 24小时内注册超过3个账号
+     */
+    ACCOUNT_ABNORMAL(2, "账号异常", "24h同设备>3账号"),
+
+    /**
+     * 交易欺诈: 用户频繁修改商品 发布成功的记录(24小时 3次 - 调取接口发当前时间 倒推24小时)
+     */
+    TRANSACTION_FRAUD(3, "交易欺诈", "24h修改商品>3次"),
+
+    /**
+     * 异常发布: 短时间大量发布同类商品(如24小时发布10个同二级分类触发- 调取接口发当前时间 倒推24小时)
+     */
+    ABNORMAL_PUBLISH(4, "异常发布", "24h同分类>10商品");
+
+
+    private final Integer ruleType;
+    private final String ruleName;
+    private final String description;
+
+    RiskControlRuleTypeEnum(Integer ruleType, String ruleName, String description) {
+        this.ruleType = ruleType;
+        this.ruleName = ruleName;
+        this.description = description;
+    }
+
+    /**
+     * 根据ruleType获取枚举
+     *
+     * @param ruleType 规则类型
+     * @return 对应的枚举值
+     */
+    public static RiskControlRuleTypeEnum fromRuleType(Integer ruleType) {
+        for (RiskControlRuleTypeEnum rule : RiskControlRuleTypeEnum.values()) {
+            if (rule.getRuleType().equals(ruleType)) {
+                return rule;
+            }
+        }
+        return null;
+    }
+}

+ 20 - 0
alien-entity/src/main/java/shop/alien/entity/second/vo/BatchUnshelveGoodsDTO.java

@@ -0,0 +1,20 @@
+package shop.alien.entity.second.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+/**
+ * 批量下架商品DTO
+ */
+@Data
+@ApiModel(value = "BatchUnshelveGoodsDTO", description = "批量下架商品参数")
+public class BatchUnshelveGoodsDTO {
+
+    @ApiModelProperty(value = "风控规则类型")
+    private Integer ruleType;
+
+    @ApiModelProperty(value = "业务ID")
+    private String businessId;
+}

+ 18 - 0
alien-entity/src/main/java/shop/alien/entity/second/vo/RiskControlGoodsIdsDTO.java

@@ -0,0 +1,18 @@
+package shop.alien.entity.second.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 风控商品ID查询DTO
+ */
+@Data
+@ApiModel(value = "RiskControlGoodsIdsDTO", description = "风控商品ID查询参数")
+public class RiskControlGoodsIdsDTO {
+
+    @ApiModelProperty(value = "商品记录表ID列表")
+    private List<Integer> recordIds;
+}

+ 18 - 0
alien-entity/src/main/java/shop/alien/entity/second/vo/RiskControlGoodsQueryDTO.java

@@ -0,0 +1,18 @@
+package shop.alien.entity.second.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 风控商品查询DTO
+ */
+@Data
+@ApiModel(value = "RiskControlGoodsQueryDTO", description = "风控商品查询参数")
+public class RiskControlGoodsQueryDTO {
+
+    @ApiModelProperty(value = "商品表ID列表")
+    private List<Integer> goodsIds;
+}

+ 6 - 0
alien-entity/src/main/java/shop/alien/entity/second/vo/SecondGoodsVo.java

@@ -7,6 +7,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
+import io.swagger.models.auth.In;
 import lombok.Data;
 import lombok.Data;
 import shop.alien.entity.second.SecondGoods;
 import shop.alien.entity.second.SecondGoods;
 
 
@@ -68,6 +69,8 @@ public class SecondGoodsVo extends SecondGoods {
     @TableField(exist = false)
     @TableField(exist = false)
     private String categoryTwoName;
     private String categoryTwoName;
 
 
+    @ApiModelProperty(value = "商品图片列表")
+    private List<String> imageUrls;
     /** -------------------- 搜索入参 -------------------- */
     /** -------------------- 搜索入参 -------------------- */
 
 
     @TableField(exist = false)
     @TableField(exist = false)
@@ -95,6 +98,9 @@ public class SecondGoodsVo extends SecondGoods {
     @ApiModelProperty(value = "屏蔽id")
     @ApiModelProperty(value = "屏蔽id")
     private String shieldId;
     private String shieldId;
 
 
+    @ApiModelProperty(value = "商品id")
+    private Integer goodsId;
+
     @ApiModelProperty(value = "屏蔽商品IDList")
     @ApiModelProperty(value = "屏蔽商品IDList")
     private List<Integer> shieldedGoodsIds;
     private List<Integer> shieldedGoodsIds;
 
 

+ 4 - 0
alien-entity/src/main/java/shop/alien/entity/second/vo/SecondReportingVo.java

@@ -1,5 +1,6 @@
 package shop.alien.entity.second.vo;
 package shop.alien.entity.second.vo;
 
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
@@ -21,6 +22,9 @@ public class SecondReportingVo{
     @ApiModelProperty(value = "商品标题")
     @ApiModelProperty(value = "商品标题")
     private String title;
     private String title;
 
 
+    @ApiModelProperty(value = "处理状态(0:未处理,1:违规,2:未违规)")
+    private String processingStatus;
+
     @ApiModelProperty(value = "商品封面图片")
     @ApiModelProperty(value = "商品封面图片")
     private String homeImage;
     private String homeImage;
 
 

+ 42 - 0
alien-entity/src/main/java/shop/alien/entity/second/vo/SecondRiskControlRecordVo.java

@@ -0,0 +1,42 @@
+package shop.alien.entity.second.vo;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import shop.alien.entity.second.SecondRiskControlRecord;
+
+import java.util.Date;
+
+@Data
+@JsonInclude
+@TableName("second_risk_control_record")
+public class SecondRiskControlRecordVo extends SecondRiskControlRecord {
+    private static final long serialVersionUID = 1L;
+
+    @TableField("rule_risk")
+    @ApiModelProperty(value = "风险等级")
+    private String ruleRisk;
+
+    @TableField("rule_name")
+    @ApiModelProperty(value = "规则名称")
+    private String ruleName;
+
+    @ApiModelProperty(value = "触发次数")
+    private String UserPhone;
+
+    @ApiModelProperty(value = "规则名称")
+    private String ruleTypeName;
+
+    @ApiModelProperty(value = "规则名称")
+    private String riskStatusName;
+
+    @ApiModelProperty(value = "分页页数")
+    private Integer pageNum;
+
+    @ApiModelProperty(value = "分页条数")
+    private Integer pageSize;
+
+}

+ 30 - 0
alien-entity/src/main/java/shop/alien/entity/second/vo/SecondRiskRecordVo.java

@@ -0,0 +1,30 @@
+package shop.alien.entity.second.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import shop.alien.entity.store.LifeUser;
+
+import java.util.List;
+
+@Data
+@JsonInclude
+public class SecondRiskRecordVo extends SecondRiskControlRecordVo {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "洗钱嫌疑")
+    private List<SecondTradeRecordVo> tradeRecordList;
+
+    @ApiModelProperty(value = "交易欺诈")
+    private List<SecondGoodsRecordDetailVo> goodsRecordList;
+
+    @ApiModelProperty(value = "异常发布")
+    private List<SecondGoodsVo> goodsList;
+
+    @ApiModelProperty(value = "账号异常")
+    private List<LifeUser> userList;
+
+    @ApiModelProperty(value = "1:执行, 2:忽略")
+    private Integer isExecute;
+
+}

+ 22 - 0
alien-entity/src/main/java/shop/alien/entity/second/vo/SecondUserCreditVo.java

@@ -0,0 +1,22 @@
+package shop.alien.entity.second.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import shop.alien.entity.second.SecondUserCredit;
+
+
+/**
+ * 用户
+ */
+@Data
+@JsonInclude
+public class SecondUserCreditVo extends SecondUserCredit {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "规则类型 1:洗钱嫌疑 2:账号异常 3:交易欺诈 4:异常发布")
+    private Integer ruleType;
+
+    @ApiModelProperty(value = "业务ID(如商品ID、交易ID等)")
+    private String businessId;
+}

+ 29 - 0
alien-entity/src/main/java/shop/alien/entity/second/vo/SecondUserViolationDetailVo.java

@@ -0,0 +1,29 @@
+package shop.alien.entity.second.vo;
+
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 二手商品类别表
+ */
+@Data
+@JsonInclude
+@ApiModel(value = "SecondUserViolation对象", description = "二手交易平台管理举报")
+public class SecondUserViolationDetailVo extends SecondUserViolationVo{
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "举报图片集合")
+    private List<Map<String, Object>> imgList;
+
+    // 商品信息
+    private SecondGoodsVo secondGoods;
+
+
+
+}

+ 40 - 13
alien-entity/src/main/java/shop/alien/entity/second/vo/SecondUserViolationVo.java

@@ -1,31 +1,58 @@
 package shop.alien.entity.second.vo;
 package shop.alien.entity.second.vo;
 
 
+
+import com.fasterxml.jackson.annotation.JsonInclude;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
+import lombok.NoArgsConstructor;
 import shop.alien.entity.store.LifeUserViolation;
 import shop.alien.entity.store.LifeUserViolation;
 
 
+import java.io.Serializable;
+import java.util.Date;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
- * <p>
- * 用户举报
- * </p>
- *
- * @author ssk
- * @since 2025-04-29
+ * 二手商品类别表
  */
  */
 @Data
 @Data
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value="LifeUserViolation对象", description="用户举报")
+@JsonInclude
+@NoArgsConstructor
+@ApiModel(value = "SecondUserViolation对象", description = "二手交易平台管理举报")
 public class SecondUserViolationVo extends LifeUserViolation {
 public class SecondUserViolationVo extends LifeUserViolation {
-
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
 
 
+    @ApiModelProperty(value = "分页页数")
+    private Integer pageNum;
+
+    @ApiModelProperty(value = "分页条数")
+    private Integer pageSize;
+
+    @ApiModelProperty(value = "被举报用户名称")
+    private String reportedUserName;
+
+    @ApiModelProperty(value = "被举报用户电话")
+    private String reportedUserPhone;
+
+    @ApiModelProperty(value = "举报用户名称")
+    private String reportingUserName;
+
+    @ApiModelProperty(value = "举报用户电话")
+    private String reportingUserPhone;
+
+    @ApiModelProperty(value = "举报类型")
+    private String reportContext;
+
+    @ApiModelProperty(value = "举报时间")
+    private String reportingDate;
+
+    @ApiModelProperty(value = "举报枚举")
+    private String dictDetail;
+
+    @ApiModelProperty(value = "举报状态")
+    private String processingContext;
+
     @ApiModelProperty(value = "商品图片")
     @ApiModelProperty(value = "商品图片")
     private List<String> imgUrl;
     private List<String> imgUrl;
 
 
-}
+}

+ 4 - 0
alien-entity/src/main/java/shop/alien/entity/store/ActivityInviteLog.java

@@ -68,4 +68,8 @@ public class ActivityInviteLog {
     @TableField("delete_flag")
     @TableField("delete_flag")
     @TableLogic
     @TableLogic
     private Integer deleteFlag;
     private Integer deleteFlag;
+
+    @ApiModelProperty(value = "发放状态, 0:未发放, 1:已发放")
+    @TableField("distribution_status")
+    private Integer distributionStatus;
 }
 }

+ 1 - 1
alien-entity/src/main/java/shop/alien/entity/store/ActivitySignInConfig.java

@@ -59,10 +59,10 @@ public class ActivitySignInConfig {
     @TableField("delete_flag")
     @TableField("delete_flag")
     @TableLogic
     @TableLogic
     private Integer deleteFlag;
     private Integer deleteFlag;
-
     @ApiModelProperty(value = "方案配置类型1,默认方案,2.特殊方案")
     @ApiModelProperty(value = "方案配置类型1,默认方案,2.特殊方案")
     private Integer planConfigType;
     private Integer planConfigType;
 
 
+
     @ApiModelProperty(value = "返回错误信息")
     @ApiModelProperty(value = "返回错误信息")
     @TableField(exist = false)
     @TableField(exist = false)
     private String errorMessage;
     private String errorMessage;

+ 1 - 1
alien-entity/src/main/java/shop/alien/entity/store/LifeCoupon.java

@@ -93,7 +93,7 @@ public class LifeCoupon {
     @ApiModelProperty(value = "受用场景")
     @ApiModelProperty(value = "受用场景")
     private String applicableRule;
     private String applicableRule;
 
 
-    @ApiModelProperty(value = "状态:-1.待审核  -2.已驳回  0.待使用(已通过), 1.进行中, 2.已暂停, 3.已结束")
+    @ApiModelProperty(value = "状态:0草稿/1待审核/2未开始/3审核拒绝/4已售罄/5进行中/6已下架/7已结束/8=2+手动下架")
     private Integer status;
     private Integer status;
 
 
     @ApiModelProperty(value = "券图片地址")
     @ApiModelProperty(value = "券图片地址")

+ 9 - 0
alien-entity/src/main/java/shop/alien/entity/store/LifeUserOrder.java

@@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 
 
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.Date;
 
 
 /**
 /**
@@ -92,4 +93,12 @@ public class LifeUserOrder {
     @ApiModelProperty(value = "核销发送优惠券(0:未发送,1:已发送)")
     @ApiModelProperty(value = "核销发送优惠券(0:未发送,1:已发送)")
     @TableField("send_discount_coupon_flag")
     @TableField("send_discount_coupon_flag")
     private Integer sendDiscountCouponFlag;
     private Integer sendDiscountCouponFlag;
+
+    @ApiModelProperty(value = "达人订单id")
+    @TableField("expert_order_id")
+    private Integer expertOrderId;
+
+    @ApiModelProperty(value = "订单评价 0:未评价 1:已评价")
+    @TableField("order_appraise")
+    private Integer orderAppraise;
 }
 }

+ 6 - 2
alien-entity/src/main/java/shop/alien/entity/store/LifeUserViolation.java

@@ -2,12 +2,16 @@ package shop.alien.entity.store;
 
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+
 import java.util.Date;
 import java.util.Date;
+
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
+
 import java.io.Serializable;
 import java.io.Serializable;
+
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
@@ -25,7 +29,7 @@ import lombok.experimental.Accessors;
 @Data
 @Data
 @EqualsAndHashCode(callSuper = false)
 @EqualsAndHashCode(callSuper = false)
 @Accessors(chain = true)
 @Accessors(chain = true)
-@ApiModel(value="LifeUserViolation对象", description="用户举报")
+@ApiModel(value = "LifeUserViolation对象", description = "用户举报")
 public class LifeUserViolation extends Model<LifeUserViolation> {
 public class LifeUserViolation extends Model<LifeUserViolation> {
 
 
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
@@ -50,7 +54,7 @@ public class LifeUserViolation extends Model<LifeUserViolation> {
     @TableField("reporting_user_id")
     @TableField("reporting_user_id")
     private String reportingUserId;
     private String reportingUserId;
 
 
-    @ApiModelProperty(value = "举报内容分类")
+    @ApiModelProperty(value = "举报内容分类(0:商户, 1:用户,2:动态,3:评论, 4:二手商品, 5:二手用户)")
     @TableField("report_context_type")
     @TableField("report_context_type")
     private String reportContextType;
     private String reportContextType;
 
 

+ 76 - 0
alien-entity/src/main/java/shop/alien/entity/store/StoreAliPayErrorLog.java

@@ -0,0 +1,76 @@
+package shop.alien.entity.store;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 支付宝转账记录错误信息表
+ * qxy
+ */
+@Data
+@JsonInclude
+@ApiModel(value = "StoreAliPayErrorLog对象", description = "支付宝转账记录错误信息表")
+public class StoreAliPayErrorLog extends Model<StoreAliPayErrorLog> {
+
+    @ApiModelProperty(value = "主键")
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "商户ID")
+    @TableField("store_user_id")
+    private Integer storeUserId;
+
+    @ApiModelProperty(value = "用户ID")
+    @TableField("life_user_id")
+    private Integer lifeUserId;
+
+    @ApiModelProperty(value = "订单总金额")
+    @TableField("trans_amount")
+    private String transAmount;
+
+    @ApiModelProperty(value = "阿里返回错误信息")
+    @TableField("sub_msg")
+    private String subMsg;
+
+    @ApiModelProperty(value = "阿里返回状态码")
+    @TableField("sub_code")
+    private String subCode;
+
+    @ApiModelProperty(value = "阿里返回参数具体内容")
+    @TableField("biz_content")
+    private String bizContent;
+
+    @ApiModelProperty(value = "错误信息")
+    @TableField("information")
+    private String information;
+
+    @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.INSERT_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;
+}

+ 2 - 0
alien-entity/src/main/java/shop/alien/entity/store/StoreAliPayLog.java

@@ -74,4 +74,6 @@ public class StoreAliPayLog extends Model<StoreAliPayLog> {
     @TableField("updated_user_id")
     @TableField("updated_user_id")
     private Integer updatedUserId;
     private Integer updatedUserId;
 
 
+    private StoreAliPayErrorLog storeAliPayErrorLog;
+
 }
 }

+ 63 - 0
alien-entity/src/main/java/shop/alien/entity/store/StoreCommentSummaryInterest.java

@@ -0,0 +1,63 @@
+package shop.alien.entity.store;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * AI服务 店铺推荐趣味信息表
+ */
+@Data
+@JsonInclude
+@TableName("store_comment_summary_interest")
+@ApiModel(value = "store_comment_summary_interest", description = "store_comment_summary_interest")
+public class StoreCommentSummaryInterest {
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @ApiModelProperty(value = "店铺ID(新增字段)")
+    @TableField("store_id")
+    private Integer storeId;
+
+    @ApiModelProperty(value = "店铺名称(对应表格“店铺名称”)")
+    @TableField("store_name")
+    private String storeName;
+
+    @ApiModelProperty(value = "总结内容(对应表格“总结内容”,允许为空)")
+    @TableField("summary")
+    private String summary;
+
+    @ApiModelProperty(value = "任务唯一标识(如 UUID,新增字段)")
+    @TableField("task_id")
+    private String taskId;
+
+    @ApiModelProperty(value = "删除标识")
+    @TableLogic
+    @TableField("delete_flag")
+    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-entity/src/main/java/shop/alien/entity/store/StoreIncomeDetailsRecord.java

@@ -34,7 +34,7 @@ public class StoreIncomeDetailsRecord extends Model<StoreIncomeDetailsRecord> {
     @TableField("cash_out_id")
     @TableField("cash_out_id")
     private Integer cashOutId;
     private Integer cashOutId;
 
 
-    @ApiModelProperty(value = "收入类型, 0:主页, 1:优惠券, 2:代金券, 3:套餐, 4:联名卡")
+    @ApiModelProperty(value = "收入类型, 0:全部, 1:代金, 2:团购")
     @TableField("income_type")
     @TableField("income_type")
     private Integer incomeType;
     private Integer incomeType;
 
 

+ 4 - 0
alien-entity/src/main/java/shop/alien/entity/store/excelVo/LifeUserOrderExcelVo.java

@@ -58,6 +58,10 @@ public class LifeUserOrderExcelVo {
     @ApiModelProperty(value = "完成时间")
     @ApiModelProperty(value = "完成时间")
     private String finishTime;
     private String finishTime;
 
 
+    @ExcelHeader("取消时间")
+    @ApiModelProperty(value = "取消时间")
+    private String cancelTime;
+
     @ExcelHeader("订单状态")
     @ExcelHeader("订单状态")
     @ApiModelProperty(value = "订单状态")
     @ApiModelProperty(value = "订单状态")
     private String orderStatus;
     private String orderStatus;

+ 15 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/ActivityInviteLogVo.java

@@ -29,4 +29,19 @@ public class ActivityInviteLogVo extends ActivityInviteLog {
 
 
     @ApiModelProperty(value = "被邀请人昵称")
     @ApiModelProperty(value = "被邀请人昵称")
     private String invitedNickName;
     private String invitedNickName;
+
+    @ApiModelProperty(value = "邀请人奖励信息")
+    private String inviteRewardInfo;
+
+    @ApiModelProperty(value = "被邀请人奖励信息")
+    private String invitedRewardInfo;
+
+    @ApiModelProperty(value = "邀请人真实姓名")
+    private String inviteRealName;
+
+    @ApiModelProperty(value = "被邀请人真实姓名")
+    private String invitedRealName;
+
+    @ApiModelProperty(value = "邀请人昵称")
+    private String inviteNickName;
 }
 }

+ 6 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeAppealManageVo.java

@@ -30,4 +30,10 @@ public class LifeAppealManageVo extends LifeAppealManage {
     @ApiModelProperty(value = "业务状态名称")
     @ApiModelProperty(value = "业务状态名称")
     private String appealTypeName;
     private String appealTypeName;
 
 
+    @ApiModelProperty(value = "用户电话")
+    private String userPhone;
+
+    @ApiModelProperty(value = "评论图片")
+    private String commentImage;
+
 }
 }

+ 6 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeFansVo.java

@@ -50,4 +50,10 @@ public class LifeFansVo {
 
 
     @ApiModelProperty(value = "拉黑id")
     @ApiModelProperty(value = "拉黑id")
     public String blackListid;
     public String blackListid;
+
+    @ApiModelProperty(value = "用户名")
+    public String username;
+
+    @ApiModelProperty(value = "用户简介")
+    public String accountBlurb;
 }
 }

+ 12 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeGroupBuyMainVo.java

@@ -27,6 +27,18 @@ public class LifeGroupBuyMainVo extends LifeGroupBuyMain {
     @ApiModelProperty(value = "商家名称")
     @ApiModelProperty(value = "商家名称")
     private String storeName;
     private String storeName;
 
 
+    @ApiModelProperty(value = "商家评分")
+    private String scoreAvg;
+
+    @ApiModelProperty(value = "商家经营种类")
+    private String businessName;
+
+    @ApiModelProperty(value = "商家地址")
+    private String address;
+
+    @ApiModelProperty(value = "团购图片url")
+    private String imagePaths;
+
     @ApiModelProperty(value = "商家手机号")
     @ApiModelProperty(value = "商家手机号")
     private String phone;
     private String phone;
 
 

+ 3 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeGroupBuyThaliVo.java

@@ -256,4 +256,7 @@ public class LifeGroupBuyThaliVo {
     @ApiModelProperty(value = "是否收藏")
     @ApiModelProperty(value = "是否收藏")
     private String isCollect;
     private String isCollect;
 
 
+    @ApiModelProperty(value = "已售数量")
+    private Integer saleNum;
+
 }
 }

+ 4 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserOrderCommentVo.java

@@ -17,4 +17,8 @@ public class LifeUserOrderCommentVo extends LifeUserOrder {
     private String groupBuyType;
     private String groupBuyType;
 
 
     private String storeType;
     private String storeType;
+
+    private String businessTypesName;
+
+    private String storeName;
 }
 }

+ 17 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserOrderVo.java

@@ -182,4 +182,21 @@ public class LifeUserOrderVo {
     @ApiModelProperty(value = "修改人ID")
     @ApiModelProperty(value = "修改人ID")
     @TableField("updated_user_id")
     @TableField("updated_user_id")
     private Integer updatedUserId;
     private Integer updatedUserId;
+
+    @ApiModelProperty(value = "达人订单id")
+    @TableField("expert_order_id")
+    private Integer expertOrderId;
+
+    @ApiModelProperty(value = "订单评价 0:未评价 1:已评价")
+    @TableField("order_appraise")
+    private Integer orderAppraise;
+    
+    @ApiModelProperty(value = "订单状态值")
+    private String orderStatusValue;
+
+    @ApiModelProperty(value = "图片id")
+    private String imgIds;
+
+    @ApiModelProperty(value = "图片地址列表")
+    private List<String> imgUrls;
 }
 }

+ 7 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserViolationVo.java

@@ -22,4 +22,11 @@ public class LifeUserViolationVo extends LifeUserViolation {
 
 
     //举报结果通知
     //举报结果通知
     private String reportResultNotification;
     private String reportResultNotification;
+
+    
+    private String phone;
+
+    private String nickName;
+
+    private String image;
 }
 }

+ 3 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserVo.java

@@ -59,4 +59,7 @@ public class LifeUserVo extends LifeUser {
 
 
     @ApiModelProperty(value = "简介")
     @ApiModelProperty(value = "简介")
     private String blurb;
     private String blurb;
+
+    @ApiModelProperty(value = "验证码")
+    private String verificationCode;
 }
 }

+ 1 - 1
alien-entity/src/main/java/shop/alien/entity/store/vo/StoreCommentAppealVo.java

@@ -25,7 +25,7 @@ public class StoreCommentAppealVo extends StoreCommentAppeal {
     @ApiModelProperty(value = "评论图片链接")
     @ApiModelProperty(value = "评论图片链接")
     private List<String> commentImgList;
     private List<String> commentImgList;
 
 
-    @ApiModelProperty(value = "商家申诉图片id")
+    @ApiModelProperty(value = "评论图片id")
     private String commentImgId;
     private String commentImgId;
 
 
     @ApiModelProperty(value = "申诉状态字符串")
     @ApiModelProperty(value = "申诉状态字符串")

+ 7 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/StoreCommentVo.java

@@ -57,5 +57,12 @@ public class StoreCommentVo extends StoreComment {
     @ApiModelProperty(value = "标签")
     @ApiModelProperty(value = "标签")
     private List<String> labels;
     private List<String> labels;
 
 
+    @ApiModelProperty(value = "商家or用户(0商家/1用户)")
+    private Integer storeUserFlag;
 
 
+    private String storeUserName;
+    private String storeUserImg;
+
+    @ApiModelProperty(value = "门店名称")
+    private String  storeName;
 }
 }

+ 4 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/StoreIncomeDetailsRecordVo.java

@@ -1,5 +1,6 @@
 package shop.alien.entity.store.vo;
 package shop.alien.entity.store.vo;
 
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
@@ -71,5 +72,8 @@ public class StoreIncomeDetailsRecordVo extends StoreIncomeDetailsRecord {
     @ApiModelProperty(value = "退款金额")
     @ApiModelProperty(value = "退款金额")
     BigDecimal refundMoney;
     BigDecimal refundMoney;
 
 
+    @ApiModelProperty(value = "抽成比例")
+    private String commissionRate;
+
     List<StoreIncomeDetailsRecordVo> incomeDetailsRecordVoList;
     List<StoreIncomeDetailsRecordVo> incomeDetailsRecordVoList;
 }
 }

+ 3 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/StoreInfoVo.java

@@ -174,6 +174,7 @@ public class StoreInfoVo extends StoreInfo {
     private Integer totalDynamicsNum;
     private Integer totalDynamicsNum;
 
 
     private StoreBusinessInfo storeBusinessInfo;
     private StoreBusinessInfo storeBusinessInfo;
+    private List<StoreBusinessInfo> storeBusinessInfos;
 
 
     @ApiModelProperty(value = "是否营业中(0否1是)")
     @ApiModelProperty(value = "是否营业中(0否1是)")
     private Integer yyFlag;
     private Integer yyFlag;
@@ -211,4 +212,6 @@ public class StoreInfoVo extends StoreInfo {
     @ApiModelProperty(value = "食品经营许可")
     @ApiModelProperty(value = "食品经营许可")
     private String foodLicenceImageUrl;
     private String foodLicenceImageUrl;
 
 
+    @ApiModelProperty(value = "动态数量")
+    private Integer dynamicsNum;
 }
 }

+ 3 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/StoreMainInfoVo.java

@@ -86,6 +86,9 @@ public class StoreMainInfoVo extends StoreInfo {
     @ApiModelProperty(value = "到期时间")
     @ApiModelProperty(value = "到期时间")
     private String expirationDate;
     private String expirationDate;
 
 
+    @ApiModelProperty(value = "合同是否到期 0已到期/1没到期")
+    private Integer expirationFlag;
+
     @ApiModelProperty(value = "门店注销中倒计时时间毫秒")
     @ApiModelProperty(value = "门店注销中倒计时时间毫秒")
     private long countdown;
     private long countdown;
 
 

+ 3 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/StoreUserVo.java

@@ -36,4 +36,7 @@ public class StoreUserVo extends StoreUser {
 
 
     @ApiModelProperty(value = "倒计时")
     @ApiModelProperty(value = "倒计时")
     private long countdown;
     private long countdown;
+
+    @ApiModelProperty(value = "手机号")
+    private String phone;
 }
 }

+ 33 - 4
alien-entity/src/main/java/shop/alien/mapper/ActivityInviteLogMapper.java

@@ -16,9 +16,38 @@ import shop.alien.entity.store.vo.ActivityInviteLogVo;
 @Mapper
 @Mapper
 public interface ActivityInviteLogMapper extends BaseMapper<ActivityInviteLog> {
 public interface ActivityInviteLogMapper extends BaseMapper<ActivityInviteLog> {
 
 
-    @Select("select ail.*, lu.user_phone as invitePhone, lu1.user_phone as invitedPhone, lu1.user_image, lu1.user_name as invitedNickName  " +
-            "from activity_invite_log ail " +
-            "left join life_user lu on lu.id = ail.invite_user_id and lu.delete_flag  = 0 " +
-            "left join life_user lu1 on lu1.id = ail.invited_user_id and lu1.delete_flag = 0 ${ew.customSqlSegment}")
+    @Select("SELECT " +
+            "  ail.*," +
+            " lud.real_name as invitedRealName," +
+            " lud.user_name as invitedNickName," +
+            " lu.user_phone AS invitePhone," +
+            " lu.real_name as inviteRealName," +
+            " lu.user_name as inviteNickName," +
+            " lu1.user_phone AS invitedPhone," +
+            " lu1.user_image," +
+            " lu1.user_name AS invitedNickName," +
+            " CASE " +
+            " WHEN ail.invite_reward_type = 1 AND lc_invite.id IS NOT NULL THEN " +
+            " CONCAT('优惠券:', lc_invite.name, '(', IFNULL(lc_invite.offprice, lc_invite.price), '元)') " +
+            " WHEN ail.invite_reward_type = 2 AND ail.invite_reward_point IS NOT NULL THEN " +
+            " CONCAT('积分:', ail.invite_reward_point, '分') " +
+            " ELSE '' " +
+            " END AS inviteRewardInfo, " +
+            " CASE " +
+            " WHEN ail.invited_reward_type = 1 AND lc_invited.id IS NOT NULL THEN " +
+            " CONCAT('优惠券:', lc_invited.name, '(', IFNULL(lc_invited.offprice, lc_invited.price), '元)') " +
+            " WHEN ail.invited_reward_type = 2 AND ail.invited_reward_point IS NOT NULL THEN " +
+            " CONCAT('积分:', ail.invited_reward_point, '分') " +
+            " ELSE '' " +
+            " END AS invitedRewardInfo " +
+            " FROM activity_invite_log ail " +
+            " LEFT JOIN life_user lu ON lu.id = ail.invite_user_id " +
+            " AND lu.delete_flag = 0 " +
+            " LEFT JOIN life_user lud ON lud.id = ail.invited_user_id " +
+            " AND lud.delete_flag = 0 " +
+            " LEFT JOIN life_user lu1 ON lu1.id = ail.invited_user_id AND lu1.delete_flag = 0 " +
+            " LEFT JOIN life_coupon lc_invite ON lc_invite.id = ail.invite_reward_coupon AND lc_invite.delete_flag = 0 " +
+            " LEFT JOIN life_coupon lc_invited ON lc_invited.id = ail.invited_reward_coupon AND lc_invited.delete_flag = 0 " +
+            "${ew.customSqlSegment}")
     IPage<ActivityInviteLogVo> getInviteActivityLogList(IPage<ActivityInviteLogVo> iPage, @Param(Constants.WRAPPER) QueryWrapper<ActivityInviteLogVo> wrapper);
     IPage<ActivityInviteLogVo> getInviteActivityLogList(IPage<ActivityInviteLogVo> iPage, @Param(Constants.WRAPPER) QueryWrapper<ActivityInviteLogVo> wrapper);
 }
 }

+ 2 - 2
alien-entity/src/main/java/shop/alien/mapper/LifeBrowseRecordMapper.java

@@ -12,7 +12,7 @@ import java.util.Map;
 public interface LifeBrowseRecordMapper extends BaseMapper<LifeBrowseRecord> {
 public interface LifeBrowseRecordMapper extends BaseMapper<LifeBrowseRecord> {
 
 
     @Select("SELECT a.id,a.liulan_date liulanDate, b.store_type storeType, b.store_position storePosition, a.liulan_time liulanTime, " +
     @Select("SELECT a.id,a.liulan_date liulanDate, b.store_type storeType, b.store_position storePosition, a.liulan_time liulanTime, " +
-            "c.img_url image, b.store_name storeName, b.store_address storeDetailAddress, b.id storeId, a.created_time, d.img_url entranceImage, dict.dict_detail storeTypeStr,b.score_avg scoreAvg,b.business_types_name businessTypesName " +
+            "c.img_url image, b.store_name storeName, b.store_address storeDetailAddress, b.id storeId, a.created_time, d.img_url entranceImage, dict.dict_detail storeTypeStr,ROUND(b.score_avg, 2) scoreAvg,b.business_types_name businessTypesName " +
             "FROM life_browse_record a " +
             "FROM life_browse_record a " +
             "LEFT JOIN store_info b ON a.store_id = b.id " +
             "LEFT JOIN store_info b ON a.store_id = b.id " +
             "LEFT JOIN store_img c on b.id = c.store_id and c.img_type = 11 and c.delete_flag = 0 " +
             "LEFT JOIN store_img c on b.id = c.store_id and c.img_type = 11 and c.delete_flag = 0 " +
@@ -20,7 +20,7 @@ public interface LifeBrowseRecordMapper extends BaseMapper<LifeBrowseRecord> {
             "left join store_dictionary dict on dict.type_name = 'storeType' and dict.dict_id = b.store_type and dict.delete_flag = 0 " +
             "left join store_dictionary dict on dict.type_name = 'storeType' and dict.dict_id = b.store_type and dict.delete_flag = 0 " +
             "WHERE a.user_id = #{userId} AND a.delete_flag = 0 AND b.delete_flag = 0 ORDER BY a.liulan_time desc")
             "WHERE a.user_id = #{userId} AND a.delete_flag = 0 AND b.delete_flag = 0 ORDER BY a.liulan_time desc")
     List<Map<String, Object>> getBrowseRecordByUserId(String userId);
     List<Map<String, Object>> getBrowseRecordByUserId(String userId);
-    @Select("select lbr.id,lgbm.group_name groupName,lgbm.id couponId,si.id storeId,original_price originalPrice,preferential_price preferentialPrice,lbr.liulan_date liulanDate,si.store_name storeName,si2.img_url\n" +
+    @Select("select lbr.id,lgbm.group_name groupName,lgbm.id couponId,si.id storeId,ROUND(b.score_avg, 2) scoreAvg, original_price originalPrice,preferential_price preferentialPrice,lbr.liulan_date liulanDate,si.store_name storeName,si2.img_url\n" +
             "from life_browse_record lbr \n" +
             "from life_browse_record lbr \n" +
             "inner join life_group_buy_main lgbm on lgbm.id = lbr.coupon_id \n" +
             "inner join life_group_buy_main lgbm on lgbm.id = lbr.coupon_id \n" +
             "and lgbm.delete_flag = 0 and lbr.delete_flag = 0\n" +
             "and lgbm.delete_flag = 0 and lbr.delete_flag = 0\n" +

+ 16 - 0
alien-entity/src/main/java/shop/alien/mapper/LifeCouponMapper.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 import shop.alien.entity.store.LifeCoupon;
 import shop.alien.entity.store.LifeCoupon;
 import shop.alien.entity.store.vo.LifeCouponVo;
 import shop.alien.entity.store.vo.LifeCouponVo;
 
 
@@ -64,4 +65,19 @@ public interface LifeCouponMapper extends BaseMapper<LifeCoupon> {
 
 
     @Select("SELECT * FROM life_coupon ${ew.customSqlSegment}")
     @Select("SELECT * FROM life_coupon ${ew.customSqlSegment}")
     List<LifeCoupon> getList(@Param(Constants.WRAPPER) LambdaQueryWrapper<LifeCoupon> lambdaQueryWrapper);
     List<LifeCoupon> getList(@Param(Constants.WRAPPER) LambdaQueryWrapper<LifeCoupon> lambdaQueryWrapper);
+
+    @Update(" UPDATE life_coupon\n" +
+            "    SET \n" +
+            "        status = CASE WHEN (single_qty - #{buyCount}) = 0 \n" +
+            "                     THEN #{soldOutStatus} \n" +
+            "                     ELSE status END,\n" +
+            "        single_qty = single_qty - #{buyCount}\n" +
+            "    WHERE \n" +
+            "        id = #{couponId} \n" +
+            "        AND single_qty >= #{buyCount}")
+    int deductInventoryAtomically(
+            @Param("couponId") Integer couponId,
+            @Param("buyCount") int buyCount,
+            @Param("soldOutStatus") int soldOutStatus
+    );
 }
 }

+ 86 - 24
alien-entity/src/main/java/shop/alien/mapper/LifeFansMapper.java

@@ -23,14 +23,15 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
             "        from life_fans   " +
             "        from life_fans   " +
             "        where delete_flag = 0 and fans_id = #{fansId} " +
             "        where delete_flag = 0 and fans_id = #{fansId} " +
             "    )   " +
             "    )   " +
-            "    select info.id, info.store_name name, user.head_img image, concat('store_', user.phone) phoneId, info.store_blurb blurb, 1 blockedType,user.id blockedId" +
+            "    select info.id, IF(info.store_application_status = 0, user.nick_name, info.store_name) AS NAME," +
+            "    user.head_img image, concat('store_', user.phone) phoneId, IF(info.store_application_status = 0, user.account_blurb, info.store_blurb) AS blurb, 1 blockedType,user.id blockedId ,IFNULL(user.nick_name, user.name) username, user.account_blurb accountBlurb " +
             "    from follow foll " +
             "    from follow foll " +
             "    join store_user user on foll.phone = user.phone " +
             "    join store_user user on foll.phone = user.phone " +
             "    join store_info info on info.id = user.store_id " +
             "    join store_info info on info.id = user.store_id " +
             "    left join store_img img on img.store_id = user.store_id and img.img_type = '10' and img.delete_flag = 0 " +
             "    left join store_img img on img.store_id = user.store_id and img.img_type = '10' and img.delete_flag = 0 " +
             "    where foll.flag = 'store' and user.delete_flag = 0 and info.delete_flag = 0 " +
             "    where foll.flag = 'store' and user.delete_flag = 0 and info.delete_flag = 0 " +
             "    union " +
             "    union " +
-            "    select user.id, user.user_name name, user.user_image image, concat('user_', user.user_phone) phoneId, user.jianjie blurb, 2 blockedType,user.id blockedId" +
+            "    select user.id, user.user_name name, user.user_image image, concat('user_', user.user_phone) phoneId, user.jianjie blurb, 2 blockedType,user.id blockedId,'' username, '' accountBlurb " +
             "    from follow foll " +
             "    from follow foll " +
             "    join life_user user on foll.phone = user.user_phone   " +
             "    join life_user user on foll.phone = user.user_phone   " +
             "    where foll.flag = 'user' and user.delete_flag = 0   " +
             "    where foll.flag = 'user' and user.delete_flag = 0   " +
@@ -71,12 +72,12 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
             "        from life_fans " +
             "        from life_fans " +
             "        where delete_flag = 0 and followed_id = #{fansId} " +
             "        where delete_flag = 0 and followed_id = #{fansId} " +
             "    ) " +
             "    ) " +
-            "    select info.id, info.store_name name, user.head_img image, concat('store_', user.phone) phoneId, info.store_blurb blurb, 1 blockedType,user.id blockedId" +
+            "    select user.id, user.nick_name name, user.head_img image, concat('store_', user.phone) phoneId, user.account_blurb blurb, 1 blockedType,user.id blockedId" +
             "    from follow foll " +
             "    from follow foll " +
             "    join store_user user on foll.phone = user.phone " +
             "    join store_user user on foll.phone = user.phone " +
-            "    join store_info info on info.id = user.store_id " +
-            "    left join store_img img on img.store_id = user.store_id and img.img_type = '10' and img.delete_flag = 0 " +
-            "    where foll.flag = 'store' and user.delete_flag = 0 and info.delete_flag = 0 " +
+//            "    join store_info info on info.id = user.store_id " +
+//            "    left join store_img img on img.store_id = user.store_id and img.img_type = '10' and img.delete_flag = 0 " +
+            "    where foll.flag = 'store' and user.delete_flag = 0" +
             "    union " +
             "    union " +
             "    select user.id, user.user_name name, user.user_image image, concat('user_', user.user_phone) phoneId, user.jianjie blurb, 2 blockedType,user.id blockedId" +
             "    select user.id, user.user_name name, user.user_image image, concat('user_', user.user_phone) phoneId, user.jianjie blurb, 2 blockedType,user.id blockedId" +
             "    from follow foll " +
             "    from follow foll " +
@@ -88,23 +89,84 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
             "${ew.customSqlSegment} ")
             "${ew.customSqlSegment} ")
     IPage<LifeFansVo> getMyFans(IPage<LifeFansVo> iPage, @Param("fansId") String fansId, @Param("blockerType") String blockerType, @Param("blockerId") String blockerId, @Param(Constants.WRAPPER) QueryWrapper<LifeFansVo> wrapper);
     IPage<LifeFansVo> getMyFans(IPage<LifeFansVo> iPage, @Param("fansId") String fansId, @Param("blockerType") String blockerType, @Param("blockerId") String blockerId, @Param(Constants.WRAPPER) QueryWrapper<LifeFansVo> wrapper);
 
 
-    @Select("select foll.*, if(isnull(fans.id), 0, 1) isFollowThis, 1 as isFollowMe, count(fans2.id) fansNum, count(fans3.id) followNum from ( " +
-            "    with follow as ( " +
-            "    select substring_index(fans_id, '_', 1) as flag, substring_index(fans_id, '_', -1) as phone " +
-            "    from life_fans " +
-            "    where delete_flag = 0 and followed_id = #{fansId} " +
-            "    ) " +
-            "    select info.id, info.store_name name, user.head_img image, concat('store_', user.phone) phoneId, info.store_blurb blurb " +
-            "    from follow foll " +
-            "    join store_user user on foll.phone = user.phone " +
-            "    join store_info info on info.id = user.store_id " +
-            "    left join store_img img on img.store_id = user.store_id and img.img_type = '10' and img.delete_flag = 0 " +
-            "    where foll.flag = 'store' and user.delete_flag = 0 and info.delete_flag = 0 " +
+//    @Select("select foll.*, if(isnull(fans.id), 0, 1) isFollowThis, 1 as isFollowMe, count(fans2.id) fansNum, count(fans3.id) followNum from ( " +
+//            "    with follow as ( " +
+//            "    select substring_index(fans_id, '_', 1) as flag, substring_index(fans_id, '_', -1) as phone " +
+//            "    from life_fans " +
+//            "    where delete_flag = 0 and followed_id = #{fansId} " +
+//            "    ) " +
+//            "    select info.id," +
+//            "    \"CASE \" +\n" +
+//            "        \"WHEN user.store_id IS NULL OR info.store_application_status = 0 THEN user.nick_name \" +\n" +
+//            "        \"ELSE info.store_name \" +\n" +
+//            "        \"END AS name, \" +\n" +
+//            "        \"CASE \" +\n" +
+//            "        \"WHEN user.store_id IS NULL OR info.store_application_status IN (0, 2) THEN user.account_blurb \" +\n" +
+//            "        \"ELSE info.store_blurb \" +\n" +
+//            "        \"END AS store_blurb, \" + " +
+//            "    user.head_img image, concat('store_', user.phone) phoneId" +
+//            "    from follow foll " +
+//            "    join store_user user on foll.phone = user.phone " +
+//            "    LEFT JOIN store_info info ON user.store_id IS NOT NULL AND info.id = user.store_id " +
+//            "    and info.delete_flag = 0" +
+//            "    left join store_img img on img.store_id = user.store_id and img.img_type = '10' and img.delete_flag = 0 " +
+//            "    where foll.flag = 'store' and user.delete_flag = 0 " +
+//            ") foll " +
+//            "left join life_fans fans on fans.followed_id = foll.phoneId and fans.fans_id = #{fansId} and fans.delete_flag = 0 " +
+//            "left join life_fans fans2 on fans2.followed_id = foll.phoneId and fans2.delete_flag = 0 " +
+//            "left join life_fans fans3 on fans3.fans_id = foll.phoneId and fans3.delete_flag = 0 " +
+//            "${ew.customSqlSegment} ")
+    @Select("SELECT " +
+            "foll.*, " +
+            "IF(isnull(fans.id), 0, 1) isFollowThis, " +
+            "1 AS isFollowMe, " +
+            "count(fans2.id) fansNum, " +
+            "count(fans3.id) followNum " +
+            "FROM " +
+            "( " +
+            "WITH follow AS ( " +
+            "SELECT " +
+            "substring_index(fans_id, '_', 1) AS flag, " +
+            "substring_index(fans_id, '_', -1) AS phone " +
+            "FROM " +
+            "life_fans " +
+            "WHERE " +
+            "delete_flag = 0 " +
+            "AND followed_id = #{fansId} " +
+            ") " +
+            "SELECT " +
+            "info.id, " +
+            "CASE " +
+            "WHEN user.store_id IS NULL OR info.store_application_status = 0 THEN user.nick_name " +
+            "ELSE info.store_name " +
+            "END AS name, " +
+            "CASE " +
+            "WHEN user.store_id IS NULL OR info.store_application_status IN (0, 2) THEN user.account_blurb " +
+            "ELSE info.store_blurb " +
+            "END AS blurb, " +
+            "user.head_img AS image, " +
+            "concat('store_', user.phone) AS phoneId " +
+            "FROM " +
+            "follow foll " +
+            "JOIN store_user user ON foll.phone = user.phone " +
+            "LEFT JOIN store_info info ON user.store_id IS NOT NULL " +
+            "AND info.id = user.store_id " +
+            "AND info.delete_flag = 0 " +
+            "LEFT JOIN store_img img ON img.store_id = user.store_id " +
+            "AND img.img_type = '10' " +
+            "AND img.delete_flag = 0 " +
+            "WHERE " +
+            "foll.flag = 'store' " +
+            "AND user.delete_flag = 0 " +
             ") foll " +
             ") foll " +
-            "left join life_fans fans on fans.followed_id = foll.phoneId and fans.fans_id = #{fansId} and fans.delete_flag = 0 " +
-            "left join life_fans fans2 on fans2.followed_id = foll.phoneId and fans2.delete_flag = 0 " +
-            "left join life_fans fans3 on fans3.fans_id = foll.phoneId and fans3.delete_flag = 0 " +
-            "${ew.customSqlSegment} ")
+            "LEFT JOIN life_fans fans ON fans.followed_id = foll.phoneId " +
+            "AND fans.fans_id = #{fansId} " +
+            "AND fans.delete_flag = 0 " +
+            "LEFT JOIN life_fans fans2 ON fans2.followed_id = foll.phoneId " +
+            "AND fans2.delete_flag = 0 " +
+            "LEFT JOIN life_fans fans3 ON fans3.fans_id = foll.phoneId " +
+            "AND fans3.delete_flag = 0 " +
+            "${ew.customSqlSegment}")
     IPage<LifeFansVo> getMyStoreFans(IPage<LifeFansVo> iPage, @Param("fansId") String fansId, @Param(Constants.WRAPPER) QueryWrapper<LifeFansVo> wrapper);
     IPage<LifeFansVo> getMyStoreFans(IPage<LifeFansVo> iPage, @Param("fansId") String fansId, @Param(Constants.WRAPPER) QueryWrapper<LifeFansVo> wrapper);
 
 
     @Select("select foll.*, if(isnull(fans.id), 0, 1) isFollowThis, 1 as isFollowMe, " +
     @Select("select foll.*, if(isnull(fans.id), 0, 1) isFollowThis, 1 as isFollowMe, " +
@@ -135,14 +197,14 @@ public interface LifeFansMapper extends BaseMapper<LifeFans> {
             "        join life_fans fans2 on fans1.followed_id = fans2.fans_id and fans1.fans_id = fans2.followed_id " +
             "        join life_fans fans2 on fans1.followed_id = fans2.fans_id and fans1.fans_id = fans2.followed_id " +
             "        where fans1.delete_flag = 0 and fans2.delete_flag = 0 and fans1.fans_id = #{fansId} " +
             "        where fans1.delete_flag = 0 and fans2.delete_flag = 0 and fans1.fans_id = #{fansId} " +
             "    ) " +
             "    ) " +
-            "    select info.id, info.store_name name, user.head_img image, concat('store_', user.phone) phoneId, info.store_blurb blurb, 1 blockedType,user.id blockedId " +
+            "    select info.id, info.store_name name, user.head_img image, concat('store_', user.phone) phoneId, info.store_blurb blurb, 1 blockedType,user.id blockedId ,IFNULL(user.nick_name, user.name) username, user.account_blurb accountBlurb " +
             "    from follow foll " +
             "    from follow foll " +
             "    join store_user user on foll.phone = user.phone " +
             "    join store_user user on foll.phone = user.phone " +
             "    join store_info info on info.id = user.store_id " +
             "    join store_info info on info.id = user.store_id " +
             "    left join store_img img on img.store_id = user.store_id and img.img_type = '10' and img.delete_flag = 0 " +
             "    left join store_img img on img.store_id = user.store_id and img.img_type = '10' and img.delete_flag = 0 " +
             "    where foll.flag = 'store' and user.delete_flag = 0 and info.delete_flag = 0 " +
             "    where foll.flag = 'store' and user.delete_flag = 0 and info.delete_flag = 0 " +
             "    union " +
             "    union " +
-            "    select user.id, user.user_name name, user.user_image image, concat('user_', user.user_phone) phoneId, user.jianjie blurb, 2 blockedType,user.id blockedId " +
+            "    select user.id, user.user_name name, user.user_image image, concat('user_', user.user_phone) phoneId, user.jianjie blurb, 2 blockedType,user.id blockedId,'' username, '' accountBlurb " +
             "    from follow foll " +
             "    from follow foll " +
             "    join life_user user on foll.phone = user.user_phone " +
             "    join life_user user on foll.phone = user.user_phone " +
             "    where foll.flag = 'user' and user.delete_flag = 0 " +
             "    where foll.flag = 'user' and user.delete_flag = 0 " +

+ 82 - 0
alien-entity/src/main/java/shop/alien/mapper/LifeGroupBuyMainMapper.java

@@ -1,5 +1,6 @@
 package shop.alien.mapper;
 package shop.alien.mapper;
 
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -7,10 +8,15 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+import org.apache.poi.ss.formula.functions.T;
 import shop.alien.entity.store.LifeGroupBuyMain;
 import shop.alien.entity.store.LifeGroupBuyMain;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import shop.alien.entity.store.vo.LifeGroupBuyMainVo;
 import shop.alien.entity.store.vo.LifeGroupBuyThaliVo;
 import shop.alien.entity.store.vo.LifeGroupBuyThaliVo;
 
 
+import java.util.List;
+
 /**
 /**
 * @author youch
 * @author youch
 * @description 针对表【life_group_buy_main(团购主表)】的数据库操作Mapper
 * @description 针对表【life_group_buy_main(团购主表)】的数据库操作Mapper
@@ -28,6 +34,82 @@ public interface LifeGroupBuyMainMapper extends BaseMapper<LifeGroupBuyMain> {
             "        coupon_id,delete_flag,created_time,updated_time,created_user_id,\n" +
             "        coupon_id,delete_flag,created_time,updated_time,created_user_id,\n" +
             "        updated_user_id from life_group_buy_main ${ew.customSqlSegment}")
             "        updated_user_id from life_group_buy_main ${ew.customSqlSegment}")
     IPage<LifeGroupBuyThaliVo> selectPageByThaliVo(IPage<LifeGroupBuyThaliVo> lifeGroupBuyThaliVoIPage,@Param(Constants.WRAPPER) QueryWrapper<LifeGroupBuyThaliVo> queryWrapper);
     IPage<LifeGroupBuyThaliVo> selectPageByThaliVo(IPage<LifeGroupBuyThaliVo> lifeGroupBuyThaliVoIPage,@Param(Constants.WRAPPER) QueryWrapper<LifeGroupBuyThaliVo> queryWrapper);
+
+
+    @Update("UPDATE life_group_buy_main\n" +
+            "SET \n" +
+            "  status = CASE \n" +
+            "    WHEN (inventory_num - #{buyCount}) = 0 THEN #{soldOutStatus}  \n" +
+            "    ELSE status \n" +
+            "  END,\n" +
+            "  inventory_num = inventory_num - #{buyCount}\n" +
+            "WHERE \n" +
+            "   id = #{couponId}\n" +
+            "\t AND inventory_num >= #{buyCount}"
+    )
+    int deductInventoryAtomically(
+            @Param("couponId") Integer couponId,
+            @Param("buyCount") int buyCount,
+            @Param("soldOutStatus") int soldOutStatus
+    );
+
+    @Select("SELECT\n" +
+            "    g.id AS id,\n" +
+            "    g.group_no AS group_no,\n" +
+            "    g.group_type AS group_type,\n" +
+            "    g.status AS status,\n" +
+            "    g.approval_comments AS approval_comments,\n" +
+            "    g.store_id AS store_id,\n" +
+            "    g.image_id AS image_id,\n" +
+            "    g.group_name AS group_name,\n" +
+            "    g.start_time_type AS start_time_type,\n" +
+            "    g.start_time_value AS start_time_value,\n" +
+            "    g.end_time AS end_time,\n" +
+            "    g.inventory_num AS inventory_num,\n" +
+            "    g.quota_type AS quota_type,\n" +
+            "    g.quota_value AS quota_value,\n" +
+            "    g.original_price AS original_price,\n" +
+            "    g.preferential_price AS preferential_price,\n" +
+            "    g.effective_date_type AS effective_date_type,\n" +
+            "    g.effective_date_value AS effective_date_value,\n" +
+            "    g.disable_date_type AS disable_date_type,\n" +
+            "    g.disable_date_value AS disable_date_value,\n" +
+            "    g.write_off AS write_off,\n" +
+            "    g.reservation_rules AS reservation_rules,\n" +
+            "    g.use_rules AS use_rules,\n" +
+            "    g.applicable_num AS applicable_num,\n" +
+            "    g.other_rules AS other_rules,\n" +
+            "    g.invoice_type AS invoice_type,\n" +
+            "    g.invoice_describe AS invoice_describe,\n" +
+            "    g.insured_flag AS insured_flag,\n" +
+            "    g.insured_price AS insured_price,\n" +
+            "    g.coupon_id AS coupon_id,\n" +
+            "    g.delete_flag AS delete_flag,\n" +
+            "    g.created_time AS created_time,\n" +
+            "    g.updated_time AS updated_time,\n" +
+            "    g.created_user_id AS created_user_id,\n" +
+            "    g.updated_user_id AS updated_user_id,\n" +
+            "    s.store_name AS store_name,\n" +
+            "    s.store_address AS store_address,\n" +
+            "    s.store_tel AS store_tel,\n" +
+            "    ROUND(s.score_avg) AS scoreAvg,\n" +
+            "    s.business_types_name AS businessName,\n" +
+            "    s.query_address AS address,\n" +
+            "    IFNULL(GROUP_CONCAT(img.img_url SEPARATOR ','), '') AS imagePaths\n" +
+            "FROM\n" +
+            "    life_group_buy_main g\n" +
+            "LEFT JOIN store_info s \n" +
+            "    ON g.store_id = s.id \n" +
+            "    AND s.delete_flag = 0 \n" +
+            "    AND g.status = 5 \n" +
+            "LEFT JOIN store_img img \n" +
+            "    ON FIND_IN_SET(img.id, g.image_id) > 0 \n" +
+            "    AND img.delete_flag = 0\t\t \n" +
+            "WHERE\n" +
+            "    g.delete_flag = 0\n" +
+            "GROUP BY\n" +
+            "    g.id")
+    List<LifeGroupBuyMainVo> getLifeGroupInfo(@Param(Constants.WRAPPER) LambdaQueryWrapper<LifeGroupBuyMainVo> queryWrapper);
 }
 }
 
 
 
 

+ 49 - 10
alien-entity/src/main/java/shop/alien/mapper/LifeUserDynamicsMapper.java

@@ -15,20 +15,28 @@ import java.util.List;
 public interface LifeUserDynamicsMapper extends BaseMapper<LifeUserDynamics> {
 public interface LifeUserDynamicsMapper extends BaseMapper<LifeUserDynamics> {
 
 
     @Select("select dyna1.* from (with dynamice as( " +
     @Select("select dyna1.* from (with dynamice as( " +
-            "    select id, top_status, top_time,  title, phone_id phoneId, context, image_path, address,address_name,address_context, liulan_count, dianzan_count, type, created_time, substring_index(phone_id, '_', 1) flag, substring_index(phone_id, '_', -1) phone, draft , address_province" +
-            "    from life_user_dynamics " +
-            "    where delete_flag = 0  and enable_status = 0 and draft = 0 order by created_time desc" +
-            ") " +
+            "select lud.id, lud.top_status, lud.top_time, lud.title, lud.phone_id phoneId, " +
+            "lud.context, lud.image_path, lud.address, lud.address_name, lud.address_context, " +
+            "lud.liulan_count, lud.dianzan_count, lud.type, lud.created_time, substring_index(lud.phone_id, '_', 1) flag, " +
+            "substring_index(lud.phone_id, '_', -1) phone, lud.draft , lud.address_province, lud.transfer_count " +
+            "from life_user_dynamics lud " +
+            "where lud.delete_flag = 0 and lud.enable_status = 0 and lud.draft = 0 and " +
+            "not exists (select 1 from life_user_violation luv where luv.delete_flag = 0 and luv.processing_status = 1 " +
+            "AND luv.dynamics_id = lud.id) order by lud.created_time desc) " +
             "select dynamice.*, info.store_name userName, user.head_img userImage, info.id storeUserId, user.id storeOrUserId, 0 isExpert " +
             "select dynamice.*, info.store_name userName, user.head_img userImage, info.id storeUserId, user.id storeOrUserId, 0 isExpert " +
             "from dynamice " +
             "from dynamice " +
             "join store_user user on dynamice.phone = user.phone and user.delete_flag = 0 " +
             "join store_user user on dynamice.phone = user.phone and user.delete_flag = 0 " +
+            "and user.status = 0 and user.logout_flag = 0 " +
             "join store_info info on info.id = user.store_id and info.delete_flag = 0 " +
             "join store_info info on info.id = user.store_id and info.delete_flag = 0 " +
+            "and info.store_status = 1 " +
             "left join store_img img on img.store_id = user.store_id and img.img_type = '10' and img.delete_flag = 0  " +
             "left join store_img img on img.store_id = user.store_id and img.img_type = '10' and img.delete_flag = 0  " +
             "where dynamice.flag = 'store' " +
             "where dynamice.flag = 'store' " +
             "union " +
             "union " +
-            "select dynamice.*, user.user_name userName, user.user_image userImage, user.id storeUserId, user.id storeOrUserId, IF(lue.expert_code IS NOT NULL , 1, 0) AS isExpert " +
+            "select dynamice.*, user.user_name userName, user.user_image userImage, user.id storeUserId, user.id storeOrUserId, " +
+            "IF(lue.expert_code IS NOT NULL , 1, 0) AS isExpert " +
             "from dynamice " +
             "from dynamice " +
             "join life_user user on dynamice.phone = user.user_phone and user.delete_flag = 0 " +
             "join life_user user on dynamice.phone = user.user_phone and user.delete_flag = 0 " +
+            "and user.logout_flag = 0 " +
             "left join life_user_expert  lue on lue.user_id = user.id and lue.delete_flag = 0 " +
             "left join life_user_expert  lue on lue.user_id = user.id and lue.delete_flag = 0 " +
             "where dynamice.flag = 'user') dyna1 order by dyna1.top_status desc, dyna1.top_time desc, created_time desc")
             "where dynamice.flag = 'user') dyna1 order by dyna1.top_status desc, dyna1.top_time desc, created_time desc")
     List<LifeUserDynamicsVo> getLifeUserDynamicsList();
     List<LifeUserDynamicsVo> getLifeUserDynamicsList();
@@ -43,15 +51,46 @@ public interface LifeUserDynamicsMapper extends BaseMapper<LifeUserDynamics> {
             "${ew.customSqlSegment}")
             "${ew.customSqlSegment}")
     List<LifeUserDynamicsVo> getStoreDynamicslist(@Param("userId") String userId, @Param(Constants.WRAPPER) QueryWrapper<LifeUserDynamics> dynamicsWrapper);
     List<LifeUserDynamicsVo> getStoreDynamicslist(@Param("userId") String userId, @Param(Constants.WRAPPER) QueryWrapper<LifeUserDynamics> dynamicsWrapper);
 
 
-    @Select("select lud.*,'1' isLike\n" +
-            "from life_user_dynamics lud \n" +
-            "where lud.delete_flag = 0 \n" +
-            "and lud.id in (select llr.huifu_id from life_like_record llr where llr.dianzan_id = #{phoneId} and llr.delete_flag = 0) \n"+
-            "and lud.phone_id not in (select lb.blocked_phone_id  from life_blacklist lb where lb.blocker_phone_id = #{phoneId} and lb.delete_flag = 0)")
+    @Select("with middle_lud as (\n" +
+            "  select distinct  \n" +
+            "    lud.*,\n" +
+            "    '1' as isLike  \n" +
+            "  from life_user_dynamics lud\n" +
+            "  inner join (\n" +
+            "    select distinct huifu_id  \n" +
+            "    from life_like_record llr\n" +
+            "    where llr.dianzan_id = #{phoneId}\n" +
+            "      and llr.delete_flag = 0\n" +
+            "  ) llr_sub on lud.id = llr_sub.huifu_id\n" +
+            "  where lud.delete_flag = 0\n" +
+            "    and not exists (  -- 替代NOT IN,避免NULL问题\n" +
+            "      select 1 from life_blacklist lb\n" +
+            "      where lb.blocker_phone_id = #{phoneId}\n" +
+            "        and lb.delete_flag = 0\n" +
+            "        and lb.blocked_phone_id = lud.phone_id\n" +
+            "    )\n" +
+            ")\n" +
+            "select middle_lud.*,\n" +
+            "  CASE \n" +
+            "    WHEN lf.id is not null THEN 1\n" +
+            "    ELSE 0                        \n" +
+            "  END AS isFollowThis,  \n" +
+            "  CASE \n" +
+            "    WHEN lf1.id is not null THEN 1\n" +
+            "    ELSE 0                        \n" +
+            "  END AS isFollowMe  \n" +
+            "from middle_lud\n" +
+            "left join life_fans lf on lf.fans_id = #{phoneId} \n" +
+            "                      and lf.followed_id = middle_lud.phone_id\n" +
+            "                      and lf.delete_flag = '0'" +
+            "left join life_fans lf1 on lf1.fans_id = middle_lud.phone_id \n" +
+            "                      and lf1.followed_id = #{phoneId}\n" +
+            "                      and lf1.delete_flag = '0'")
     List<LifeUserDynamicsVo> selectDianZanList(String phoneId);
     List<LifeUserDynamicsVo> selectDianZanList(String phoneId);
 
 
     List<LifeUserDynamicsVo> getDynamicsList(@Param("nickName") String nickName, @Param("userType") String userType, @Param("dynamicsType") Integer dynamicsType, @Param("releaseStartTime") String releaseStartTime, @Param("releaseEndTime") String releaseEndTime);
     List<LifeUserDynamicsVo> getDynamicsList(@Param("nickName") String nickName, @Param("userType") String userType, @Param("dynamicsType") Integer dynamicsType, @Param("releaseStartTime") String releaseStartTime, @Param("releaseEndTime") String releaseEndTime);
 
 
     List<LifeUserDynamicsVo> getDynamicsDetail(@Param("id") Integer id);
     List<LifeUserDynamicsVo> getDynamicsDetail(@Param("id") Integer id);
 
 
+    List<LifeUserDynamicsVo> getStoreDynamicslist(@Param("userId") String userId, @Param("phoneId") String phoneId);
 }
 }

+ 17 - 15
alien-entity/src/main/java/shop/alien/mapper/LifeUserMapper.java

@@ -32,23 +32,15 @@ public interface LifeUserMapper extends BaseMapper<LifeUser> {
             "where delete_flag = 0 and substring_index(#{phoneId}, '_', 1) = 'user' and substring_index(#{phoneId}, '_', -1) = user_phone")
             "where delete_flag = 0 and substring_index(#{phoneId}, '_', 1) = 'user' and substring_index(#{phoneId}, '_', -1) = user_phone")
     LifeFansVo getUserInfoByPhoneId(@Param("phoneId") String phoneId);
     LifeFansVo getUserInfoByPhoneId(@Param("phoneId") String phoneId);
 
 
-
     LifeFansVo getUserInfoByPhoneIdList(@Param("phoneId") String phoneId);
     LifeFansVo getUserInfoByPhoneIdList(@Param("phoneId") String phoneId);
 
 
-
-    @Select("select * from ( " +
-            "    select store.id, concat('store_', user.phone) phoneId, img.img_url imgUrl, store_blurb blurb, store.store_name storeUserName " +
-            "    from store_info store " +
-            "    join store_user user on user.store_id = store.id " +
-            "    left join store_img img on img.store_id = store.id and img.img_type = '10' and img.delete_flag = 0 " +
-            "    where store.delete_flag = 0 " +
-            "    and user.delete_flag = 0 " +
-            "    union all " +
-            "    select id, concat('user_', user_phone) phoneId, user_image imgUrl, jianjie blurb, user_name name " +
-            "    from life_user " +
-            "    where delete_flag = 0 " +
-            ") a " +
-            "${ew.customSqlSegment}")
+    @Select("SELECT * FROM ( " +
+            " SELECT store.id, concat( 'store_', USER.phone ) phoneId, USER.head_img imgUrl, store_blurb blurb, " +
+            " if(store.id is null,USER.name ,store.store_name) storeUserName " +
+            " FROM store_user USER LEFT JOIN store_info store ON USER.store_id = store.id  and USER.delete_flag = 0 and  store.delete_flag = 0  " +
+            " UNION ALL SELECT id, concat( 'user_', user_phone ) phoneId, user_image imgUrl, jianjie blurb, user_name NAME " +
+            " FROM life_user WHERE delete_flag = 0 ) a " +
+            " ${ew.customSqlSegment}")
     IPage<LifeUserVo> getStoreAndUserByName(IPage<LifeUserVo> iPage, @Param(Constants.WRAPPER) QueryWrapper<LifeUserVo> wrapper);
     IPage<LifeUserVo> getStoreAndUserByName(IPage<LifeUserVo> iPage, @Param(Constants.WRAPPER) QueryWrapper<LifeUserVo> wrapper);
 
 
     LifeUserVo getRemoveUser(@Param("id") String id);
     LifeUserVo getRemoveUser(@Param("id") String id);
@@ -62,4 +54,14 @@ public interface LifeUserMapper extends BaseMapper<LifeUser> {
     @Select("SELECT * " +
     @Select("SELECT * " +
             "FROM life_user ${ew.customSqlSegment}")
             "FROM life_user ${ew.customSqlSegment}")
     List<LifeUserVo> getUserByIds(@Param(Constants.WRAPPER) QueryWrapper<LifeUserVo> queryWrapper);
     List<LifeUserVo> getUserByIds(@Param(Constants.WRAPPER) QueryWrapper<LifeUserVo> queryWrapper);
+
+    /**
+     * 根据id集合查询用户信息
+     *
+     * @param queryWrapper 查询条件
+     * @return 用户信息
+     */
+    @Select("SELECT * " +
+            "FROM life_user ${ew.customSqlSegment}")
+    LifeUserVo getUserById(@Param(Constants.WRAPPER) QueryWrapper<LifeUserVo> queryWrapper);
 }
 }

+ 45 - 8
alien-entity/src/main/java/shop/alien/mapper/LifeUserOrderMapper.java

@@ -1,7 +1,6 @@
 package shop.alien.mapper;
 package shop.alien.mapper;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Constants;
 import com.baomidou.mybatisplus.core.toolkit.Constants;
@@ -36,13 +35,14 @@ public interface LifeUserOrderMapper extends BaseMapper<LifeUserOrder> {
     @Select("with total_coupon as(\n" +
     @Select("with total_coupon as(\n" +
             "-- 团购\n" +
             "-- 团购\n" +
             "\tselect id coupon_id,2 coupon_type,lgbm.group_name coupon_name, SUBSTRING_INDEX(image_id, ',', 1) AS image_id,effective_date_type,effective_date_value \n" +
             "\tselect id coupon_id,2 coupon_type,lgbm.group_name coupon_name, SUBSTRING_INDEX(image_id, ',', 1) AS image_id,effective_date_type,effective_date_value \n" +
-            "from life_group_buy_main lgbm where lgbm.delete_flag = 0\n" +
+            "from life_group_buy_main lgbm \n" +
             "\tunion all\n" +
             "\tunion all\n" +
             "-- 代金券\n" +
             "-- 代金券\n" +
-            "\tselect id coupon_id,1 coupon_type,lc.name coupon_name, SUBSTRING_INDEX(image_path, ',', 1) AS image_id,0 effective_date_type,expiration_date effective_date_value \n" +
-            "from life_coupon lc where lc.delete_flag = 0\n" +
+            "\tselect id coupon_id,1 coupon_type,lc.name coupon_name, SUBSTRING_INDEX(image_path, ',', 1) AS image_id,\n" +
+            "case when expiration_type = 1 then 0 else 1 end effective_date_type,case when expiration_type = 1 then expiration_date else validity_period end  effective_date_value \n" +
+            "from life_coupon lc \n" +
             ")\n" +
             ")\n" +
-            "select luo.id,luo.buy_time,luo.status,luo.price,luo.final_price,luo.user_id,luo.store_id,luo.order_no,luo.pay_time,luo.cancel_time,luo.finish_time,luo.order_str,\n" +
+            "select luo.id,luo.buy_time,luo.status,luo.price,luo.final_price,luo.user_id,luo.store_id,luo.order_no,luo.pay_time,luo.cancel_time,luo.finish_time,luo.order_str,luo.expert_order_id,luo.order_appraise,\n" +
             "si.store_name,si.commission_rate,si.business_section store_type,si.store_status,si.business_status,\n" +
             "si.store_name,si.commission_rate,si.business_section store_type,si.store_status,si.business_status,\n" +
             "count(ocm.coupon_code) coupon_count,\n" +
             "count(ocm.coupon_code) coupon_count,\n" +
             "simg.img_url,\n" +
             "simg.img_url,\n" +
@@ -57,8 +57,8 @@ public interface LifeUserOrderMapper extends BaseMapper<LifeUserOrder> {
             "from life_user_order luo\n" +
             "from life_user_order luo\n" +
             "left join store_info si on si.id = luo.store_id  -- 查询店铺相关 \n" +
             "left join store_info si on si.id = luo.store_id  -- 查询店铺相关 \n" +
             "left join life_user lu on lu.id = luo.user_id and lu.delete_flag = 0 -- 查询用户相关 \n" +
             "left join life_user lu on lu.id = luo.user_id and lu.delete_flag = 0 -- 查询用户相关 \n" +
-            "left join order_coupon_middle ocm on ocm.order_id = luo.id and ocm.delete_flag = 0\n" +
-            "inner join total_coupon tc on tc.coupon_id = ocm.coupon_id and tc.coupon_type = luo.coupon_type\n" +
+            "left join order_coupon_middle ocm on ocm.order_id = luo.id \n" +
+            "left join total_coupon tc on tc.coupon_id = ocm.coupon_id and tc.coupon_type = luo.coupon_type\n" +
             "left join  store_img simg on simg.id = tc.image_id and simg.delete_flag = 0 \n" +
             "left join  store_img simg on simg.id = tc.image_id and simg.delete_flag = 0 \n" +
             "left join  store_comment sc on sc.business_id = luo.id and sc.delete_flag = 0 and sc.business_type = 5\n" +
             "left join  store_comment sc on sc.business_id = luo.id and sc.delete_flag = 0 and sc.business_type = 5\n" +
             "left join life_discount_coupon_user ldcu on ldcu .id = luo.quan_id \n" +
             "left join life_discount_coupon_user ldcu on ldcu .id = luo.quan_id \n" +
@@ -71,5 +71,42 @@ public interface LifeUserOrderMapper extends BaseMapper<LifeUserOrder> {
      * @param selectWrapper
      * @param selectWrapper
      * @return
      * @return
      */
      */
-    List<LifeUserOrderVo> selectRefundList(LambdaUpdateWrapper<LifeUserOrder> selectWrapper);
+    List<LifeUserOrderVo> selectRefundList(@Param(Constants.WRAPPER) QueryWrapper<LifeUserOrder> selectWrapper);
+
+    @Select("SELECT count( luo.id ) FROM life_user_order luo LEFT JOIN order_coupon_middle ocm ON luo.id = ocm.order_id WHERE luo.`status` IN ( 0, 1, 2, 7 ) AND luo.delete_flag = 0 AND luo.coupon_type = 2 AND ocm.coupon_id = #{groupId}")
+    Integer countBuyGroup(@Param("groupId") String groupId);
+
+    @Select("with total_coupon as(\n" +
+            "-- 团购\n" +
+            "\tselect id coupon_id,2 coupon_type,lgbm.group_name coupon_name, SUBSTRING_INDEX(image_id, ',', 1) AS image_id,effective_date_type,effective_date_value \n" +
+            "from life_group_buy_main lgbm \n" +
+            "\tunion all\n" +
+            "-- 代金券\n" +
+            "\tselect id coupon_id,1 coupon_type,lc.name coupon_name, SUBSTRING_INDEX(image_path, ',', 1) AS image_id,\n" +
+            "case when expiration_type = 1 then 0 else 1 end effective_date_type,case when expiration_type = 1 then expiration_date else validity_period end  effective_date_value \n" +
+            "from life_coupon lc \n" +
+            ")\n" +
+            "select luo.id,luo.buy_time,luo.status,luo.price,luo.final_price,luo.user_id,luo.store_id,luo.order_no,luo.pay_time,luo.cancel_time,luo.finish_time,luo.order_str,luo.expert_order_id,luo.order_appraise,\n" +
+            "si.store_name,si.commission_rate,si.business_section store_type,si.store_status,si.business_status,\n" +
+            "count(ocm.coupon_code) coupon_count,\n" +
+            "simg.img_url,\n" +
+            "lu.user_phone,\n" +
+            "IF(sc.id is null,false,true) as hasComment,\n" +
+            "tc.*,\n" +
+            "CASE\n" +
+            "        WHEN si.delete_flag = 1 OR si.logout_flag = 1 THEN 1\n" +
+            "        ELSE 0\n" +
+            "    END AS abnormalStateFlag,\n" +
+            "ldc.nominal_value,ldc.type\n" +
+            "from life_user_order luo\n" +
+            "left join store_info si on si.id = luo.store_id  -- 查询店铺相关 \n" +
+            "left join life_user lu on lu.id = luo.user_id and lu.delete_flag = 0 -- 查询用户相关 \n" +
+            "left join order_coupon_middle ocm on ocm.order_id = luo.id \n" +
+            "left join total_coupon tc on tc.coupon_id = ocm.coupon_id and tc.coupon_type = luo.coupon_type\n" +
+            "left join  store_img simg on simg.id = tc.image_id and simg.delete_flag = 0 \n" +
+            "left join  store_comment sc on sc.business_id = luo.id and sc.delete_flag = 0 and sc.business_type = 5\n" +
+            "left join life_discount_coupon_user ldcu on ldcu .id = luo.quan_id \n" +
+            "left join life_discount_coupon ldc on ldc.id = ldcu.coupon_id \n" +
+            "${ew.customSqlSegment}")
+    IPage<LifeUserOrderVo> queryPlatformOrderList(IPage<LifeUserOrderVo> brandedPage,@Param(Constants.WRAPPER) QueryWrapper<LifeUserOrderVo> lifeUserOrderQueryWrapper);
 }
 }

+ 100 - 0
alien-entity/src/main/java/shop/alien/mapper/LifeUserViolationMapper.java

@@ -1,7 +1,16 @@
 package shop.alien.mapper;
 package shop.alien.mapper;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import shop.alien.entity.store.LifeUserViolation;
 import shop.alien.entity.store.LifeUserViolation;
+import shop.alien.entity.store.dto.LifeUserViolationDto;
+import shop.alien.entity.store.vo.LifeUserViolationVo;
+
+import java.util.List;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -13,4 +22,95 @@ import shop.alien.entity.store.LifeUserViolation;
  */
  */
 public interface LifeUserViolationMapper extends BaseMapper<LifeUserViolation> {
 public interface LifeUserViolationMapper extends BaseMapper<LifeUserViolation> {
 
 
+    /**
+     * 分页查询用户举报信息
+     *
+     * @param page         分页对象
+     * @param queryWrapper 查询条件包装器
+     * @return 分页结果
+     */
+    @Select("<script>" +
+            " WITH userInfo AS ( " +
+            " SELECT " +
+            " su.phone, " +
+            " su.id, " +
+            " CASE su.delete_flag " +
+            " WHEN 1 THEN CONCAT(su.nick_name, '(账号已注销)') " +
+            " ELSE su.nick_name " +
+            " END AS nick_name, " +
+            " '1' AS type " +
+            " FROM store_user su " +
+            " UNION ALL " +
+            " SELECT " +
+            " lu.user_phone AS phone, " +
+            " lu.id, " +
+            " CASE lu.delete_flag " +
+            " WHEN 1 THEN CONCAT(lu.user_name, '(账号已注销)') " +
+            " ELSE lu.user_name " +
+            " END AS nick_name, " +
+            " '2' AS type " +
+            " FROM life_user lu " +
+            " ) " +
+            " SELECT " +
+            " luv.*, " +
+            " ui.nick_name AS nickname, " +
+            " ui.phone, " +
+            " img.img_url image" +
+            " FROM life_user_violation luv " +
+            " LEFT JOIN userInfo ui ON ui.type = luv.reporting_user_type " +
+            " AND ui.id = luv.reporting_user_id " +
+            " left join store_img img on luv.id = img.store_id and img.delete_flag = 0 " +
+            " ${ew.customSqlSegment}" +
+            "</script>")
+    IPage<LifeUserViolationVo> getViolationPage(
+            IPage<LifeUserViolationVo> page,
+            @Param(Constants.WRAPPER) QueryWrapper<LifeUserViolationVo> queryWrapper
+    );
+
+    @Select("select luv.*, img.img_url image " +
+            "FROM life_user_violation luv " +
+            "left join store_img img on luv.id = img.store_id and img.delete_flag = 0 " +
+            "${ew.customSqlSegment}")
+    LifeUserViolationDto getDetailById(@Param(Constants.WRAPPER) QueryWrapper<LifeUserViolationDto> queryWrapper);
+
+    /**
+     * 查询用户举报信息列表
+     *
+     * @param queryWrapper 查询条件包装器
+     * @return 举报信息列表
+     */
+    @Select("<script>" +
+            "WITH userInfo AS (" +
+            "    SELECT " +
+            "        su.phone, " +
+            "        su.id, " +
+            "        CASE su.delete_flag " +
+            "            WHEN 1 THEN CONCAT(su.nick_name, '(账号已注销)') " +
+            "            ELSE su.nick_name " +
+            "        END AS nick_name, " +
+            "        '1' AS type " +
+            "    FROM store_user su " +
+            "    UNION ALL " +
+            "    SELECT " +
+            "        lu.user_phone AS phone, " +
+            "        lu.id, " +
+            "        CASE lu.delete_flag " +
+            "            WHEN 1 THEN CONCAT(lu.user_name, '(账号已注销)') " +
+            "            ELSE lu.user_name " +
+            "        END AS nick_name, " +
+            "        '2' AS type " +
+            "    FROM life_user lu " +
+            ") " +
+            "SELECT " +
+            "    luv.*, " +
+            "    ui.nick_name AS nickname, " +
+            "    ui.phone " +
+            "FROM life_user_violation luv " +
+            "LEFT JOIN userInfo ui ON ui.type = luv.reporting_user_type " +
+            "    AND ui.id = luv.reporting_user_id " +
+            "    ${ew.customSqlSegment}" +
+            "</script>")
+    List<LifeUserViolationVo> getViolationList(
+            @Param(Constants.WRAPPER) QueryWrapper<LifeUserViolationVo> queryWrapper
+    );
 }
 }

+ 15 - 0
alien-entity/src/main/java/shop/alien/mapper/StoreAliPayErrorLogMapper.java

@@ -0,0 +1,15 @@
+package shop.alien.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import shop.alien.entity.store.StoreAliPayErrorLog;
+
+/**
+ * <p>
+ * 支付宝转账错误记录表 Mapper 接口
+ * </p>
+ *
+ * @author qxy
+ * @since 2025-10-27
+ */
+public interface StoreAliPayErrorLogMapper extends BaseMapper<StoreAliPayErrorLog> {
+}

+ 13 - 0
alien-entity/src/main/java/shop/alien/mapper/StoreCashOutRecordMapper.java

@@ -1,14 +1,27 @@
 package shop.alien.mapper;
 package shop.alien.mapper;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 import shop.alien.entity.store.StoreCashOutRecord;
 import shop.alien.entity.store.StoreCashOutRecord;
 
 
+import java.util.List;
+
 /**
 /**
  * 商户提现记录表 Mapper 接口
  * 商户提现记录表 Mapper 接口
  *
  *
  * @author ssk
  * @author ssk
  * @since 2025-02-25
  * @since 2025-02-25
  */
  */
+@Mapper
 public interface StoreCashOutRecordMapper extends BaseMapper<StoreCashOutRecord> {
 public interface StoreCashOutRecordMapper extends BaseMapper<StoreCashOutRecord> {
 
 
+    @Select("select scor.*, If(su.alipay_account is not null,su.alipay_account,su.phone) settlementAccount\n" +
+            "from store_cash_out_record scor\n" +
+            "left join store_user su on su.store_id = scor.store_id and su.delete_flag = 0\n" +
+            "${ew.customSqlSegment}")
+    List<StoreCashOutRecord> selectCashoutRecordList(@Param(Constants.WRAPPER) QueryWrapper<StoreCashOutRecord> wrapper);
 }
 }

+ 1 - 1
alien-entity/src/main/java/shop/alien/mapper/StoreCommentAppealMapper.java

@@ -26,7 +26,7 @@ public interface StoreCommentAppealMapper extends BaseMapper<StoreCommentAppeal>
      * @param queryWrapper 查询条件
      * @param queryWrapper 查询条件
      * @return IPage<StoreCommentAppealVo>
      * @return IPage<StoreCommentAppealVo>
      */
      */
-    @Select("select a.*, b.dict_detail appeal_status_str, c.comment_content, c.comment_star, c.score score, c.other_score,c.is_anonymous, d.user_name, d.user_image, e.store_name, f.phone store_phone, f.name store_contact, e.store_type " +
+    @Select("select a.*, b.dict_detail appeal_status_str, c.comment_content, c.comment_star, c.score score, c.other_score,c.is_anonymous,c.img_id commentImgId, d.user_name, d.user_image, e.store_name, f.phone store_phone, f.name store_contact, e.store_type " +
             "from store_comment_appeal a " +
             "from store_comment_appeal a " +
             "left join store_dictionary b on a.appeal_status = b.dict_id and b.type_name = 'appealStatus' and b.delete_flag = 0 " +
             "left join store_dictionary b on a.appeal_status = b.dict_id and b.type_name = 'appealStatus' and b.delete_flag = 0 " +
             "left join store_comment c on a.comment_id = c.id " +
             "left join store_comment c on a.comment_id = c.id " +

+ 40 - 4
alien-entity/src/main/java/shop/alien/mapper/StoreCommentMapper.java

@@ -129,19 +129,55 @@ public interface StoreCommentMapper extends BaseMapper<StoreComment> {
             "AND store_id = #{storeId}")
             "AND store_id = #{storeId}")
     StoreInfoScoreVo getCommentCountAndScoreInfo(@Param("storeId") Integer storeId);
     StoreInfoScoreVo getCommentCountAndScoreInfo(@Param("storeId") Integer storeId);
 
 
-
+/*
+    with total_coupon as (
+select lgbm.id,lgbm.group_type,lgbm.group_name,lgbm.image_id,2 coupon_type
+from life_group_buy_main lgbm
+union all
+select lc.id,0 group_type,lc.name group_name,0 image_id,1 coupon_type
+from life_coupon lc
+)
+SELECT
+	luo.*,
+	tc.group_type groupBuyType,
+	tc.group_name groupBuyName,
+	tc.image_id groupBuyImgId,
+	store.business_section storeType
+FROM
+	life_user_order luo
+LEFT JOIN order_coupon_middle ocm ON
+	luo.id = ocm.order_id
+LEFT JOIN total_coupon tc ON
+	ocm.coupon_id = tc.id
+	and tc.coupon_type = luo.coupon_type
+LEFT JOIN store_info store on
+	luo.store_id = store.id
+WHERE
+	luo.`status` in (2, 7)
+	AND luo.delete_flag = 0
+	AND luo.user_id = 142
+	AND luo.id NOT IN (
+	SELECT
+		business_id
+	FROM
+		store_comment
+	WHERE
+		business_type = 5
+		AND user_id = 142
+		AND delete_flag = 0)
+ */
     @Select("SELECT " +
     @Select("SELECT " +
-            "luo.*,lgbm.group_type groupBuyType,lgbm.group_name groupBuyName,lgbm.image_id groupBuyImgId,store.business_section storeType " +
+            "luo.*,lgbm.group_type groupBuyType,lgbm.group_name groupBuyName,lgbm.image_id groupBuyImgId,store.business_section storeType, store.business_types_name businessTypesName, store.store_name storeName " +
             "FROM life_user_order luo LEFT JOIN order_coupon_middle ocm ON luo.id = ocm.order_id LEFT JOIN life_group_buy_main lgbm ON ocm.coupon_id = lgbm.id LEFT JOIN store_info store on luo.store_id = store.id " +
             "FROM life_user_order luo LEFT JOIN order_coupon_middle ocm ON luo.id = ocm.order_id LEFT JOIN life_group_buy_main lgbm ON ocm.coupon_id = lgbm.id LEFT JOIN store_info store on luo.store_id = store.id " +
             "WHERE luo.`status` in (2,7) " +
             "WHERE luo.`status` in (2,7) " +
             "AND luo.coupon_type = 2 " +
             "AND luo.coupon_type = 2 " +
             "AND luo.delete_flag = 0 " +
             "AND luo.delete_flag = 0 " +
             "AND luo.user_id = #{userId} " +
             "AND luo.user_id = #{userId} " +
-            "AND luo.id NOT IN (SELECT business_id FROM store_comment WHERE business_type = 5 AND user_id = #{userId} AND delete_flag = 0)")
+            "AND luo.id NOT IN (SELECT business_id FROM store_comment WHERE business_type = 5 AND user_id = #{userId})")
     IPage<LifeUserOrderCommentVo> getCommentOrderWPJPage(IPage<LifeUserOrderCommentVo> page, @Param("userId") String userId);
     IPage<LifeUserOrderCommentVo> getCommentOrderWPJPage(IPage<LifeUserOrderCommentVo> page, @Param("userId") String userId);
 
 
     @Select("SELECT " +
     @Select("SELECT " +
-            "luo.*,lgbm.group_type groupBuyType,lgbm.group_name groupBuyName,lgbm.image_id groupBuyImgId,store.business_section storeType " +
+            "luo.*,lgbm.group_type groupBuyType,lgbm.group_name groupBuyName,lgbm.image_id groupBuyImgId,store.business_section storeType, store.business_types_name businessTypesName, store.store_name storeName " +
             "FROM life_user_order luo LEFT JOIN order_coupon_middle ocm ON luo.id = ocm.order_id LEFT JOIN life_group_buy_main lgbm ON ocm.coupon_id = lgbm.id LEFT JOIN store_info store on luo.store_id = store.id " +
             "FROM life_user_order luo LEFT JOIN order_coupon_middle ocm ON luo.id = ocm.order_id LEFT JOIN life_group_buy_main lgbm ON ocm.coupon_id = lgbm.id LEFT JOIN store_info store on luo.store_id = store.id " +
             "WHERE luo.`status` in (2,7) " +
             "WHERE luo.`status` in (2,7) " +
             "AND luo.coupon_type = 2 " +
             "AND luo.coupon_type = 2 " +

+ 40 - 0
alien-entity/src/main/java/shop/alien/mapper/StoreCommentSummaryInterestMapper.java

@@ -0,0 +1,40 @@
+package shop.alien.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Mapper;
+import shop.alien.entity.store.StoreCommentSummaryInterest;
+
+import java.util.List;
+
+/**
+ * qxy
+ * AI 服务 店铺趣味信息
+ */
+@Mapper
+public interface StoreCommentSummaryInterestMapper extends BaseMapper<StoreCommentSummaryInterest> {
+    @Insert({
+            "<script>", // 开启动态 SQL 脚本
+            "INSERT INTO store_comment_summary_interest (",
+            "  id, store_id, store_name, summary, task_id, delete_flag, created_time, created_user_id,",
+            "  updated_time, updated_user_id",
+            ")",
+            "VALUES",
+            "<foreach collection='list' item='item' separator=','>",
+            "(",
+            "  #{item.id},",
+            "  #{item.storeId},",
+            "  #{item.storeName},",
+            "  #{item.summary},",
+            "  #{item.taskId},",
+            "  #{item.deleteFlag},",
+            "  #{item.createdTime},",
+            "  #{item.createdUserId},",
+            "  #{item.updatedTime},",
+            "  #{item.updatedUserId}",
+            ")",
+            "</foreach>",
+            "</script>" // 关闭动态 SQL 脚本
+    })
+    int insertBatchStoreCommentSummaryInterest(List<StoreCommentSummaryInterest> storeCommentSummaryInterests);
+}

+ 1 - 1
alien-entity/src/main/java/shop/alien/mapper/StoreIncomeDetailsRecordMapper.java

@@ -43,7 +43,7 @@ public interface StoreIncomeDetailsRecordMapper extends BaseMapper<StoreIncomeDe
             "SELECT\n" +
             "SELECT\n" +
             "\tsidr.id,sidr.updated_time,sidr.created_user_id,sidr.created_time,sidr.income_type,sidr.business_id,sidr.cash_out_id,sidr.store_id,sidr.user_order_id,sidr.delete_flag,sidr.money,sidr.commission,sidr.updated_user_id,\n" +
             "\tsidr.id,sidr.updated_time,sidr.created_user_id,sidr.created_time,sidr.income_type,sidr.business_id,sidr.cash_out_id,sidr.store_id,sidr.user_order_id,sidr.delete_flag,sidr.money,sidr.commission,sidr.updated_user_id,\n" +
             "\tluo.buy_time orderTime,\n" +
             "\tluo.buy_time orderTime,\n" +
-            "\tocm.created_time checkTime,\n" +
+            "\tsidr.created_time checkTime,\n" +
             "\tADDDATE(sidr.created_time, 4) incomeTime,\n" +
             "\tADDDATE(sidr.created_time, 4) incomeTime,\n" +
             "\ttc.name couponName\n" +
             "\ttc.name couponName\n" +
             "FROM\n" +
             "FROM\n" +

+ 20 - 0
alien-entity/src/main/java/shop/alien/mapper/StoreInfoMapper.java

@@ -53,6 +53,19 @@ public interface StoreInfoMapper extends BaseMapper<StoreInfo> {
             " ${ew.customSqlSegment}")
             " ${ew.customSqlSegment}")
     List<StoreInfoVo> getStoreInfoVoList(@Param(Constants.WRAPPER) QueryWrapper<StoreInfoVo> queryWrapper);
     List<StoreInfoVo> getStoreInfoVoList(@Param(Constants.WRAPPER) QueryWrapper<StoreInfoVo> queryWrapper);
 
 
+    @Select("with menu as (select store_id,GROUP_CONCAT(dish_name) dish_name from store_menu GROUP BY store_id) " +
+            "select a.*, b.name store_contact, b.phone store_phone, b.password, c.dish_name, a.store_type, img.img_url entranceImage, d.img_url, dict.dict_detail storeTypeStr, dict2.dict_detail businessStatusStr," +
+            "            ROUND(ST_Distance_Sphere(ST_GeomFromText(CONCAT('POINT(', REPLACE(#{position}, ',', ' '), ')' )), ST_GeomFromText(CONCAT('POINT(', REPLACE(a.store_position, ',', ' '), ')' ))) / 1000, 2) dist " +
+            "from store_info a " +
+            "left join store_user b on a.id = b.store_id  AND b.delete_flag = 0 " +
+            "left join menu c on a.id = c.store_id " +
+            "left join store_img img on img.store_id = a.id and img.img_type = 1 and img.delete_flag = 0 " +
+            "left join store_dictionary dict on dict.type_name = 'storeType' and dict.dict_id = a.store_type and dict.delete_flag = 0 " +
+            "left join store_dictionary dict2 on dict2.type_name = 'businessStatus' and a.business_status = dict2.dict_id and dict2.delete_flag = 0 " +
+            "left join store_img d on d.store_id = a.id and d.img_type = 10 and d.delete_flag = 0" +
+            " ${ew.customSqlSegment}")
+    List<StoreInfoVo> getStoreInfoVoListNew(@Param(Constants.WRAPPER) QueryWrapper<StoreInfoVo> queryWrapper,  @Param("position") String position);
+
     /**
     /**
      * web端-门店列表
      * web端-门店列表
      *
      *
@@ -110,4 +123,11 @@ public interface StoreInfoMapper extends BaseMapper<StoreInfo> {
     @Select("SELECT a.* FROM store_info a " +
     @Select("SELECT a.* FROM store_info a " +
             "left join store_user b on a.id =b.store_id  where b.phone = #{phoneIdNew} limit 1")
             "left join store_user b on a.id =b.store_id  where b.phone = #{phoneIdNew} limit 1")
     StoreMainInfoVo getStoreNameByPhone(String phoneIdNew);
     StoreMainInfoVo getStoreNameByPhone(String phoneIdNew);
+
+    @Select(
+            "select " +
+            "            ROUND(ST_Distance_Sphere(ST_GeomFromText(CONCAT('POINT(', REPLACE(#{position}, ',', ' '), ')' )), ST_GeomFromText(CONCAT('POINT(', REPLACE(store_position, ',', ' '), ')' ))) / 1000, 1) dist " +
+            "from store_info where id = #{storeId}"
+            )
+    Double getStoreDistance(@Param("position") String position,@Param("storeId") Integer storeId);
 }
 }

+ 27 - 0
alien-entity/src/main/java/shop/alien/mapper/second/LifeUserLogMapper.java

@@ -0,0 +1,27 @@
+package shop.alien.mapper.second;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import shop.alien.entity.second.LifeUserLog;
+
+import java.util.List;
+
+@Mapper
+public interface LifeUserLogMapper extends BaseMapper<LifeUserLog> {
+
+    /**
+     * 查询时间段内同一个macip地址的登录记录
+     *
+     * @param starDate 开始日期
+     * @param endDate 结束日期
+     * @return 同一个macip地址的登录记录
+     */
+    @Select(" SELECT user_id, user_name, mac_ip FROM life_user_log " +
+            " WHERE created_time BETWEEN DATE_FORMAT(#{starDate}, '%Y-%m-%d %H:%i:%s') " +
+            " AND DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%s') AND mac_ip = #{macIp} " +
+            " GROUP BY user_id, user_name, mac_ip ")
+    List<LifeUserLog> getLifeUserLogByDate(@Param("starDate") String starDate, @Param("endDate") String endDate, @Param("macIp") String macIp);
+
+}

+ 17 - 0
alien-entity/src/main/java/shop/alien/mapper/second/SecondGoodsMapper.java

@@ -74,6 +74,23 @@ public interface SecondGoodsMapper extends BaseMapper<SecondGoods> {
     List<SecondGoods> getCollectTop10();
     List<SecondGoods> getCollectTop10();
 
 
     /**
     /**
+     * 商品列表
+     * @return 结果列表
+     */
+    @Select("SELECT " +
+            "sg.*, " +
+            "sgc1.category_name as categoryOneName, " +
+            "sgc2.category_name as categoryTwoName "+
+            " FROM second_goods sg " +
+            "left JOIN second_goods_category sgc1 " +
+            "on sg.category_one_id = sgc1.id " +
+            "left JOIN second_goods_category sgc2 " +
+            "on sg.category_two_id = sgc2.id "+
+            "${ew.customSqlSegment}")
+    List<SecondGoodsVo> selectGoodsList(@Param(Constants.WRAPPER) QueryWrapper<SecondGoodsVo> queryWrapper);
+
+
+    /**
      * 搜索结果-商品列表
      * 搜索结果-商品列表
      * @param page 分页参数
      * @param page 分页参数
      * @return 搜索结果列表
      * @return 搜索结果列表

+ 39 - 0
alien-entity/src/main/java/shop/alien/mapper/second/SecondRiskControlRecordMapper.java

@@ -0,0 +1,39 @@
+package shop.alien.mapper.second;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import shop.alien.entity.second.SecondGoodsRecord;
+import shop.alien.entity.second.SecondRiskControlRecord;
+import shop.alien.entity.second.vo.SecondRiskControlRecordVo;
+
+import java.util.List;
+
+/**
+ * 二手商品风控记录映射器
+ */
+public interface SecondRiskControlRecordMapper extends BaseMapper<SecondRiskControlRecord> {
+
+
+    @Select(" select r.*, case when r.rule_type = 1 then '洗钱嫌疑' when r.rule_type = 2 then '账号异常' " +
+            " when r.rule_type = 3 then '交易欺诈' when r.rule_type = 4 then '异常发布' end ruleTypeName,  " +
+            " case when r.rule_type = 1 then '高频高价交易' when r.rule_type = 2 then '同一设备/mac 24小时内注册超过3个账号' " +
+            " when r.rule_type = 3 then '用户频繁修改商品' when r.rule_type = 4 then '短时间大量发布同类商品' end ruleName, " +
+            " case when r.rule_type = 1 or r.rule_type = 2 then '中风险' when r.rule_type = 3 or r.rule_type = 4 then '高风险' end ruleRisk,  " +
+            " case when r.risk_status = 0 then '待处理' when r.risk_status = 1 then '已处理' " +
+            " when r.risk_status = 2 then '已忽略' end riskStatusName,  " +
+            " case when r.rule_type = 1 or r.rule_type = 3 or r.rule_type = 4 then u.user_phone " +
+            " else '--' end userPhone " +
+            " from second_risk_control_record r left join life_user u on r.user_id = u.id " +
+            " ${ew.customSqlSegment} ")
+    IPage<SecondRiskControlRecordVo> queryRiskControlRecords(IPage<SecondRiskControlRecordVo> page, @Param(Constants.WRAPPER) QueryWrapper<SecondRiskControlRecordVo> queryWrapper);
+
+
+    @Select(" select * from second_risk_control_record " +
+            " WHERE created_time BETWEEN DATE_FORMAT(#{starDate}, '%Y-%m-%d %H:%i:%s') " +
+            " AND DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%s') AND business_id = #{macIp} ")
+    List<SecondRiskControlRecord> selectByBusinessId(@Param("starDate") String starDate, @Param("endDate") String endDate, @Param("macIp") String macIp);
+}

+ 4 - 4
alien-entity/src/main/java/shop/alien/mapper/second/SecondTradeRecordMapper.java

@@ -55,13 +55,13 @@ public interface SecondTradeRecordMapper extends BaseMapper<SecondTradeRecord> {
     SecondTradeRecordVo getTradeRecordById(@Param("id") Integer id);
     SecondTradeRecordVo getTradeRecordById(@Param("id") Integer id);
 
 
     @Select("with record as ( " +
     @Select("with record as ( " +
-            "    select buyer_id userId, count(1) num, 'buyer' flag " +
+            "    select buyer_id userId, count(1) num, 'buyer' flag, max(transaction_time) time " +
             "    from second_trade_record " +
             "    from second_trade_record " +
             "    where delete_flag = 0 and trade_status = 4 and failure_flag = 0 " +
             "    where delete_flag = 0 and trade_status = 4 and failure_flag = 0 " +
             "    and transaction_time >= #{beginTime} and transaction_time <= #{endTime} " +
             "    and transaction_time >= #{beginTime} and transaction_time <= #{endTime} " +
             "    group by buyer_id " +
             "    group by buyer_id " +
             "    union all " +
             "    union all " +
-            "    select seller_id userId, count(1) num, 'seller' flag " +
+            "    select seller_id userId, count(1) num, 'seller' flag, max(transaction_time) time " +
             "    from second_trade_record " +
             "    from second_trade_record " +
             "    where delete_flag = 0 and trade_status = 4 and failure_flag = 0 " +
             "    where delete_flag = 0 and trade_status = 4 and failure_flag = 0 " +
             "    and transaction_time >= #{beginTime} and transaction_time <= #{endTime} " +
             "    and transaction_time >= #{beginTime} and transaction_time <= #{endTime} " +
@@ -69,14 +69,14 @@ public interface SecondTradeRecordMapper extends BaseMapper<SecondTradeRecord> {
             ") " +
             ") " +
             "select a.*, ifnull(b.num, 0) buyer, ifnull(c.num, 0) seller, user.user_name userName, concat('user_', user.user_phone) phoneId, user.user_phone userPhone " +
             "select a.*, ifnull(b.num, 0) buyer, ifnull(c.num, 0) seller, user.user_name userName, concat('user_', user.user_phone) phoneId, user.user_phone userPhone " +
             "from ( " +
             "from ( " +
-            "    select userId, sum(num) num " +
+            "    select userId, sum(num) num, max(time) time " +
             "    from record " +
             "    from record " +
             "    group by userId " +
             "    group by userId " +
             ") a " +
             ") a " +
             "left join record b on a.userId = b.userId and b.flag = 'buyer' " +
             "left join record b on a.userId = b.userId and b.flag = 'buyer' " +
             "left join record c on a.userId = c.userId and c.flag = 'seller' " +
             "left join record c on a.userId = c.userId and c.flag = 'seller' " +
             "join life_user user on user.id = a.userId and user.delete_flag = 0 " +
             "join life_user user on user.id = a.userId and user.delete_flag = 0 " +
-            "order by a.num desc " +
+            "order by a.num desc, a.time " +
             "limit 20 ")
             "limit 20 ")
     List<JSONObject> getRankingList(@Param("beginTime") String beginTime, @Param("endTime") String endTime);
     List<JSONObject> getRankingList(@Param("beginTime") String beginTime, @Param("endTime") String endTime);
 }
 }

+ 20 - 0
alien-entity/src/main/java/shop/alien/mapper/second/SecondUserCreditMapper.java

@@ -0,0 +1,20 @@
+package shop.alien.mapper.second;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import shop.alien.entity.second.SecondUserCredit;
+
+
+/**
+ * 二手商品映射器
+ */
+@Mapper
+public interface SecondUserCreditMapper extends BaseMapper<SecondUserCredit> {
+
+    @Select("update second_user_credit set user_points = user_points + #{points} " +
+            "where user_id = #{userId} and delete_flag = 0 ")
+    void updatePointsByUserId(@Param("userId") int userId, @Param("points") int points);
+
+}

+ 12 - 0
alien-entity/src/main/java/shop/alien/mapper/second/SecondUserCreditRecordMapper.java

@@ -0,0 +1,12 @@
+package shop.alien.mapper.second;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import shop.alien.entity.second.SecondUserCreditRecord;
+
+
+/**
+ * 二手商品映射器
+ */
+public interface SecondUserCreditRecordMapper extends BaseMapper<SecondUserCreditRecord> {
+
+}

+ 20 - 0
alien-entity/src/main/java/shop/alien/mapper/second/SecondUserViolationMapper.java

@@ -0,0 +1,20 @@
+package shop.alien.mapper.second;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Param;
+import shop.alien.entity.second.vo.SecondUserViolationDetailVo;
+import shop.alien.entity.second.vo.SecondUserViolationVo;
+
+
+/**
+ * 二手交易举报
+ */
+public interface SecondUserViolationMapper extends BaseMapper<SecondUserViolationVo> {
+
+    IPage<SecondUserViolationVo> getUserViolationByPage(IPage<SecondUserViolationVo> page, @Param("reportingUserName") String reportingUserName,
+                                                        @Param("reportingDate") String reportingDate, @Param("processingStatus") String processingStatus,
+                                                        @Param("reportContextType") String reportContextType);
+
+    SecondUserViolationDetailVo getUserViolationInfo(@Param("id") Integer id);
+}

+ 5 - 1
alien-entity/src/main/resources/mapper/LifeAppealManageMapper.xml

@@ -18,13 +18,16 @@
     <select id="getAppealManagement" resultType="shop.alien.entity.store.vo.LifeAppealManageVo">
     <select id="getAppealManagement" resultType="shop.alien.entity.store.vo.LifeAppealManageVo">
         SELECT
         SELECT
         appeal.id,
         appeal.id,
+        appeal.store_id,
         store.store_name,
         store.store_name,
         su.`name` AS store_contact,
         su.`name` AS store_contact,
-        lu.user_phone AS store_phone,
+        lu.user_phone AS user_phone,
+        store.store_tel AS store_phone,
         `comment`.comment_content AS customer_report,
         `comment`.comment_content AS customer_report,
         appeal.appeal_reason,
         appeal.appeal_reason,
         appeal.appeal_status AS appeal_type,
         appeal.appeal_status AS appeal_type,
         si.img_url as appeal_image,
         si.img_url as appeal_image,
+        sg.img_url AS commentImage,
         CASE
         CASE
         appeal.appeal_status
         appeal.appeal_status
         WHEN 0 THEN
         WHEN 0 THEN
@@ -52,6 +55,7 @@
         LEFT JOIN store_comment `comment` ON `comment`.id = appeal.comment_id
         LEFT JOIN store_comment `comment` ON `comment`.id = appeal.comment_id
         LEFT JOIN life_user lu ON `comment`.user_id = lu.id
         LEFT JOIN life_user lu ON `comment`.user_id = lu.id
         LEFT JOIN store_img si ON appeal.img_id = si.id
         LEFT JOIN store_img si ON appeal.img_id = si.id
+        LEFT JOIN store_img sg ON sg.id = `comment`.img_id
         WHERE
         WHERE
         1 = 1
         1 = 1
         <if test="storeName != null and storeName != ''">
         <if test="storeName != null and storeName != ''">

+ 86 - 0
alien-entity/src/main/resources/mapper/LifeUserDynamicsMapper.xml

@@ -88,4 +88,90 @@
         GROUP by dyna1.id order by dyna1.top_status desc, dyna1.top_time desc
         GROUP by dyna1.id order by dyna1.top_status desc, dyna1.top_time desc
     </select>
     </select>
 
 
+    <select id="getStoreDynamicslist" resultType="shop.alien.entity.store.vo.LifeUserDynamicsVo">
+        select
+        dyna1.*,
+        COUNT(dyna1.id) AS fansCount
+        from
+        (
+        select
+        dyna.*,
+        COUNT(sc.id) AS commentCount,
+        COUNT(lm.id) AS transferNum
+        from
+        (
+        with dynamice as(
+        select
+        CASE
+        WHEN image_path REGEXP '.mp4|.avi|.flv|.mkv|.rmvb|.wmv|.3gp|.mov' THEN 2
+        WHEN image_path REGEXP '.jpg|.jpeg|.png|.bmp|.webp|.gif|.svg' THEN 1
+        ELSE 0
+        END AS dynamicsType, id, title, phone_id phoneId, context, image_path, address, address_name, address_context, liulan_count, dianzan_count, type, created_time, substring_index(phone_id, '_', 1) userType, substring_index(phone_id, '_', -1) phone, draft , address_province, top_status, top_time, enable_status,
+        business_id
+        from life_user_dynamics
+        where phone_id = #{phoneId} and delete_flag = 0 and draft = 0 order by created_time desc
+        )
+        select
+        dynamice.*,
+        user.nick_name userName,
+        user.head_img userImage,
+        info.id storeUserId,
+        info.store_name storeName,
+        user.id storeOrUserId,
+        0 isExpert,
+        IF(llr.huifu_id IS NOT NULL or llr1.huifu_id IS NOT NULL, 1, 0) AS isLike
+        from
+        dynamice
+        left join store_user user on
+        dynamice.phone = user.phone
+        and user.delete_flag = 0
+        left join store_info info on
+        info.id = user.store_id
+        and info.delete_flag = 0
+        left join store_img img on
+        img.store_id = user.store_id
+        and img.img_type = '10'
+        and img.delete_flag = 0
+        left join life_like_record llr on
+        llr.huifu_id = dynamice.id
+        and llr.delete_flag = 0
+        and llr.dianzan_id = (
+        select
+        CONCAT('user_', lu1.user_phone)
+        from
+        life_user lu1
+        where
+        lu1.id = #{userId})
+        left join life_like_record llr1 on
+        llr1.huifu_id = dynamice.id
+        and llr1.delete_flag = 0
+        and llr1.dianzan_id = (
+        select
+        CONCAT('store_', lu2.phone)
+        from
+        store_user lu2
+        where
+        lu2.id = #{userId})
+        where
+        dynamice.userType = 'store') dyna
+        left join life_comment lc on
+        lc.dongtai_shequ_id = dyna.id
+        left join store_comment sc on
+        sc.business_id = dyna.id
+        and sc.business_type = 2
+        and sc.delete_flag = 0
+        left join life_message lm on
+        lm.business_id = dyna.id
+        GROUP BY
+        dyna.id
+        order by
+        dyna.created_time desc) dyna1
+        left join life_fans lf1 on
+        lf1.followed_id = dyna1.phoneId
+        GROUP by
+        dyna1.id
+        order by
+        dyna1.top_status desc,
+        dyna1.top_time desc
+    </select>
 </mapper>
 </mapper>

+ 35 - 10
alien-entity/src/main/resources/mapper/LifeUserOrderMapper.xml

@@ -30,6 +30,7 @@
         <result column="img_url" property="imgUrl"/>
         <result column="img_url" property="imgUrl"/>
         <result column="user_name" property="userName"/>
         <result column="user_name" property="userName"/>
         <result column="order_status" property="status"/>
         <result column="order_status" property="status"/>
+        <result column="order_status_value" property="orderStatusValue"/>
         <result column="dist" property="dist"/>
         <result column="dist" property="dist"/>
         <result column="store_address" property="storeAddress"/>
         <result column="store_address" property="storeAddress"/>
         <result column="effective_date_type" property="effectiveDateType"/>
         <result column="effective_date_type" property="effectiveDateType"/>
@@ -43,7 +44,8 @@
         <result column="total_refund_time" property="totalRefundTime"/>
         <result column="total_refund_time" property="totalRefundTime"/>
         <result column="business_status" property="businessStatus"/>
         <result column="business_status" property="businessStatus"/>
         <result column="type" property="type"/>
         <result column="type" property="type"/>
-
+        <result column="store_type" property="storeType"/>
+        <result column="store_status" property="storeStatus"/>
         <result column="business_type" property="businessType"/>
         <result column="business_type" property="businessType"/>
         <result column="collect_num" property="collectNum"/>
         <result column="collect_num" property="collectNum"/>
         <result column="business_date" property="businessDate"/>
         <result column="business_date" property="businessDate"/>
@@ -53,6 +55,10 @@
         <result column="reservation_rules" property="reservationRules"/>
         <result column="reservation_rules" property="reservationRules"/>
         <result column="original_price" property="originalPrice"/>
         <result column="original_price" property="originalPrice"/>
         <result column="order_str" property="orderStr"/>
         <result column="order_str" property="orderStr"/>
+        <result column="expert_order_id" property="expertOrderId"/>
+        <result column="order_appraise" property="orderAppraise"/>
+        <result column="user_id" property="userId"/>
+        <result column="imgIds" property="imgIds"/>
 
 
         <collection property="orderCouponMiddleList" ofType="shop.alien.entity.store.vo.OrderCouponMiddleVo">
         <collection property="orderCouponMiddleList" ofType="shop.alien.entity.store.vo.OrderCouponMiddleVo">
             <id column="ocmId" property="id" />
             <id column="ocmId" property="id" />
@@ -61,6 +67,7 @@
             <result column="refund_time" property="refundTime"/>
             <result column="refund_time" property="refundTime"/>
             <result column="refund_reason" property="refundReason"/>
             <result column="refund_reason" property="refundReason"/>
             <result column="refundPrice" property="price"/>
             <result column="refundPrice" property="price"/>
+            <result column="used_time" property="usedTime"/>
         </collection>
         </collection>
     </resultMap>
     </resultMap>
 
 
@@ -68,21 +75,35 @@
     <!-- 查询用户订单详情 -->
     <!-- 查询用户订单详情 -->
     <select id="queryUserOrderDetail" resultMap="BaseResultMap">
     <select id="queryUserOrderDetail" resultMap="BaseResultMap">
         with total_coupon as(
         with total_coupon as(
-        select id coupon_id,2 coupon_type,lgbm.group_name coupon_name,preferential_price offprice,original_price, SUBSTRING_INDEX(image_id, ',', 1) AS image_id,
+        select id coupon_id,2 coupon_type,lgbm.group_name coupon_name,preferential_price offprice,original_price, SUBSTRING_INDEX(image_id, ',', 1) AS image_id, image_id AS imgIds,
                effective_date_type,effective_date_value,use_rules,reservation_rules,applicable_num,quota_type,quota_value,inventory_num single_qty
                effective_date_type,effective_date_value,use_rules,reservation_rules,applicable_num,quota_type,quota_value,inventory_num single_qty
         from life_group_buy_main lgbm where lgbm.delete_flag = 0
         from life_group_buy_main lgbm where lgbm.delete_flag = 0
         union all
         union all
-        select id coupon_id,1 coupon_type,lc.name coupon_name,lc.offprice offprice,price original_price,SUBSTRING_INDEX(image_path, ',', 1) AS image_id,
-               0 effective_date_type,expiration_date effective_date_value,use_rule use_rules,reservation_rules,applicable_num,1 quota_type,buy_limit quota_value,single_qty
+        select id coupon_id,1 coupon_type,lc.name coupon_name,lc.offprice offprice,price original_price,SUBSTRING_INDEX(image_path, ',', 1) AS image_id, image_path AS imgIds,
+        case when expiration_type = 1 then 0 else 1 end effective_date_type, case when expiration_type = 1 then expiration_date else validity_period end  effective_date_value,use_rule use_rules,reservation_rules,applicable_num,1 quota_type,buy_limit quota_value,single_qty
         from life_coupon lc where lc.delete_flag = 0
         from life_coupon lc where lc.delete_flag = 0
         )
         )
-        select luo.id,luo.order_no,luo.created_time , luo.price ,luo.final_price,luo.order_str,
-        luo.pay_method,luo.buy_time,luo.cancel_time,luo.pay_time,luo.finish_time,luo.status order_status,luo.quan_id,luo.refund_time total_refund_time,
+        select luo.id,luo.order_no,luo.created_time , luo.price ,
+        luo.final_price,
+        luo.order_str,
+        luo.pay_method,luo.buy_time,luo.cancel_time,luo.pay_time,luo.finish_time,luo.status order_status,
+        CASE luo.status
+        WHEN 0 THEN '待支付'
+        WHEN 1 THEN '已支付/待使用'
+        WHEN 2 THEN '已核销'
+        WHEN 3 THEN '已过期'
+        WHEN 4 THEN '已取消'
+        WHEN 5 THEN '已退款'
+        WHEN 6 THEN '退款失败'
+        WHEN 7 THEN '已完成'
+        END AS order_status_value,
+        luo.quan_id,luo.refund_time total_refund_time,luo.expert_order_id,luo.order_appraise,
         tc.*,
         tc.*,
         ldc.nominal_value,ldc.type,
         ldc.nominal_value,ldc.type,
         lu.user_phone,lu.user_name,lu.id user_id,
         lu.user_phone,lu.user_name,lu.id user_id,
         ocm.id ocmId,ocm.status,ocm.coupon_code,ocm.refund_time,ocm.refund_reason,ocm.price refundPrice,
         ocm.id ocmId,ocm.status,ocm.coupon_code,ocm.refund_time,ocm.refund_reason,ocm.price refundPrice,
-        si.id store_id,si.store_name,si.commission_rate,si.store_address,si.store_tel,si.business_status,si.collect_num,
+        si.id store_id,si.store_name,si.commission_rate,si.store_address,si.store_tel,si.business_status,si.collect_num,si.business_section store_type,si.store_status,
+        su.phone store_user_tel,
         <if test="position != null and position != ''">
         <if test="position != null and position != ''">
             ROUND(
             ROUND(
             ST_Distance_Sphere(
             ST_Distance_Sphere(
@@ -103,6 +124,7 @@
         left join life_user lu on lu.id = luo.user_id and lu.delete_flag = 0
         left join life_user lu on lu.id = luo.user_id and lu.delete_flag = 0
         left join store_img simg on simg.id = tc.image_id and simg.delete_flag = 0
         left join store_img simg on simg.id = tc.image_id and simg.delete_flag = 0
         left join store_business_info sbi on sbi.store_id = si.id and sbi.delete_flag = 0
         left join store_business_info sbi on sbi.store_id = si.id and sbi.delete_flag = 0
+        left join store_user su on su.store_id = si.id and su.delete_flag = 0
         where luo.id = #{orderId}
         where luo.id = #{orderId}
         order by luo.created_time desc
         order by luo.created_time desc
     </select>
     </select>
@@ -114,7 +136,7 @@
         from life_group_buy_main lgbm where lgbm.delete_flag = 0
         from life_group_buy_main lgbm where lgbm.delete_flag = 0
         union all
         union all
         select id coupon_id,1 coupon_type,lc.name coupon_name,lc.offprice offprice,SUBSTRING_INDEX(image_path, ',', 1) AS image_id,
         select id coupon_id,1 coupon_type,lc.name coupon_name,lc.offprice offprice,SUBSTRING_INDEX(image_path, ',', 1) AS image_id,
-        0 effective_date_type,expiration_date effective_date_value,use_rule use_rules,reservation_rules,applicable_num,1 quota_type,buy_limit quota_value,single_qty,end_date
+        case when expiration_type = 1 then 0 else 1 end effective_date_type,case when expiration_type = 1 then expiration_date else validity_period end  effective_date_value,use_rule use_rules,reservation_rules,applicable_num,1 quota_type,buy_limit quota_value,single_qty,end_date
         from life_coupon lc where lc.delete_flag = 0
         from life_coupon lc where lc.delete_flag = 0
         )
         )
         select luo.id,luo.order_no,luo.created_time , luo.price ,luo.final_price
         select luo.id,luo.order_no,luo.created_time , luo.price ,luo.final_price
@@ -129,13 +151,16 @@
         from life_user_order luo
         from life_user_order luo
         left join store_info si on si.id = luo.store_id and si.delete_flag = 0
         left join store_info si on si.id = luo.store_id and si.delete_flag = 0
         left join order_coupon_middle ocm on ocm.order_id = luo.id and ocm.delete_flag = 0
         left join order_coupon_middle ocm on ocm.order_id = luo.id and ocm.delete_flag = 0
-        left join total_coupon tc on tc.coupon_id = ocm.coupon_id and tc.coupon_type = luo.coupon_type
+        inner join total_coupon tc on tc.coupon_id = ocm.coupon_id and tc.coupon_type = luo.coupon_type
         left join life_discount_coupon_user ldcu on ldcu.id = luo.quan_id and ldcu.delete_flag = 0
         left join life_discount_coupon_user ldcu on ldcu.id = luo.quan_id and ldcu.delete_flag = 0
         left join life_discount_coupon ldc on ldc.id = ldcu.coupon_id and ldc.delete_flag = 0
         left join life_discount_coupon ldc on ldc.id = ldcu.coupon_id and ldc.delete_flag = 0
         left join life_user lu on lu.id = luo.user_id and lu.delete_flag = 0
         left join life_user lu on lu.id = luo.user_id and lu.delete_flag = 0
         left join store_img simg on simg.id = tc.image_id and simg.delete_flag = 0
         left join store_img simg on simg.id = tc.image_id and simg.delete_flag = 0
         left join store_business_info sbi on sbi.store_id = si.id and sbi.delete_flag = 0
         left join store_business_info sbi on sbi.store_id = si.id and sbi.delete_flag = 0
-        where luo.status = 1
+        <where>
+            <!-- 引用 LambdaQueryWrapper 构建的条件 -->
+            ${ew.sqlSegment}
+        </where>
         order by luo.created_time desc
         order by luo.created_time desc
     </select>
     </select>
 </mapper>
 </mapper>

+ 235 - 134
alien-entity/src/main/resources/mapper/ManagementInfoMapper.xml

@@ -152,7 +152,7 @@
                 END AS type_name,
                 END AS type_name,
             coupon.`name`,
             coupon.`name`,
             "1" AS buy_count,
             "1" AS buy_count,
-            ROUND(userOrder.price / 100,2) AS buy_amount,
+            ROUND(userOrder.price ,2) AS buy_amount,
             userOrder.buy_time AS buy_time,
             userOrder.buy_time AS buy_time,
             userOrder.used_time AS used_time,
             userOrder.used_time AS used_time,
             userOrder.refund_time AS refund_time,
             userOrder.refund_time AS refund_time,
@@ -170,7 +170,8 @@
                 WHEN 4 THEN
                 WHEN 4 THEN
                     "已退款"
                     "已退款"
                 END AS status_name,
                 END AS status_name,
-        userOrder.order_no
+        userOrder.order_no,
+        userOrder.coupon_type
         FROM
         FROM
             life_user_order userOrder
             life_user_order userOrder
                 LEFT JOIN life_coupon coupon ON coupon.id = userOrder.id
                 LEFT JOIN life_coupon coupon ON coupon.id = userOrder.id
@@ -252,6 +253,7 @@
         <if test="storeName != null and storeName != ''">
         <if test="storeName != null and storeName != ''">
             AND store.store_name LIKE CONCAT('%', #{storeName}, '%')
             AND store.store_name LIKE CONCAT('%', #{storeName}, '%')
         </if>
         </if>
+        ORDER BY cash.created_time DESC
     </select>
     </select>
 
 
     <select id="getCashOutDetail" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
     <select id="getCashOutDetail" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
@@ -284,52 +286,35 @@
     </select>
     </select>
 
 
     <select id="getPlatformNetProfit" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
     <select id="getPlatformNetProfit" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
-        select IFNULL(ROUND(sum(all_data.platform_profit),2), 0) AS profit from
-        (SELECT
-        ROUND(SUM(final_price) * (IFNULL(store.commission_rate, 3)/100),2) AS platform_profit
-        FROM
-        life_user_order `order`
-        LEFT JOIN store_info store ON store.id = `order`.store_id
-        WHERE
-        `status` = 2
+
+        select IFNULL(ROUND(sum(sidr.commission)/100,2), 0) AS profit
+        from store_income_details_record sidr
+        where 1=1
         <if test="dataTime != null and dataTime != ''">
         <if test="dataTime != null and dataTime != ''">
             AND
             AND
-            `order`.used_time > #{dataTime}
+            sidr.created_time > #{dataTime}
         </if>
         </if>
-        GROUP BY
-        store.id) all_data
     </select>
     </select>
     <select id="getOrderQuantity" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
     <select id="getOrderQuantity" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
-        SELECT
-            IFNULL(COUNT( 1 ) ,0) AS count
-        FROM
-            life_user_order
-        WHERE
-            ( `status` in (1, 2)
-            <if test="dataTime != null and dataTime != ''">
-                AND
-                buy_time > #{dataTime}
-            </if>
-             )
+        select count(*) count
+        from life_user_order luo
+        where luo.status in (1, 7)
+        <if test="dataTime != null and dataTime != ''">
+            and luo.pay_time > #{dataTime}
+        </if>
     </select>
     </select>
     <select id="getTradingVolume" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
     <select id="getTradingVolume" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
+       select IFNULL(ROUND(sum(all_data.profit_a), 2 ),0) profit from (
         SELECT
         SELECT
-            IFNULL(ROUND( sum( final_price ), 2 ),0) AS profit
+            IFNULL(ROUND(luo.final_price , 2 ),0) AS profit_a
         FROM
         FROM
-            life_user_order
+            life_user_order luo
         WHERE
         WHERE
-            ( `status` = 2
-                <if test="dataTime != null and dataTime != ''">
-                    AND
-                    used_time > #{dataTime}
-                </if>
-            )
-           OR ( `status` = 1
+            luo.status in (1, 7)
             <if test="dataTime != null and dataTime != ''">
             <if test="dataTime != null and dataTime != ''">
-                AND
-                buy_time > #{dataTime}
+                and luo.pay_time > #{dataTime}
             </if>
             </if>
-            )
+        ) all_data
     </select>
     </select>
     <select id="getQueryNetProfitDay" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
     <select id="getQueryNetProfitDay" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
         -- 使用递归 CTE 生成 1 到 23 的小时序列
         -- 使用递归 CTE 生成 1 到 23 的小时序列
@@ -339,20 +324,23 @@
         SELECT hour_num + 1
         SELECT hour_num + 1
         FROM hours
         FROM hours
         WHERE hour_num &lt; 23
         WHERE hour_num &lt; 23
+        ),
+        order_data AS (
+        SELECT
+        sidr.commission,
+        sidr.created_time
+        FROM store_income_details_record sidr where 1=1
+        <if test="dataTime != null and dataTime != ''">
+            AND sidr.created_time >= #{dataTime}
+        </if>
         )
         )
+
         SELECT
         SELECT
         concat(h.hour_num,":00") AS hour_num,
         concat(h.hour_num,":00") AS hour_num,
-        COALESCE(ROUND(SUM(o.final_price) * 0.04, 2), 0) AS profit
+        COALESCE(IFNULL(ROUND(sum(o.commission)/100,2), 0)) AS profit
         FROM
         FROM
         hours h
         hours h
-        LEFT JOIN
-        life_user_order o
-        ON
-        h.hour_num = HOUR(o.used_time)
-        AND o.`status` = 1
-        <if test="dataTime != null and dataTime != ''">
-            AND o.used_time >= #{dataTime}
-        </if>
+        LEFT JOIN order_data o ON h.hour_num = HOUR(o.created_time)
         GROUP BY
         GROUP BY
         h.hour_num
         h.hour_num
         ORDER BY
         ORDER BY
@@ -365,17 +353,21 @@
         SELECT hour_num + INTERVAL 1 DAY
         SELECT hour_num + INTERVAL 1 DAY
         FROM date_sequence
         FROM date_sequence
         WHERE hour_num &lt; DATE_SUB(#{dataTime}, INTERVAL WEEKDAY(#{dataTime}) DAY) + INTERVAL 6 DAY
         WHERE hour_num &lt; DATE_SUB(#{dataTime}, INTERVAL WEEKDAY(#{dataTime}) DAY) + INTERVAL 6 DAY
+        ),
+        order_data AS (
+        SELECT
+        sidr.commission,
+        sidr.created_time
+        FROM store_income_details_record sidr
         )
         )
         SELECT
         SELECT
         DATE_FORMAT(ds.hour_num, '%c-%d') AS hour_num,
         DATE_FORMAT(ds.hour_num, '%c-%d') AS hour_num,
-        COALESCE(ROUND(SUM(luo.final_price) * 0.04, 2), 0) AS profit
+        COALESCE(IFNULL(ROUND(sum(o.commission)/100,2), 0)) AS profit
         FROM
         FROM
         date_sequence ds
         date_sequence ds
-        LEFT JOIN
-        life_user_order luo
-        ON
-        luo.used_time >= ds.hour_num AND luo.used_time &lt; ds.hour_num + INTERVAL 1 DAY
-        AND luo.`status` = 1
+        LEFT JOIN order_data o ON
+        o.created_time >= ds.hour_num
+        AND o.created_time &lt; ds.hour_num + INTERVAL 1 DAY
         GROUP BY
         GROUP BY
         ds.hour_num
         ds.hour_num
         ORDER BY
         ORDER BY
@@ -388,17 +380,20 @@
         SELECT DATE_ADD(hour_num, INTERVAL 1 DAY)
         SELECT DATE_ADD(hour_num, INTERVAL 1 DAY)
         FROM date_sequence
         FROM date_sequence
         WHERE DATE_ADD(hour_num, INTERVAL 1 DAY)  &lt;= LAST_DAY(#{dataTime})
         WHERE DATE_ADD(hour_num, INTERVAL 1 DAY)  &lt;= LAST_DAY(#{dataTime})
+        ),
+        order_data AS (
+        SELECT
+        sidr.commission,
+        sidr.created_time
+        FROM store_income_details_record sidr
         )
         )
         SELECT
         SELECT
         DATE_FORMAT(ds.hour_num, '%c-%d') AS hour_num,
         DATE_FORMAT(ds.hour_num, '%c-%d') AS hour_num,
-        COALESCE(ROUND(SUM(luo.final_price) * 0.04, 2), 0) AS profit
+        COALESCE(IFNULL(ROUND(sum(o.commission)/100,2), 0)) AS profit
         FROM
         FROM
         date_sequence ds
         date_sequence ds
-        LEFT JOIN
-        life_user_order luo
-        ON
-        luo.used_time >= ds.hour_num AND luo.used_time &lt; DATE_ADD(ds.hour_num, INTERVAL 1 DAY)
-        AND luo.`status` = 1
+        LEFT JOIN order_data o ON
+        o.created_time >= ds.hour_num AND o.created_time &lt; DATE_ADD(ds.hour_num, INTERVAL 1 DAY)
         GROUP BY
         GROUP BY
         ds.hour_num
         ds.hour_num
         ORDER BY
         ORDER BY
@@ -411,18 +406,21 @@
         SELECT hour_num + 1
         SELECT hour_num + 1
         FROM month_sequence
         FROM month_sequence
         WHERE hour_num &lt; 12
         WHERE hour_num &lt; 12
+        ),
+        order_data AS (
+        SELECT
+        sidr.commission,
+        sidr.created_time
+        FROM store_income_details_record sidr
         )
         )
         SELECT
         SELECT
         CONCAT(ms.hour_num,'月') AS hour_num,
         CONCAT(ms.hour_num,'月') AS hour_num,
-        COALESCE(ROUND(SUM(luo.final_price) * 0.04, 2), 0) AS profit
+        COALESCE(IFNULL(ROUND(sum(o.commission)/100,2), 0)) AS profit
         FROM
         FROM
         month_sequence ms
         month_sequence ms
-        LEFT JOIN
-        life_user_order luo
-        ON
-        MONTH(luo.used_time) = ms.hour_num
-        AND YEAR(luo.used_time) = YEAR(#{dataTime})
-        AND luo.`status` = 1
+        LEFT JOIN order_data o ON
+        MONTH(o.created_time) = ms.hour_num
+        AND YEAR(o.created_time) = YEAR(#{dataTime})
         GROUP BY
         GROUP BY
         ms.hour_num
         ms.hour_num
         ORDER BY
         ORDER BY
@@ -435,16 +433,28 @@
         SELECT hour_num + 1
         SELECT hour_num + 1
         FROM hours
         FROM hours
         WHERE hour_num &lt; 23
         WHERE hour_num &lt; 23
+        ),
+        order_data AS (
+        SELECT
+        o.id,
+        si.commission_rate,
+        o.final_price,
+        ocm.used_time,
+        o.pay_time,
+        o.status
+        FROM life_user_order o
+        LEFT JOIN order_coupon_middle ocm ON ocm.order_id = o.id
+        LEFT JOIN store_info si ON si.id = o.store_id
+        WHERE o.delete_flag = 0
         )
         )
         SELECT
         SELECT
         concat(h.hour_num,":00") AS hour_num,
         concat(h.hour_num,":00") AS hour_num,
         COALESCE(ROUND(SUM(o.final_price), 2), 0) AS profit
         COALESCE(ROUND(SUM(o.final_price), 2), 0) AS profit
         FROM
         FROM
         hours h
         hours h
-        LEFT JOIN
-        life_user_order o
-        ON ( h.hour_num = HOUR( o.used_time ) AND ( o.`status` = 1 AND o.used_time >= #{dataTime} ) )
-        OR ( h.hour_num = HOUR( o.buy_time ) AND ( o.`status` = 0 AND o.buy_time >= #{dataTime} ) )
+        LEFT JOIN order_data o
+        ON ( h.hour_num = HOUR( o.used_time ) AND ( o.`status` = 2 AND o.used_time >= #{dataTime} ) )
+        OR ( h.hour_num = HOUR( o.pay_time ) AND ( o.`status` = 1 AND o.pay_time >= #{dataTime} ) )
         GROUP BY
         GROUP BY
         h.hour_num
         h.hour_num
         ORDER BY
         ORDER BY
@@ -457,22 +467,35 @@
             SELECT hour_num + INTERVAL 1 DAY
             SELECT hour_num + INTERVAL 1 DAY
         FROM date_sequence
         FROM date_sequence
         WHERE hour_num &lt; DATE_SUB(#{dataTime}, INTERVAL WEEKDAY(#{dataTime}) DAY) + INTERVAL 6 DAY
         WHERE hour_num &lt; DATE_SUB(#{dataTime}, INTERVAL WEEKDAY(#{dataTime}) DAY) + INTERVAL 6 DAY
-            )
+            ),
+        order_data AS (
+        SELECT
+        o.id,
+        si.commission_rate,
+        o.final_price,
+        ocm.used_time,
+        o.pay_time,
+        o.status
+        FROM life_user_order o
+        LEFT JOIN order_coupon_middle ocm ON ocm.order_id = o.id
+        LEFT JOIN store_info si ON si.id = o.store_id
+        WHERE o.delete_flag = 0
+        )
         SELECT
         SELECT
             DATE_FORMAT(ds.hour_num, '%c-%d') AS hour_num,
             DATE_FORMAT(ds.hour_num, '%c-%d') AS hour_num,
-            COALESCE(ROUND(SUM(luo.final_price), 2), 0) AS profit
+            COALESCE(ROUND(SUM(o.final_price), 2), 0) AS profit
         FROM
         FROM
             date_sequence ds
             date_sequence ds
                 LEFT JOIN
                 LEFT JOIN
-            life_user_order luo
+        order_data o
             ON
             ON
-                (luo.used_time >= ds.hour_num
-                AND luo.used_time &lt; ds.hour_num + INTERVAL 1 DAY
-                AND luo.`status` = 1 )
+                (o.used_time >= ds.hour_num
+                AND o.used_time &lt; ds.hour_num + INTERVAL 1 DAY
+                AND o.`status` = 2 )
             OR
             OR
-                (luo.buy_time >= ds.hour_num
-                AND luo.buy_time &lt; ds.hour_num + INTERVAL 1 DAY
-                AND luo.`status` = 0 )
+                (o.pay_time >= ds.hour_num
+                AND o.pay_time &lt; ds.hour_num + INTERVAL 1 DAY
+                AND o.`status` = 1 )
         GROUP BY
         GROUP BY
             ds.hour_num
             ds.hour_num
         ORDER BY
         ORDER BY
@@ -485,22 +508,35 @@
             SELECT DATE_ADD(hour_num, INTERVAL 1 DAY)
             SELECT DATE_ADD(hour_num, INTERVAL 1 DAY)
             FROM date_sequence
             FROM date_sequence
             WHERE DATE_ADD(hour_num, INTERVAL 1 DAY)  &lt;= LAST_DAY(#{dataTime})
             WHERE DATE_ADD(hour_num, INTERVAL 1 DAY)  &lt;= LAST_DAY(#{dataTime})
+        ),
+        order_data AS (
+        SELECT
+        o.id,
+        si.commission_rate,
+        o.final_price,
+        ocm.used_time,
+        o.pay_time,
+        o.status
+        FROM life_user_order o
+        LEFT JOIN order_coupon_middle ocm ON ocm.order_id = o.id
+        LEFT JOIN store_info si ON si.id = o.store_id
+        WHERE o.delete_flag = 0
         )
         )
         SELECT
         SELECT
             DATE_FORMAT(ds.hour_num, '%c-%d') AS hour_num,
             DATE_FORMAT(ds.hour_num, '%c-%d') AS hour_num,
-            COALESCE(ROUND(SUM(luo.final_price), 2), 0) AS profit
+            COALESCE(ROUND(SUM(o.final_price), 2), 0) AS profit
         FROM
         FROM
             date_sequence ds
             date_sequence ds
-                LEFT JOIN
-            life_user_order luo
+            LEFT JOIN
+            order_data o
             ON
             ON
-                (luo.used_time >= ds.hour_num
-                AND luo.used_time &lt; DATE_ADD( ds.hour_num, INTERVAL 1 DAY )
-                AND luo.`status` = 1 )
+                (o.used_time >= ds.hour_num
+                AND o.used_time &lt; DATE_ADD( ds.hour_num, INTERVAL 1 DAY )
+                AND o.`status` = 2 )
             OR
             OR
-                (luo.buy_time >= ds.hour_num
-                AND luo.buy_time &lt; DATE_ADD( ds.hour_num, INTERVAL 1 DAY )
-                AND luo.`status` = 0 )
+                (o.pay_time >= ds.hour_num
+                AND o.pay_time &lt; DATE_ADD( ds.hour_num, INTERVAL 1 DAY )
+                AND o.`status` = 1 )
         GROUP BY
         GROUP BY
             ds.hour_num
             ds.hour_num
         ORDER BY
         ORDER BY
@@ -513,22 +549,35 @@
             SELECT hour_num + 1
             SELECT hour_num + 1
             FROM month_sequence
             FROM month_sequence
             WHERE hour_num &lt; 12
             WHERE hour_num &lt; 12
+        ),
+        order_data AS (
+        SELECT
+        o.id,
+        si.commission_rate,
+        o.final_price,
+        ocm.used_time,
+        o.pay_time,
+        o.status
+        FROM life_user_order o
+        LEFT JOIN order_coupon_middle ocm ON ocm.order_id = o.id
+        LEFT JOIN store_info si ON si.id = o.store_id
+        WHERE o.delete_flag = 0
         )
         )
         SELECT
         SELECT
             CONCAT(ms.hour_num,'月') AS hour_num,
             CONCAT(ms.hour_num,'月') AS hour_num,
-            COALESCE(ROUND(SUM(luo.final_price), 2), 0) AS profit
+            COALESCE(ROUND(SUM(o.final_price), 2), 0) AS profit
         FROM
         FROM
             month_sequence ms
             month_sequence ms
-                LEFT JOIN
-            life_user_order luo
+        LEFT JOIN
+        order_data o
             ON
             ON
-                (MONTH( luo.used_time ) = ms.hour_num
-                    AND YEAR( luo.used_time ) = YEAR( #{dataTime} )
-                    AND luo.`status` = 1 )
+                (MONTH( o.used_time ) = ms.hour_num
+                    AND YEAR( o.used_time ) = YEAR( #{dataTime} )
+                    AND o.`status` = 1 )
             OR
             OR
-                (MONTH( luo.buy_time ) = ms.hour_num
-                    AND YEAR( luo.buy_time ) = YEAR( #{dataTime} )
-                    AND luo.`status` = 0 )
+                (MONTH( o.pay_time ) = ms.hour_num
+                    AND YEAR( o.pay_time ) = YEAR( #{dataTime} )
+                    AND o.`status` = 0 )
         GROUP BY
         GROUP BY
             ms.hour_num
             ms.hour_num
         ORDER BY
         ORDER BY
@@ -561,6 +610,19 @@
             UNION ALL SELECT 21
             UNION ALL SELECT 21
             UNION ALL SELECT 22
             UNION ALL SELECT 22
             UNION ALL SELECT 23
             UNION ALL SELECT 23
+        ),
+        order_data AS (
+        SELECT
+        o.id,
+        si.commission_rate,
+        o.final_price,
+        ocm.used_time,
+        o.pay_time,
+        o.status
+        FROM life_user_order o
+        LEFT JOIN order_coupon_middle ocm ON ocm.order_id = o.id
+        LEFT JOIN store_info si ON si.id = o.store_id
+        WHERE o.delete_flag = 0
         )
         )
 -- 主查询,左连接小时序列和原查询结果
 -- 主查询,左连接小时序列和原查询结果
         SELECT
         SELECT
@@ -570,21 +632,21 @@
             hours h
             hours h
                 LEFT JOIN (
                 LEFT JOIN (
                 SELECT
                 SELECT
-                    HOUR(CASE WHEN `status` = 1 THEN used_time ELSE buy_time END) AS hour_of_day,
+                    HOUR(CASE WHEN  oa.`status` = 1 THEN  oa.used_time ELSE  oa.pay_time END) AS hour_of_day,
                     COUNT(*) AS order_count
                     COUNT(*) AS order_count
                 FROM
                 FROM
-                    life_user_order
+                  order_data oa
                 WHERE
                 WHERE
                     (
                     (
-                    `status` = 1
-                  AND used_time > #{dataTime}
+                  oa.`status` = 2
+                  AND oa.used_time > #{dataTime}
                     )
                     )
                    OR (
                    OR (
-                    `status` = 0
-                  AND buy_time > #{dataTime}
+                    oa.`status` = 1
+                  AND oa.pay_time > #{dataTime}
                     )
                     )
                 GROUP BY
                 GROUP BY
-                    HOUR(CASE WHEN `status` = 1 THEN used_time ELSE buy_time END)
+                    HOUR(CASE WHEN  oa.`status` = 2 THEN  oa.used_time ELSE  oa.pay_time END)
             ) orders ON h.hour_of_day = orders.hour_of_day
             ) orders ON h.hour_of_day = orders.hour_of_day
         ORDER BY
         ORDER BY
             h.hour_of_day;
             h.hour_of_day;
@@ -596,19 +658,32 @@
             SELECT hour_num + INTERVAL 1 DAY
             SELECT hour_num + INTERVAL 1 DAY
         FROM date_sequence
         FROM date_sequence
         WHERE hour_num &lt; DATE_SUB(#{dataTime}, INTERVAL WEEKDAY(#{dataTime}) DAY) + INTERVAL 6 DAY
         WHERE hour_num &lt; DATE_SUB(#{dataTime}, INTERVAL WEEKDAY(#{dataTime}) DAY) + INTERVAL 6 DAY
-            )
+            ),
+        order_data AS (
+        SELECT
+        o.id,
+        si.commission_rate,
+        o.final_price,
+        ocm.used_time,
+        o.pay_time,
+        o.status
+        FROM life_user_order o
+        LEFT JOIN order_coupon_middle ocm ON ocm.order_id = o.id
+        LEFT JOIN store_info si ON si.id = o.store_id
+        WHERE o.delete_flag = 0
+        )
         SELECT
         SELECT
             DATE_FORMAT(ds.hour_num, '%c-%d') AS hour_num,
             DATE_FORMAT(ds.hour_num, '%c-%d') AS hour_num,
-            COALESCE(count(luo.id), 0) AS profit
+            COALESCE(count(o.id), 0) AS profit
         FROM
         FROM
             date_sequence ds
             date_sequence ds
                 LEFT JOIN
                 LEFT JOIN
-            life_user_order luo
+        order_data o
             ON
             ON
-               (luo.used_time >= ds.hour_num AND luo.used_time &lt; ds.hour_num + INTERVAL 1 DAY
-                   AND luo.`status` = 1)  or
-               (luo.buy_time >= ds.hour_num AND luo.buy_time &lt; ds.hour_num + INTERVAL 1 DAY
-                   AND luo.`status` = 0)
+               (o.used_time >= ds.hour_num AND o.used_time &lt; ds.hour_num + INTERVAL 1 DAY
+                   AND o.`status` = 2)  or
+               (o.pay_time >= ds.hour_num AND o.pay_time &lt; ds.hour_num + INTERVAL 1 DAY
+                   AND o.`status` = 1)
         GROUP BY
         GROUP BY
             ds.hour_num
             ds.hour_num
         ORDER BY
         ORDER BY
@@ -621,19 +696,32 @@
             SELECT DATE_ADD(hour_num, INTERVAL 1 DAY)
             SELECT DATE_ADD(hour_num, INTERVAL 1 DAY)
             FROM date_sequence
             FROM date_sequence
             WHERE DATE_ADD(hour_num, INTERVAL 1 DAY)  &lt;= LAST_DAY(#{dataTime})
             WHERE DATE_ADD(hour_num, INTERVAL 1 DAY)  &lt;= LAST_DAY(#{dataTime})
+        ),
+        order_data AS (
+        SELECT
+        o.id,
+        si.commission_rate,
+        o.final_price,
+        ocm.used_time,
+        o.pay_time,
+        o.status
+        FROM life_user_order o
+        LEFT JOIN order_coupon_middle ocm ON ocm.order_id = o.id
+        LEFT JOIN store_info si ON si.id = o.store_id
+        WHERE o.delete_flag = 0
         )
         )
         SELECT
         SELECT
             DATE_FORMAT(ds.hour_num, '%c-%d') AS hour_num,
             DATE_FORMAT(ds.hour_num, '%c-%d') AS hour_num,
-            COALESCE(count(luo.id), 0) AS profit
+            COALESCE(count(o.id), 0) AS profit
         FROM
         FROM
             date_sequence ds
             date_sequence ds
                 LEFT JOIN
                 LEFT JOIN
-            life_user_order luo
+        order_data o
                 ON
                 ON
-                (luo.used_time >= ds.hour_num AND luo.used_time &lt; ds.hour_num + INTERVAL 1 DAY
-                   AND luo.`status` = 1)  or
-               (luo.buy_time >= ds.hour_num AND luo.buy_time &lt; ds.hour_num + INTERVAL 1 DAY
-                   AND luo.`status` = 0)
+                (o.used_time >= ds.hour_num AND o.used_time &lt; ds.hour_num + INTERVAL 1 DAY
+                   AND o.`status` = 2)  or
+               (o.pay_time >= ds.hour_num AND o.pay_time &lt; ds.hour_num + INTERVAL 1 DAY
+                   AND o.`status` = 1)
         GROUP BY
         GROUP BY
             ds.hour_num
             ds.hour_num
         ORDER BY
         ORDER BY
@@ -649,29 +737,42 @@
             SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL
             SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL
             SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12
             SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12
             ) seq
             ) seq
-            )
+            ),
+        order_data AS (
+        SELECT
+        o.id,
+        si.commission_rate,
+        o.final_price,
+        ocm.used_time,
+        o.pay_time,
+        o.status
+        FROM life_user_order o
+        LEFT JOIN order_coupon_middle ocm ON ocm.order_id = o.id
+        LEFT JOIN store_info si ON si.id = o.store_id
+        WHERE o.delete_flag = 0
+        )
         SELECT
         SELECT
-            CONCAT(MONTH(STR_TO_DATE(m.MONTH, '%Y-%m')),'月') AS hour_num,
+            m.MONTH AS hour_num,
             COALESCE(orders.order_count, 0) AS profit
             COALESCE(orders.order_count, 0) AS profit
         FROM
         FROM
             months m
             months m
                 LEFT JOIN (
                 LEFT JOIN (
                 SELECT
                 SELECT
-                    DATE_FORMAT(CASE WHEN `status` = 1 THEN used_time ELSE buy_time END, '%Y-%m') AS month,
+                    DATE_FORMAT(CASE WHEN oa.`status` = 1 THEN oa.used_time ELSE oa.pay_time END, '%Y-%m') AS month,
         COUNT(*) AS order_count
         COUNT(*) AS order_count
                 FROM
                 FROM
-                    life_user_order
+              order_data oa
                 WHERE
                 WHERE
                     (
                     (
-                    `status` = 1
-                  AND used_time > #{dataTime}
+                    oa.`status` = 2
+                  AND oa.used_time > #{dataTime}
                     )
                     )
                    OR (
                    OR (
-                    `status` = 0
-                  AND buy_time > #{dataTime}
+                    oa.`status` = 1
+                  AND pay_time > #{dataTime}
                     )
                     )
                 GROUP BY
                 GROUP BY
-                    DATE_FORMAT(CASE WHEN `status` = 1 THEN used_time ELSE buy_time END, '%Y-%m')
+                    DATE_FORMAT(CASE WHEN `status` = 2 THEN used_time ELSE pay_time END, '%Y-%m')
             ) orders ON m.month = orders.month
             ) orders ON m.month = orders.month
         ORDER BY
         ORDER BY
             m.month;
             m.month;
@@ -689,15 +790,15 @@
         FROM
         FROM
         life_user_order
         life_user_order
         WHERE
         WHERE
-        ( `status` = 1 AND used_time >= #{startTime} AND used_time &lt; #{endTime})
-        OR ( `status` = 0  AND buy_time >= #{startTime} AND buy_time &lt; #{endTime})
+        ( `status` = 7 AND finish_time >= #{startTime} AND finish_time &lt; #{endTime})
+        OR ( `status` = 1  AND pay_time >= #{startTime} AND pay_time &lt; #{endTime})
         GROUP BY
         GROUP BY
         store_id
         store_id
         LIMIT 10
         LIMIT 10
         ) statistic
         ) statistic
         LEFT JOIN store_info store ON store.id = statistic.store_id
         LEFT JOIN store_info store ON store.id = statistic.store_id
         ORDER BY
         ORDER BY
-        profit DESC
+        profit DESC limit 10
     </select>
     </select>
     <select id="getStorePlatformProfitDetails" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
     <select id="getStorePlatformProfitDetails" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
         SELECT
         SELECT
@@ -712,10 +813,10 @@
         WHERE
         WHERE
             `status` = 2
             `status` = 2
         <if test="startTime != null and startTime != ''" >
         <if test="startTime != null and startTime != ''" >
-            AND used_time > #{startTime}
+            AND `order`.updated_time > #{startTime}
         </if>
         </if>
         <if test="endTime != null and endTime != ''" >
         <if test="endTime != null and endTime != ''" >
-            AND used_time &lt; #{endTime}
+            AND `order`.updated_time &lt; #{endTime}
         </if>
         </if>
         <if test="storeId != null and storeId != ''" >
         <if test="storeId != null and storeId != ''" >
             AND store_id like concat('%',#{storeId},'%')
             AND store_id like concat('%',#{storeId},'%')
@@ -745,9 +846,9 @@
         FROM
         FROM
             life_user_order `order`
             life_user_order `order`
         WHERE
         WHERE
-            delete_flag = 0
+            1=1
                 <if test="dataTime != null and dataTime != ''">
                 <if test="dataTime != null and dataTime != ''">
-                         AND buy_time > #{dataTime}
+                         AND created_time > #{dataTime}
                 </if>
                 </if>
     </select>
     </select>
     <select id="getStorePlatformOrderVolume" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
     <select id="getStorePlatformOrderVolume" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
@@ -809,8 +910,8 @@
                 AND store.store_name like concat('%',#{storeName},'%')
                 AND store.store_name like concat('%',#{storeName},'%')
             </if>
             </if>
         </where>
         </where>
-        ORDER BY
-        `order`.created_time DESC
+        GROUP by `order`.`id`
+        ORDER BY `order`.created_time DESC
     </select>
     </select>
     <select id="getRefundAmount" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
     <select id="getRefundAmount" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
         SELECT
         SELECT
@@ -818,7 +919,7 @@
         FROM
         FROM
             life_user_order `order`
             life_user_order `order`
         WHERE
         WHERE
-            `status` = 4
+            `status` = 5
         <if test="dataTime != null and dataTime != ''" >
         <if test="dataTime != null and dataTime != ''" >
             AND `order`.refund_time > #{dataTime}
             AND `order`.refund_time > #{dataTime}
         </if>
         </if>

+ 5 - 4
alien-entity/src/main/resources/mapper/PlatformLifeUserMapper.xml

@@ -28,10 +28,11 @@
         ifnull(orders.consume_num, 0) consume_num,
         ifnull(orders.consume_num, 0) consume_num,
         ifnull(orders.consume_price, 0) consume_price,
         ifnull(orders.consume_price, 0) consume_price,
         IFNULL(comment.bad_num, 0) AS bad_num,
         IFNULL(comment.bad_num, 0) AS bad_num,
-        (
-        IFNULL((SELECT SUM(like_count) FROM store_comment WHERE user_id = user.id), 0) +
-        IFNULL((SELECT SUM(dianzan_count) FROM life_user_dynamics WHERE phone_id = user.user_phone), 0)
-        ) AS likesNumber,
+--         (
+--         IFNULL((SELECT SUM(like_count) FROM store_comment WHERE user_id = user.id), 0) +
+        IFNULL((SELECT SUM(dianzan_count) FROM life_user_dynamics WHERE phone_id = phoneId), 0)
+--         )
+            AS likesNumber,
         COUNT(lf.id) AS fans_count,
         COUNT(lf.id) AS fans_count,
         lue.id as expert_id,
         lue.id as expert_id,
         lue.expert_code as expert_code
         lue.expert_code as expert_code

+ 3 - 0
alien-entity/src/main/resources/mapper/second/SecondGoodsInfoMapper.xml

@@ -66,6 +66,7 @@
             g.goods_status,
             g.goods_status,
             g.delete_flag,
             g.delete_flag,
             g.release_time,
             g.release_time,
+            g.video_first_frame,
             ROUND(ST_Distance_Sphere(ST_GeomFromText(CONCAT('POINT(', REPLACE(#{position}, ',', ' '), ')' )), ST_GeomFromText(CONCAT('POINT(', REPLACE(g.position, ',', ' '), ')' ))) / 1000, 2) AS dist,
             ROUND(ST_Distance_Sphere(ST_GeomFromText(CONCAT('POINT(', REPLACE(#{position}, ',', ' '), ')' )), ST_GeomFromText(CONCAT('POINT(', REPLACE(g.position, ',', ' '), ')' ))) / 1000, 2) AS dist,
             case when llr.id is null then '0' else '1' end likeStatus,
             case when llr.id is null then '0' else '1' end likeStatus,
             g.home_image,
             g.home_image,
@@ -115,6 +116,7 @@
             CONCAT('user_', u.user_phone) as user_phone,
             CONCAT('user_', u.user_phone) as user_phone,
             g.goods_status,
             g.goods_status,
             g.home_image,
             g.home_image,
+            g.video_first_frame,
             case when llr.id is null then '0' else '1' end likeStatus,
             case when llr.id is null then '0' else '1' end likeStatus,
             case when lc.id is null then '0' else '1' end collectStatus,
             case when lc.id is null then '0' else '1' end collectStatus,
             (select count(1) from (SELECT id FROM store_comment c where c.business_id = g.id and c.business_type = 7 and c.delete_flag = 0 UNION ALL
             (select count(1) from (SELECT id FROM store_comment c where c.business_id = g.id and c.business_type = 7 and c.delete_flag = 0 UNION ALL
@@ -198,6 +200,7 @@
             g.delete_flag,
             g.delete_flag,
             ROUND(ST_Distance_Sphere(ST_GeomFromText(CONCAT('POINT(', REPLACE(#{position}, ',', ' '), ')' )), ST_GeomFromText(CONCAT('POINT(', REPLACE(g.position, ',', ' '), ')' ))) / 1000, 2) AS dist,
             ROUND(ST_Distance_Sphere(ST_GeomFromText(CONCAT('POINT(', REPLACE(#{position}, ',', ' '), ')' )), ST_GeomFromText(CONCAT('POINT(', REPLACE(g.position, ',', ' '), ')' ))) / 1000, 2) AS dist,
             g.home_image,
             g.home_image,
+            g.video_first_frame,
             case when llr.id is null then '0' else '1' end likeStatus,
             case when llr.id is null then '0' else '1' end likeStatus,
             case when lc.id is null then '0' else '1' end collectStatus,
             case when lc.id is null then '0' else '1' end collectStatus,
             (select count(1) from (SELECT id FROM store_comment c where c.business_id = g.id and c.business_type = 7 and c.delete_flag = 0 UNION ALL
             (select count(1) from (SELECT id FROM store_comment c where c.business_id = g.id and c.business_type = 7 and c.delete_flag = 0 UNION ALL

+ 95 - 0
alien-entity/src/main/resources/mapper/second/SecondUserViolationMapper.xml

@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="shop.alien.mapper.second.SecondUserViolationMapper">
+    <resultMap id="BaseResultMap" type="shop.alien.entity.second.vo.SecondUserViolationVo">
+        <!--@mbggenerated-->
+        <id column="id" property="id" jdbcType="INTEGER"/>
+        <result column="reported_user_name" property="reportedUserName" jdbcType="VARCHAR"/>
+        <result column="reported_user_phone" property="reportedUserPhone" jdbcType="VARCHAR"/>
+        <result column="reporting_user_name" property="reportingUserName" jdbcType="VARCHAR"/>
+        <result column="reporting_user_phone" property="reportingUserPhone" jdbcType="VARCHAR"/>
+        <result column="report_context" property="reportContext" jdbcType="VARCHAR"/>
+        <result column="report_context_type" property="reportContextType" jdbcType="VARCHAR"/>
+        <result column="dict_detail" property="dictDetail" jdbcType="VARCHAR"/>
+        <result column="processing_context" property="processingContext" jdbcType="VARCHAR"/>
+        <result column="processing_status" property="processingStatus" jdbcType="VARCHAR"/>
+        <result column="business_id" property="businessId" jdbcType="INTEGER"/>
+        <result column="created_time" property="reportingDate" jdbcType="TIMESTAMP"/>
+        <result column="other_reason_content" property="otherReasonContent" jdbcType="VARCHAR"/>
+        <result column="report_evidence_img" property="reportEvidenceImg" jdbcType="VARCHAR"/>
+        <result column="processing_time" property="processingTime" jdbcType="TIMESTAMP"/>
+        <result column="report_result" property="reportResult" jdbcType="VARCHAR"/>
+        <result column="video_first_frame" property="videoFirstFrame" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <!-- 分页查询举报信息 -->
+    <select id="getUserViolationByPage" resultType="shop.alien.entity.second.vo.SecondUserViolationVo">
+        select
+            v.id,
+            u.user_name reporting_user_name,
+            u.user_phone reporting_user_phone,
+            case when v.report_context_type = 4 then '二手商品' else '二手用户' end report_context,
+            v.report_context_type,
+            d.dict_detail dict_detail,
+            case when v.processing_status = 0 then '待处理'
+                when v.processing_status = 1 then '已通过'
+                else '已驳回' end processing_context,
+            v.processing_status,
+            v.created_time as reportingDate,
+            v.business_id
+        from
+        life_user_violation v
+        left join store_dictionary d on v.dict_type = d.type_name and v.dict_id = d.dict_id
+        left join life_user u on u.id = v.reporting_user_id
+        where 1 = 1
+        <if test="reportingUserName != null and reportingUserName != ''">
+            and u.user_name like concat('%',#{reportingUserName},'%')
+        </if>
+        <if test="reportingDate != null and reportingDate != ''">
+            and DATE_FORMAT(v.created_time, '%Y-%m-%d') = #{reportingDate}
+        </if>
+        <if test="processingStatus != null and processingStatus != ''">
+            and v.processing_status = #{processingStatus}
+        </if>
+        <if test="reportContextType != null and reportContextType != ''">
+            and v.report_context_type = #{reportContextType}
+        </if>
+        <if test="reportContextType == null or reportContextType == ''">
+            and (v.report_context_type = 4 or v.report_context_type = 5)
+        </if>
+        order by v.created_time desc
+    </select>
+
+    <!-- 分页查询举报信息 -->
+    <select id="getUserViolationInfo" resultType="shop.alien.entity.second.vo.SecondUserViolationDetailVo">
+        select
+            v.id,
+            case when v.report_context_type = 4 then lu1.user_name else u.user_name end reported_user_name,
+            case when v.report_context_type = 4 then lu1.user_phone else u.user_phone end reported_user_phone,
+            lu.user_name reporting_user_name,
+            lu.user_phone reporting_user_phone,
+            v.created_time,
+            case when v.processing_status = 0 then '待处理' when v.processing_status = 1 then '已通过' else '已驳回' end processing_status,
+            d.dict_detail,
+            v.business_id,
+            v.report_context_type,
+            v.processing_status,
+            v.other_reason_content,
+            v.report_evidence_img,
+            v.processing_time,
+            v.report_result,
+            v.video_first_frame
+        from
+        life_user_violation v
+        left join life_user u on v.reported_user_id = u.id
+        left join life_user lu on v.reporting_user_id = lu.id
+        left join store_dictionary d on v.dict_type = d.type_name
+            and v.dict_id = d.dict_id
+        left join second_goods_record g on g.id = v.business_id
+        left join life_user lu1 on g.user_id = lu1.id
+        <if test="id != null and id != ''">
+            where v.id = #{id}
+        </if>
+    </select>
+
+</mapper>

+ 13 - 0
alien-gateway/pom.xml

@@ -103,6 +103,13 @@
             <artifactId>fastjson</artifactId>
             <artifactId>fastjson</artifactId>
         </dependency>
         </dependency>
 
 
+        <!-- 验证码 -->
+        <dependency>
+            <groupId>pro.fessional</groupId>
+            <artifactId>kaptcha</artifactId>
+        </dependency>
+
+
         <!--Swagger Start-->
         <!--Swagger Start-->
         <dependency>
         <dependency>
             <groupId>io.springfox</groupId>
             <groupId>io.springfox</groupId>
@@ -180,10 +187,16 @@
         </dependency>
         </dependency>
 
 
         <dependency>
         <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+
+        <dependency>
             <groupId>javax.xml.bind</groupId>
             <groupId>javax.xml.bind</groupId>
             <artifactId>jaxb-api</artifactId>
             <artifactId>jaxb-api</artifactId>
         </dependency>
         </dependency>
 
 
+
     </dependencies>
     </dependencies>
 
 
     <build>
     <build>

+ 4 - 2
alien-gateway/src/main/java/shop/alien/gateway/AlienGatewayApplication.java

@@ -3,6 +3,7 @@ package shop.alien.gateway;
 import org.mybatis.spring.annotation.MapperScan;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.ComponentScan;
 
 
 /**
 /**
@@ -13,7 +14,8 @@ import org.springframework.context.annotation.ComponentScan;
  * @date 2025/1/21 16:58
  * @date 2025/1/21 16:58
  */
  */
 @ComponentScan({"shop.alien.gateway.*"})
 @ComponentScan({"shop.alien.gateway.*"})
-@MapperScan({"shop.alien.gateway.mapper"})
+@MapperScan(basePackages = {"shop.alien.gateway.mapper", "shop.alien.mapper"})
+@EnableFeignClients(basePackages = "shop.alien.gateway.feign")
 @SpringBootApplication
 @SpringBootApplication
 public class AlienGatewayApplication {
 public class AlienGatewayApplication {
 
 
@@ -26,4 +28,4 @@ public class AlienGatewayApplication {
         SpringApplication.run(AlienGatewayApplication.class, args);
         SpringApplication.run(AlienGatewayApplication.class, args);
     }
     }
 
 
-}
+}

+ 57 - 0
alien-gateway/src/main/java/shop/alien/gateway/config/BeanConfig.java

@@ -0,0 +1,57 @@
+package shop.alien.gateway.config;
+
+import com.google.code.kaptcha.impl.DefaultKaptcha;
+import com.google.code.kaptcha.util.Config;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.Properties;
+
+import static com.google.code.kaptcha.Constants.*;
+
+/**
+ * @author ssk
+ * @version 1.0
+ * @date 2025/10/31 14:46
+ */
+@Configuration
+public class BeanConfig {
+
+    @Bean(name = "captchaProducerMath")
+    public DefaultKaptcha getKaptchaBeanMath() {
+        DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
+        Properties properties = new Properties();
+        // 是否有边框 默认为true 我们可以自己设置yes,no
+        properties.setProperty(KAPTCHA_BORDER, "yes");
+        // 边框颜色 默认为Color.BLACK
+        properties.setProperty(KAPTCHA_BORDER_COLOR, "105,179,90");
+        // 验证码文本字符颜色 默认为Color.BLACK
+        properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_COLOR, "blue");
+        // 验证码图片宽度 默认为200
+        properties.setProperty(KAPTCHA_IMAGE_WIDTH, "160");
+        // 验证码图片高度 默认为50
+        properties.setProperty(KAPTCHA_IMAGE_HEIGHT, "60");
+        // 验证码文本字符大小 默认为40
+        properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_SIZE, "35");
+        // KAPTCHA_SESSION_KEY
+        properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCodeMath");
+        // 验证码文本生成器 使用默认实现
+        properties.setProperty(KAPTCHA_TEXTPRODUCER_IMPL, "shop.alien.gateway.util.KaptchaTextCreator");
+        // 验证码文本字符间距 默认为2
+        properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, "3");
+        // 验证码文本字符长度 默认为5
+        properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_LENGTH, "6");
+        // 验证码文本字体样式 默认为new Font("Arial", 1, fontSize), new Font("Courier", 1, fontSize)
+        properties.setProperty(KAPTCHA_TEXTPRODUCER_FONT_NAMES, "Arial,Courier");
+        // 验证码噪点颜色 默认为Color.BLACK
+        properties.setProperty(KAPTCHA_NOISE_COLOR, "white");
+        // 干扰实现类
+        properties.setProperty(KAPTCHA_NOISE_IMPL, "com.google.code.kaptcha.impl.NoNoise");
+        // 图片样式 水纹com.google.code.kaptcha.impl.WaterRipple 鱼眼com.google.code.kaptcha.impl.FishEyeGimpy 阴影com.google.code.kaptcha.impl.ShadowGimpy
+        properties.setProperty(KAPTCHA_OBSCURIFICATOR_IMPL, "com.google.code.kaptcha.impl.ShadowGimpy");
+        Config config = new Config(properties);
+        defaultKaptcha.setConfig(config);
+        return defaultKaptcha;
+    }
+
+}

+ 4 - 4
alien-gateway/src/main/java/shop/alien/gateway/config/JwtTokenFilter.java

@@ -25,8 +25,8 @@ import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
 import reactor.core.publisher.Mono;
 import shop.alien.entity.store.LifeUser;
 import shop.alien.entity.store.LifeUser;
 import shop.alien.entity.store.StoreUser;
 import shop.alien.entity.store.StoreUser;
-import shop.alien.gateway.mapper.LifeUserMapper;
-import shop.alien.gateway.mapper.StoreUserMapper;
+import shop.alien.gateway.mapper.LifeUserGatewayMapper;
+import shop.alien.gateway.mapper.StoreUserGatewayMapper;
 import shop.alien.util.common.JwtUtil;
 import shop.alien.util.common.JwtUtil;
 
 
 import java.nio.charset.StandardCharsets;
 import java.nio.charset.StandardCharsets;
@@ -57,10 +57,10 @@ public class JwtTokenFilter implements GlobalFilter, Ordered {
     private BaseRedisService baseRedisService;
     private BaseRedisService baseRedisService;
 
 
     @Autowired
     @Autowired
-    private StoreUserMapper storeUserMapper;
+    private StoreUserGatewayMapper storeUserMapper;
 
 
     @Autowired
     @Autowired
-    private LifeUserMapper lifeUserMapper;
+    private LifeUserGatewayMapper lifeUserMapper;
 
 
     /**
     /**
      * 过滤器
      * 过滤器

+ 120 - 0
alien-gateway/src/main/java/shop/alien/gateway/config/RiskControlProperties.java

@@ -0,0 +1,120 @@
+package shop.alien.gateway.config;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.stereotype.Component;
+
+@Data
+@Component
+@RefreshScope
+@ConfigurationProperties(prefix = "risk-control")
+public class RiskControlProperties {
+
+    /**
+     * 洗钱嫌疑规则配置
+     */
+    private MoneyLaundering moneyLaundering = new MoneyLaundering();
+
+    /**
+     * 账号异常规则配置
+     */
+    private AccountAbnormal accountAbnormal = new AccountAbnormal();
+
+    /**
+     * 交易欺诈规则配置
+     */
+    private TradeFraud tradeFraud = new TradeFraud();
+
+    /**
+     * 异常发布规则配置
+     */
+    private AbnormalPublish abnormalPublish = new AbnormalPublish();
+
+    @Data
+    public static class MoneyLaundering {
+        /**
+         * 每天交易次数阈值
+         */
+        private int dailyCount = 5;
+
+        /**
+         * 每笔交易金额阈值(元)
+         */
+        private double amountThreshold = 200.0;
+
+        /**
+         * 风险类型
+         */
+        private String riskType = "洗钱嫌疑";
+
+        /**
+         * 检测指标
+         */
+        private String detectIndicator = "高频高价交易";
+    }
+
+    @Data
+    public static class AccountAbnormal {
+        /**
+         * 24小时内同一设备/mac注册账号数量阈值
+         */
+        private int regCount24h = 3;
+
+        /**
+         * 风险类型
+         */
+        private String riskType = "账号异常";
+
+        /**
+         * 检测指标
+         */
+        private String detectIndicator = "同一设备24小时内注册超过3个账号";
+    }
+
+    @Data
+    public static class TradeFraud {
+        /**
+         * 24小时内发布成功记录次数阈值
+         */
+        private int publishCount24h = 3;
+
+        /**
+         * 时间窗口(小时)
+         */
+        private int timeWindowHours = 24;
+
+        /**
+         * 风险类型
+         */
+        private String riskType = "交易欺诈";
+
+        /**
+         * 检测指标
+         */
+        private String detectIndicator = "用户频繁修改商品";
+    }
+
+    @Data
+    public static class AbnormalPublish {
+        /**
+         * 24小时内发布同类商品数量阈值
+         */
+        private int sameCategoryCount24h = 10;
+        
+        /**
+         * 时间窗口(小时)
+         */
+        private int timeWindowHours = 24;
+
+        /**
+         * 风险类型
+         */
+        private String riskType = "异常发布";
+
+        /**
+         * 检测指标
+         */
+        private String detectIndicator = "短时间大量发布同类商品";
+    }
+}

+ 70 - 0
alien-gateway/src/main/java/shop/alien/gateway/controller/CaptchaImageController.java

@@ -0,0 +1,70 @@
+package shop.alien.gateway.controller;
+
+import com.google.code.kaptcha.Producer;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.FastByteArrayOutputStream;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import reactor.core.publisher.Mono;
+import shop.alien.entity.result.R;
+import shop.alien.gateway.config.BaseRedisService;
+import shop.alien.gateway.util.Base64;
+
+import javax.annotation.Resource;
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * @author ssk
+ * @version 1.0
+ * @date 2025/10/31 14:12
+ */
+@RestController
+@RequestMapping("/captcha")
+public class CaptchaImageController {
+
+    @Resource(name = "captchaProducerMath")
+    private Producer captchaProducerMath;
+
+    @Autowired
+    private BaseRedisService redisCache;
+
+    /**
+     * 5分钟
+     */
+    private Long CAPTCHA_EXPIRATION = 5 * 60 * 1000L;
+
+    /**
+     * 生成验证码
+     */
+    @GetMapping("/captchaImage")
+    public Mono<R<Map<String, String>>> getCode() {
+        Map<String, String> resultMap = new HashMap<>();
+        // 保存验证码信息
+        String uuid = UUID.randomUUID().toString();
+        String verifyKey = "captcha_codes:" + uuid;
+        String capStr, code;
+        BufferedImage image;
+        String capText = captchaProducerMath.createText();
+        capStr = capText.substring(0, capText.lastIndexOf("@"));
+        code = capText.substring(capText.lastIndexOf("@") + 1);
+        image = captchaProducerMath.createImage(capStr);
+        redisCache.setString(verifyKey, code, CAPTCHA_EXPIRATION);
+        // 转换流信息写出
+        FastByteArrayOutputStream os = new FastByteArrayOutputStream();
+        try {
+            ImageIO.write(image, "jpg", os);
+        } catch (IOException e) {
+            return Mono.just(R.fail("验证码生成失败"));
+        }
+        resultMap.put("uuid", uuid);
+        resultMap.put("img", "data:image/gif;base64," + Base64.encode(os.toByteArray()));
+        return Mono.just(R.data(resultMap));
+    }
+
+}

+ 35 - 5
alien-gateway/src/main/java/shop/alien/gateway/controller/LifeUserController.java

@@ -3,9 +3,12 @@ package shop.alien.gateway.controller;
 import io.swagger.annotations.*;
 import io.swagger.annotations.*;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 import shop.alien.entity.result.R;
 import shop.alien.entity.result.R;
 import shop.alien.entity.store.vo.LifeUserVo;
 import shop.alien.entity.store.vo.LifeUserVo;
+import shop.alien.gateway.config.BaseRedisService;
+import shop.alien.gateway.service.ActivityInviteConfigService;
 import shop.alien.gateway.service.LifeUserService;
 import shop.alien.gateway.service.LifeUserService;
 
 
 /**
 /**
@@ -19,18 +22,45 @@ import shop.alien.gateway.service.LifeUserService;
 @RequiredArgsConstructor
 @RequiredArgsConstructor
 public class LifeUserController {
 public class LifeUserController {
 
 
-    private final LifeUserService service;
+    private final LifeUserService lifeUserService;
+
+    private final BaseRedisService baseRedisService;
+
+    private final ActivityInviteConfigService activityInviteConfigService;
 
 
     @ApiOperation("用户登录")
     @ApiOperation("用户登录")
     @ApiOperationSupport(order = 1)
     @ApiOperationSupport(order = 1)
-    @ApiImplicitParams({@ApiImplicitParam(name = "phoneNum", value = "手机号", dataType = "String", paramType = "query", required = true)})
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "phoneNum", value = "手机号", dataType = "String", paramType = "query", required = true),
+            @ApiImplicitParam(name = "code", value = "验证码", dataType = "String", paramType = "query", required = true),
+            @ApiImplicitParam(name = "inviteCode", value = "邀请码", dataType = "String", paramType = "query", required = false),
+            @ApiImplicitParam(name = "inviteCode", value = "邀请码", dataType = "String", paramType = "query", required = false)
+    })
     @GetMapping("/userLogin")
     @GetMapping("/userLogin")
-    public R<LifeUserVo> userLogin(@RequestParam("phoneNum") String phoneNum) {
-        log.info("LifeUserController.userLogin?phoneNum={}", phoneNum);
-        LifeUserVo userVo = service.userLogin(phoneNum);
+    public R<LifeUserVo> userLogin(@RequestParam("phoneNum") String phoneNum,
+                                   @RequestParam("code") String code,
+                                   @RequestParam(value = "macIp", required = false) String macIp,
+                                   @RequestParam(value = "inviteCode", required = false) String inviteCode) {
+        log.info("LifeUserController.userLogin?phoneNum={}&code={}", phoneNum, code);
+        // 2025-11-04 验证码-用户端登录
+        String cacheCode = baseRedisService.getString("verification_user_login_" + phoneNum);
+        if (null == cacheCode) {
+            return R.fail("当验证码过期或未发送");
+        }
+        if (!cacheCode.trim().equals(code.trim())) {
+            return R.fail("验证码错误");
+        }
+        LifeUserVo userVo = lifeUserService.userLogin(phoneNum, inviteCode, macIp);
         if (null == userVo) {
         if (null == userVo) {
             return R.fail("登录失败");
             return R.fail("登录失败");
         }
         }
+
+        if(StringUtils.isNotBlank(inviteCode)){
+           String bindResult =  activityInviteConfigService.bindInviteCode(userVo.getId(), inviteCode);
+           if(StringUtils.isNotBlank(bindResult) && !bindResult.equals("绑定成功")){
+               return R.fail(bindResult);
+           }
+        }
         return R.data(userVo);
         return R.data(userVo);
     }
     }
 
 

+ 27 - 7
alien-gateway/src/main/java/shop/alien/gateway/controller/StoreUserController.java

@@ -8,7 +8,8 @@ import org.springframework.web.bind.annotation.*;
 import shop.alien.entity.result.R;
 import shop.alien.entity.result.R;
 import shop.alien.entity.store.StoreUser;
 import shop.alien.entity.store.StoreUser;
 import shop.alien.entity.store.vo.StoreUserVo;
 import shop.alien.entity.store.vo.StoreUserVo;
-import shop.alien.gateway.mapper.StoreUserMapper;
+import shop.alien.gateway.config.BaseRedisService;
+import shop.alien.gateway.mapper.StoreUserGatewayMapper;
 import shop.alien.gateway.service.StoreUserService;
 import shop.alien.gateway.service.StoreUserService;
 
 
 import java.util.Objects;
 import java.util.Objects;
@@ -30,17 +31,36 @@ import java.util.Optional;
 public class StoreUserController {
 public class StoreUserController {
 
 
     private final StoreUserService storeUserService;
     private final StoreUserService storeUserService;
-    private final StoreUserMapper storeUserMapper;
+
+    private final StoreUserGatewayMapper storeUserMapper;
+
+    private final BaseRedisService baseRedisService;
 
 
     @ApiOperation("门店用户登录")
     @ApiOperation("门店用户登录")
     @ApiOperationSupport(order = 1)
     @ApiOperationSupport(order = 1)
-    @ApiImplicitParams({@ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true),
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "phone", value = "手机号", dataType = "String", paramType = "query", required = true),
             @ApiImplicitParam(name = "password", value = "密码", dataType = "String", paramType = "query", required = true),
             @ApiImplicitParam(name = "password", value = "密码", dataType = "String", paramType = "query", required = true),
-            @ApiImplicitParam(name = "isPassword", value = "是否密码登录", dataType = "Boolean", paramType = "query", required = true)})
+            @ApiImplicitParam(name = "isPassword", value = "是否密码登录", dataType = "Boolean", paramType = "query", required = true),
+            @ApiImplicitParam(name = "code", value = "验证码", dataType = "String", paramType = "query", required = true)
+    })
     @GetMapping("/login")
     @GetMapping("/login")
-    public R<StoreUserVo> login(String phone, String password,
-                                @RequestParam(defaultValue = "true", required = false) Boolean isPassword) {
-        log.info("StoreUserController.login?phone={}&password={}&isPassword={}", phone, password, isPassword);
+    public R<StoreUserVo> login(
+            @RequestParam("phone") String phone,
+            @RequestParam("password") String password,
+            @RequestParam("isPassword") Boolean isPassword,
+            @RequestParam("code") String code) {
+        log.info("StoreUserController.login?phone={}&password={}&isPassword={}&code={}", phone, password, isPassword, code);
+        if (!isPassword) {
+            // 2025-11-04 验证码-商户端登录
+            String cacheCode = baseRedisService.getString("verification_store_login_" + phone);
+            if (null == cacheCode) {
+                return R.fail("验证码过期或未发送");
+            }
+            if (!cacheCode.trim().equals(code.trim())) {
+                return R.fail("验证码错误");
+            }
+        }
         StoreUser storeUser = storeUserMapper.selectOne(new LambdaQueryWrapper<StoreUser>()
         StoreUser storeUser = storeUserMapper.selectOne(new LambdaQueryWrapper<StoreUser>()
                 .eq(StoreUser::getPhone, phone));
                 .eq(StoreUser::getPhone, phone));
         if (null == storeUser) {
         if (null == storeUser) {

+ 36 - 0
alien-gateway/src/main/java/shop/alien/gateway/feign/SecondServiceFeign.java

@@ -0,0 +1,36 @@
+package shop.alien.gateway.feign;
+
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@FeignClient(name = "alien-second", url = "${feign.alienSecond.url}")
+public interface SecondServiceFeign {
+    
+    /**
+     * 记录风控数据
+     *
+     * @param userId     用户ID
+     * @param ruleType   规则类型 1:洗钱嫌疑 2:账号异常 3:交易欺诈 4:异常发布
+     * @param ruleName   规则名称
+     * @param businessId 业务ID
+     * @param detailInfo 详细信息(JSON格式)
+     */
+    @PostMapping("/riskControl/record")
+    void recordRiskControlData(@RequestParam("userId") Integer userId,
+                               @RequestParam("ruleType") Integer ruleType,
+                               @RequestParam("ruleName") String ruleName,
+                               @RequestParam("businessId") String businessId,
+                               @RequestParam("detailInfo") String detailInfo);
+
+    /**
+     * 用户积分数据
+     *
+     * @param userId     用户ID
+     * @param initialPoints   用户积分
+     */
+    @PostMapping("/userPoints/create")
+    void createPointsRecord(@RequestParam("userId") Integer userId,
+                            @RequestParam("initialPoints") Integer initialPoints,
+                            @RequestParam("pointsType") Integer pointsType);
+}

+ 1 - 1
alien-gateway/src/main/java/shop/alien/gateway/mapper/LifeSysMapper.java → alien-gateway/src/main/java/shop/alien/gateway/mapper/LifeSysGatewayMapper.java

@@ -8,5 +8,5 @@ import shop.alien.entity.store.LifeSys;
  * 系统用户
  * 系统用户
  */
  */
 @Mapper
 @Mapper
-public interface LifeSysMapper extends BaseMapper<LifeSys> {
+public interface LifeSysGatewayMapper extends BaseMapper<LifeSys> {
 }
 }

+ 1 - 1
alien-gateway/src/main/java/shop/alien/gateway/mapper/LifeUserMapper.java → alien-gateway/src/main/java/shop/alien/gateway/mapper/LifeUserGatewayMapper.java

@@ -8,6 +8,6 @@ import shop.alien.entity.store.LifeUser;
  * 用户
  * 用户
  */
  */
 @Mapper
 @Mapper
-public interface LifeUserMapper extends BaseMapper<LifeUser> {
+public interface LifeUserGatewayMapper extends BaseMapper<LifeUser> {
 
 
 }
 }

+ 27 - 0
alien-gateway/src/main/java/shop/alien/gateway/mapper/LifeUserLogGatewayMapper.java

@@ -0,0 +1,27 @@
+package shop.alien.gateway.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import shop.alien.entity.second.LifeUserLog;
+
+import java.util.List;
+
+@Mapper
+public interface LifeUserLogGatewayMapper extends BaseMapper<LifeUserLog> {
+
+    /**
+     * 查询时间段内同一个macip地址的登录记录
+     *
+     * @param starDate 开始日期
+     * @param endDate 结束日期
+     * @return 同一个macip地址的登录记录
+     */
+    @Select("SELECT user_id, user_name, mac_ip FROM life_user_log " +
+            " WHERE created_time BETWEEN DATE_FORMAT(#{starDate}, '%Y-%m-%d %H:%i:%s') " +
+            " AND DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%s') AND mac_ip = #{macIp} " +
+            " GROUP BY user_id, user_name, mac_ip ")
+    List<LifeUserLog> getLifeUserLogByDate(@Param("starDate") String starDate, @Param("endDate") String endDate, @Param("macIp") String macIp);
+
+}

+ 1 - 1
alien-gateway/src/main/java/shop/alien/gateway/mapper/StoreInfoMapper.java → alien-gateway/src/main/java/shop/alien/gateway/mapper/StoreInfoGatewayMapper.java

@@ -11,5 +11,5 @@ import shop.alien.entity.store.StoreInfo;
  * @since 2024-12-05
  * @since 2024-12-05
  */
  */
 @Mapper
 @Mapper
-public interface StoreInfoMapper extends BaseMapper<StoreInfo> {
+public interface StoreInfoGatewayMapper extends BaseMapper<StoreInfo> {
 }
 }

+ 1 - 1
alien-gateway/src/main/java/shop/alien/gateway/mapper/StoreUserMapper.java → alien-gateway/src/main/java/shop/alien/gateway/mapper/StoreUserGatewayMapper.java

@@ -13,5 +13,5 @@ import shop.alien.entity.store.StoreUser;
  * @since 2024-12-11
  * @since 2024-12-11
  */
  */
 @Mapper
 @Mapper
-public interface StoreUserMapper extends BaseMapper<StoreUser> {
+public interface StoreUserGatewayMapper extends BaseMapper<StoreUser> {
 }
 }

+ 15 - 0
alien-gateway/src/main/java/shop/alien/gateway/service/ActivityInviteConfigService.java

@@ -0,0 +1,15 @@
+package shop.alien.gateway.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import shop.alien.entity.store.ActivityInviteConfig;
+
+/**
+ * @author zhangchen
+ * @version 1.0
+ * @date 2025/09/05 10:00
+ */
+public interface ActivityInviteConfigService extends IService<ActivityInviteConfig> {
+
+    String bindInviteCode(Integer invitedUserId, String inviteCode);
+
+}

+ 119 - 35
alien-gateway/src/main/java/shop/alien/gateway/service/LifeUserService.java

@@ -1,59 +1,59 @@
 package shop.alien.gateway.service;
 package shop.alien.gateway.service;
 
 
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import shop.alien.entity.second.LifeUserLog;
+import shop.alien.entity.second.SecondRiskControlRecord;
 import shop.alien.entity.store.LifeUser;
 import shop.alien.entity.store.LifeUser;
 import shop.alien.entity.store.vo.LifeUserVo;
 import shop.alien.entity.store.vo.LifeUserVo;
 import shop.alien.gateway.config.BaseRedisService;
 import shop.alien.gateway.config.BaseRedisService;
-import shop.alien.gateway.mapper.LifeUserMapper;
+import shop.alien.gateway.config.RiskControlProperties;
+import shop.alien.gateway.feign.SecondServiceFeign;
+import shop.alien.gateway.mapper.LifeUserLogGatewayMapper;
+import shop.alien.gateway.mapper.LifeUserGatewayMapper;
+import shop.alien.mapper.second.SecondRiskControlRecordMapper;
 import shop.alien.util.common.JwtUtil;
 import shop.alien.util.common.JwtUtil;
 
 
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.stream.Collectors;
 
 
 /**
 /**
  * 用户
  * 用户
  */
  */
 @Service
 @Service
 @RequiredArgsConstructor
 @RequiredArgsConstructor
-public class LifeUserService extends ServiceImpl<LifeUserMapper, LifeUser> {
+public class LifeUserService extends ServiceImpl<LifeUserGatewayMapper, LifeUser> {
 
 
-    private final LifeUserMapper lifeUserMapper;
+    private final LifeUserGatewayMapper lifeUserMapper;
+
+    private final LifeUserLogGatewayMapper lifeUserLogMapper;
 
 
     private final BaseRedisService baseRedisService;
     private final BaseRedisService baseRedisService;
 
 
+    private final SecondServiceFeign alienSecondFeign;
+
+    private final ActivityInviteConfigService activityInviteConfigService;
+
+    private final SecondRiskControlRecordMapper secondRiskControlRecordMapper;
+
+    @Autowired
+    private RiskControlProperties riskControlProperties;
+
     @Value("${jwt.expiration-time}")
     @Value("${jwt.expiration-time}")
     private String effectiveTime;
     private String effectiveTime;
 
 
-    public LifeUserVo userLogin(String phoneNum) {
-        int effectiveTimeInt = Integer.parseInt(effectiveTime.substring(0, effectiveTime.length() - 1));
-        String effectiveTimeUnit = effectiveTime.substring(effectiveTime.length() - 1);
-        long effectiveTimeIntLong = 0L;
-        switch (effectiveTimeUnit) {
-            case "s": {
-                effectiveTimeIntLong = effectiveTimeInt * 1000L;
-                break;
-            }
-            case "m": {
-                effectiveTimeIntLong = effectiveTimeInt * 60L * 1000L;
-                break;
-            }
-            case "h": {
-                effectiveTimeIntLong = effectiveTimeInt * 60L * 60L * 1000L;
-                break;
-            }
-            case "d": {
-                effectiveTimeIntLong = effectiveTimeInt * 24L * 60L * 60L * 1000L;
-                break;
-            }
-        }
-
+    public LifeUserVo userLogin(String phoneNum, String inviteCode, String macIp) {
         LifeUser user = getUserByPhone(phoneNum);
         LifeUser user = getUserByPhone(phoneNum);
         if (user == null) {
         if (user == null) {
             LifeUser lifeUser = new LifeUser();
             LifeUser lifeUser = new LifeUser();
@@ -71,9 +71,13 @@ public class LifeUserService extends ServiceImpl<LifeUserMapper, LifeUser> {
                 tokenMap.put("userName", lifeUser.getUserName());
                 tokenMap.put("userName", lifeUser.getUserName());
                 tokenMap.put("userId", lifeUser.getId().toString());
                 tokenMap.put("userId", lifeUser.getId().toString());
                 tokenMap.put("userType", "user");
                 tokenMap.put("userType", "user");
-                userVo.setToken(JwtUtil.createJWT("user_" + phoneNum, lifeUser.getUserName(), JSONObject.toJSONString(tokenMap), effectiveTimeIntLong));
-//                userVo.setToken(JWTUtils.createToken(tokenMap));
-                baseRedisService.setString("user_" + phoneNum, userVo.getToken());
+//                userVo.setToken(JWTUtils1.createToken(tokenMap));
+                String token = getToken(phoneNum, userVo.getUserName(), tokenMap);
+                userVo.setToken(token);
+                baseRedisService.setString("user_" + phoneNum, token);
+                // 二手平台登录log,同一个macip登录多账号记录
+                addLifeUserLogInfo(user2, macIp);
+
                 return userVo;
                 return userVo;
             } else {
             } else {
                 return null;
                 return null;
@@ -86,18 +90,98 @@ public class LifeUserService extends ServiceImpl<LifeUserMapper, LifeUser> {
             tokenMap.put("userName", user.getUserName());
             tokenMap.put("userName", user.getUserName());
             tokenMap.put("userId", user.getId().toString());
             tokenMap.put("userId", user.getId().toString());
             tokenMap.put("userType", "user");
             tokenMap.put("userType", "user");
-//            String token = JWTUtils.createToken(tokenMap);
-            String token = JwtUtil.createJWT("user_" + phoneNum, user.getUserName(), JSONObject.toJSONString(tokenMap), effectiveTimeIntLong);
+            String token = getToken(phoneNum, user.getUserName(), tokenMap);
             userVo.setToken(token);
             userVo.setToken(token);
             baseRedisService.setString("user_" + phoneNum, token);
             baseRedisService.setString("user_" + phoneNum, token);
+            // 二手平台登录log,同一个macip登录多账号记录
+            addLifeUserLogInfo(user, macIp);
+
             return userVo;
             return userVo;
         }
         }
     }
     }
 
 
+    private String getToken(String phoneNum, String userVo, Map<String, String> tokenMap) {
+        int effectiveTimeInt = Integer.parseInt(effectiveTime.substring(0, effectiveTime.length() - 1));
+        String effectiveTimeUnit = effectiveTime.substring(effectiveTime.length() - 1);
+        long effectiveTimeIntLong = 0L;
+        switch (effectiveTimeUnit) {
+            case "s": {
+                effectiveTimeIntLong = effectiveTimeInt * 1000L;
+                break;
+            }
+            case "m": {
+                effectiveTimeIntLong = effectiveTimeInt * 60L * 1000L;
+                break;
+            }
+            case "h": {
+                effectiveTimeIntLong = effectiveTimeInt * 60L * 60L * 1000L;
+                break;
+            }
+            case "d": {
+                effectiveTimeIntLong = effectiveTimeInt * 24L * 60L * 60L * 1000L;
+                break;
+            }
+        }
+        String token = JwtUtil.createJWT("user_" + phoneNum, userVo, JSONObject.toJSONString(tokenMap), effectiveTimeIntLong);
+        return token;
+    }
+
     public LifeUser getUserByPhone(String phoneNum) {
     public LifeUser getUserByPhone(String phoneNum) {
         LambdaQueryWrapper<LifeUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<LifeUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
         lambdaQueryWrapper.eq(LifeUser::getUserPhone, phoneNum);
         lambdaQueryWrapper.eq(LifeUser::getUserPhone, phoneNum);
         return this.getOne(lambdaQueryWrapper);
         return this.getOne(lambdaQueryWrapper);
     }
     }
 
 
+
+    /**
+     * 用户登录log存放(加入mac地址)
+     */
+    @Transactional
+    public void addLifeUserLogInfo(LifeUser user, String macIp) {
+        try {
+            LifeUserLog lifeUserLog = new LifeUserLog();
+            lifeUserLog.setUserId(user.getId());
+            lifeUserLog.setUserName(user.getUserName());
+            lifeUserLog.setMacIp(macIp);
+            lifeUserLog.setCreatedTime(new Date());
+            int count = lifeUserLogMapper.insert(lifeUserLog);
+            if (count > 0) {
+                String startDate = LocalDateTime.now().minusHours(24L).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+                String endDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+                // 使用一个新的事务来查询,确保能看到刚才插入的数据
+                List<LifeUserLog> lsit = getLifeUserLogByDateInNewTransaction(startDate, endDate, macIp);
+
+                if (lsit.size() > riskControlProperties.getAccountAbnormal().getRegCount24h() && !isViolation(startDate, endDate, macIp, user.getId())) {
+                    String detailInfo = lsit.stream()
+                            .map(row -> row.getUserId().toString())
+                            .collect(Collectors.joining(","));
+                    alienSecondFeign.recordRiskControlData(user.getId(), 2, "账号异常", macIp, detailInfo);
+                }
+            }
+            // 第一次登录,添加用户基础积分
+            alienSecondFeign.createPointsRecord(user.getId(), 300, 1);
+        } catch (Exception e) {
+            log.error("用户登录log存放异常:{}", e);
+        }
+
+    }
+
+    @Transactional(propagation = Propagation.REQUIRES_NEW)
+    public List<LifeUserLog> getLifeUserLogByDateInNewTransaction(String startDate, String endDate, String macIp) {
+        return lifeUserLogMapper.getLifeUserLogByDate(startDate, endDate, macIp);
+    }
+
+    public boolean isViolation(String startDate, String endDate, String macIp, Integer userId) {
+        List<SecondRiskControlRecord> list = secondRiskControlRecordMapper.selectByBusinessId(startDate, endDate, macIp);
+        for (SecondRiskControlRecord record : list) {
+            // 将数组转换为包含整数的列表
+            List<Integer> userIdList = Arrays.stream(record.getDetailInfo().split(","))
+                    .map(Integer::parseInt)
+                    .collect(Collectors.toList());
+            if (userIdList.contains(userId)) {
+                return true;
+            }
+        }
+        return false;
+    }
 }
 }

+ 15 - 0
alien-gateway/src/main/java/shop/alien/gateway/service/UserPointService.java

@@ -0,0 +1,15 @@
+package shop.alien.gateway.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import shop.alien.entity.store.UserPoint;
+
+/**
+ * @author zhangchen
+ * @version 1.0
+ * @date 2025/09/05 10:00
+ */
+public interface UserPointService extends IService<UserPoint> {
+
+    UserPoint addPoint(Integer userId, Integer point);
+
+}

+ 120 - 0
alien-gateway/src/main/java/shop/alien/gateway/service/impl/ActivityInviteConfigServiceImpl.java

@@ -0,0 +1,120 @@
+package shop.alien.gateway.service.impl;
+
+import com.alibaba.nacos.common.utils.CollectionUtils;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Service;
+import shop.alien.entity.store.ActivityInviteConfig;
+import shop.alien.entity.store.ActivityInviteLog;
+import shop.alien.entity.store.LifeUser;
+import shop.alien.gateway.service.ActivityInviteConfigService;
+import shop.alien.gateway.service.UserPointService;
+import shop.alien.mapper.ActivityInviteConfigMapper;
+import shop.alien.mapper.ActivityInviteLogMapper;
+import shop.alien.mapper.LifeUserMapper;
+
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.util.Date;
+import java.util.List;
+
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class ActivityInviteConfigServiceImpl extends ServiceImpl<ActivityInviteConfigMapper, ActivityInviteConfig> implements ActivityInviteConfigService {
+
+    private final UserPointService userPointService;
+
+    private final ActivityInviteConfigMapper activityInviteConfigMapper;
+
+    private final LifeUserMapper lifeUserMapper;
+
+    private final ActivityInviteLogMapper activityInviteLogMapper;
+
+
+    @Override
+    public String bindInviteCode(Integer invitedUserId, String inviteCode) {
+        if (StringUtils.isNotBlank(inviteCode) && invitedUserId != null) {
+            // 根据邀请码查询邀请用户
+            LambdaQueryWrapper<LifeUser> lifeUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            lifeUserLambdaQueryWrapper.eq(LifeUser::getDeleteFlag, 0);
+            lifeUserLambdaQueryWrapper.apply("BINARY invite_code = {0}", inviteCode);
+            List<LifeUser> lifeUserList = lifeUserMapper.selectList(lifeUserLambdaQueryWrapper);
+            if (CollectionUtils.isEmpty(lifeUserList)) {
+                return "邀请码异常或邀请用户已注销";
+            }
+            LifeUser originalLifeUser = lifeUserList.get(0);
+            int inviteUserId = originalLifeUser.getId();
+            LifeUser invitedLifeUser = lifeUserMapper.selectById(invitedUserId);
+            if (invitedLifeUser == null) {
+                return "被邀请用户异常";
+            } else if (StringUtils.isNotBlank(invitedLifeUser.getBindInviteCode())) {
+                return "已经绑定邀请码不能重复绑定";
+            } else if (StringUtils.isNotBlank(invitedLifeUser.getInviteCode()) && invitedLifeUser.getInviteCode().equals(inviteCode)) {
+                return "不能绑定自己的邀请码";
+            } else {
+                LambdaQueryWrapper<ActivityInviteConfig> activityInviteConfigLambdaQueryWrapper = new LambdaQueryWrapper<>();
+                activityInviteConfigLambdaQueryWrapper.eq(ActivityInviteConfig::getDeleteFlag, 0);
+                List<ActivityInviteConfig> activityInviteConfigList = activityInviteConfigMapper.selectList(activityInviteConfigLambdaQueryWrapper);
+                if (CollectionUtils.isNotEmpty(activityInviteConfigList)) {
+                    ActivityInviteConfig activityInviteConfig = activityInviteConfigList.get(0);
+
+                    // 判断是否达到当天邀请最大次数
+                    Integer maxInviteNum = activityInviteConfig.getMaxInviteNum();
+                    if (maxInviteNum != null) {
+                        LambdaQueryWrapper<ActivityInviteLog> activityInviteLogLambdaQueryWrapper = new LambdaQueryWrapper<>();
+                        activityInviteLogLambdaQueryWrapper.eq(ActivityInviteLog::getInviteUserId, inviteUserId);
+                        activityInviteLogLambdaQueryWrapper.eq(ActivityInviteLog::getDeleteFlag, 0);
+                        // 使用 Date 对象而不是字符串,确保类型匹配
+                        LocalDate today = LocalDate.now();
+                        LocalDateTime startOfDay = today.atStartOfDay();
+                        LocalDateTime endOfDay = today.atTime(23, 59, 59);
+                        Date startDate = Date.from(startOfDay.atZone(ZoneId.systemDefault()).toInstant());
+                        Date endDate = Date.from(endOfDay.atZone(ZoneId.systemDefault()).toInstant());
+                        activityInviteLogLambdaQueryWrapper.between(ActivityInviteLog::getInviteTime, startDate, endDate);
+                        int todayInviteCount = activityInviteLogMapper.selectCount(activityInviteLogLambdaQueryWrapper);
+                        if (todayInviteCount > maxInviteNum) {
+                            return "绑定数量已超过当天最大绑定数量";
+                        }
+                    }
+
+                    ActivityInviteLog activityInviteLog = new ActivityInviteLog();
+                    activityInviteLog.setInviteUserId(inviteUserId);
+                    activityInviteLog.setInvitedUserId(invitedUserId);
+                    activityInviteLog.setActivityId(activityInviteConfig.getId());
+
+                    // 邀请奖励
+                    activityInviteLog.setInviteRewardType(activityInviteConfig.getInviteRewardType());
+                    activityInviteLog.setInviteRewardCoupon(activityInviteConfig.getInviteRewardCoupon());
+                    activityInviteLog.setInviteRewardPoint(activityInviteConfig.getInviteRewardPoint());
+                    // 被邀请奖励
+                    activityInviteLog.setInvitedRewardType(activityInviteConfig.getInvitedRewardType());
+                    activityInviteLog.setInvitedRewardCoupon(activityInviteConfig.getInvitedRewardCoupon());
+                    activityInviteLog.setInvitedRewardPoint(activityInviteConfig.getInvitedRewardPoint());
+                    activityInviteLog.setInviteTime(Date.from(Instant.now()));
+                    activityInviteLogMapper.insert(activityInviteLog);
+
+                    if (activityInviteConfig.getInviteRewardType() == 2) {
+                        userPointService.addPoint(inviteUserId, activityInviteConfig.getInviteRewardPoint());
+                    }
+                    if (activityInviteConfig.getInvitedRewardType() == 2) {
+                        userPointService.addPoint(invitedUserId, activityInviteConfig.getInvitedRewardPoint());
+                    }
+                    LifeUser updateLifeUser = new LifeUser();
+                    updateLifeUser.setId(invitedLifeUser.getId());
+                    updateLifeUser.setBindInviteCode(inviteCode);
+                    lifeUserMapper.updateById(updateLifeUser);
+                    return "绑定成功";
+                } else {
+                    return "活动未开始或已结束";
+                }
+            }
+        }
+        return "参数异常";
+    }
+}

+ 2 - 2
alien-gateway/src/main/java/shop/alien/gateway/service/impl/StoreInfoServiceImpl.java

@@ -5,7 +5,7 @@ import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 import shop.alien.entity.store.StoreInfo;
 import shop.alien.entity.store.StoreInfo;
-import shop.alien.gateway.mapper.StoreInfoMapper;
+import shop.alien.gateway.mapper.StoreInfoGatewayMapper;
 import shop.alien.gateway.service.StoreInfoService;
 import shop.alien.gateway.service.StoreInfoService;
 
 
 /**
 /**
@@ -17,6 +17,6 @@ import shop.alien.gateway.service.StoreInfoService;
 @Service
 @Service
 @RequiredArgsConstructor
 @RequiredArgsConstructor
 @Transactional
 @Transactional
-public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo> implements StoreInfoService {
+public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoGatewayMapper, StoreInfo> implements StoreInfoService {
 
 
 }
 }

+ 4 - 4
alien-gateway/src/main/java/shop/alien/gateway/service/impl/StoreUserServiceImpl.java

@@ -12,8 +12,8 @@ import shop.alien.entity.store.StoreInfo;
 import shop.alien.entity.store.StoreUser;
 import shop.alien.entity.store.StoreUser;
 import shop.alien.entity.store.vo.StoreUserVo;
 import shop.alien.entity.store.vo.StoreUserVo;
 import shop.alien.gateway.config.BaseRedisService;
 import shop.alien.gateway.config.BaseRedisService;
-import shop.alien.gateway.mapper.StoreInfoMapper;
-import shop.alien.gateway.mapper.StoreUserMapper;
+import shop.alien.gateway.mapper.StoreInfoGatewayMapper;
+import shop.alien.gateway.mapper.StoreUserGatewayMapper;
 import shop.alien.gateway.service.StoreUserService;
 import shop.alien.gateway.service.StoreUserService;
 import shop.alien.util.common.JwtUtil;
 import shop.alien.util.common.JwtUtil;
 
 
@@ -29,7 +29,7 @@ import java.util.Map;
 @Transactional
 @Transactional
 @Service
 @Service
 @RequiredArgsConstructor
 @RequiredArgsConstructor
-public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser> implements StoreUserService {
+public class StoreUserServiceImpl extends ServiceImpl<StoreUserGatewayMapper, StoreUser> implements StoreUserService {
 
 
     @Value("${jwt.expiration-time}")
     @Value("${jwt.expiration-time}")
     private String effectiveTime;
     private String effectiveTime;
@@ -38,7 +38,7 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
      * 设定初始化默认密码
      * 设定初始化默认密码
      */
      */
 
 
-    private final StoreInfoMapper storeInfoMapper;
+    private final StoreInfoGatewayMapper storeInfoMapper;
 
 
     private final BaseRedisService baseRedisService;
     private final BaseRedisService baseRedisService;
 
 

+ 2 - 2
alien-gateway/src/main/java/shop/alien/gateway/service/impl/SystemServiceImpl.java

@@ -9,7 +9,7 @@ import shop.alien.entity.store.LifeSys;
 import shop.alien.entity.store.UserLoginInfo;
 import shop.alien.entity.store.UserLoginInfo;
 import shop.alien.entity.store.vo.SystemLoginVo;
 import shop.alien.entity.store.vo.SystemLoginVo;
 import shop.alien.gateway.config.BaseRedisService;
 import shop.alien.gateway.config.BaseRedisService;
-import shop.alien.gateway.mapper.LifeSysMapper;
+import shop.alien.gateway.mapper.LifeSysGatewayMapper;
 import shop.alien.gateway.service.SystemService;
 import shop.alien.gateway.service.SystemService;
 import shop.alien.util.common.JwtUtil;
 import shop.alien.util.common.JwtUtil;
 
 
@@ -30,7 +30,7 @@ import java.util.Map;
 @RequiredArgsConstructor
 @RequiredArgsConstructor
 public class SystemServiceImpl implements SystemService {
 public class SystemServiceImpl implements SystemService {
 
 
-    private final LifeSysMapper lifeSysMapper;
+    private final LifeSysGatewayMapper lifeSysMapper;
 
 
     private final BaseRedisService baseRedisService;
     private final BaseRedisService baseRedisService;
 
 

+ 50 - 0
alien-gateway/src/main/java/shop/alien/gateway/service/impl/UserPointServiceImpl.java

@@ -0,0 +1,50 @@
+package shop.alien.gateway.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+import shop.alien.entity.store.UserPoint;
+import shop.alien.gateway.service.UserPointService;
+import shop.alien.mapper.UserPointMapper;
+
+import java.util.List;
+
+/**
+ * 签到类型活动服务
+ *
+ * @author zhangchen
+ * @since 2025-9-8
+ */
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class UserPointServiceImpl extends ServiceImpl<UserPointMapper, UserPoint> implements UserPointService {
+
+    private final UserPointMapper userPointMapper;
+
+    @Override
+    public UserPoint addPoint(Integer userId, Integer point) {
+        UserPoint userPoint = new UserPoint();
+        if (userId != null && point != null) {
+            LambdaQueryWrapper<UserPoint> userPointLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            userPointLambdaQueryWrapper.eq(UserPoint::getUserId, userId);
+            userPointLambdaQueryWrapper.eq(UserPoint::getDeleteFlag, 0);
+            List<UserPoint> userPointList = userPointMapper.selectList(userPointLambdaQueryWrapper);
+            if (!CollectionUtils.isEmpty(userPointList)) {
+                userPoint = userPointList.get(0);
+                int totalPoint = point + userPoint.getUserPoint();
+                userPoint.setUserPoint(totalPoint);
+                userPointMapper.updateById(userPoint);
+            } else {
+                userPoint.setUserId(userId);
+                userPoint.setUserPoint(point);
+                userPointMapper.insert(userPoint);
+            }
+        }
+        return userPoint;
+    }
+
+}

+ 253 - 0
alien-gateway/src/main/java/shop/alien/gateway/util/Base64.java

@@ -0,0 +1,253 @@
+package shop.alien.gateway.util;
+
+/**
+ * Base64工具类
+ *
+ * @author ssk
+ */
+public final class Base64 {
+    static private final int BASELENGTH = 128;
+    static private final int LOOKUPLENGTH = 64;
+    static private final int TWENTYFOURBITGROUP = 24;
+    static private final int EIGHTBIT = 8;
+    static private final int SIXTEENBIT = 16;
+    static private final int FOURBYTE = 4;
+    static private final int SIGN = -128;
+    static private final char PAD = '=';
+    static final private byte[] base64Alphabet = new byte[BASELENGTH];
+    static final private char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH];
+
+    static {
+        for (int i = 0; i < BASELENGTH; ++i) {
+            base64Alphabet[i] = -1;
+        }
+        for (int i = 'Z'; i >= 'A'; i--) {
+            base64Alphabet[i] = (byte) (i - 'A');
+        }
+        for (int i = 'z'; i >= 'a'; i--) {
+            base64Alphabet[i] = (byte) (i - 'a' + 26);
+        }
+
+        for (int i = '9'; i >= '0'; i--) {
+            base64Alphabet[i] = (byte) (i - '0' + 52);
+        }
+
+        base64Alphabet['+'] = 62;
+        base64Alphabet['/'] = 63;
+
+        for (int i = 0; i <= 25; i++) {
+            lookUpBase64Alphabet[i] = (char) ('A' + i);
+        }
+
+        for (int i = 26, j = 0; i <= 51; i++, j++) {
+            lookUpBase64Alphabet[i] = (char) ('a' + j);
+        }
+
+        for (int i = 52, j = 0; i <= 61; i++, j++) {
+            lookUpBase64Alphabet[i] = (char) ('0' + j);
+        }
+        lookUpBase64Alphabet[62] = (char) '+';
+        lookUpBase64Alphabet[63] = (char) '/';
+    }
+
+    private static boolean isWhiteSpace(char octect) {
+        return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9);
+    }
+
+    private static boolean isPad(char octect) {
+        return (octect == PAD);
+    }
+
+    private static boolean isData(char octect) {
+        return (octect < BASELENGTH && base64Alphabet[octect] != -1);
+    }
+
+    /**
+     * Encodes hex octects into Base64
+     *
+     * @param binaryData Array containing binaryData
+     * @return Encoded Base64 array
+     */
+    public static String encode(byte[] binaryData) {
+        if (binaryData == null) {
+            return null;
+        }
+
+        int lengthDataBits = binaryData.length * EIGHTBIT;
+        if (lengthDataBits == 0) {
+            return "";
+        }
+
+        int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
+        int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
+        int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets;
+        char encodedData[] = null;
+
+        encodedData = new char[numberQuartet * 4];
+
+        byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0;
+
+        int encodedIndex = 0;
+        int dataIndex = 0;
+
+        for (int i = 0; i < numberTriplets; i++) {
+            b1 = binaryData[dataIndex++];
+            b2 = binaryData[dataIndex++];
+            b3 = binaryData[dataIndex++];
+
+            l = (byte) (b2 & 0x0f);
+            k = (byte) (b1 & 0x03);
+
+            byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
+            byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0);
+            byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc);
+
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f];
+        }
+
+        // form integral number of 6-bit groups
+        if (fewerThan24bits == EIGHTBIT) {
+            b1 = binaryData[dataIndex];
+            k = (byte) (b1 & 0x03);
+            byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4];
+            encodedData[encodedIndex++] = PAD;
+            encodedData[encodedIndex++] = PAD;
+        } else if (fewerThan24bits == SIXTEENBIT) {
+            b1 = binaryData[dataIndex];
+            b2 = binaryData[dataIndex + 1];
+            l = (byte) (b2 & 0x0f);
+            k = (byte) (b1 & 0x03);
+
+            byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0);
+            byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0);
+
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)];
+            encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2];
+            encodedData[encodedIndex++] = PAD;
+        }
+        return new String(encodedData);
+    }
+
+    /**
+     * Decodes Base64 data into octects
+     *
+     * @param encoded string containing Base64 data
+     * @return Array containind decoded data.
+     */
+    public static byte[] decode(String encoded) {
+        if (encoded == null) {
+            return null;
+        }
+
+        char[] base64Data = encoded.toCharArray();
+        // remove white spaces
+        int len = removeWhiteSpace(base64Data);
+
+        if (len % FOURBYTE != 0) {
+            return null;// should be divisible by four
+        }
+
+        int numberQuadruple = (len / FOURBYTE);
+
+        if (numberQuadruple == 0) {
+            return new byte[0];
+        }
+
+        byte decodedData[] = null;
+        byte b1 = 0, b2 = 0, b3 = 0, b4 = 0;
+        char d1 = 0, d2 = 0, d3 = 0, d4 = 0;
+
+        int i = 0;
+        int encodedIndex = 0;
+        int dataIndex = 0;
+        decodedData = new byte[(numberQuadruple) * 3];
+
+        for (; i < numberQuadruple - 1; i++) {
+
+            if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))
+                    || !isData((d3 = base64Data[dataIndex++])) || !isData((d4 = base64Data[dataIndex++]))) {
+                return null;
+            } // if found "no data" just return null
+
+            b1 = base64Alphabet[d1];
+            b2 = base64Alphabet[d2];
+            b3 = base64Alphabet[d3];
+            b4 = base64Alphabet[d4];
+
+            decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
+            decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
+            decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
+        }
+
+        if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) {
+            return null;// if found "no data" just return null
+        }
+
+        b1 = base64Alphabet[d1];
+        b2 = base64Alphabet[d2];
+
+        d3 = base64Data[dataIndex++];
+        d4 = base64Data[dataIndex++];
+        if (!isData((d3)) || !isData((d4))) {// Check if they are PAD characters
+            if (isPad(d3) && isPad(d4)) {
+                if ((b2 & 0xf) != 0)// last 4 bits should be zero
+                {
+                    return null;
+                }
+                byte[] tmp = new byte[i * 3 + 1];
+                System.arraycopy(decodedData, 0, tmp, 0, i * 3);
+                tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
+                return tmp;
+            } else if (!isPad(d3) && isPad(d4)) {
+                b3 = base64Alphabet[d3];
+                if ((b3 & 0x3) != 0)// last 2 bits should be zero
+                {
+                    return null;
+                }
+                byte[] tmp = new byte[i * 3 + 2];
+                System.arraycopy(decodedData, 0, tmp, 0, i * 3);
+                tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
+                tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
+                return tmp;
+            } else {
+                return null;
+            }
+        } else { // No PAD e.g 3cQl
+            b3 = base64Alphabet[d3];
+            b4 = base64Alphabet[d4];
+            decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
+            decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
+            decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
+
+        }
+        return decodedData;
+    }
+
+    /**
+     * remove WhiteSpace from MIME containing encoded Base64 data.
+     *
+     * @param data the byte array of base64 data (with WS)
+     * @return the new length
+     */
+    private static int removeWhiteSpace(char[] data) {
+        if (data == null) {
+            return 0;
+        }
+
+        // count characters that's not whitespace
+        int newSize = 0;
+        int len = data.length;
+        for (int i = 0; i < len; i++) {
+            if (!isWhiteSpace(data[i])) {
+                data[newSize++] = data[i];
+            }
+        }
+        return newSize;
+    }
+}

+ 56 - 0
alien-gateway/src/main/java/shop/alien/gateway/util/KaptchaTextCreator.java

@@ -0,0 +1,56 @@
+package shop.alien.gateway.util;
+
+import com.google.code.kaptcha.text.impl.DefaultTextCreator;
+
+import java.util.Random;
+
+/**
+ * 验证码文本生成器
+ *
+ * @author ruoyi
+ */
+public class KaptchaTextCreator extends DefaultTextCreator {
+    private static final String[] CNUMBERS = "0,1,2,3,4,5,6,7,8,9,10".split(",");
+
+    @Override
+    public String getText() {
+        Integer result = 0;
+        Random random = new Random();
+        int x = random.nextInt(10);
+        int y = random.nextInt(10);
+        StringBuilder suChinese = new StringBuilder();
+        int randomoperands = random.nextInt(3);
+        if (randomoperands == 0) {
+            result = x * y;
+            suChinese.append(CNUMBERS[x]);
+            suChinese.append("*");
+            suChinese.append(CNUMBERS[y]);
+        } else if (randomoperands == 1) {
+            if ((x != 0) && y % x == 0) {
+                result = y / x;
+                suChinese.append(CNUMBERS[y]);
+                suChinese.append("/");
+                suChinese.append(CNUMBERS[x]);
+            } else {
+                result = x + y;
+                suChinese.append(CNUMBERS[x]);
+                suChinese.append("+");
+                suChinese.append(CNUMBERS[y]);
+            }
+        } else {
+            if (x >= y) {
+                result = x - y;
+                suChinese.append(CNUMBERS[x]);
+                suChinese.append("-");
+                suChinese.append(CNUMBERS[y]);
+            } else {
+                result = y - x;
+                suChinese.append(CNUMBERS[y]);
+                suChinese.append("-");
+                suChinese.append(CNUMBERS[x]);
+            }
+        }
+        suChinese.append("=?@" + result);
+        return suChinese.toString();
+    }
+}

+ 2 - 2
alien-gateway/src/main/resources/mapper/StoreUserMapper.xml → alien-gateway/src/main/resources/mapper/StoreUserGatewayMapper.xml

@@ -2,10 +2,10 @@
 <!DOCTYPE mapper
 <!DOCTYPE mapper
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="shop.alien.gateway.mapper.StoreUserMapper">
+<mapper namespace="shop.alien.gateway.mapper.StoreUserGatewayMapper">
 
 
     <!-- 查询已删除的用户 -->
     <!-- 查询已删除的用户 -->
     <select id="getRemoveUser" resultType="shop.alien.entity.store.StoreUser">
     <select id="getRemoveUser" resultType="shop.alien.entity.store.StoreUser">
-        select concat(name,"(账号已注销)") as name,phone FROM store_user where id = #{id}
+        select concat(nick_name,"(账号已注销)") as name,phone FROM store_user where id = #{id}
     </select>
     </select>
 </mapper>
 </mapper>

+ 1 - 1
alien-job/src/main/java/shop/alien/job/feign/AlienStoreFeign.java

@@ -50,7 +50,7 @@ public interface AlienStoreFeign {
      * @param refundReason 退款原因
      * @param refundReason 退款原因
      * @return
      * @return
      */
      */
-    @GetMapping("/processRefund")
+    @GetMapping("/ali/processRefund")
     public String processRefund(@RequestParam(value = "outTradeNo") String outTradeNo,
     public String processRefund(@RequestParam(value = "outTradeNo") String outTradeNo,
                                    @RequestParam(value = "refundAmount") String refundAmount,
                                    @RequestParam(value = "refundAmount") String refundAmount,
                                    @RequestParam(value = "refundReason") String refundReason,
                                    @RequestParam(value = "refundReason") String refundReason,

部分文件因为文件数量过多而无法显示