Просмотр исходного кода

Merge branch 'sit' into sit-OrderFood

lutong 2 месяцев назад
Родитель
Сommit
11414ef774
18 измененных файлов с 402 добавлено и 25 удалено
  1. 1 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/OrderRevenueVO.java
  2. 55 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/SubAccountListVo.java
  3. 3 0
      alien-entity/src/main/java/shop/alien/entity/storePlatform/vo/StoreOperationalActivityAchievementCaseDetailVo.java
  4. 9 0
      alien-entity/src/main/java/shop/alien/entity/storePlatform/vo/StoreOperationalActivityAchievementCaseVo.java
  5. 6 0
      alien-entity/src/main/java/shop/alien/entity/storePlatform/vo/StoreOperationalActivitySignupVO.java
  6. 17 0
      alien-entity/src/main/java/shop/alien/mapper/StorePlatformUserRoleMapper.java
  7. 35 0
      alien-entity/src/main/resources/mapper/StorePlatformUserRoleMapper.xml
  8. 5 1
      alien-entity/src/main/resources/mapper/storePlatform/StoreOperationalActivityAchievementMapper.xml
  9. 12 9
      alien-job/src/main/java/shop/alien/job/store/BadReviewAppealJob.java
  10. 1 1
      alien-job/src/main/java/shop/alien/job/store/StoreOperationalActivityJob.java
  11. 56 0
      alien-store-platform/src/main/java/shop/alien/storeplatform/controller/StorePlatformUserRoleController.java
  12. 28 0
      alien-store-platform/src/main/java/shop/alien/storeplatform/service/StorePlatformUserRoleService.java
  13. 3 0
      alien-store-platform/src/main/java/shop/alien/storeplatform/service/impl/OperationalActivitySignupServiceImpl.java
  14. 73 0
      alien-store-platform/src/main/java/shop/alien/storeplatform/service/impl/StorePlatformUserRoleServiceImpl.java
  15. 67 11
      alien-store/src/main/java/shop/alien/store/controller/StoreInfoController.java
  16. 2 2
      alien-store/src/main/java/shop/alien/store/service/impl/OperationalActivityServiceImpl.java
  17. 1 1
      alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java
  18. 28 0
      alien-store/src/main/java/shop/alien/store/util/ai/AiReportReviewUtil.java

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

