From 31267d9b3a33c8b3fbb1b9f810ab08e01c49b846 Mon Sep 17 00:00:00 2001
From: rentaiming <806181062@qq.com>
Date: 星期二, 16 七月 2024 19:12:28 +0800
Subject: [PATCH] 修改bug
---
ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomServiceImpl.java | 343 ++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 255 insertions(+), 88 deletions(-)
diff --git a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomServiceImpl.java b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomServiceImpl.java
index 34ac9c3..bf73784 100644
--- a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomServiceImpl.java
+++ b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomServiceImpl.java
@@ -54,6 +54,7 @@
import com.ruoyi.common.core.utils.page.CollUtils;
import com.ruoyi.common.core.utils.page.PageDTO;
import com.ruoyi.common.security.utils.SecurityUtils;
+import com.ruoyi.system.api.RemoteFileService;
import com.ruoyi.system.api.constants.NotificationTypeConstant;
import com.ruoyi.system.api.domain.AppMiniLoginVO;
import com.ruoyi.system.api.domain.AuctionGoods;
@@ -63,6 +64,7 @@
import com.ruoyi.system.api.domain.OrderAuctionBond;
import com.ruoyi.system.api.domain.PromotionVideo;
import com.ruoyi.system.api.domain.SysUser;
+import com.ruoyi.system.api.domain.WebsocketMessageDTO;
import com.ruoyi.system.api.domain.dto.AppMiniLoginDTO;
import com.ruoyi.system.api.domain.dto.AuctionSalesroomDTO;
import com.ruoyi.system.api.domain.dto.BidDTO;
@@ -84,7 +86,6 @@
import com.ruoyi.system.api.feignClient.OrderClient;
import com.ruoyi.system.api.feignClient.PromotionClient;
import com.ruoyi.system.api.feignClient.SysUserClient;
-import com.ruoyi.system.api.util.WebSocketUsers;
import io.seata.spring.annotation.GlobalTransactional;
import java.io.IOException;
import java.math.BigDecimal;
@@ -159,6 +160,8 @@
@Resource
private AuctionBidRecordMapper auctionBidRecordMapper;
+ @Resource
+ private RemoteFileService remoteFileService;
public static RequestConfig config = RequestConfig.custom().setConnectTimeout(5000).setSocketTimeout(5000).build();
// 配置您申请的KEY,在个人中心->我的数据,接口名称上方查看
public static final String APPKEY = "";
@@ -203,6 +206,7 @@
private static final ObjectMapper objectMapper = new ObjectMapper();
+
@Override
public List<AuctionSalesroom> getAuctionBidRecordList(AuctionSalesroomDTO ationSalesroomGoodsDTO) {
LambdaQueryWrapper<AuctionSalesroom> wrapper=Wrappers.lambdaQuery();
@@ -237,7 +241,11 @@
if (sysUser==null){
throw new ServiceException("手机号未注册");
}
- if (!SecurityUtils.matchesPassword(arepartAuctionBidRecordDTO.getPassword(), sysUser.getPassword())){
+ if (sysUser.getStatus().equals(1)){
+ throw new ServiceException("该拍卖师账号停用");
+ }
+
+ if (!SecurityUtils.matchesPassword(arepartAuctionBidRecordDTO.getPassword(), sysUser.getPassword())){
throw new ServiceException("密码输入错误");
}
@@ -245,6 +253,9 @@
wrapper.eq(AuctionSalesroom::getAuctionSalesroomNo,arepartAuctionBidRecordDTO.getAuctionSalesroomQrcode());
wrapper.eq(AuctionSalesroom::getDelFlag,0);
AuctionSalesroom auctionBidRecord = this.getOne(wrapper);
+ if(auctionBidRecord.getType().getCode()==0){
+ throw new ServiceException("当前扫码是线下拍卖会");
+ }
return auctionBidRecord;
}
@@ -345,7 +356,7 @@
R<SysUser> sysUserR = sysUserClient.queryUserByPhone(appMiniLoginDto.getPhone());
SysUser data = sysUserR.getData();
appMiniLoginVo.setSysUser(data);
- appMiniLoginVo.setPhone(appMiniLoginDto.getAuth_code());
+ appMiniLoginVo.setPhone(appMiniLoginDto.getPhone());
return appMiniLoginVo;
}
@@ -378,8 +389,10 @@
memberAuctionSalesroomVO.setEndTime(auctionSalesroom.getEndTime());
memberAuctionSalesroomVO.setCoverPic(auctionSalesroom.getCoverPic());
memberAuctionSalesroomVO.setBond(auctionSalesroom.getBond());
+ memberAuctionSalesroomVO.setAuthentication(auctionSalesroom.getAuthentication());
+ memberAuctionSalesroomDTO.setAuctionSalesroomId(auctionSalesroom.getId());
List<OrderAuctionBond> data = orderClient.getOrderAuctionBondList1(memberAuctionSalesroomDTO, SecurityConstants.INNER).getData();
- if (data!=null||data.size()>0){
+ if (data!=null&&data.size()>0){
memberAuctionSalesroomVO.setIsApply(2);
}else{
memberAuctionSalesroomVO.setIsApply(1);
@@ -387,8 +400,14 @@
MemberAuctionSalesroomDTO memberAuctionSalesroomDTO1=new MemberAuctionSalesroomDTO();
memberAuctionSalesroomDTO1.setAuctionSalesroomId(auctionSalesroom.getId());
List<OrderAuctionBond> data1 = orderClient.getOrderAuctionBondList1(memberAuctionSalesroomDTO1, SecurityConstants.INNER).getData();
- memberAuctionSalesroomVO.setApplyNum(data1.size());
- List.add(memberAuctionSalesroomVO);
+ if(data1!=null){
+ memberAuctionSalesroomVO.setApplyNum(data1.size());
+ List.add(memberAuctionSalesroomVO);
+ }else{
+ memberAuctionSalesroomVO.setApplyNum(0);
+ }
+
+
}
page.setRecords(List);
return PageDTO.of(page);
@@ -397,12 +416,19 @@
@Override
public MemberAuctionSalesroomInfoVO getMemberAuctionSalesroomInfo(MemberAuctionSalesroomDTO memberAuctionSalesroomDTO) {
AuctionSalesroom byId = this.getById(memberAuctionSalesroomDTO.getAuctionSalesroomId());
+ if(byId==null){
+ LambdaQueryWrapper<AuctionSalesroom> wrapper=Wrappers.lambdaQuery();
+ wrapper.eq(AuctionSalesroom::getAuctionSalesroomNo,memberAuctionSalesroomDTO.getAuctionSalesroomId());
+ wrapper.eq(AuctionSalesroom::getDelFlag,0);
+ byId =this.getOne(wrapper);
+ }
MemberAuctionSalesroomInfoVO memberAuctionSalesroomInfoVO=new MemberAuctionSalesroomInfoVO();
memberAuctionSalesroomInfoVO.setId(byId.getId());
memberAuctionSalesroomInfoVO.setBound(byId.getBond());
memberAuctionSalesroomInfoVO.setAuthentication(byId.getAuthentication());
memberAuctionSalesroomInfoVO.setEndTime(byId.getEndTime());
memberAuctionSalesroomInfoVO.setSalesroomName(byId.getSalesroomName());
+ memberAuctionSalesroomInfoVO.setEndTime(byId.getEndTime());
memberAuctionSalesroomInfoVO.setType(byId.getType());
memberAuctionSalesroomInfoVO.setDescription(byId.getDescription());
memberAuctionSalesroomInfoVO.setSharePic(byId.getSharePic());
@@ -417,7 +443,10 @@
memberAuctionSalesroomInfoVO.setIsApply(1);
}
List<ForepartAuctionSalesroomGoodsVO> forepartAuctionSalesroomGoodsVOS=new ArrayList<>();
- List<AuctionSalesroomGoods> auctionSalesroomGoods = auctionSalesroomGoodsMapper.getAuctionSalesroomGoods(memberAuctionSalesroomDTO);
+ MemberAuctionSalesroomDTO memberAuctionSalesroomDTO1 =new MemberAuctionSalesroomDTO();
+ memberAuctionSalesroomDTO1.setAuctionSalesroomId(byId.getId());
+ memberAuctionSalesroomDTO1.setBackupStatus(false);
+ List<AuctionSalesroomGoods> auctionSalesroomGoods = auctionSalesroomGoodsMapper.getAuctionSalesroomGoods(memberAuctionSalesroomDTO1);
for (AuctionSalesroomGoods salesroomGoods:auctionSalesroomGoods){
ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO=new ForepartAuctionSalesroomGoodsVO();
forepartAuctionSalesroomGoodsVO.setSalesroomId(byId.getId());
@@ -429,8 +458,13 @@
forepartAuctionSalesroomGoodsVO.setCoverPic(goodsSku.getCoverPic());
forepartAuctionSalesroomGoodsVO.setStartingPrice(salesroomGoods.getStartingPrice());
forepartAuctionSalesroomGoodsVO.setSalesroomStock(salesroomGoods.getSalesroomStock());
- forepartAuctionSalesroomGoodsVO.setGoodsSkustatus(salesroomGoods.getStatus());
+ forepartAuctionSalesroomGoodsVO.setGoodsSkustatus(salesroomGoods.getStatus().getCode());
+ forepartAuctionSalesroomGoodsVO.setMinimumMarkupAmount(salesroomGoods.getMinimumMarkupAmount());
+ forepartAuctionSalesroomGoodsVO.setStartTime(salesroomGoods.getStartTime());
forepartAuctionSalesroomGoodsVO.setYears(String.valueOf(goodsSku.getYears()));
+ forepartAuctionSalesroomGoodsVO.setListingDuration(salesroomGoods.getListingDuration());
+ forepartAuctionSalesroomGoodsVO.setSpec(goodsSku.getSpec());
+ forepartAuctionSalesroomGoodsVO.setSpecUnit(goodsSku.getSpecUnit());
LambdaQueryWrapper<AuctionBidRecord> wrapper1=Wrappers.lambdaQuery();
wrapper1.eq(AuctionBidRecord::getMemberId,memberAuctionSalesroomDTO.getMemberId());
wrapper1.eq(AuctionBidRecord::getAuctionSalesroomId,byId.getId());
@@ -448,6 +482,28 @@
forepartAuctionSalesroomGoodsVO.setIsBond(1);
forepartAuctionSalesroomGoodsVO.setIsStatus(1);
}
+
+ LambdaQueryWrapper<AuctionBidRecord> wrapper2=Wrappers.lambdaQuery();
+ wrapper2.eq(AuctionBidRecord::getAuctionSalesroomId,byId.getId());
+ wrapper2.eq(AuctionBidRecord::getAuctionType,2);
+ wrapper2.eq(AuctionBidRecord::getTargetId,salesroomGoods.getId());
+ wrapper2.eq(AuctionBidRecord::getDelFlag,0);
+ AuctionBidRecord list2 = auctionBidRecordMapper.selectOne(wrapper1);
+ if (list2!=null){
+ forepartAuctionSalesroomGoodsVO.setZgBid(list2.getLastBidAmount());
+ }
+
+ LambdaQueryWrapper<AuctionBidRecord> wrapper5=Wrappers.lambdaQuery();
+ wrapper5.eq(AuctionBidRecord::getAuctionSalesroomId,byId.getId());
+ wrapper5.eq(AuctionBidRecord::getAuctionType,2);
+ wrapper5.eq(AuctionBidRecord::getTargetId,salesroomGoods.getId());
+ wrapper5.eq(AuctionBidRecord::getMemberId,memberAuctionSalesroomDTO.getMemberId());
+ wrapper5.eq(AuctionBidRecord::getDelFlag,0);
+ AuctionBidRecord list5 = auctionBidRecordMapper.selectOne(wrapper1);
+ if (list5!=null){
+ forepartAuctionSalesroomGoodsVO.setPresentBid(list5.getLastBidAmount());
+ }
+
forepartAuctionSalesroomGoodsVOS.add(forepartAuctionSalesroomGoodsVO);
}
memberAuctionSalesroomInfoVO.setForepartAuctionSalesroomGoodsVO(forepartAuctionSalesroomGoodsVOS);
@@ -459,6 +515,7 @@
LambdaQueryWrapper<AuctionBrowseRecord> wrapper3=Wrappers.lambdaQuery();
wrapper3.eq(AuctionBrowseRecord::getDelFlag,0);
wrapper3.eq(AuctionBrowseRecord::getTargetId,memberAuctionSalesroomDTO.getAuctionSalesroomId());
+ wrapper3.eq(AuctionBrowseRecord::getBrowseType,AuctionOrderTypeEnum.AUCTION_ITEMS);
wrapper3.eq(AuctionBrowseRecord::getMemberId,memberAuctionSalesroomDTO.getMemberId());
wrapper3.ge(AuctionBrowseRecord::getCreateTime, now)
.le(AuctionBrowseRecord::getCreateTime, newTime7);
@@ -513,27 +570,18 @@
if (auctionBidRecord!=null){
throw new ServiceException("当前拍卖场中标拍品订单未完成,请完成后再试。");
}
-
-
// 远程调用订单服务进行退款
- Map<String, Object> data = orderClient.refund(refundDTOList,
- SecurityConstants.INNER).getData();
+ orderClient.refund1(refundDTO, SecurityConstants.INNER).getData();
// 处理退款返回结果
List<String> successfulOrders = new ArrayList<>();
List<String> failedOrders = new ArrayList<>();
- data.forEach((key, value) -> {
- if ((boolean) value) {
- successfulOrders.add(key);
- } else {
- failedOrders.add(key);
- }
- });
- // 退款成功的订单修改状态
- List<Long> ids = new ArrayList<>();
+
+ List<Long> ids=new ArrayList<>();
ids.add(orderAuctionBond.getId());
+
// 远程调用订单服务修改订单状态
- orderClient.updateOrderAuctionBondStatus(ids, BondStatusEnum.PAID);
+ orderClient.updateOrderAuctionBondStatus(ids, BondStatusEnum.REFUNDED,SecurityConstants.INNER);
}else{
OrderAuctionBond orderAuctionBond = orderClient.getOrderAuctionBondone1(memberAuctionSalesroomBondDTO, SecurityConstants.INNER).getData();
@@ -541,6 +589,7 @@
RefundDTO refundDTO = new RefundDTO();
refundDTO.setOrderNo(orderAuctionBond.getOrderNo());
refundDTO.setAmount(orderAuctionBond.getBond());
+ refundDTOList.add(refundDTO);
LambdaQueryWrapper<AuctionBidRecord> wrapper = Wrappers.lambdaQuery();
wrapper.eq(AuctionBidRecord::getTargetId, memberAuctionSalesroomBondDTO.getAuctionGoodsId());
@@ -553,24 +602,14 @@
}
// 远程调用订单服务进行退款
- Map<String, Object> data = orderClient.refund(refundDTOList,
+ orderClient.refund1(refundDTO,
SecurityConstants.INNER).getData();
- // 处理退款返回结果
- List<String> successfulOrders = new ArrayList<>();
- List<String> failedOrders = new ArrayList<>();
- data.forEach((key, value) -> {
- if ((boolean) value) {
- successfulOrders.add(key);
- } else {
- failedOrders.add(key);
- }
- });
- // 退款成功的订单修改状态
- List<Long> ids = new ArrayList<>();
+
+ List<Long> ids=new ArrayList<>();
ids.add(orderAuctionBond.getId());
// 远程调用订单服务修改订单状态
- orderClient.updateOrderAuctionBondStatus(ids, BondStatusEnum.PAID);
+ orderClient.updateOrderAuctionBondStatus(ids,BondStatusEnum.REFUNDED,SecurityConstants.INNER);
}
@@ -581,23 +620,39 @@
Member membeOne = memberClient.getMembeOne(bidVO.getMemberId(), SecurityConstants.INNER).getData();
if (bidVO.getAuctionType()==2){
AuctionSalesroomGoods byId = auctionSalesroomGoodsMapper.selectById(bidVO.getTargetId());
- if (byId.getStartingPrice().doubleValue()<bidVO.getLastBidAmount().doubleValue()){
+ if (byId.getStartingPrice().doubleValue()>bidVO.getLastBidAmount().doubleValue()){
throw new ServiceException("出价不能比起拍价低");
}
BigDecimal bigDecimal=byId.getStartingPrice().add(byId.getMinimumMarkupAmount());
- if (bigDecimal.doubleValue()<bidVO.getLastBidAmount().doubleValue()){
+ if (bigDecimal.doubleValue()>bidVO.getLastBidAmount().doubleValue()){
throw new ServiceException("出价不能比每次最少加价低");
}
+
+
+ LambdaQueryWrapper<AuctionBidRecord> wrapper3=Wrappers.lambdaQuery();
+ wrapper3.eq(AuctionBidRecord::getAuctionSalesroomId,bidVO.getAuctionSalesroomId());
+ wrapper3.eq(AuctionBidRecord::getTargetId,bidVO.getTargetId());
+ wrapper3.eq(AuctionBidRecord::getDelFlag,0);
+ wrapper3.orderByDesc(AuctionBidRecord::getLastBidAmount);
+ wrapper3.last("limit 1");
+ AuctionBidRecord one3 = auctionBidRecordService.getOne(wrapper3);
+ if (one3!=null){
+ if (bidVO.getLastBidAmount().doubleValue()<one3.getLastBidAmount().doubleValue()){
+ throw new ServiceException("出价不能比当前最高价低");
+ }
+ }
+
LambdaQueryWrapper<AuctionBidRecord> wrapper1=Wrappers.lambdaQuery();
wrapper1.eq(AuctionBidRecord::getMemberId,bidVO.getMemberId());
wrapper1.eq(AuctionBidRecord::getAuctionSalesroomId,bidVO.getAuctionSalesroomId());
wrapper1.eq(AuctionBidRecord::getTargetId,bidVO.getTargetId());
wrapper1.eq(AuctionBidRecord::getDelFlag,0);
+
AuctionBidRecord one = auctionBidRecordService.getOne(wrapper1);
if (one!=null){
BigDecimal bigDecimal1=one.getLastBidAmount().add(byId.getMinimumMarkupAmount());
- if (bigDecimal1.doubleValue()<bidVO.getLastBidAmount().doubleValue()){
+ if (bigDecimal1.doubleValue()>bidVO.getLastBidAmount().doubleValue()){
throw new ServiceException("出价不能比上次出价加每次最少加价低");
}
one.setLastBidAmount(bidVO.getLastBidAmount());
@@ -610,6 +665,13 @@
one.setTargetId(bidVO.getTargetId());
one.setMemberId(bidVO.getMemberId());
one.setLastBidTime(LocalDateTime.now());
+ if(membeOne.getRealName()!=null||membeOne.getRealName()!=""){
+ one.setNickname(membeOne.getRealName());
+ }else{
+ one.setNickname(membeOne.getNickname());
+ }
+
+ one.setPhone(membeOne.getPhone());
one.setAuctionType(AuctionOrderTypeEnum.AUCTION_ITEMS);
one.setStatus(BidStatusEnum.ELIMINATE);
one.setBidCount(1);
@@ -618,41 +680,104 @@
}
+ LambdaQueryWrapper<AuctionBidRecord> wrapper2=Wrappers.lambdaQuery();
+ wrapper2.eq(AuctionBidRecord::getAuctionSalesroomId,bidVO.getAuctionSalesroomId());
+ wrapper2.eq(AuctionBidRecord::getTargetId,bidVO.getTargetId());
+ wrapper2.eq(AuctionBidRecord::getDelFlag,0);
+ wrapper2.orderByDesc(AuctionBidRecord::getLastBidAmount);
+ AuctionBidRecord one2 = auctionBidRecordService.getOne(wrapper1);
+
+ Map<String, Object> map = new ConcurrentHashMap<>();
+ map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM);
+ map.put("auctionSalesroomId", bidVO.getAuctionSalesroomId());
+ map.put("byId", byId.getStatus());
+ map.put("lastBidAmount",one2.getLastBidAmount());
+ map.put("message_type", "BidRecor");
+ map.put("type",3);
+ String msg = null;
+ try {
+ msg = objectMapper.writeValueAsString(map);
+ } catch (JsonProcessingException e) {
+ }
+ String finalMsg = msg;
+ sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(finalMsg)
+ .clientType(ClientTypeEnum.MEMBER).build(), SecurityConstants.INNER);
+
+
+
+
}else {
AuctionGoods byId = auctionGoodsService.getById(bidVO.getTargetId());
- if (byId.getStartingPrice().doubleValue()<bidVO.getLastBidAmount().doubleValue()){
+ if (byId.getStartingPrice().doubleValue()>bidVO.getLastBidAmount().doubleValue()){
throw new ServiceException("出价不能比起拍价低");
}
BigDecimal bigDecimal=byId.getStartingPrice().add(byId.getMinimumMarkupAmount());
- if (bigDecimal.doubleValue()<bidVO.getLastBidAmount().doubleValue()){
+ if (bigDecimal.doubleValue()>bidVO.getLastBidAmount().doubleValue()){
throw new ServiceException("出价不能比每次最少加价低");
}
LambdaQueryWrapper<AuctionBidRecord> wrapper1=Wrappers.lambdaQuery();
- wrapper1.eq(AuctionBidRecord::getMemberId,bidVO.getMemberId());
wrapper1.eq(AuctionBidRecord::getTargetId,bidVO.getTargetId());
wrapper1.eq(AuctionBidRecord::getDelFlag,0);
+ wrapper1.orderByDesc(AuctionBidRecord::getLastBidAmount);
+ wrapper1.last("limit 1");
AuctionBidRecord one = auctionBidRecordService.getOne(wrapper1);
- if (one!=null){
- BigDecimal bigDecimal1=one.getLastBidAmount().add(byId.getMinimumMarkupAmount());
- if (bigDecimal1.doubleValue()<bidVO.getLastBidAmount().doubleValue()){
- throw new ServiceException("出价不能比上次出价加每次最少加价低");
+ if (byId.getAuctionStock()==1) {
+ if (one != null) {
+ BigDecimal bigDecimal1 = one.getLastBidAmount().add(byId.getMinimumMarkupAmount());
+ if (bigDecimal1.doubleValue() > bidVO.getLastBidAmount().doubleValue()) {
+ throw new ServiceException("出价不能比上次出价加每次最少加价低");
+ }
+
}
- one.setLastBidAmount(bidVO.getLastBidAmount());
- one.setLastBidTime(LocalDateTime.now());
- one.setBidCount(one.getBidCount()+1);
- auctionBidRecordService.updateById(one);
- }else{
- one=new AuctionBidRecord();
- one.setAuctionSalesroomId(bidVO.getAuctionSalesroomId());
- one.setTargetId(bidVO.getTargetId());
- one.setMemberId(bidVO.getMemberId());
- one.setLastBidTime(LocalDateTime.now());
- one.setAuctionType(AuctionOrderTypeEnum.REGULAR_ITEMS);
- one.setStatus(BidStatusEnum.ELIMINATE);
- one.setBidCount(1);
- one.setLastBidAmount(bidVO.getLastBidAmount());
- auctionBidRecordService.save(one);
}
+
+ LambdaQueryWrapper<AuctionBidRecord> wrapper3=Wrappers.lambdaQuery();
+ wrapper3.eq(AuctionBidRecord::getTargetId,bidVO.getTargetId());
+ wrapper3.eq(AuctionBidRecord::getDelFlag,0);
+ wrapper3.eq(AuctionBidRecord::getMemberId,bidVO.getMemberId());
+ wrapper3.orderByDesc(AuctionBidRecord::getLastBidAmount);
+ wrapper3.last("limit 1");
+ AuctionBidRecord one3 = auctionBidRecordService.getOne(wrapper3);
+ if (one3!=null){
+ one3.setLastBidAmount(bidVO.getLastBidAmount());
+ one3.setLastBidTime(LocalDateTime.now());
+ one3.setBidCount(one.getBidCount()+1);
+ auctionBidRecordService.updateById(one3);
+ }else{
+ one3=new AuctionBidRecord();
+ one3.setAuctionSalesroomId(bidVO.getAuctionSalesroomId());
+ one3.setTargetId(bidVO.getTargetId());
+ one3.setMemberId(bidVO.getMemberId());
+ if(membeOne.getRealName()!=null||membeOne.getRealName()!=""){
+ one3.setNickname(membeOne.getRealName());
+ }else{
+ one3.setNickname(membeOne.getNickname());
+ }
+ one3.setPhone(membeOne.getPhone());
+ one3.setLastBidTime(LocalDateTime.now());
+ one3.setAuctionType(AuctionOrderTypeEnum.REGULAR_ITEMS);
+ one3.setStatus(BidStatusEnum.ELIMINATE);
+ one3.setBidCount(1);
+ one3.setLastBidAmount(bidVO.getLastBidAmount());
+ auctionBidRecordService.save(one3);
+ }
+
+ Map<String, Object> map = new ConcurrentHashMap<>();
+ map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM);
+ map.put("auctionSalesroomId", byId.getId());
+ map.put("byId", byId.getStartStatus());
+ map.put("lastBidAmount",one3.getLastBidAmount());
+ map.put("message_type", "BidRecor");
+ map.put("type",4);
+ String msg = null;
+ try {
+ msg = objectMapper.writeValueAsString(map);
+ } catch (JsonProcessingException e) {
+ }
+ String finalMsg = msg;
+ sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(finalMsg)
+ .clientType(ClientTypeEnum.MEMBER).build(), SecurityConstants.INNER);
+
}
}
@@ -702,7 +827,9 @@
query.getEndTime()), AuctionSalesroom::getStartTime,
query.getStartTime(),
query.getEndTime())
+ .orderByDesc(AuctionSalesroom::getCreateTime)
.page(new Page<>(query.getPageCurr(), query.getPageSize()));
+
List<AuctionSalesroom> records = page.getRecords();
if (StringUtils.isNull(records)) {
return PageDTO.empty(page);
@@ -712,18 +839,21 @@
List<MgtAuctionSalesroomVO> list = auctionSalesroomVOPageDTO.getList();
List<Long> auctionSalesroomIdList = list.stream().map(MgtAuctionSalesroomVO::getId)
.collect(Collectors.toList());
- // 所有拍卖场的拍卖商品
- List<AuctionSalesroomGoods> auctionSalesroomGoods = auctionSalesroomGoodsMapper.selectList(
- Wrappers.<AuctionSalesroomGoods>lambdaQuery()
- .in(AuctionSalesroomGoods::getAuctionSalesroomId, auctionSalesroomIdList));
- // 计算每个拍卖场所有拍品数量
- Map<Long, Integer> map = auctionSalesroomGoods.stream()
- .collect(Collectors.groupingBy(AuctionSalesroomGoods::getAuctionSalesroomId,
- Collectors.summingInt(AuctionSalesroomGoods::getSalesroomStock)));
- for (MgtAuctionSalesroomVO mgtAuctionSalesroomVO : list) {
- Integer i = map.get(mgtAuctionSalesroomVO.getId());
- if (StringUtils.isNotNull(i)) {
- mgtAuctionSalesroomVO.setAuctionGoodsNum(i);
+ if (StringUtils.isNotEmpty(auctionSalesroomIdList)) {
+ // 所有拍卖场的拍卖商品
+ List<AuctionSalesroomGoods> auctionSalesroomGoods = auctionSalesroomGoodsMapper.selectList(
+ Wrappers.<AuctionSalesroomGoods>lambdaQuery()
+ .in(AuctionSalesroomGoods::getAuctionSalesroomId,
+ auctionSalesroomIdList));
+ // 计算每个拍卖场所有拍品数量
+ Map<Long, Integer> map = auctionSalesroomGoods.stream()
+ .collect(Collectors.groupingBy(AuctionSalesroomGoods::getAuctionSalesroomId,
+ Collectors.summingInt(AuctionSalesroomGoods::getSalesroomStock)));
+ for (MgtAuctionSalesroomVO mgtAuctionSalesroomVO : list) {
+ Integer i = map.get(mgtAuctionSalesroomVO.getId());
+ if (StringUtils.isNotNull(i)) {
+ mgtAuctionSalesroomVO.setAuctionGoodsNum(i);
+ }
}
}
return auctionSalesroomVOPageDTO;
@@ -774,8 +904,9 @@
// 生成唯一编号
Long nextId = IDhelper.getNextId();
auctionSalesroom.setAuctionSalesroomNo(nextId.toString());
- String qrCodeToObs = CreateQrCode.createQRCodeToObs(nextId.toString());
- auctionSalesroom.setQrCode(qrCodeToObs);
+ String url = remoteFileService.obsUpload(
+ CreateQrCode.createQRCodeStream(nextId.toString())).getData();
+ auctionSalesroom.setQrCode(url);
// 添加
this.save(auctionSalesroom);
List<GoodsStockUpdDTO> goodsStockUpdDTOS = auctionSalesroomGoods.stream().map(item -> {
@@ -1005,6 +1136,7 @@
.between(StringUtils.isNotNull(query.getStartTime()) && StringUtils.isNotNull(
query.getEndTime()), AuctionSalesroom::getStartTime, query.getStartTime(),
query.getEndTime())
+ .orderByAsc(AuctionSalesroom::getStartTime)
.page(new Page<>(query.getPageCurr(), query.getPageSize()));
List<AuctionSalesroom> records = page.getRecords();
if (StringUtils.isNull(records)) {
@@ -1050,7 +1182,9 @@
vo.setAuctionSalesroomGoodsVOS(collect);
if (StringUtils.isNotNull(vo.getCurrentAuctionSalesroomGoods())) {
int index = collect.indexOf(vo.getCurrentAuctionSalesroomGoods());
- vo.setNextAuctionSalesroomGoods(collect.get(index + 1));
+ if (collect.size() > 1) {
+ vo.setNextAuctionSalesroomGoods(collect.get(index + 1));
+ }
// 分页查询当前拍品出价信息
List<AuctionBidRecord> list = auctionBidRecordService.lambdaQuery()
.eq(AuctionBidRecord::getTargetId,
@@ -1207,13 +1341,22 @@
* @param id 拍卖场商品id
*/
@Override
- public void stopCurrentGoods(Long id) {
+ public void stopCurrentGoods(Long id) throws JsonProcessingException {
AuctionSalesroomGoods auctionSalesroomGoods = auctionSalesroomGoodsMapper.selectById(id);
if (StringUtils.isNull(auctionSalesroomGoods)) {
throw new ServiceException("拍卖商品不存在");
}
auctionSalesroomGoods.setStatus(AuctionGoodsStatusEnum.ENDED);
auctionSalesroomGoodsMapper.updateById(auctionSalesroomGoods);
+ Map<String, Object> map = new ConcurrentHashMap<>();
+ map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM_GOODS);
+ map.put("auctionSalesroomId", auctionSalesroomGoods.getAuctionSalesroomId().toString());
+ map.put("auctionSalesroomGoodsId", auctionSalesroomGoods.getId().toString());
+ map.put("AuctionTypeEnum", auctionSalesroomGoods.getStatus());
+ map.put("message_type", "stop");
+ map.put("type", "2");
+ String msg = objectMapper.writeValueAsString(map);
+ sysUserClient.pushAll(msg, SecurityConstants.INNER);
}
/**
@@ -1222,13 +1365,22 @@
* @param id 拍卖场商品id
*/
@Override
- public void startNextGoods(Long id) {
+ public void startNextGoods(Long id) throws JsonProcessingException {
AuctionSalesroomGoods auctionSalesroomGoods = auctionSalesroomGoodsMapper.selectById(id);
if (StringUtils.isNull(auctionSalesroomGoods)) {
throw new ServiceException("拍卖商品不存在");
}
auctionSalesroomGoods.setStatus(AuctionGoodsStatusEnum.IN_PROGRESS);
auctionSalesroomGoodsMapper.updateById(auctionSalesroomGoods);
+ Map<String, Object> map = new ConcurrentHashMap<>();
+ map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM_GOODS);
+ map.put("auctionSalesroomId", auctionSalesroomGoods.getAuctionSalesroomId().toString());
+ map.put("auctionSalesroomGoodsId", auctionSalesroomGoods.getId().toString());
+ map.put("AuctionTypeEnum", auctionSalesroomGoods.getStatus());
+ map.put("message_type", "start");
+ map.put("type", "2");
+ String msg = objectMapper.writeValueAsString(map);
+ sysUserClient.pushAll(msg, SecurityConstants.INNER);
}
/**
@@ -1243,6 +1395,8 @@
if (StringUtils.isNull(data)) {
throw new ServiceException("视频不存在");
}
+ iAuctionVideoService.remove(Wrappers.<AuctionVideo>lambdaQuery().eq
+ (AuctionVideo::getAuctionSalesroomId, dto.getAuctionSalesroomId()));
AuctionVideo auctionVideo = new AuctionVideo();
auctionVideo.setAuctionSalesroomId(dto.getAuctionSalesroomId());
auctionVideo.setPromotionVideoId(dto.getVideoId());
@@ -1258,7 +1412,7 @@
@Override
public void stopPlay(Long auctionSalesroomId) {
iAuctionVideoService.remove(Wrappers.<AuctionVideo>lambdaQuery().eq
- (AuctionVideo::getAuctionSalesroomId, 1L));
+ (AuctionVideo::getAuctionSalesroomId, auctionSalesroomId));
}
/**
@@ -1288,10 +1442,13 @@
Map<String, Object> map = new ConcurrentHashMap<>();
map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM);
- map.put("auctionSalesroomId", auctionSalesroom.getId());
+ map.put("auctionSalesroomId", auctionSalesroom.getId().toString());
+ map.put("AuctionTypeEnum", auctionSalesroom.getStatus());
map.put("message_type", "start");
+ map.put("type", "1");
String msg = objectMapper.writeValueAsString(map);
- WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.AUCTIONEER.getCode(), msg);
+ sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(msg)
+ .clientType(ClientTypeEnum.AUCTIONEER).build(), SecurityConstants.INNER);
}
@Override
@@ -1299,17 +1456,24 @@
@Transactional
public void stopCurrentAuctionSalesroom(Long auctionSalesroomId)
throws JsonProcessingException {
- // 修改拍卖场开始状态
- AuctionSalesroom auctionSalesroom = this.getById(auctionSalesroomId);
- auctionSalesroom.setStatus(AuctionStartStatusEnum.ENDED);
- auctionSalesroom.setEndTime(LocalDateTime.now());
- auctionSalesroomMapper.updateById(auctionSalesroom);
LambdaQueryWrapper<AuctionSalesroomGoods> wrapper = Wrappers.lambdaQuery();
wrapper.eq(AuctionSalesroomGoods::getStatus, AuctionGoodsStatusEnum.WAITING);
wrapper.eq(AuctionSalesroomGoods::getAuctionSalesroomId, auctionSalesroomId);
wrapper.orderByDesc(AuctionSalesroomGoods::getSortNum);
List<AuctionSalesroomGoods> auctionSalesroomGoods = auctionSalesroomGoodsMapper.selectList(
wrapper);
+ long count = auctionSalesroomGoods.stream()
+ .filter(goods -> goods.getStatus().equals(AuctionGoodsStatusEnum.IN_PROGRESS))
+ .count();
+ if (count > 0) {
+ throw new ServiceException("当前拍卖场正在拍卖商品,不能停止");
+ }
+ // 修改拍卖场开始状态
+ AuctionSalesroom auctionSalesroom = this.getById(auctionSalesroomId);
+ auctionSalesroom.setStatus(AuctionStartStatusEnum.ENDED);
+ auctionSalesroom.setEndTime(LocalDateTime.now());
+ auctionSalesroomMapper.updateById(auctionSalesroom);
+
if (StringUtils.isNotEmpty(auctionSalesroomGoods)) {
List<GoodsStockUpdDTO> dtoList = new ArrayList<>();
for (AuctionSalesroomGoods salesroomGoods : auctionSalesroomGoods) {
@@ -1338,10 +1502,13 @@
}
Map<String, Object> map = new ConcurrentHashMap<>();
map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM);
- map.put("auctionSalesroomId", auctionSalesroom.getId());
+ map.put("auctionSalesroomId", auctionSalesroom.getId().toString());
+ map.put("AuctionTypeEnum",auctionSalesroom.getStatus());
map.put("message_type", "end");
+ map.put("type", "1");
String msg = objectMapper.writeValueAsString(map);
- WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.AUCTIONEER.getCode(), msg);
+ sysUserClient.pushByClientType(WebsocketMessageDTO.builder().message(msg)
+ .clientType(ClientTypeEnum.AUCTIONEER).build(), SecurityConstants.INNER);
}
@Override
--
Gitblit v1.7.1