Forráskód Böngészése

竞拍相关模块-收藏 / 取消收藏、我的页面-我的收藏

jintao.geng 1 hete
szülő
commit
16be06acef

+ 2 - 2
auc/src/main/java/cn/hobbystocks/auc/web/LotGroupController.java

@@ -11,7 +11,7 @@ import cn.hobbystocks.auc.common.utils.UserType;
 import cn.hobbystocks.auc.domain.Bid;
 import cn.hobbystocks.auc.domain.Lot;
 import cn.hobbystocks.auc.domain.LotGroup;
-import cn.hobbystocks.auc.service.ILotFansService;
+import cn.hobbystocks.auc.service.LotFansService;
 import cn.hobbystocks.auc.vo.LotGroupVO;
 import cn.hobbystocks.auc.vo.SkuDTO;
 import io.swagger.annotations.Api;
@@ -41,7 +41,7 @@ public class LotGroupController extends AdminBaseController {
 	@Autowired
 	private AppClient appClient;
 	@Autowired
-	ILotFansService lotFansService;
+    LotFansService lotFansService;
 
 
 	@ApiOperation(value = "克隆商品", notes = "insertLotGroup with no id", response = AjaxResult.class, responseContainer = "AjaxResult")

+ 0 - 50
bid/src/main/java/cn/hobbystocks/auc/web/FansController.java

@@ -1,50 +0,0 @@
-package cn.hobbystocks.auc.web;
-
-import cn.hobbystocks.auc.common.core.domain.AjaxResult;
-import cn.hobbystocks.auc.common.user.UserUtils;
-import cn.hobbystocks.auc.domain.LotFans;
-import cn.hobbystocks.auc.service.ILotFansService;
-import cn.hobbystocks.auc.vo.FansVO;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.CollectionUtils;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-
-@RestController
-@RequestMapping("/bid/fans")
-@Slf4j
-@Api(tags = "关注拍品相关接口")
-public class FansController {
-
-    @Autowired
-    private ILotFansService lotFansService;
-
-    @ApiOperation("关注拍卖品")
-    @PostMapping
-    public AjaxResult fans(@RequestBody FansVO fansVO) {
-        lotFansService.fans(fansVO);
-        return AjaxResult.success();
-    }
-
-
-    @ApiOperation("检查当前用户是否关注了指定的拍卖品")
-    @PostMapping("/isFans")
-    public AjaxResult isFans(@RequestBody FansVO fansVO) {
-        List<LotFans> lotFansList = lotFansService.selectLotFansList(LotFans.builder()
-                .lotId(fansVO.getLotId())
-                .userId(UserUtils.getSimpleUserInfo().getId().longValue())
-                .type("user_like")
-                .build());
-        return AjaxResult.success(!CollectionUtils.isEmpty(lotFansList));
-    }
-
-
-
-}

+ 70 - 0
bid/src/main/java/cn/hobbystocks/auc/web/LotFansController.java

@@ -0,0 +1,70 @@
+package cn.hobbystocks.auc.web;
+
+import cn.hobbystocks.auc.common.core.domain.AjaxResult;
+import cn.hobbystocks.auc.common.user.UserUtils;
+import cn.hobbystocks.auc.domain.LotFans;
+import cn.hobbystocks.auc.request.LotFansTogglePageRequest;
+import cn.hobbystocks.auc.request.LotFansToggleRequest;
+import cn.hobbystocks.auc.response.LotFansResponse;
+import cn.hobbystocks.auc.response.FavoriteOperationResponse;
+import cn.hobbystocks.auc.service.LotFansService;
+import cn.hobbystocks.auc.vo.FansVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/api/bid/fans")
+@Slf4j
+@Api(tags = "关注拍品相关接口")
+public class LotFansController {
+
+    @Autowired
+    private LotFansService lotFansService;
+
+    /**
+     * 收藏/取消收藏拍品
+     */
+    @ApiOperation(value = "收藏/取消收藏拍品", notes = "根据isLike参数进行收藏或取消收藏操作", response = FavoriteOperationResponse.class)
+    @PostMapping("/toggle")
+    public AjaxResult toggleFavorite(@RequestBody LotFansToggleRequest request) {
+        Boolean result = lotFansService.toggleFavorite(request);
+        if (Boolean.TRUE.equals(result)) {
+            return AjaxResult.success();
+        } else {
+            return AjaxResult.error();
+        }
+    }
+
+    /**
+     * 查询用户收藏的拍品列表(分页)
+     */
+    @ApiOperation(value = "查询用户收藏的拍品列表(分页)", notes = "分页查询当前用户收藏的拍品列表", response = LotFansResponse.class, responseContainer = "List<LotFansResponse>")
+    @PostMapping("/fansPage")
+    public AjaxResult page(@RequestBody LotFansTogglePageRequest  request) {
+
+        List<LotFansResponse> list = lotFansService.page(request);
+        return AjaxResult.successPage(list);
+    }
+
+
+
+    @ApiOperation("检查当前用户是否关注了指定的拍卖品")
+    @PostMapping("/isFans")
+    public AjaxResult isFans(@RequestBody FansVO fansVO) {
+        List<LotFans> lotFansList = lotFansService.selectLotFansList(LotFans.builder()
+                .lotId(fansVO.getLotId())
+                .userId(UserUtils.getSimpleUserInfo().getId().longValue())
+                .type("user_like")
+                .build());
+        return AjaxResult.success(!CollectionUtils.isEmpty(lotFansList));
+    }
+
+
+
+}

+ 18 - 0
lot/src/main/java/cn/hobbystocks/auc/common/utils/DateUtils.java

@@ -31,6 +31,9 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
             "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
             "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
 
+    // 系统默认时区(避免时区偏移问题)
+    private static final ZoneId DEFAULT_ZONE_ID = ZoneId.systemDefault();
+
     /**
      * 获取当前Date型日期
      *
@@ -224,4 +227,19 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
     public static LocalDateTime parseStringToLocalDateTime(String time) {
         return LocalDateTime.parse(time, DateTimeFormatter.ofPattern(YYYY_MM_DD_HH_MM_SS));
     }
+
+    /**
+     * 当前时间 + n天
+     * @param days 偏移天数(正数=往后,负数=往前,0=当前时间)
+     * @return 偏移后的Date类型时间(兼容旧代码)
+     */
+
+
+    public static Date addDays(int days) {
+        LocalDateTime currentTime = LocalDateTime.now();
+        LocalDateTime targetTime = currentTime.plusDays(days);
+        // 转换为Date类型(若不需要Date,可直接返回LocalDateTime)
+        return Date.from(targetTime.atZone(DEFAULT_ZONE_ID).toInstant());
+    }
+
 }