@@ -47,3 +47,4 @@ public class OrderRevenueVO implements Serializable {
 
 
 
+

+ 55 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/SubAccountListVo.java

@@ -0,0 +1,55 @@
+package shop.alien.entity.store.vo;
+
+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;
+
+/**
+ * 子账号列表信息VO(包含主账号电话)
+ *
+ * @author system
+ * @since 2025-01-XX
+ */
+@Data
+@JsonInclude
+@ApiModel(value = "SubAccountListVo对象", description = "子账号列表信息VO")
+public class SubAccountListVo {
+
+    @ApiModelProperty(value = "主账号ID")
+    private Integer mainAccountId;
+
+    @ApiModelProperty(value = "主账号联系电话")
+    private String mainAccountPhone;
+
+    @ApiModelProperty(value = "子账号中间表ID")
+    private Integer subAccountId;
+
+    @ApiModelProperty(value = "子账号用户ID")
+    private Integer userId;
+
+    @ApiModelProperty(value = "联系电话(子账号电话)")
+    private String phone;
+
+    @ApiModelProperty(value = "账号名称")
+    private String accountName;
+
+    @ApiModelProperty(value = "店铺ID")
+    private Integer storeId;
+
+    @ApiModelProperty(value = "角色ID")
+    private Long roleId;
+
+    @ApiModelProperty(value = "角色名称")
+    private String roleName;
+
+    @ApiModelProperty(value = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createdTime;
+
+    @ApiModelProperty(value = "状态(0:启用 1:禁用)")
+    private Integer status;
+}

+ 3 - 0
alien-entity/src/main/java/shop/alien/entity/storePlatform/vo/StoreOperationalActivityAchievementCaseDetailVo.java

@@ -46,6 +46,9 @@ public class StoreOperationalActivityAchievementCaseDetailVo {
     @ApiModelProperty(value = "联系方式(手机号)")
     private String phone;
 
+    @ApiModelProperty(value = "用户手机号")
+    private String userPhone;
+
     @ApiModelProperty(value = "用户头像")
     private String userImage;
 

+ 9 - 0
alien-entity/src/main/java/shop/alien/entity/storePlatform/vo/StoreOperationalActivityAchievementCaseVo.java

@@ -63,4 +63,13 @@ public class StoreOperationalActivityAchievementCaseVo {
     @ApiModelProperty(value = "更新时间")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date updatedTime;
+
+    @ApiModelProperty(value = "用户手机号")
+    private String userPhone;
+
+    @ApiModelProperty(value = "用户名称")
+    private String userName;
+
+    @ApiModelProperty(value = "用户头像")
+    private String userImage;
 }

+ 6 - 0
alien-entity/src/main/java/shop/alien/entity/storePlatform/vo/StoreOperationalActivitySignupVO.java

@@ -37,6 +37,12 @@ public class StoreOperationalActivitySignupVO {
     @ApiModelProperty(value = "用户昵称")
     private String nickName;
 
+    @ApiModelProperty(value = "用户头像")
+    private String userImage;
+
+    @ApiModelProperty(value = "用户手机号")
+    private String userPhone;
+
     @ApiModelProperty(value = "手机号")
     private String phone;
 

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

@@ -1,9 +1,12 @@
 package shop.alien.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import shop.alien.entity.store.StorePlatformUserRole;
+import shop.alien.entity.store.vo.SubAccountListVo;
 import shop.alien.entity.store.vo.SubAccountVo;
 
 import java.util.List;
@@ -30,5 +33,19 @@ public interface StorePlatformUserRoleMapper extends BaseMapper<StorePlatformUse
                                         @Param("accountName") String accountName,
                                         @Param("phone") String phone,
                                         @Param("roleName") String roleName);
+
+    /**
+     * 查询所有子账号信息(包含主账号电话)- 分页查询
+     *
+     * @param page      分页对象
+     * @param accountId 账号ID(主账号ID或子账号用户ID,模糊查询)
+     * @param phone      联系电话(子账号电话,模糊查询)
+     * @param status    状态(精确查询)
+     * @return 子账号分页列表
+     */
+    IPage<SubAccountListVo> queryAllSubAccounts(Page<SubAccountListVo> page,
+                                                @Param("accountId") String accountId,
+                                                @Param("phone") String phone,
+                                                @Param("status") Integer status);
 }
 

+ 35 - 0
alien-entity/src/main/resources/mapper/StorePlatformUserRoleMapper.xml

@@ -32,5 +32,40 @@
         ORDER BY spur.created_time DESC
     </select>
 
+    <!-- 查询所有子账号信息(包含主账号电话) -->
+    <select id="queryAllSubAccounts" resultType="shop.alien.entity.store.vo.SubAccountListVo">
+        SELECT
+            su_main.id AS mainAccountId,
+            su_main.phone AS mainAccountPhone,
+            sur.id AS userId,
+            sur.phone AS phone,
+            spur.id AS subAccountId,
+            spur.account_name AS accountName,
+            spur.store_id AS storeId,
+            spr.role_id AS roleId,
+            spr.role_name AS roleName,
+            spur.created_time AS createdTime,
+            spur.status AS status
+        FROM store_platform_user_role spur
+        INNER JOIN store_user sur ON spur.user_id = sur.id
+        LEFT JOIN store_user su_main ON spur.store_id = su_main.store_id 
+            AND su_main.account_type = 1 
+            AND su_main.delete_flag = 0
+        LEFT JOIN store_platform_role spr ON spur.role_id = spr.role_id
+        WHERE spur.delete_flag = 0
+          AND sur.delete_flag = 0
+        <if test="accountId != null and accountId != ''">
+            AND (sur.id LIKE CONCAT('%', #{accountId}, '%') 
+                 OR su_main.id LIKE CONCAT('%', #{accountId}, '%'))
+        </if>
+        <if test="phone != null and phone != ''">
+            AND sur.phone LIKE CONCAT('%', #{phone}, '%')
+        </if>
+        <if test="status != null">
+            AND spur.status = #{status}
+        </if>
+        ORDER BY spur.created_time DESC
+    </select>
+
 </mapper>
 

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

@@ -66,7 +66,8 @@
             signup.user_name AS userName,
             signup.phone AS phone,
             signup.created_time AS createdTime,
-            u.user_image AS userImage
+            u.user_image AS userImage,
+            u.user_phone AS userPhone
         FROM store_operational_activity act
         LEFT JOIN life_user u ON u.id = #{userId}
         LEFT JOIN store_operational_activity_signup signup ON signup.activity_id = #{activityId}
@@ -106,6 +107,9 @@
             END AS activityStatus,
             u.user_name AS nickName,
             signup.phone AS phone,
+            u.user_name AS userName,
+            u.user_image AS userImage,
+            u.user_phone AS userPhone,
             CASE
                 WHEN (act.result_media_url IS NOT NULL AND act.result_media_url != '')
                     OR (act.result_text IS NOT NULL AND act.result_text != '') THEN 1

+ 12 - 9
alien-job/src/main/java/shop/alien/job/store/BadReviewAppealJob.java

@@ -189,20 +189,21 @@ public class BadReviewAppealJob {
                         continue;
                     }
 
-                    // 计算差值:差值>=10则同意,差值<10则驳回
-                    double confidenceDiff = Math.abs(userConfidence - merchantConfidence);
-                    log.info("差评申述置信度分析结果,申诉ID: {},user_confidence: {},merchant_confidence: {},差值: {}", 
-                        appeal.getId(), userConfidence, merchantConfidence, confidenceDiff);
+                    // 谁分数多算谁赢,平分的话算用户赢
+                    log.info("差评申述置信度分析结果,申诉ID: {},user_confidence: {},merchant_confidence: {}", 
+                        appeal.getId(), userConfidence, merchantConfidence);
 
                     StoreCommentAppeal sCommentAppeal = new StoreCommentAppeal();
                     sCommentAppeal.setRecordId(appeal.getRecordId());
                     sCommentAppeal.setAppealAiApproval(dataJsonObj.toJSONString());
 
-                    // 差值>=10则同意,差值<10则驳回
-                    if (confidenceDiff >= 10) {
+                    // 谁分数多算谁赢,平分的话算用户赢
+                    if (merchantConfidence > userConfidence) {
+                        //  商家分数 > 用户分数,商家赢(同意)
                         sCommentAppeal.setAppealStatus(2);
                         sCommentAppeal.setFinalResult("已同意");
-                        log.info("差评申述置信度差值>=10,申诉通过,申诉ID: {},差值: {}", appeal.getId(), confidenceDiff);
+                        log.info("差评申述置信度判断:商家赢(user_confidence: {} >= merchant_confidence: {}),申诉通过,申诉ID: {}",
+                            userConfidence, merchantConfidence, appeal.getId());
                         
                         // 删除评价和评论(与 StoreCommentAppealServiceImpl 逻辑一致)
                         Integer ratingId = appeal.getCommentId(); // commentId 存储的是评价ID(common_rating.id)
@@ -210,9 +211,11 @@ public class BadReviewAppealJob {
                             deleteRatingAndComments(ratingId);
                         }
                     } else {
+                        //  用户分数 >= 商家分数,用户赢(驳回)
                         sCommentAppeal.setAppealStatus(1);
                         sCommentAppeal.setFinalResult("已驳回");
-                        log.info("差评申述置信度差值<10,申诉驳回,申诉ID: {},差值: {}", appeal.getId(), confidenceDiff);
+                        log.info("差评申述置信度判断:用户赢(user_confidence: {} < merchant_confidence: {}),申诉驳回,申诉ID: {}",
+                            userConfidence, merchantConfidence, appeal.getId());
                     }
 
                     storeCommentAppealMapper.updateByRecordId(appeal.getRecordId(),
@@ -584,7 +587,7 @@ public class BadReviewAppealJob {
                 // 没有评价,设置默认评分为0
                 StoreInfo storeInfo = new StoreInfo();
                 storeInfo.setId(businessId);
-                storeInfo.setScoreAvg(0.0);
+                storeInfo.setScoreAvg(5.0);
                 storeInfo.setScoreOne(0.0);
                 storeInfo.setScoreTwo(0.0);
                 storeInfo.setScoreThree(0.0);

+ 1 - 1
alien-job/src/main/java/shop/alien/job/store/StoreOperationalActivityJob.java

@@ -75,7 +75,7 @@ public class StoreOperationalActivityJob {
 
             // 遍历活动,判断状态
             for (StoreOperationalActivity activity : activities) {
-                Date startTime = activity.getStartTime();
+                Date startTime = activity.getSignupStartTime() != null ? activity.getSignupStartTime() : activity.getStartTime();
                 Date endTime = activity.getEndTime();
                 Integer currentStatus = activity.getStatus();
 

+ 56 - 0
alien-store-platform/src/main/java/shop/alien/storeplatform/controller/StorePlatformUserRoleController.java

@@ -1,11 +1,13 @@
 package shop.alien.storeplatform.controller;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import io.swagger.annotations.*;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 import shop.alien.entity.result.R;
 import shop.alien.entity.store.vo.SubAccountDetailVo;
+import shop.alien.entity.store.vo.SubAccountListVo;
 import shop.alien.entity.store.vo.SubAccountVo;
 import shop.alien.storeplatform.dto.AssignRolesDto;
 import shop.alien.storeplatform.dto.BatchDeleteSubAccountDto;
@@ -241,5 +243,59 @@ public class StorePlatformUserRoleController {
         return R.fail("更新子账号信息失败");
     }
 
+    @ApiOperation("查询所有子账号信息(分页)")
+    @ApiOperationSupport(order = 11)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum", value = "页码", dataType = "int", paramType = "query", required = false, defaultValue = "1"),
+            @ApiImplicitParam(name = "pageSize", value = "每页大小", dataType = "int", paramType = "query", required = false, defaultValue = "10"),
+            @ApiImplicitParam(name = "mainAccountId", value = "账号ID(主账号ID或子账号用户ID,模糊查询)", dataType = "String", paramType = "query", required = false),
+            @ApiImplicitParam(name = "phone", value = "联系电话(子账号电话,模糊查询)", dataType = "String", paramType = "query", required = false),
+            @ApiImplicitParam(name = "status", value = "状态(0:启用 1:禁用)", dataType = "int", paramType = "query", required = false)
+    })
+    @GetMapping("/queryAllSubAccounts")
+    public R<IPage<SubAccountListVo>> queryAllSubAccounts(
+            @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
+            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
+            @RequestParam(value = "mainAccountId", required = false) String mainAccountId,
+            @RequestParam(value = "phone", required = false) String phone,
+            @RequestParam(value = "status", required = false) Integer status) {
+        log.info("StorePlatformUserRoleController.queryAllSubAccounts?pageNum={}, pageSize={}, mainAccountId={}, phone={}, status={}",
+                pageNum, pageSize, mainAccountId, phone, status);
+        IPage<SubAccountListVo> subAccountPage = storePlatformUserRoleService.queryAllSubAccounts(pageNum, pageSize, mainAccountId, phone, status);
+        return R.data(subAccountPage);
+    }
+
+    @ApiOperation("禁用子账号")
+    @ApiOperationSupport(order = 12)
+    @PlatformOperationLog(
+            module = "账号操作记录",
+            type = "禁用子账号",
+            content = "禁用子账号(关联记录ID=#{#id})"
+    )
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "子账号关联记录的主键ID", dataType = "Long", paramType = "query", required = true),
+            @ApiImplicitParam(name = "status", value = "状态标志(0启用 1禁用)", dataType = "Integer", paramType = "query", required = true)
+    })
+    @GetMapping("/disableSubAccount")
+    public R<String> disableSubAccount(@RequestParam("id") Long id, @RequestParam("status") Integer status) {
+        log.info("StorePlatformUserRoleController.disableSubAccount?id={}, status={}", id, status);
+        
+        if (id == null) {
+            return R.fail("子账号关联记录ID不能为空");
+        }
+        
+        if (status == null || (status != 0 && status != 1)) {
+            return R.fail("状态参数必须为0(启用)或1(禁用)");
+        }
+        
+        boolean result = storePlatformUserRoleService.disableSubAccount(id, status);
+        if (result) {
+            String message = status == 0 ? "启用子账号成功" : "禁用子账号成功";
+            return R.success(message);
+        }
+        String message = status == 0 ? "启用子账号失败" : "禁用子账号失败";
+        return R.fail(message);
+    }
+
 }
 

+ 28 - 0
alien-store-platform/src/main/java/shop/alien/storeplatform/service/StorePlatformUserRoleService.java

@@ -1,9 +1,11 @@
 package shop.alien.storeplatform.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import shop.alien.entity.result.R;
 import shop.alien.entity.store.StorePlatformUserRole;
 import shop.alien.entity.store.vo.SubAccountDetailVo;
+import shop.alien.entity.store.vo.SubAccountListVo;
 import shop.alien.entity.store.vo.SubAccountVo;
 
 import java.util.List;
@@ -120,5 +122,31 @@ public interface StorePlatformUserRoleService extends IService<StorePlatformUser
      * @return 是否成功
      */
     boolean updateSubAccount(Integer userId, String phone, String accountName, Integer storeId, Long roleId);
+
+    /**
+     * 查询所有子账号信息(包含主账号电话)- 分页查询
+     * 查询 store_platform_user_role 表中所有的数据
+     * 主账号电话通过 store_id 关联 store_user 表查询
+     * 联系电话通过 user_id 关联 store_user 表查询
+     *
+     * @param pageNum   页码
+     * @param pageSize  每页大小
+     * @param mainAccountId 账号ID(主账号ID或子账号用户ID,模糊查询)
+     * @param phone     联系电话(子账号电话,模糊查询)
+     * @param status    状态(精确查询)
+     * @return 子账号分页列表
+     */
+    IPage<SubAccountListVo> queryAllSubAccounts(Integer pageNum, Integer pageSize, String mainAccountId, String phone, Integer status);
+
+    /**
+     * 更新子账号状态
+     * 根据传入的 status 值更新 store_platform_user_role 表中指定记录的 status 字段
+     * status 为 0 表示启用,status 为 1 表示禁用
+     *
+     * @param id 子账号关联记录的主键ID
+     * @param status 状态值(0启用 1禁用)
+     * @return 是否成功
+     */
+    boolean disableSubAccount(Long id, Integer status);
 }
 

+ 3 - 0
alien-store-platform/src/main/java/shop/alien/storeplatform/service/impl/OperationalActivitySignupServiceImpl.java

@@ -100,6 +100,9 @@ public class OperationalActivitySignupServiceImpl implements OperationalActivity
                 LifeUser lifeUser = lifeUserMapper.selectById(signup.getUserId());
                 if (lifeUser != null && lifeUser.getUserName() != null) {
                     vo.setNickName(lifeUser.getUserName());
+                    vo.setUserImage(lifeUser.getUserImage());
+                    vo.setUserPhone(lifeUser.getUserPhone());
+                    vo.setUserName(lifeUser.getUserName());
                 }
             }
 

+ 73 - 0
alien-store-platform/src/main/java/shop/alien/storeplatform/service/impl/StorePlatformUserRoleServiceImpl.java

@@ -2,6 +2,8 @@ package shop.alien.storeplatform.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -15,6 +17,7 @@ import shop.alien.entity.store.StorePlatformUserRole;
 import shop.alien.entity.store.StoreUser;
 import shop.alien.entity.store.vo.PermissionItemVo;
 import shop.alien.entity.store.vo.SubAccountDetailVo;
+import shop.alien.entity.store.vo.SubAccountListVo;
 import shop.alien.entity.store.vo.SubAccountVo;
 import shop.alien.mapper.StorePlatformMenuMapper;
 import shop.alien.mapper.StorePlatformRoleMapper;
@@ -775,5 +778,75 @@ public class StorePlatformUserRoleServiceImpl extends ServiceImpl<StorePlatformU
             return false;
         }
     }
+
+    @Override
+    public IPage<SubAccountListVo> queryAllSubAccounts(Integer pageNum, Integer pageSize, String accountId, String phone, Integer status) {
+        try {
+            // 创建分页对象
+            Page<SubAccountListVo> page = new Page<>(pageNum, pageSize);
+            // 执行分页查询
+            IPage<SubAccountListVo> result = storePlatformUserRoleMapper.queryAllSubAccounts(page, accountId, phone, status);
+            log.info("查询所有子账号信息成功,共{}条记录,当前页{}条,查询条件:accountId={}, phone={}, status={}", 
+                    result.getTotal(), result.getRecords() != null ? result.getRecords().size() : 0, accountId, phone, status);
+            return result;
+        } catch (Exception e) {
+            log.error("查询所有子账号信息失败,查询条件:accountId={}, phone={}, status={}", accountId, phone, status, e);
+            // 返回空分页对象
+            Page<SubAccountListVo> emptyPage = new Page<>(pageNum, pageSize);
+            emptyPage.setTotal(0);
+            emptyPage.setRecords(new ArrayList<>());
+            return emptyPage;
+        }
+    }
+
+    @Override
+    public boolean disableSubAccount(Long id, Integer status) {
+        if (id == null) {
+            log.error("子账号关联记录ID不能为空");
+            return false;
+        }
+
+        if (status == null || (status != 0 && status != 1)) {
+            log.error("状态参数必须为0(启用)或1(禁用): status={}", status);
+            return false;
+        }
+
+        try {
+            // 1. 先查询记录是否存在
+            StorePlatformUserRole userRole = storePlatformUserRoleMapper.selectById(id);
+            if (userRole == null) {
+                log.error("子账号关联记录不存在: id={}", id);
+                return false;
+            }
+
+            // 2. 检查当前状态是否已经是目标状态
+            if (userRole.getStatus() != null && userRole.getStatus().equals(status)) {
+                String statusText = status == 0 ? "启用" : "禁用";
+                log.warn("子账号已经是{}状态: id={}", statusText, id);
+                return true; // 已经是目标状态,返回成功
+            }
+
+            // 3. 根据传入的 status 值更新状态
+            LambdaUpdateWrapper<StorePlatformUserRole> updateWrapper = new LambdaUpdateWrapper<>();
+            updateWrapper.eq(StorePlatformUserRole::getId, id)
+                    .eq(StorePlatformUserRole::getDeleteFlag, 0) // 只更新未删除的记录
+                    .set(StorePlatformUserRole::getStatus, status); // 根据传入的 status 值更新
+
+            int updateResult = storePlatformUserRoleMapper.update(null, updateWrapper);
+            if (updateResult > 0) {
+                String statusText = status == 0 ? "启用" : "禁用";
+                log.info("成功{}子账号: id={}, userId={}, storeId={}, roleId={}, status={}", 
+                        statusText, id, userRole.getUserId(), userRole.getStoreId(), userRole.getRoleId(), status);
+                return true;
+            } else {
+                String statusText = status == 0 ? "启用" : "禁用";
+                log.error("{}子账号失败: id={}", statusText, id);
+                return false;
+            }
+        } catch (Exception e) {
+            log.error("更新子账号状态异常: id={}, status={}", id, status, e);
+            return false;
+        }
+    }
 }
 

