| | |
| | | import com.ruoyi.common.core.utils.page.Checker; |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | @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 = ""; |
| | |
| | | |
| | | private static final ObjectMapper objectMapper = new ObjectMapper(); |
| | | |
| | | |
| | | @Override |
| | | public List<AuctionSalesroom> getAuctionBidRecordList(AuctionSalesroomDTO ationSalesroomGoodsDTO) { |
| | | LambdaQueryWrapper<AuctionSalesroom> wrapper=Wrappers.lambdaQuery(); |
| | |
| | | if (sysUser==null){ |
| | | throw new ServiceException("手机号未注册"); |
| | | } |
| | | if (!SecurityUtils.matchesPassword(arepartAuctionBidRecordDTO.getPassword(), sysUser.getPassword())){ |
| | | /* if (!SecurityUtils.matchesPassword(arepartAuctionBidRecordDTO.getPassword(), sysUser.getPassword())){ |
| | | throw new ServiceException("密码输入错误"); |
| | | } |
| | | }*/ |
| | | |
| | | LambdaQueryWrapper<AuctionSalesroom> wrapper=Wrappers.lambdaQuery(); |
| | | wrapper.eq(AuctionSalesroom::getAuctionSalesroomNo,arepartAuctionBidRecordDTO.getAuctionSalesroomQrcode()); |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | 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); |
| | |
| | | one.setTargetId(bidVO.getTargetId()); |
| | | one.setMemberId(bidVO.getMemberId()); |
| | | one.setLastBidTime(LocalDateTime.now()); |
| | | one.setNickname(membeOne.getNickname()); |
| | | one.setPhone(membeOne.getPhone()); |
| | | one.setAuctionType(AuctionOrderTypeEnum.AUCTION_ITEMS); |
| | | one.setStatus(BidStatusEnum.ELIMINATE); |
| | | one.setBidCount(1); |
| | |
| | | } |
| | | |
| | | |
| | | 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(); |
| | |
| | | one.setLastBidTime(LocalDateTime.now()); |
| | | one.setBidCount(one.getBidCount()+1); |
| | | auctionBidRecordService.updateById(one); |
| | | |
| | | |
| | | }else{ |
| | | one=new AuctionBidRecord(); |
| | | one.setAuctionSalesroomId(bidVO.getAuctionSalesroomId()); |
| | |
| | | one.setLastBidAmount(bidVO.getLastBidAmount()); |
| | | auctionBidRecordService.save(one); |
| | | } |
| | | |
| | | 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.getStartStatus()); |
| | | map.put("lastBidAmount",one2.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); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | 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); |
| | |
| | | // 生成唯一编号 |
| | | 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 -> { |
| | |
| | | .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)) { |
| | |
| | | * @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); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @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); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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()); |
| | |
| | | @Override |
| | | public void stopPlay(Long auctionSalesroomId) { |
| | | iAuctionVideoService.remove(Wrappers.<AuctionVideo>lambdaQuery().eq |
| | | (AuctionVideo::getAuctionSalesroomId, 1L)); |
| | | (AuctionVideo::getAuctionSalesroomId, auctionSalesroomId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | 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 |
| | |
| | | @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) { |
| | |
| | | } |
| | | 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 |