+ 27 - 0
lot/src/main/java/cn/hobbystocks/auc/convert/LotConvert.java

@@ -0,0 +1,27 @@
+package cn.hobbystocks.auc.convert;
+
+
+import cn.hobbystocks.auc.domain.Lot;
+import cn.hobbystocks.auc.response.LotFansResponse;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+
+/**
+ * 拍品转换器
+ *
+ * @author: gengjintao
+ * @date: 2026/01/20
+ */
+@Mapper
+public interface LotConvert {
+
+    LotConvert INSTANCE = Mappers.getMapper(LotConvert.class);
+
+
+
+    LotFansResponse toLotFansResponse(Lot po);
+
+
+
+}

+ 38 - 3
lot/src/main/java/cn/hobbystocks/auc/domain/LotFans.java

@@ -1,9 +1,9 @@
 package cn.hobbystocks.auc.domain;
 
-import cn.hobbystocks.auc.common.core.domain.BaseEntity;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.*;
 
+import java.time.LocalDateTime;
 import java.util.Date;
 
 @Data
@@ -12,20 +12,55 @@ import java.util.Date;
 @NoArgsConstructor
 @Builder
 @TableName("lot_fans")
-public class LotFans extends BaseEntity
-{
+public class LotFans {
     private static final long serialVersionUID = 1L;
 
+    /**
+     * 主键id
+     */
     private Long id;
 
+    /**
+     * 用户id
+     */
     private Long userId;
 
+    /**
+     * 拍品id
+     */
     private Long lotId;
 
+    /**
+     * 关注类型
+     */
     private String type;
 
+    /**
+     * 过期时间
+     */
     private Date expire;
 
+    /**
+     * 商家id
+     */
     private Long merchantId;
 
+    /**
+     * 创建id
+     */
+    private String createUser;
+
+    /**
+     * 更新id
+     */
+    private String updateUser;
+
+    /** 创建时间 */
+    private LocalDateTime createTime;
+
+
+    /** 更新时间 */
+    private LocalDateTime updateTime;
+
+
 }

+ 4 - 0
lot/src/main/java/cn/hobbystocks/auc/mapper/LotFansMapper.java

@@ -3,6 +3,7 @@ package cn.hobbystocks.auc.mapper;
 
 import cn.hobbystocks.auc.domain.LotFans;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -28,4 +29,7 @@ public interface LotFansMapper extends BaseMapper<LotFans> {
     int updateLotFansDel(Long id);
 
     LotFans selectLotFansByLotIdAndType(@Param("lotId") Long lotId, @Param("type") String type);
+
+    List<LotFans> selectLotFansPageList(IPage<LotFans> lotFansIPage,@Param("request") LotFans lotFans);
+
 }

+ 1 - 0
lot/src/main/java/cn/hobbystocks/auc/mapper/LotMapper.java

@@ -60,4 +60,5 @@ public interface LotMapper extends BaseMapper<Lot> {
 
     List<Lot> queryLotListByCategory(Lot lot);
 
+    List<Lot> selectLotListByLotIds(@Param("lotIds") List<Long> lotIds);
 }

+ 16 - 0
lot/src/main/java/cn/hobbystocks/auc/request/LotFansTogglePageRequest.java

@@ -0,0 +1,16 @@
+package cn.hobbystocks.auc.request;
+
+import cn.hobbystocks.auc.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@ApiModel("收藏拍品请求对象")
+public class LotFansTogglePageRequest extends BaseEntity {
+
+
+}

+ 23 - 0
lot/src/main/java/cn/hobbystocks/auc/request/LotFansToggleRequest.java

@@ -0,0 +1,23 @@
+package cn.hobbystocks.auc.request;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+@ApiModel("收藏拍品请求对象")
+public class LotFansToggleRequest {
+
+    @ApiModelProperty("是否收藏:true-收藏,false-取消收藏")
+    private Boolean isLike;
+
+    @ApiModelProperty("拍品ID")
+    private Long lotId;
+
+}

+ 25 - 0
lot/src/main/java/cn/hobbystocks/auc/response/FavoriteOperationResponse.java

@@ -0,0 +1,25 @@
+package cn.hobbystocks.auc.response;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+@ApiModel("收藏操作响应对象")
+public class FavoriteOperationResponse {
+
+    @ApiModelProperty("是否操作成功")
+    private Boolean success;
+
+    @ApiModelProperty("操作结果:true-已收藏,false-已取消收藏")
+    private Boolean isLiked;
+
+    @ApiModelProperty("提示信息")
+    private String message;
+}

+ 83 - 0
lot/src/main/java/cn/hobbystocks/auc/response/LotFansResponse.java

@@ -0,0 +1,83 @@
+package cn.hobbystocks.auc.response;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+@ApiModel("收藏拍品响应对象")
+public class LotFansResponse {
+
+    @ApiModelProperty("收藏ID")
+    private Long id;
+
+    @ApiModelProperty("用户ID")
+    private Long userId;
+
+    @ApiModelProperty("拍品ID")
+    private Long lotId;
+
+    @ApiModelProperty("商品ID")
+    private String goodsId;
+
+    @ApiModelProperty("商品名称")
+    private String goodsName;
+
+    @ApiModelProperty("拍品名称")
+    private String name;
+
+    @ApiModelProperty("拍品图片")
+    private String imgs;
+
+    @ApiModelProperty("轮播图片")
+    private String carouselImgs;
+
+    @ApiModelProperty("商家ID")
+    private Long merchantId;
+
+    @ApiModelProperty("商家名称")
+    private String merchantName;
+
+    @ApiModelProperty("商家头像")
+    private String merchantAvatar;
+
+    @ApiModelProperty("拍卖会ID")
+    private Long auctionId;
+
+    @ApiModelProperty("起拍价")
+    private BigDecimal startPrice;
+
+    @ApiModelProperty("当前价")
+    private BigDecimal currentPrice;
+
+    @ApiModelProperty("拍品数量")
+    private Long num;
+
+    @ApiModelProperty("数量单位")
+    private String unit;
+
+    @ApiModelProperty("拍卖状态")
+    private String status;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty("拍卖开始时间")
+    private Date startTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty("拍卖结束时间")
+    private Date endTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @ApiModelProperty("收藏时间")
+    private Date createTime;
+}

+ 0 - 26
lot/src/main/java/cn/hobbystocks/auc/service/ILotFansService.java

@@ -1,26 +0,0 @@
-package cn.hobbystocks.auc.service;
-
-
-import cn.hobbystocks.auc.domain.LotFans;
-import cn.hobbystocks.auc.vo.FansVO;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-import java.util.List;
-
-public interface ILotFansService extends IService<LotFans> {
-    public LotFans selectLotFansById(Long id);
-
-    public List<LotFans> selectLotFansList(LotFans lotFans);
-
-    public int insertLotFans(LotFans lotFans);
-
-    public int updateLotFans(LotFans lotFans);
-
-    public int deleteLotFansById(Long id);
-
-    void fans(FansVO fansVO);
-
-    int updateLotFansDel(Long id);
-
-    LotFans selectLotFansByLotIdAndType(Long lotId, String type);
-}

+ 9 - 0
lot/src/main/java/cn/hobbystocks/auc/service/ILotService.java

@@ -124,4 +124,13 @@ public interface ILotService extends IService<Lot> {
      * @param request
      */
     List<LotExportDTO> exportLotList(LotRequest request);
+
+    /**
+     * 根据拍品id数组查询拍品列表
+     * @param lotIds 拍品id数组
+     * @return 拍品列表
+     */
+    List<Lot> selectLotListByLotIds(List<Long> lotIds);
+
+
 }

+ 42 - 0
lot/src/main/java/cn/hobbystocks/auc/service/LotFansService.java

@@ -0,0 +1,42 @@
+package cn.hobbystocks.auc.service;
+
+
+import cn.hobbystocks.auc.domain.LotFans;
+import cn.hobbystocks.auc.request.LotFansTogglePageRequest;
+import cn.hobbystocks.auc.request.LotFansToggleRequest;
+import cn.hobbystocks.auc.response.LotFansResponse;
+import cn.hobbystocks.auc.vo.FansVO;
+
+import java.util.List;
+
+public interface LotFansService {
+    LotFans selectLotFansById(Long id);
+
+    List<LotFans> selectLotFansList(LotFans lotFans);
+
+    int insertLotFans(LotFans lotFans);
+
+    int updateLotFans(LotFans lotFans);
+
+    int deleteLotFansById(Long id);
+
+    void fans(FansVO fansVO);
+
+    int updateLotFansDel(Long id);
+
+    LotFans selectLotFansByLotIdAndType(Long lotId, String type);
+
+    /**
+     * 收藏/取消收藏拍品
+     * @param request
+     * @return
+     */
+    Boolean toggleFavorite(LotFansToggleRequest request);
+
+    /**
+     * 分页查询用户收藏的拍品列表
+     * @param request
+     * @return
+     */
+    List<LotFansResponse> page(LotFansTogglePageRequest request);
+}

+ 99 - 10
lot/src/main/java/cn/hobbystocks/auc/service/impl/LotFansServiceImpl.java

@@ -1,27 +1,45 @@
 package cn.hobbystocks.auc.service.impl;
 
+import cn.hobbystocks.auc.common.exception.ServiceException;
+import cn.hobbystocks.auc.common.user.UserInfo;
 import cn.hobbystocks.auc.common.user.UserUtils;
 import cn.hobbystocks.auc.common.utils.DateUtils;
+import cn.hobbystocks.auc.convert.LotConvert;
+import cn.hobbystocks.auc.domain.Lot;
 import cn.hobbystocks.auc.domain.LotFans;
 import cn.hobbystocks.auc.mapper.LotFansMapper;
-import cn.hobbystocks.auc.service.ILotFansService;
+import cn.hobbystocks.auc.request.LotFansTogglePageRequest;
+import cn.hobbystocks.auc.request.LotFansToggleRequest;
+import cn.hobbystocks.auc.response.LotFansResponse;
+import cn.hobbystocks.auc.service.ILotService;
+import cn.hobbystocks.auc.service.LotFansService;
 import cn.hobbystocks.auc.vo.FansVO;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.google.common.collect.Lists;
+import lombok.extern.log4j.Log4j2;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import javax.annotation.Resource;
+import java.time.LocalDateTime;
 import java.util.Date;
 import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
 
-
+@Log4j2
 @Service
-public class LotFansServiceImpl extends ServiceImpl<LotFansMapper,LotFans> implements ILotFansService
-{
-    @Autowired
-    private LotFansMapper lotFansMapper;
+public class LotFansServiceImpl  implements LotFansService {
+    @Resource
+    LotFansMapper lotFansMapper;
+
+    @Resource
+    ILotService lotService;
+
+
 
     @Override
     public LotFans selectLotFansById(Long id)
@@ -38,7 +56,7 @@ public class LotFansServiceImpl extends ServiceImpl<LotFansMapper,LotFans> imple
     @Override
     public int insertLotFans(LotFans lotFans)
     {
-        lotFans.setCreateTime(DateUtils.getNowDate());
+        lotFans.setCreateTime(LocalDateTime.now());
         return lotFansMapper.insertLotFans(lotFans);
     }
 
@@ -63,7 +81,7 @@ public class LotFansServiceImpl extends ServiceImpl<LotFansMapper,LotFans> imple
             List<LotFans> lotFansList =
                     lotFansMapper.selectLotFansList(lotFans);
             if (CollectionUtils.isEmpty(lotFansList)) {
-                lotFans.setCreateTime(new Date());
+                lotFans.setCreateTime(LocalDateTime.now());
                 lotFansMapper.insertLotFans(lotFans);
             }
         }else {
@@ -80,4 +98,75 @@ public class LotFansServiceImpl extends ServiceImpl<LotFansMapper,LotFans> imple
     public LotFans selectLotFansByLotIdAndType(Long lotId, String type) {
         return lotFansMapper.selectLotFansByLotIdAndType(lotId, type);
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean toggleFavorite(LotFansToggleRequest request) {
+        UserInfo userInfo = UserUtils.getSimpleUserInfo();
+        if (Objects.isNull(userInfo) || userInfo.getId() == -1) {
+            throw new ServiceException("用户未登录",-1);
+        }
+        // 获取用户ID
+        long userId = userInfo.getId().longValue();
+
+        if (request.getLotId() == null) {
+            log.error("lotId不能为空");
+            return Boolean.FALSE;
+        }
+
+        String type = "user_like";
+        Boolean isLike = request.getIsLike();
+        // 收藏
+        if (Boolean.TRUE.equals(isLike)) {
+            List<LotFans> lotFansList = lotFansMapper.selectLotFansList(LotFans.builder()
+                    .lotId(request.getLotId())
+                    .userId(userId)
+                    .type(type)
+                    .build()
+            );
+            if (CollectionUtils.isEmpty(lotFansList)) {
+                LotFans lotFans = LotFans.builder()
+                    .lotId(request.getLotId())
+                    .userId(userId)
+                    .type(type)
+                    // 过期时间往后退30天
+                    .expire(DateUtils.addDays(30))
+                    .createTime(LocalDateTime.now())
+                    .updateTime(LocalDateTime.now())
+                    .createUser(String.valueOf(userId))
+                    .updateUser(String.valueOf(userId))
+                    .build();
+                lotFansMapper.insertLotFans(lotFans);
+            }
+        } else { // 取消收藏
+            lotFansMapper.deleteLotFans(userId, request.getLotId(), type);
+        }
+        return true;
+    }
+
+    @Override
+    public List<LotFansResponse> page(LotFansTogglePageRequest request) {
+        Long userId = UserUtils.getSimpleUserInfo().getId().longValue();
+        if (Objects.isNull(userId) || userId == -1) {
+            throw new ServiceException("用户未登录",-1);
+        }
+        // 查询当前用户关注的拍品
+        LotFans lotFans = LotFans.builder()
+            .userId(userId)
+            .type("user_like")
+            .build();
+        IPage<LotFans> lotFansIPage =new Page<>(request.getPageNum(),request.getPageSize());
+        List<LotFans> lotFansList = lotFansMapper.selectLotFansPageList(lotFansIPage,lotFans);
+        if (CollectionUtils.isEmpty(lotFansList)) {
+            return Lists.newArrayList();
+        }
+        // 收集关注表中所有lotId,查询拍品信息
+        List<Long> lotIdList = lotFansList.stream().map(LotFans::getLotId).collect(Collectors.toList());
+        List<Lot> lotList = lotService.selectLotListByLotIds(lotIdList);
+        if (CollectionUtils.isEmpty(lotList)) {
+            return Lists.newArrayList();
+        }
+        List<LotFansResponse> lotFansResponses = lotList.stream().map(LotConvert.INSTANCE::toLotFansResponse).collect(Collectors.toList());
+        return lotFansResponses;
+    }
 }

+ 6 - 1
lot/src/main/java/cn/hobbystocks/auc/service/impl/LotServiceImpl.java

@@ -210,7 +210,7 @@ public class LotServiceImpl extends ServiceImpl<LotMapper,Lot> implements ILotSe
                 LotFans.builder()
                         .id(fans.getId())
                         .type("pay_expire")
-                        .expire(DateUtils.addDays(fans.getCreateTime(), 1))
+                        .expire(DateUtils.addDays(DateUtils.toDate(fans.getCreateTime()), 1))
                         .build());
         lotMapper.updateLot(Lot.builder().id(fans.getLotId()).status(Constants.LOT_STATUS_PASS).build());
     }
@@ -688,4 +688,9 @@ public class LotServiceImpl extends ServiceImpl<LotMapper,Lot> implements ILotSe
 
         return lotExportDTOS;
     }
