Commit 85acedac authored by shiyu's avatar shiyu

分销商购买样品2

parent 84b2f4f7
......@@ -116,4 +116,9 @@ public class SupplierItemVo implements Entity {
* 商品类型1一口价2竞拍
*/
private Integer type;
/**
* 分销商是否购买过
*/
private Boolean shopBought;
}
......@@ -87,6 +87,6 @@ public class AuctionRecordDaoImpl implements AuctionRecordDao {
@Override
public List<Long> findItemsOfRecord(long userId) {
return null;
return auctionRecordMapper.findItemsOfRecord(userId);
}
}
......@@ -371,7 +371,7 @@
</select>
<select id="findItemsOfRecord" parameterType="java.lang.Long" resultType="java.lang.Long">
select DISTINCT(`item_id`) from `auction_record` where user_id = = #{userId}
select DISTINCT(`item_id`) from `auction_record` where user_id = = #{userId} order by create_time desc
</select>
</mapper>
\ No newline at end of file
......@@ -35,6 +35,7 @@ public class AuctionRecordVo implements Entity {
*/
private List<AuctionRecord> auctionRecordList;
private Integer state;
/**
......@@ -42,5 +43,20 @@ public class AuctionRecordVo implements Entity {
*/
private String stateName;
/**
* 是否领先
*/
private Boolean isLead;
/**
* 用户自己的出价次数
*/
private Integer offerNum;
/**
* 该商品的总出价次数
*/
private Integer totalOfferNum;
}
......@@ -24,6 +24,7 @@ import org.springframework.util.CollectionUtils;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
......@@ -131,9 +132,13 @@ public class AuctionRecordServiceImpl implements AuctionRecordService {
@Override
public Result findList(AuctionRecordRequestDto dto) {
try {
List<AuctionRecordVo> auctionRecordVos = new ArrayList<>();
AuctionRecordVo auctionRecordVo = new AuctionRecordVo();
AuctionRecordRequestDto searchDto = new AuctionRecordRequestDto();
searchDto.setUserId(dto.getUserId());
List<Long> items = auctionRecordDao.findItemsOfRecord(dto.getUserId());
if (CollectionUtils.isEmpty(items)) {
return Result.success();
}
items.forEach(item -> {
List<AuctionRecord> auctionRecordList = auctionRecordDao.findByPage(dto);
//查询商品竞拍信息
AuctionConfig auctionConfig = auctionConfigDao.findByItemId(dto.getItemId());
......@@ -161,9 +166,11 @@ public class AuctionRecordServiceImpl implements AuctionRecordService {
auctionRecordVo.setState(DistributionEnum.AuctionStateEnum.IN_AUCTION.getCode());
auctionRecordVo.setStateName(DistributionEnum.AuctionStateEnum.IN_AUCTION.getDes());
}
return Result.success(auctionRecordVo);
auctionRecordVos.add(auctionRecordVo);
});
return Result.success(auctionRecordVos);
} catch (Exception e) {
logger.error("退款申请失败 error : {}", e);
logger.error("出价记录查询失败 error : {}", e);
}
return Result.failed();
}
......
......@@ -140,6 +140,14 @@ public class SupplierItemServiceImpl implements SupplierItemService {
userRecentBrowseDao.insert(newRecord);
}
}
} else {
//店家进入详情,需要判断是否购买过样品
List<DistributionOrder> distributionOrders = distributionOrderDao.findByBuyerId(dto.getUserId());
if (CollectionUtils.isEmpty(distributionOrders)) {
supplierItemVo.setShopBought(false);
} else {
supplierItemVo.setShopBought(true);
}
}
SupplierItem supplierItem = supplierItemDao.findById(itemId);
EntityMapper.copyAttribute(supplierItem, supplierItemVo);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment