From fc8b51f40e71aa09bb49f407c1e9f68ac94ceb58 Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期一, 29 七月 2024 18:51:32 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomServiceImpl.java | 82 ++++++++++++++++++++++++++--------------- 1 files changed, 52 insertions(+), 30 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 a0806af..e6ff93b 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 @@ -24,11 +24,9 @@ import com.ruoyi.auction.controller.management.vo.MgtAuctionSalesroomGoodsVO; import com.ruoyi.auction.controller.management.vo.MgtAuctionSalesroomScreenVO; import com.ruoyi.auction.controller.management.vo.MgtAuctionSalesroomVO; -import com.ruoyi.auction.domain.AuctionBidRecord; -import com.ruoyi.auction.domain.AuctionBrowseRecord; -import com.ruoyi.auction.domain.AuctionSalesroomGoods; -import com.ruoyi.auction.domain.AuctionVideo; +import com.ruoyi.auction.domain.*; import com.ruoyi.auction.mapper.AuctionBidRecordMapper; +import com.ruoyi.auction.mapper.AuctionBondJlMapper; import com.ruoyi.auction.mapper.AuctionSalesroomGoodsMapper; import com.ruoyi.auction.mapper.AuctionSalesroomMapper; import com.ruoyi.auction.service.IAuctionBidRecordService; @@ -168,6 +166,9 @@ private AuctionBidRecordMapper auctionBidRecordMapper; @Resource + private AuctionBondJlMapper auctionBondJlMapper; + + @Resource private RemoteFileService remoteFileService; public static RequestConfig config = RequestConfig.custom().setConnectTimeout(5000).setSocketTimeout(5000).build(); // 配置您申请的KEY,在个人中心->我的数据,接口名称上方查看 @@ -243,12 +244,12 @@ @Override public AuctionSalesroom getAuctionBidRecordOne(ForepartAuctionBidRecordDTO arepartAuctionBidRecordDTO) { - R<SysUser> r=sysUserClient.queryUserByPhone(arepartAuctionBidRecordDTO.getPhone()); + R<SysUser> r=sysUserClient.queryUserByPhone1(arepartAuctionBidRecordDTO.getPhone()); SysUser sysUser=r.getData(); if (sysUser==null){ throw new ServiceException("手机号未注册"); } - if (sysUser.getStatus().equals(1)){ + if (sysUser.getStatus().equals("1")){ throw new ServiceException("该拍卖师账号停用"); } @@ -401,8 +402,14 @@ 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){ + + LambdaQueryWrapper<AuctionBondJl> wrapper=Wrappers.lambdaQuery(); + wrapper.eq(AuctionBondJl::getAuctionSalesroomId,auctionSalesroom.getId()); + wrapper.eq(AuctionBondJl::getMemberId,memberAuctionSalesroomDTO.getMemberId()); + wrapper.eq(AuctionBondJl::getIsState,0); + AuctionBondJl auctionBondJl = auctionBondJlMapper.selectOne(wrapper); + + if (auctionBondJl!=null){ memberAuctionSalesroomVO.setIsApply(2); }else{ memberAuctionSalesroomVO.setIsApply(1); @@ -452,8 +459,12 @@ memberAuctionSalesroomInfoVO.setStatus(byId.getStatus()); memberAuctionSalesroomInfoVO.setCoverPic(byId.getCoverPic()); - List<OrderAuctionBond> data = orderClient.getOrderAuctionBondList1(memberAuctionSalesroomDTO, SecurityConstants.INNER).getData(); - if (data.size()>0){ + LambdaQueryWrapper<AuctionBondJl> wrapper=Wrappers.lambdaQuery(); + wrapper.eq(AuctionBondJl::getAuctionSalesroomId,byId.getId()); + wrapper.eq(AuctionBondJl::getMemberId,memberAuctionSalesroomDTO.getMemberId()); + wrapper.eq(AuctionBondJl::getIsState,0); + AuctionBondJl auctionBondJl = auctionBondJlMapper.selectOne(wrapper); + if (auctionBondJl!=null){ memberAuctionSalesroomInfoVO.setIsApply(2); }else{ memberAuctionSalesroomInfoVO.setIsApply(1); @@ -978,6 +989,15 @@ throw new ServiceException("该拍卖场已结束,不能编辑"); } auctionSalesroom.setId(auctionSalesroomOrg.getId()); + if (!auctionSalesroomOrg.getType().equals(auctionSalesroom.getType())) { + AuctionSalesroomQrCodeVO vo = new AuctionSalesroomQrCodeVO(); + vo.setAuctionSalesroomNo(auctionSalesroomOrg.getAuctionSalesroomNo()); + vo.setType(auctionSalesroom.getType().getCode()); + String url = remoteFileService.obsUpload( + CreateQrCode.createQRCodeStream(objectMapper.writeValueAsString(vo))) + .getData(); + auctionSalesroom.setQrCode(url); + } this.updateById(auctionSalesroom); List<AuctionSalesroomGoods> list = auctionSalesroomGoodsMapper.selectList( Wrappers.<AuctionSalesroomGoods>lambdaQuery() @@ -1018,9 +1038,7 @@ Set<Long> goodsSkuIdList = null; goodsSkuIdList = data.stream().map(OrderAuctionBond::getAuctionSalesroomId) .collect(Collectors.toSet()); - Page<AuctionSalesroom> page = new Page<>(); - page.setSize(memberAuctionSalesroomDTO.getPageSize()); - page.setCurrent(memberAuctionSalesroomDTO.getPageCurr()); + /* MemberAuctionSalesroomWdDTO memberAuctionSalesroomWdDTO=new MemberAuctionSalesroomWdDTO(); if (goodsSkuIdList.size()>0){ memberAuctionSalesroomWdDTO.setGoodsSkuIdList(goodsSkuIdList); @@ -1039,6 +1057,9 @@ }*/ + Page<AuctionSalesroom> page = new Page<>(); + page.setSize(memberAuctionSalesroomDTO.getPageSize()); + page.setCurrent(memberAuctionSalesroomDTO.getPageCurr()); LambdaQueryWrapper<AuctionSalesroom> wrapper1=Wrappers.lambdaQuery(); if (goodsSkuIdList.size()>0){ wrapper1.in(AuctionSalesroom::getId,goodsSkuIdList); @@ -1061,7 +1082,7 @@ " WHEN status = 2 THEN 3\n" + " END,status"); - Page<AuctionSalesroom> auctionSalesroomList=this.page(page,wrapper1); + Page<AuctionSalesroom> auctionSalesroomList=this.page(Page.of(memberAuctionSalesroomDTO.getPageCurr(),memberAuctionSalesroomDTO.getPageSize()),wrapper1); PageDTO<WdMemberAuctionSalesroomVO> wdMemberAuctionSalesroomVOPageDTO = PageDTO.of(auctionSalesroomList, WdMemberAuctionSalesroomVO.class); List<WdMemberAuctionSalesroomVO> list = wdMemberAuctionSalesroomVOPageDTO.getList(); for (WdMemberAuctionSalesroomVO auctionSalesroom:list){ @@ -1197,11 +1218,10 @@ AuctionSalesroom::getSalesroomName, query.getSalesroomName()) .eq(StringUtils.isNotNull(query.getStatus()), AuctionSalesroom::getStatus, query.getStatus()) - .ne(AuctionSalesroom::getStatus, AuctionStartStatusEnum.ENDED) .between(StringUtils.isNotNull(query.getStartTime()) && StringUtils.isNotNull( query.getEndTime()), AuctionSalesroom::getStartTime, query.getStartTime(), query.getEndTime()) - .orderByAsc(AuctionSalesroom::getStartTime) + .orderByDesc(AuctionSalesroom::getCreateTime) .page(new Page<>(query.getPageCurr(), query.getPageSize())); List<AuctionSalesroom> records = page.getRecords(); if (StringUtils.isNull(records)) { @@ -1247,7 +1267,7 @@ vo.setAuctionSalesroomGoodsVOS(collect); if (StringUtils.isNotNull(vo.getCurrentAuctionSalesroomGoods())) { int index = collect.indexOf(vo.getCurrentAuctionSalesroomGoods()); - if (collect.size() > 1) { + if (collect.size() > 1 && index < collect.size() - 1) { vo.setNextAuctionSalesroomGoods(collect.get(index + 1)); } // 分页查询当前拍品出价信息 @@ -1362,8 +1382,8 @@ public PageDTO<MgtAuctionSalesroomGoodsVO> backupGoods(MgtAuctionSalesroomGoodsQuery query) { Page<AuctionSalesroomGoods> page = new Page<>(query.getPageCurr(), query.getPageSize()); Set<Long> goodsSkuIdSet = null; - if (StringUtils.isNotBlank(query.getGoodsName())) { - List<GoodsSku> data = goodsSkuClient.getGoodsByName(query.getGoodsName(), + if (StringUtils.isNotBlank(query.getGoodsSkuName())) { + List<GoodsSku> data = goodsSkuClient.getGoodsByName(query.getGoodsSkuName(), SecurityConstants.INNER).getData(); if (StringUtils.isNotEmpty(data)) { goodsSkuIdSet = data.stream().map(GoodsSku::getId) @@ -1438,7 +1458,7 @@ Wrappers.lambdaQuery(AuctionBidRecord.class) .eq(AuctionBidRecord::getAuctionSalesroomId, auctionSalesroomGoods.getAuctionSalesroomId()) - .eq(AuctionBidRecord::getTargetId, auctionSalesroomGoods.getGoodsSkuId()) + .eq(AuctionBidRecord::getTargetId, auctionSalesroomGoods.getId()) .eq(AuctionBidRecord::getAuctionType, AuctionOrderTypeEnum.AUCTION_ITEMS) .orderByDesc(AuctionBidRecord::getLastBidAmount)); if (CollUtils.isNotEmpty(auctionBidRecordList)) { @@ -1446,11 +1466,15 @@ if (auctionBidRecordList.size() >= auctionSalesroomGoods.getSalesroomStock()) { for (int i = 0; i < auctionSalesroomGoods.getSalesroomStock(); i++) { AuctionBidRecord auctionBidRecord = auctionBidRecordList.get(i); + auctionBidRecord.setStatus(BidStatusEnum.SUCCESSFUL); + auctionBidRecordMapper.updateById(auctionBidRecord); auctionBidRecords.add(auctionBidRecord); } } else { - for (int i = 0; i < auctionSalesroomGoods.getSalesroomStock(); i++) { + for (int i = 0; i < auctionBidRecordList.size(); i++) { AuctionBidRecord auctionBidRecord = auctionBidRecordList.get(i); + auctionBidRecord.setStatus(BidStatusEnum.SUCCESSFUL); + auctionBidRecordMapper.updateById(auctionBidRecord); auctionBidRecords.add(auctionBidRecord); } // 没有出价记录,回退库存 @@ -1637,7 +1661,6 @@ public void stopCurrentAuctionSalesroom(Long auctionSalesroomId) throws JsonProcessingException { 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( @@ -1653,19 +1676,18 @@ auctionSalesroom.setStatus(AuctionStartStatusEnum.ENDED); auctionSalesroom.setEndTime(LocalDateTime.now()); auctionSalesroomMapper.updateById(auctionSalesroom); - + auctionSalesroomGoods = auctionSalesroomGoods.stream() + .filter(goods -> goods.getStatus().equals(AuctionGoodsStatusEnum.WAITING)).collect( + Collectors.toList()); if (StringUtils.isNotEmpty(auctionSalesroomGoods)) { List<GoodsStockUpdDTO> dtoList = new ArrayList<>(); for (AuctionSalesroomGoods salesroomGoods : auctionSalesroomGoods) { salesroomGoods.setStatus(AuctionGoodsStatusEnum.ENDED); // 等待中的商品退库存 - if (salesroomGoods.getStatus().equals(AuctionGoodsStatusEnum.WAITING)) { - GoodsStockUpdDTO goodsStockUpdDTO = new GoodsStockUpdDTO(); - goodsStockUpdDTO.setGoodsSkuId(salesroomGoods.getGoodsSkuId()); - goodsStockUpdDTO.setAuctionStock(salesroomGoods.getSalesroomStock()); - dtoList.add(goodsStockUpdDTO); - } - + GoodsStockUpdDTO goodsStockUpdDTO = new GoodsStockUpdDTO(); + goodsStockUpdDTO.setGoodsSkuId(salesroomGoods.getGoodsSkuId()); + goodsStockUpdDTO.setAuctionStock(salesroomGoods.getSalesroomStock()); + dtoList.add(goodsStockUpdDTO); } // 批量更新商品库存 auctionSalesroomGoodsMapper.updateBatchById(auctionSalesroomGoods); -- Gitblit v1.7.1