+
+    @Override
+    public List<Lot> selectLotListByLotIds(List<Long> lotIds) {
+        return baseMapper.selectLotListByLotIds(lotIds);
+    }
 }

+ 48 - 15
lot/src/main/resources/mapper/LotFansMapper.xml

@@ -4,35 +4,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.hobbystocks.auc.mapper.LotFansMapper">
 
-    <resultMap type="LotFans" id="LotFansResult">
+    <resultMap type="LotFans" id="BaseResultMap">
         <result property="id"    column="id"    />
         <result property="userId"    column="user_id"    />
         <result property="lotId"    column="lot_id"    />
-        <result property="createTime"    column="create_time"    />
         <result property="type"    column="type"    />
         <result property="expire" column="expire"/>
         <result property="merchantId" column="merchant_id"/>
+        <result property="createUser" column="create_user"/>
+        <result property="updateUser" column="update_user"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
     </resultMap>
 
     <sql id="selectLotFansVo">
-        select id, user_id, lot_id, create_time, type, expire,merchant_id  from lot_fans
+        select id, user_id, lot_id, create_time, type, expire,merchant_id,update_time,create_user,update_user
     </sql>
 
-    <select id="selectLotFansList" parameterType="LotFans" resultMap="LotFansResult">
+    <select id="selectLotFansList" parameterType="LotFans" resultMap="BaseResultMap">
         <include refid="selectLotFansVo"/>