+ 67 - 11
alien-store/src/main/java/shop/alien/store/controller/StoreInfoController.java

@@ -1518,7 +1518,7 @@ public class StoreInfoController {
         }
     }
 
-    @ApiOperation("分页随机查询店铺(排除已删除和已拉黑的店铺)")
+    @ApiOperation("分页随机查询店铺(排除已删除、已拉黑和已关注的店铺)")
     @ApiOperationSupport(order = 100)
     @ApiImplicitParams({
             @ApiImplicitParam(
@@ -1575,13 +1575,69 @@ public class StoreInfoController {
                 }
             }
             
+            // 查询当前登录用户已关注的店铺ID(仅普通用户)
+            List<Integer> followedStoreIds = new ArrayList<>();
+            if (userLoginInfo != null && userLoginInfo.getUserId() > 0 && "user".equals(userLoginInfo.getType())) {
+                try {
+                    // 查询用户信息获取手机号
+                    Integer userId = userLoginInfo.getUserId();
+                    LifeUser lifeUser = lifeUserMapper.selectById(userId);
+                    
+                    if (lifeUser != null && StringUtils.isNotEmpty(lifeUser.getUserPhone())) {
+                        // 构造粉丝ID:fans_id = "user_" + 用户手机号
+                        String fansId = "user_" + lifeUser.getUserPhone();
+                        
+                        // 查询该用户关注的所有门店(followed_id 以 "store_" 开头)
+                        LambdaQueryWrapper<LifeFans> fansWrapper = new LambdaQueryWrapper<>();
+                        fansWrapper.eq(LifeFans::getFansId, fansId)
+                                   .likeRight(LifeFans::getFollowedId, "store_")
+                                   .eq(LifeFans::getDeleteFlag, 0);
+                        List<LifeFans> lifeFansList = lifeFansMapper.selectList(fansWrapper);
+                        
+                        if (!CollectionUtils.isEmpty(lifeFansList)) {
+                            // 从 followed_id 中提取门店手机号(去掉 "store_" 前缀)
+                            Set<String> storePhones = new HashSet<>();
+                            for (LifeFans fans : lifeFansList) {
+                                if (fans.getFollowedId() != null && fans.getFollowedId().startsWith("store_")) {
+                                    String storePhone = fans.getFollowedId().substring(6); // 去掉 "store_" 前缀
+                                    if (StringUtils.isNotEmpty(storePhone)) {
+                                        storePhones.add(storePhone);
+                                    }
+                                }
+                            }
+                            
+                            // 通过门店手机号查询门店ID
+                            if (!storePhones.isEmpty()) {
+                                LambdaQueryWrapper<StoreInfo> storeWrapper = new LambdaQueryWrapper<>();
+                                storeWrapper.in(StoreInfo::getStoreTel, storePhones)
+                                          .eq(StoreInfo::getDeleteFlag, 0);
+                                List<StoreInfo> followedStores = storeInfoMapper.selectList(storeWrapper);
+                                
+                                for (StoreInfo store : followedStores) {
+                                    if (store.getId() != null) {
+                                        followedStoreIds.add(store.getId());
+                                    }
+                                }
+                            }
+                        }
+                    }
+                } catch (Exception e) {
+                    log.error("查询用户已关注门店失败 - userId: {}, error: {}", 
+                            userLoginInfo.getUserId(), e.getMessage(), e);
+                }
+            }
+            
+            // 合并拉黑和已关注的店铺ID列表
+            Set<Integer> excludedStoreIds = new HashSet<>(blacklistedStoreIds);
+            excludedStoreIds.addAll(followedStoreIds);
+            
             // 构建查询条件
             LambdaQueryWrapper<StoreInfo> queryWrapper = new LambdaQueryWrapper<>();
             queryWrapper.eq(StoreInfo::getDeleteFlag, 0); // 未删除
             
-            // 排除被拉黑的店铺
-            if (!blacklistedStoreIds.isEmpty()) {
-                queryWrapper.notIn(StoreInfo::getId, blacklistedStoreIds);
+            // 排除被拉黑和已关注的店铺
+            if (!excludedStoreIds.isEmpty()) {
+                queryWrapper.notIn(StoreInfo::getId, excludedStoreIds);
             }
             
             // 随机排序
@@ -1642,23 +1698,23 @@ public class StoreInfoController {
                         // userId是用户ID(数字),查询用户信息获取手机号
                         Integer userId = userLoginInfo.getUserId();
                         LifeUser lifeUser = lifeUserMapper.selectById(userId);
-                        
+
                         // 获取门店手机号
                         String storePhone = storePhoneMap.get(store.getId());
-                        
-                        if (lifeUser != null && StringUtils.isNotEmpty(lifeUser.getUserPhone()) 
+
+                        if (lifeUser != null && StringUtils.isNotEmpty(lifeUser.getUserPhone())
                                 && StringUtils.isNotEmpty(storePhone)) {
                             // 构造关注关系:followed_id = "store_" + 门店手机号,fans_id = "user_" + 用户手机号
                             String followedId = "store_" + storePhone;
                             String fansId = "user_" + lifeUser.getUserPhone();
-                            
+
                             // 查询关注关系
                             LambdaQueryWrapper<LifeFans> fansWrapper = new LambdaQueryWrapper<>();
                             fansWrapper.eq(LifeFans::getFollowedId, followedId)
                                     .eq(LifeFans::getFansId, fansId)
                                     .eq(LifeFans::getDeleteFlag, 0);
                             LifeFans lifeFans = lifeFansMapper.selectOne(fansWrapper);
-                            
+
                             if (lifeFans != null) {
                                 isFollowed = 1; // 已关注
                             } else {
@@ -1668,11 +1724,11 @@ public class StoreInfoController {
                             isFollowed = 0; // 无法获取用户手机号或店铺手机号,默认未关注
                         }
                     } catch (NumberFormatException e) {
-                        log.error("用户ID格式错误 - userId: {}, storeId: {}, error: {}", 
+                        log.error("用户ID格式错误 - userId: {}, storeId: {}, error: {}",
                                 userLoginInfo.getUserId(), store.getId(), e.getMessage());
                         isFollowed = 0; // 用户ID格式错误,默认未关注
                     } catch (Exception e) {
-                        log.error("查询用户关注状态失败 - userId: {}, storeId: {}, error: {}", 
+                        log.error("查询用户关注状态失败 - userId: {}, storeId: {}, error: {}",
                                 userLoginInfo.getUserId(), store.getId(), e.getMessage(), e);
                         isFollowed = 0; // 查询失败,默认未关注
                     }

+ 2 - 2
alien-store/src/main/java/shop/alien/store/service/impl/OperationalActivityServiceImpl.java

@@ -286,9 +286,9 @@ public class OperationalActivityServiceImpl implements OperationalActivityServic
             return null;
         }
         switch (activityType) {
-            case "COMMENT":
+            case "2":
                 return "评论有礼";
-            case "MARKETING":
+            case "1":
                 return "营销活动";
             default:
                 return activityType;

+ 1 - 1
alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java

@@ -3480,7 +3480,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
                     }
                     Integer status = activity.getStatus();
                     String activityType = activity.getActivityType();
-                    if (!"MARKETING".equals(activityType)) {
+                    if (!"1".equals(activityType)) {
                         // 非MARKETING且未开始,不展示
                         return status == null || status != 2;
                     }

+ 28 - 0
alien-store/src/main/java/shop/alien/store/util/ai/AiReportReviewUtil.java

@@ -1,5 +1,6 @@
 package shop.alien.store.util.ai;
 
+import com.alibaba.fastjson2.JSONObject;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
@@ -12,6 +13,10 @@ import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
 import org.springframework.util.StringUtils;
 import org.springframework.web.client.RestTemplate;
+import shop.alien.entity.store.LifeUserViolation;
+import shop.alien.mapper.CommonCommentMapper;
+import shop.alien.mapper.LifeUserDynamicsMapper;
+import shop.alien.mapper.LifeUserViolationMapper;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -35,6 +40,10 @@ public class AiReportReviewUtil {
     @Value("${third-party-ai.report-review.base-url:http://124.93.18.180:9000/ai/auto-review/api/v1/merchant_dynamic_violation_audit_task/submit}")
     private String aiReportReviewUrl;
 
+    private final LifeUserViolationMapper lifeUserViolationMapper;
+    private final CommonCommentMapper commonCommentMapper;
+    private final LifeUserDynamicsMapper  lifeUserDynamicsMapper;
+
     @Async("taskExecutor")
     public void reviewReport(Integer reportId, String reportType) {
 
@@ -64,8 +73,27 @@ public class AiReportReviewUtil {
         HttpEntity<Map<String, Object>> request = new HttpEntity<>(requestBody, headers);
         log.info("调用ai举报接口URL:{},requestBody: {}", aiReportReviewUrl, requestBody);
         ResponseEntity<String> response = restTemplate.postForEntity(aiReportReviewUrl, request, String.class);
+
         if(response.getStatusCode().isError()){
             log.error("调用ai举报接口失败,URL:{},requestBody: {},response: {}", aiReportReviewUrl, requestBody, response);
+        } else {
+            // 如果举报成功删除对应数据,动态/评论
+            boolean success = JSONObject.parseObject(response.getBody()).getJSONObject("data").getJSONObject("result").getString("processing_status").equals("1");
+            if(success){
+                LifeUserViolation lifeUserViolation = lifeUserViolationMapper.selectById(reportId);
+                int i = 0;
+                if(reportType.equals("2")){
+                    // 删除动态
+                    i = lifeUserDynamicsMapper.deleteById(lifeUserViolation.getDynamicsId());
+                }
+                if(reportType.equals("3")){
+                    // 删除评论
+                    i = commonCommentMapper.deleteById(lifeUserViolation.getBusinessId());
+                }
+                if( i == 0 ){
+                    log.info("删除动态/评论失败,type:{},举报id:{}", reportType, reportId);
+                }
+            }
         }
     }
 }