Explorar el Código

Merge remote-tracking branch 'origin/sit-three-categories' into sit-three-categories

liyafei hace 3 meses
padre
commit
e4ab56d22f

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

@@ -9,6 +9,7 @@ import lombok.Data;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 菜单权限表
@@ -104,5 +105,8 @@ public class LifeSysMenu {
     @ApiModelProperty(value = "子菜单列表(用于树形结构)")
     @TableField(exist = false)
     private List<LifeSysMenu> children;
+
+    @TableField(exist = false)
+    private Map<String,Object> meta;
 }
 

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

@@ -40,5 +40,12 @@ public class StoreStaffDetailWithPerformanceVo implements Serializable {
      */
     @ApiModelProperty(value = "是否今日演出(true-今日有演出,false-今日无演出)")
     private Boolean hasPerformanceToday;
+
+    /**
+     * 是否喜欢(true-已喜欢,false-未喜欢)
+     * 根据当前登录用户的token中的userid判断
+     */
+    @ApiModelProperty(value = "是否喜欢(true-已喜欢,false-未喜欢)")
+    private Boolean isLiked;
 }
 

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

@@ -27,7 +27,7 @@ public class WebSocketVo {
     @ApiModelProperty(value = "是否已读  0:未读  1:已读")
     private Integer isRead;
 
-    @ApiModelProperty(value = "消息类型  1-文本  2-图片 3-链接分享  4-二手交易(确认/拒绝/取消)  5-二手交易签到提醒  6-二手交易已签到  7-消息内容不合规 8-律师消息")
+    @ApiModelProperty(value = "消息类型  1-文本  2-图片 3-链接分享  4-二手交易(确认/拒绝/取消)  5-二手交易签到提醒  6-二手交易已签到  7-消息内容不合规 8-律师消息 14-人员分享")
     private String type;
 
     @ApiModelProperty(value = "消息内容")

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

@@ -86,10 +86,10 @@ public class SystemServiceImpl implements SystemService {
             tokenMap.put("userType", "web");
             R<List<LifeSysMenu>> menuByUserId = storeServiceFeign.getMenuByUserId(lifeSys.getId().longValue(), 1L);
             List<LifeSysMenu> data = menuByUserId.getData();
-            tokenMap.put("menuList", JSONObject.toJSONString(data));
             //存入token
             result.setToken(JwtUtil.createJWT("web_" + lifeSys.getId(), lifeSys.getUserName(), JSONObject.toJSONString(tokenMap), effectiveTimeIntLong));
             baseRedisService.setString("web_" + lifeSys.getUserName(), result.getToken());
+            tokenMap.put("menuList", JSONObject.toJSONString(data));
             //登录结果
             result.setResult(true);
             //角色Id

+ 17 - 5
alien-store/src/main/java/shop/alien/store/controller/StoreStaffConfigController.java

@@ -2,12 +2,15 @@ package shop.alien.store.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import io.swagger.annotations.*;
+import springfox.documentation.annotations.ApiIgnore;
 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.StoreStaffConfig;
 import shop.alien.entity.store.StoreStaffTitle;
+import shop.alien.entity.store.UserLoginInfo;
+import shop.alien.util.common.TokenInfo;
 import shop.alien.entity.store.dto.StoreStaffConfigListQueryDto;
 import shop.alien.entity.store.vo.StaffTitleGroupVo;
 import shop.alien.entity.store.vo.StoreStaffDetailVo;
@@ -266,8 +269,10 @@ public class StoreStaffConfigController {
     })
     @GetMapping("/queryStaffDetail")
     public R<StoreStaffDetailWithPerformanceVo> queryStaffDetail(
-            @RequestParam(value = "id", required = true) Integer id) {
-        log.info("查询员工详情(包含演出列表),id={}", id);
+            @RequestParam(value = "id", required = true) Integer id,
+            @ApiIgnore @TokenInfo UserLoginInfo userLoginInfo) {
+        log.info("查询员工详情(包含演出列表),id={},userId={}", 
+                id, userLoginInfo != null ? userLoginInfo.getUserId() : null);
 
         try {
             // 参数校验
@@ -276,17 +281,24 @@ public class StoreStaffConfigController {
                 return R.fail("员工ID不能为空且必须大于0");
             }
 
+            // 获取用户ID(可能为null,如果用户未登录)
+            Integer userId = null;
+            if (userLoginInfo != null) {
+                userId = userLoginInfo.getUserId();
+            }
+
             // 调用服务层查询
             StoreStaffDetailWithPerformanceVo result =
-                    storeStaffConfigService.queryStaffDetailWithPerformance(id);
+                    storeStaffConfigService.queryStaffDetailWithPerformance(id, userId);
 
             if (result == null) {
                 log.warn("查询员工详情失败,员工不存在:id={}", id);
                 return R.fail("员工不存在");
             }
 
-            log.info("查询员工详情成功,id={},演出安排数量:{}",
-                    id, result.getPerformanceScheduleList() != null ? result.getPerformanceScheduleList().size() : 0);
+            log.info("查询员工详情成功,id={},演出安排数量:{},是否喜欢:{}",
+                    id, result.getPerformanceScheduleList() != null ? result.getPerformanceScheduleList().size() : 0,
+                    result.getIsLiked());
             return R.data(result);
         } catch (IllegalArgumentException e) {
             log.warn("查询员工详情参数错误,id={},错误信息:{}", id, e.getMessage());

+ 2 - 1
alien-store/src/main/java/shop/alien/store/service/StoreStaffConfigService.java

@@ -132,9 +132,10 @@ public interface StoreStaffConfigService {
      * </p>
      *
      * @param id 员工主键ID,必须大于0
+     * @param userId 当前登录用户ID,可为null(未登录时)
      * @return 员工详情(包含演出列表),如果员工不存在则返回null
      */
-    shop.alien.entity.store.vo.StoreStaffDetailWithPerformanceVo queryStaffDetailWithPerformance(Integer id);
+    shop.alien.entity.store.vo.StoreStaffDetailWithPerformanceVo queryStaffDetailWithPerformance(Integer id, Integer userId);
 
     /**
      * 获取美食员工列表

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

@@ -382,7 +382,15 @@ public class LifeSysMenuServiceImpl implements LifeSysMenuService {
         for (LifeSysMenu menu : flatList) {
             Long menuId = menu.getMenuId();
             Long parentId = menu.getParentId() != null ? menu.getParentId() : 0L;
-
+            HashMap<String, Object> metaMap = new HashMap<>();
+            metaMap.put("title",menu.getMenuName());
+            metaMap.put("isFull","false");
+            if (menu.getStatus().equals("1")) {
+                metaMap.put("isHide",true);
+            } else {
+                metaMap.put("isHide",false);
+            }
+            menu.setMeta(metaMap);
             // 存入节点映射
             nodeMap.put(menuId, menu);
 

+ 48 - 8
alien-store/src/main/java/shop/alien/store/service/impl/StoreStaffConfigServiceImpl.java

@@ -27,12 +27,14 @@ import shop.alien.entity.store.vo.PerformanceScheduleVo;
 import shop.alien.entity.store.StoreComment;
 import shop.alien.entity.store.StoreStaffReview;
 import shop.alien.entity.store.StoreStaffTitle;
+import shop.alien.entity.store.LifeLikeRecord;
 import shop.alien.entity.store.vo.StaffTitleGroupVo;
 import shop.alien.entity.store.vo.StoreStaffDetailVo;
 import shop.alien.entity.store.vo.StoreStaffDetailWithPerformanceVo;
 import shop.alien.entity.store.vo.StoreStaffFitnessDetailVo;
 import shop.alien.entity.store.vo.StoreStaffPositionCountVo;
 import shop.alien.mapper.*;
+import shop.alien.mapper.LifeLikeRecordMapper;
 import shop.alien.store.service.StoreStaffConfigService;
 import shop.alien.store.service.StoreStaffFitnessBaseService;
 import shop.alien.store.service.StoreStaffFitnessCertificationService;
@@ -92,6 +94,8 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
 
     private final StoreStaffFitnessExperienceService storeStaffFitnessExperienceService;
 
+    private final LifeLikeRecordMapper lifeLikeRecordMapper;
+
     /**
      * 认证类型:认证
      */
@@ -243,15 +247,15 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
                             (videoAuditResult == null || videoAuditResult.isPassed());
 
         // 根据 AI 审核结果更新状态
-        // 审核通过:状态保持为"0"(审核中),等待人工审核
+        // 审核通过:状态保持为"1"(审核通过)
         // 审核失败:状态设置为"2"(审核拒绝)
         StoreStaffConfig auditUpdate = new StoreStaffConfig();
         auditUpdate.setId(staffId);
         if (allPassed) {
-            // AI审核通过,状态保持为"审核中"(0),等待人工审核
-            auditUpdate.setStatus("0");
+            // AI审核通过,状态保持为"审核中"(1)
+            auditUpdate.setStatus("1");
             auditUpdate.setRejectionReason(null);
-            log.info("人员AI审核通过,状态保持为审核中,等待人工审核:staffId={}", staffId);
+            log.info("人员AI审核通过,状态设置为审核通过:staffId={}", staffId);
         } else {
             // AI审核失败,状态设置为"审核拒绝"(2)
             // 收集所有失败原因
@@ -939,8 +943,8 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
      * @return 员工详情(包含演出列表),如果员工不存在则返回null
      */
     @Override
-    public StoreStaffDetailWithPerformanceVo queryStaffDetailWithPerformance(Integer id) {
-        log.info("查询员工详情(包含演出列表),id={}", id);
+    public StoreStaffDetailWithPerformanceVo queryStaffDetailWithPerformance(Integer id, Integer userId) {
+        log.info("查询员工详情(包含演出列表),id={},userId={}", id, userId);
 
         // 参数校验
         if (id == null || id <= 0) {
@@ -963,15 +967,19 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
             // 判断今日是否有演出
             Boolean hasPerformanceToday = checkHasPerformanceToday(id);
 
+            // 判断是否喜欢(根据userId查询点赞记录)
+            Boolean isLiked = checkIsLiked(id, userId);
+
             // 构建返回对象
             StoreStaffDetailWithPerformanceVo result =
                     new StoreStaffDetailWithPerformanceVo();
             result.setStaffInfo(staffConfig);
             result.setPerformanceScheduleList(performanceScheduleList);
             result.setHasPerformanceToday(hasPerformanceToday);
+            result.setIsLiked(isLiked);
 
-            log.info("查询员工详情(包含演出列表)成功,id={},演出安排数量:{},今日是否有演出:{}",
-                    id, performanceScheduleList != null ? performanceScheduleList.size() : 0, hasPerformanceToday);
+            log.info("查询员工详情(包含演出列表)成功,id={},演出安排数量:{},今日是否有演出:{},是否喜欢:{}",
+                    id, performanceScheduleList != null ? performanceScheduleList.size() : 0, hasPerformanceToday, isLiked);
             return result;
         } catch (Exception e) {
             log.error("查询员工详情(包含演出列表)异常,id={},异常信息:{}", id, e.getMessage(), e);
@@ -1805,4 +1813,36 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
             throw new RuntimeException("根据标题ID查询员工列表失败:" + e.getMessage(), e);
         }
     }
+
+    /**
+     * 检查用户是否喜欢该员工
+     * <p>
+     * 根据userId查询life_like_record表,判断是否存在点赞记录
+     * type = "8" 表示点赞员工
+     * </p>
+     *
+     * @param staffId 员工ID
+     * @param userId 用户ID,可为null(未登录时返回false)
+     * @return true-已喜欢,false-未喜欢
+     */
+    private Boolean checkIsLiked(Integer staffId, Integer userId) {
+        // 如果用户未登录,返回false
+        if (userId == null || userId <= 0) {
+            return false;
+        }
+
+        try {
+            LambdaQueryWrapper<LifeLikeRecord> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(LifeLikeRecord::getType, "8") // 8-点赞员工
+                    .eq(LifeLikeRecord::getDianzanId, String.valueOf(userId))
+                    .eq(LifeLikeRecord::getHuifuId, String.valueOf(staffId))
+                    .eq(LifeLikeRecord::getDeleteFlag, 0);
+            long count = lifeLikeRecordMapper.selectCount(queryWrapper);
+            return count > 0;
+        } catch (Exception e) {
+            log.error("查询员工是否喜欢异常,staffId={},userId={},异常信息:{}", 
+                    staffId, userId, e.getMessage(), e);
+            return false;
+        }
+    }
 }