-        where del_flag = 0
-        <if test="lotId != null"> and lot_id = #{lotId}</if>
-        <if test="userId != null"> and user_id = #{userId}</if>
-        <if test="type != null"> and type = #{type}</if>
-        <if test="merchantId != null"> and merchant_id = #{merchantId}</if>
+        from
+            lot_fans
+        <where>
+            del_flag = 0
+            <if test="lotId != null"> and lot_id = #{lotId}</if>
+            <if test="userId != null"> and user_id = #{userId}</if>
+            <if test="type != null"> and type = #{type}</if>
+            <if test="merchantId != null"> and merchant_id = #{merchantId}</if>
+        </where>
     </select>
 
     <delete id="lotFansListCheck">
         delete from lot_fans where type = 'pay_expire' and expire &lt; NOW()
     </delete>
 
-    <select id="selectLotFansById" parameterType="Long" resultMap="LotFansResult">
+    <select id="selectLotFansById" parameterType="Long" resultMap="BaseResultMap">
         <include refid="selectLotFansVo"/>
+        from
+            lot_fans
         where id = #{id}
     </select>
 
@@ -42,19 +51,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="id != null">id,</if>
             <if test="userId != null">user_id,</if>
             <if test="lotId != null">lot_id,</if>
-            <if test="createTime != null">create_time,</if>
             <if test="type != null and type != ''">type,</if>
             <if test="expire != null">expire,</if>
             <if test="merchantId != null">merchant_id,</if>
+            <if test="createUser != null">create_user,</if>
+            <if test="updateUser != null">update_user,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
             <if test="userId != null">#{userId},</if>
             <if test="lotId != null">#{lotId},</if>
-            <if test="createTime != null">#{createTime},</if>
             <if test="type != null and type != ''">#{type},</if>
             <if test="expire != null">#{expire},</if>
             <if test="merchantId != null">#{merchantId},</if>
+            <if test="createUser != null">#{createUser},</if>
+            <if test="updateUser != null">#{updateUser},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
          </trim>
     </insert>
 
@@ -82,9 +97,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </delete>
 
-    <delete id="deleteLotFans">
-        delete from lot_fans where user_id = #{userId} and lot_id = #{lotId} and type = #{type}
-    </delete>
+    <update id="deleteLotFans">
+        update lot_fans set del_flag = 1 ,update_time = now() where user_id = #{userId} and lot_id = #{lotId} and type = #{type}
+    </update>
 
     <update id="updateLotFansDel">
         update lot_fans set del_flag = 1 where id = #{id}
@@ -92,6 +107,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectLotFansByLotIdAndType" resultType="cn.hobbystocks.auc.domain.LotFans">
         <include refid="selectLotFansVo"/>
+        from
+            lot_fans
         where lot_id = #{lotId} and type = #{type} and del_flag = 0
     </select>
+
+
+    <select id="selectLotFansPageList" parameterType="cn.hobbystocks.auc.domain.LotFans" resultMap="BaseResultMap">
+        <include refid="selectLotFansVo"/>
+        from
+            lot_fans
+        <where>
+            del_flag = 0
+            <if test="request.lotId != null"> and lot_id = #{request.lotId}</if>
+            <if test="request.userId != null"> and user_id = #{request.userId}</if>
+            <if test="request.type != null"> and type = #{request.type}</if>
+            <if test="request.merchantId != null"> and merchant_id = #{request.merchantId}</if>
+        </where>
+        order by create_time desc
+    </select>
+
 </mapper>

+ 13 - 0
lot/src/main/resources/mapper/LotMapper.xml

@@ -513,4 +513,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </if>
         </where>
     </select>
+    <select id="selectLotListByLotIds" resultType="cn.hobbystocks.auc.domain.Lot">
+        <include refid="selectLotVo"/>
+        <where>
+            del_flag = 0
+            <if test="lotIds != null and lotIds.size() > 0">
+                and id in
+                <foreach item="id" collection="lotIds" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+
+    </select>
 </mapper>