| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.auction.controller.forepart.dto.AuctionSalesroomGoodsDTO; |
| | | import com.ruoyi.auction.controller.forepart.dto.AuctionSalesroomGoodsInfoDTO; |
| | | import com.ruoyi.auction.controller.forepart.dto.OrderDTO; |
| | | import com.ruoyi.auction.controller.forepart.vo.AuctionBidRecordVO; |
| | | import com.ruoyi.auction.controller.forepart.vo.AuctionSalesroomGoodsInfoVO; |
| | | import com.ruoyi.auction.controller.forepart.vo.AuctionSalesroomVO; |
| | | import com.ruoyi.auction.controller.forepart.vo.ForepartAuctionSalesroomGoodsVO; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.google.common.collect.Lists; |
| | | import com.ruoyi.auction.domain.AuctionBidRecord; |
| | | import com.ruoyi.auction.domain.AuctionSalesroomGoods; |
| | | import com.ruoyi.auction.mapper.AuctionBidRecordMapper; |
| | | import com.ruoyi.auction.mapper.AuctionSalesroomGoodsMapper; |
| | | import com.ruoyi.auction.mapper.AuctionSalesroomMapper; |
| | | import com.ruoyi.auction.service.IAuctionBrowseRecordService; |
| | | import com.ruoyi.auction.service.IAuctionSalesroomGoodsService; |
| | | import com.ruoyi.auction.service.IAuctionSalesroomService; |
| | | import com.ruoyi.common.core.constant.SecurityConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.enums.AuctionGoodsStatusEnum; |
| | | import com.ruoyi.common.core.enums.AuctionOrderTypeEnum; |
| | | import com.ruoyi.common.core.enums.AuctionStartStatusEnum; |
| | | import com.ruoyi.common.core.enums.BidStatusEnum; |
| | | import com.ruoyi.common.core.enums.ClientTypeEnum; |
| | | import com.ruoyi.common.core.enums.OrderFromEnum; |
| | | import com.ruoyi.system.api.constants.NotificationTypeConstant; |
| | | import com.ruoyi.system.api.domain.AuctionSalesroom; |
| | | import com.ruoyi.system.api.domain.CustomConfig; |
| | | import com.ruoyi.system.api.domain.GoodsBrand; |
| | | import com.ruoyi.system.api.domain.GoodsCategory; |
| | | import com.ruoyi.system.api.domain.GoodsFlavorType; |
| | |
| | | import com.ruoyi.system.api.domain.GoodsSku; |
| | | import com.ruoyi.system.api.domain.Member; |
| | | import com.ruoyi.system.api.domain.MemberAddress; |
| | | import com.ruoyi.system.api.domain.dto.AuctionSalesroomDTO; |
| | | import com.ruoyi.system.api.domain.dto.AuctionSalesroomGoodsInfoDTO; |
| | | import com.ruoyi.system.api.domain.dto.GoodsStockUpdDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderAuctionBondDTO; |
| | | import com.ruoyi.system.api.domain.dto.OrderDTO; |
| | | import com.ruoyi.system.api.domain.vo.AuctionBidRecordVO; |
| | | import com.ruoyi.system.api.domain.vo.AuctionSalesroomGoodsInfoVO; |
| | | import com.ruoyi.system.api.domain.vo.AuctionSalesroomVO; |
| | | import com.ruoyi.system.api.domain.vo.ForepartAuctionSalesroomGoodsVO; |
| | | import com.ruoyi.system.api.feignClient.GoodsSkuClient; |
| | | import com.ruoyi.system.api.feignClient.MemberClient; |
| | | import com.ruoyi.system.api.feignClient.OrderClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.util.WebSocketUsers; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import javax.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | |
| | | private IAuctionBrowseRecordService iAuctionBrowseRecordService; |
| | | |
| | | @Resource |
| | | private IAuctionSalesroomService iAuctionSalesroomService; |
| | | |
| | | private static final ObjectMapper objectMapper = new ObjectMapper(); |
| | | |
| | | |
| | | |
| | | |
| | |
| | | * |
| | | */ |
| | | @Override |
| | | public ForepartAuctionSalesroomGoodsVO getAuctionSalesroomGoods(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) { |
| | | public ForepartAuctionSalesroomGoodsVO getAuctionSalesroomGoods(AuctionSalesroomDTO ationSalesroomGoodsDTO) { |
| | | ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO =new ForepartAuctionSalesroomGoodsVO(); |
| | | AuctionSalesroom auctionSalesroom = auctionSalesroomMapper.selectById( |
| | | ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | |
| | | .getData(); |
| | | forepartAuctionSalesroomGoodsVO.setGoodsSkuId(auctionSalesroomGoods.getId()); |
| | | forepartAuctionSalesroomGoodsVO.setGoodsSkuName(goodsSku.getSkuName()); |
| | | forepartAuctionSalesroomGoodsVO.setGoodsSkustatus(auctionSalesroomGoods.getStatus().getCode()); |
| | | forepartAuctionSalesroomGoodsVO.setGoodsSkustatus(auctionSalesroomGoods.getStatus()); |
| | | forepartAuctionSalesroomGoodsVO.setStartingPrice(auctionSalesroomGoods.getStartingPrice()); |
| | | forepartAuctionSalesroomGoodsVO.setSalesroomStock(auctionSalesroomGoods.getSalesroomStock()); |
| | | forepartAuctionSalesroomGoodsVO.setListingDuration(auctionSalesroomGoods.getListingDuration()); |
| | | forepartAuctionSalesroomGoodsVO.setStartTime(auctionSalesroomGoods.getStartTime()); |
| | | forepartAuctionSalesroomGoodsVO.setCoverPic(goodsSku.getCoverPic()); |
| | | forepartAuctionSalesroomGoodsVO.setDescription(goodsSku.getDescription()); |
| | | forepartAuctionSalesroomGoodsVO.setDetail(goodsSku.getDetail()); |
| | | forepartAuctionSalesroomGoodsVO.setYears(String.valueOf(goodsSku.getYears().getYear())); |
| | | forepartAuctionSalesroomGoodsVO.setUnit(goodsSku.getUnit()); |
| | | forepartAuctionSalesroomGoodsVO.setSpec(goodsSku.getSpec()); |
| | | forepartAuctionSalesroomGoodsVO.setSpecUnit(goodsSku.getSpecUnit()); |
| | |
| | | * |
| | | */ |
| | | @Override |
| | | public AuctionSalesroomVO getAuctionSalesroominfo(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) { |
| | | public AuctionSalesroomVO getAuctionSalesroominfo(AuctionSalesroomDTO ationSalesroomGoodsDTO) { |
| | | ForepartAuctionSalesroomGoodsVO forepartAuctionSalesroomGoodsVO =new ForepartAuctionSalesroomGoodsVO(); |
| | | AuctionSalesroom auctionSalesroom = auctionSalesroomMapper.selectById( |
| | | ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | |
| | | forepartAuctionSalesroomGoodsVO1.setCoverPic(goodsSku.getCoverPic()); |
| | | auctionSalesroomGoodsVOS.add(forepartAuctionSalesroomGoodsVO1); |
| | | } |
| | | }if (auctionSalesroom.getStatus().getCode()==2){ |
| | | }if (auctionSalesroom.getStatus().getCode()==1){ |
| | | List list =new ArrayList(); |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper=Wrappers.lambdaQuery(); |
| | | wrapper.eq(AuctionSalesroomGoods::getStatus,1); |
| | |
| | | wrapper.last("limit 1"); |
| | | AuctionSalesroomGoods auctionSalesroomGoods = this.getOne(wrapper); |
| | | ForepartAuctionSalesroomGoodsVO currentAuctionSalesroomGoods= new ForepartAuctionSalesroomGoodsVO(); |
| | | R<GoodsSku> goodsSkuOne = goodsSkuClient.getGoodsSkuOne( |
| | | auctionSalesroomGoods.getGoodsSkuId(), SecurityConstants.INNER); |
| | | GoodsSku goodsSku=goodsSkuOne.getData(); |
| | | currentAuctionSalesroomGoods.setGoodsSkuName(goodsSku.getSkuName()); |
| | | currentAuctionSalesroomGoods.setCoverPic(goodsSku.getCoverPic()); |
| | | auctionSalesroomVO.setCurrentAuctionSalesroomGoods(currentAuctionSalesroomGoods); |
| | | |
| | | list.add(auctionSalesroomGoods.getSortNum()); |
| | | |
| | | if (auctionSalesroomGoods!=null){ |
| | | R<GoodsSku> goodsSkuOne = goodsSkuClient.getGoodsSkuOne( |
| | | auctionSalesroomGoods.getGoodsSkuId(), SecurityConstants.INNER); |
| | | GoodsSku goodsSku=goodsSkuOne.getData(); |
| | | currentAuctionSalesroomGoods.setGoodsSkuName(goodsSku.getSkuName()); |
| | | currentAuctionSalesroomGoods.setGoodsSkuId(auctionSalesroomGoods.getGoodsSkuId()); |
| | | currentAuctionSalesroomGoods.setCoverPic(goodsSku.getCoverPic()); |
| | | currentAuctionSalesroomGoods.setStartTime(auctionSalesroomGoods.getStartTime()); |
| | | currentAuctionSalesroomGoods.setGoodsSkustatus(auctionSalesroomGoods.getStatus()); |
| | | currentAuctionSalesroomGoods.setListingDuration(auctionSalesroomGoods.getListingDuration()); |
| | | auctionSalesroomVO.setCurrentAuctionSalesroomGoods(currentAuctionSalesroomGoods); |
| | | list.add(auctionSalesroomGoods.getSortNum()); |
| | | } |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper1=Wrappers.lambdaQuery(); |
| | | wrapper1.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper1.eq(AuctionSalesroomGoods::getSortNum,auctionSalesroomGoods.getSortNum()+1); |
| | | wrapper1.eq(AuctionSalesroomGoods::getStatus,0); |
| | | if (auctionSalesroomGoods!=null) { |
| | | wrapper1.eq(AuctionSalesroomGoods::getSortNum, auctionSalesroomGoods.getSortNum() + 1); |
| | | list.add(auctionSalesroomGoods.getSortNum()+1); |
| | | }else{ |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrappers=Wrappers.lambdaQuery(); |
| | | wrappers.eq(AuctionSalesroomGoods::getStatus,0); |
| | | wrappers.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrappers.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrappers.orderByAsc(AuctionSalesroomGoods::getSortNum); |
| | | wrappers.last("limit 1"); |
| | | AuctionSalesroomGoods auctionSalesroomGoodss = this.getOne(wrappers); |
| | | if (auctionSalesroomGoodss!=null){ |
| | | R<GoodsSku> goodsSkuOne = goodsSkuClient.getGoodsSkuOne( |
| | | auctionSalesroomGoodss.getGoodsSkuId(), SecurityConstants.INNER); |
| | | GoodsSku goodsSku=goodsSkuOne.getData(); |
| | | currentAuctionSalesroomGoods.setGoodsSkuName(goodsSku.getSkuName()); |
| | | currentAuctionSalesroomGoods.setGoodsSkuId(auctionSalesroomGoodss.getGoodsSkuId()); |
| | | currentAuctionSalesroomGoods.setCoverPic(goodsSku.getCoverPic()); |
| | | currentAuctionSalesroomGoods.setStartTime(auctionSalesroomGoodss.getStartTime()); |
| | | currentAuctionSalesroomGoods.setGoodsSkustatus(auctionSalesroomGoodss.getStatus()); |
| | | currentAuctionSalesroomGoods.setListingDuration(auctionSalesroomGoodss.getListingDuration()); |
| | | auctionSalesroomVO.setCurrentAuctionSalesroomGoods(currentAuctionSalesroomGoods); |
| | | } |
| | | wrappers.eq(AuctionSalesroomGoods::getSortNum, auctionSalesroomGoodss.getSortNum()); |
| | | list.add(auctionSalesroomGoodss.getSortNum()); |
| | | } |
| | | wrapper1.last("limit 1"); |
| | | AuctionSalesroomGoods auctionSalesroomGoods1 = this.getOne(wrapper1); |
| | | ForepartAuctionSalesroomGoodsVO nextAuctionSalesroomGoods= new ForepartAuctionSalesroomGoodsVO(); |
| | | if (auctionSalesroomGoods1!=null){ |
| | | list.add(auctionSalesroomGoods.getSortNum()+1); |
| | | |
| | | R<GoodsSku> goodsSkuOne1 = goodsSkuClient.getGoodsSkuOne( |
| | | auctionSalesroomGoods.getGoodsSkuId(), SecurityConstants.INNER); |
| | | auctionSalesroomGoods1.getGoodsSkuId(), SecurityConstants.INNER); |
| | | GoodsSku goodsSku1=goodsSkuOne1.getData(); |
| | | nextAuctionSalesroomGoods.setNextGoodsSkuName(goodsSku1.getSkuName()); |
| | | nextAuctionSalesroomGoods.setCoverPic(goodsSku1.getCoverPic()); |
| | | nextAuctionSalesroomGoods.setGoodsSkustatus(auctionSalesroomGoods1.getStatus()); |
| | | nextAuctionSalesroomGoods.setGoodsSkuId(auctionSalesroomGoods1.getGoodsSkuId()); |
| | | auctionSalesroomVO.setNextAuctionSalesroomGoods(nextAuctionSalesroomGoods); |
| | | } |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.notIn(AuctionSalesroomGoods::getSortNum,list); |
| | | wrapper2.notIn(AuctionSalesroomGoods::getSortNum,list); |
| | | wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | |
| | | GoodsSku goodsSku2=goodsSkuOne2.getData(); |
| | | forepartAuctionSalesroomGoodsVO1.setGoodsSkuName(goodsSku2.getSkuName()); |
| | | forepartAuctionSalesroomGoodsVO1.setCoverPic(goodsSku2.getCoverPic()); |
| | | forepartAuctionSalesroomGoodsVO1.setGoodsSkuId(salesroomGoods.getGoodsSkuId()); |
| | | forepartAuctionSalesroomGoodsVO1.setGoodsSkustatus(salesroomGoods.getStatus()); |
| | | auctionSalesroomGoodsVOS.add(forepartAuctionSalesroomGoodsVO1); |
| | | } |
| | | |
| | | |
| | | } |
| | | auctionSalesroomVO.setElseAuctionSalesroomGoods(auctionSalesroomGoodsVOS); |
| | | |
| | | |
| | | return auctionSalesroomVO; |
| | | } |
| | | |
| | |
| | | * |
| | | */ |
| | | @Override |
| | | public void auctionSalesroomStart(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) { |
| | | public void auctionSalesroomStart(AuctionSalesroomDTO ationSalesroomGoodsDTO) { |
| | | AuctionSalesroom auctionSalesroom = auctionSalesroomMapper.selectById( |
| | | ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | auctionSalesroom.setStatus(AuctionStartStatusEnum.IN_AUCTION); |
| | |
| | | wrapper2.orderByAsc(AuctionSalesroomGoods::getSortNum); |
| | | wrapper2.last("limit 1"); |
| | | AuctionSalesroomGoods auctionSalesroomGoods = this.getOne(wrapper2); |
| | | auctionSalesroomGoods.setStatus(AuctionStartStatusEnum.IN_AUCTION); |
| | | auctionSalesroomGoods.setStatus(AuctionGoodsStatusEnum.IN_PROGRESS); |
| | | auctionSalesroomGoods.setStartTime(LocalDateTime.now()); |
| | | this.updateById(auctionSalesroomGoods); |
| | | |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM); |
| | | map.put("auctionSalesroomId", auctionSalesroom.getId()); |
| | | map.put("message_type", "start"); |
| | | String msg = null; |
| | | try { |
| | | msg = objectMapper.writeValueAsString(map); |
| | | } catch (JsonProcessingException e) { |
| | | } |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.AUCTIONEER.getCode(), msg); |
| | | |
| | | } |
| | | |
| | |
| | | * |
| | | */ |
| | | @Override |
| | | public void auctionSalesroomEnd(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) { |
| | | public void auctionSalesroomEnd(AuctionSalesroomDTO ationSalesroomGoodsDTO) { |
| | | AuctionSalesroom auctionSalesroom = auctionSalesroomMapper.selectById( |
| | | ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | auctionSalesroom.setStatus(AuctionStartStatusEnum.ENDED); |
| | |
| | | wrapper2.eq(AuctionSalesroomGoods::getStatus,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | List<AuctionSalesroomGoods> auctionSalesroomGoods = this.list(wrapper2); |
| | | for (AuctionSalesroomGoods salesroomGoods:auctionSalesroomGoods){ |
| | | salesroomGoods.setStatus(AuctionStartStatusEnum.ENDED); |
| | | this.updateById(salesroomGoods); |
| | | List<AuctionSalesroomGoods> auctionSalesroomGoods=this.list(wrapper2); |
| | | if (auctionSalesroomGoods.size()>0){ |
| | | for (AuctionSalesroomGoods salesroomGoods:auctionSalesroomGoods){ |
| | | salesroomGoods.setStatus(AuctionGoodsStatusEnum.ENDED); |
| | | this.updateById(salesroomGoods); |
| | | |
| | | GoodsStockUpdDTO goodsStockUpdDTO = new GoodsStockUpdDTO(); |
| | | goodsStockUpdDTO.setGoodsSkuId(salesroomGoods.getGoodsSkuId()); |
| | | goodsStockUpdDTO.setAuctionStock(salesroomGoods.getSalesroomStock()); |
| | | goodsSkuClient.updGoodsStock(Lists.newArrayList(goodsStockUpdDTO), |
| | | SecurityConstants.INNER); |
| | | |
| | | } |
| | | |
| | | } |
| | | List<Long> list=new ArrayList<>(); |
| | | |
| | | |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper = Wrappers.lambdaQuery(); |
| | | wrapper.eq(AuctionBidRecord::getAuctionSalesroomId, ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper.eq(AuctionBidRecord::getDelFlag, 0); |
| | |
| | | orderClient.getOrderAuctionBond(orderAuctionBondDTO, |
| | | SecurityConstants.INNER); |
| | | } |
| | | |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM); |
| | | map.put("auctionSalesroomId", auctionSalesroom.getId()); |
| | | map.put("message_type", "end"); |
| | | String msg = null; |
| | | try { |
| | | msg = objectMapper.writeValueAsString(map); |
| | | } catch (JsonProcessingException e) { |
| | | } |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.AUCTIONEER.getCode(), msg); |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | */ |
| | | @Override |
| | | public List<AuctionSalesroomGoods> isAuctionSalesroom(AuctionSalesroomGoodsDTO ationSalesroomGoodsDTO) { |
| | | public List<AuctionSalesroomGoods> isAuctionSalesroom(AuctionSalesroomDTO ationSalesroomGoodsDTO) { |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.eq(AuctionSalesroomGoods::getStatus,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getStatus,1); |
| | | wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,ationSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | List<AuctionSalesroomGoods> auctionSalesroomGoods = this.list(wrapper2); |
| | |
| | | * |
| | | */ |
| | | @Override |
| | | public void auctionSalesroomGoodsStart(AuctionSalesroomGoodsDTO auctionSalesroomGoodsDTO) { |
| | | public void auctionSalesroomGoodsStart(AuctionSalesroomDTO auctionSalesroomGoodsDTO) { |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,auctionSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getGoodsSkuId,auctionSalesroomGoodsDTO.getGoodsSkuId()); |
| | | AuctionSalesroomGoods auctionSalesroomGoods = this.getOne(wrapper2); |
| | | auctionSalesroomGoods.setStatus(AuctionStartStatusEnum.IN_AUCTION); |
| | | AuctionSalesroomGoods auctionSalesroomGoods=this.getOne(wrapper2); |
| | | auctionSalesroomGoods.setStatus(AuctionGoodsStatusEnum.IN_PROGRESS); |
| | | this.updateById(auctionSalesroomGoods); |
| | | |
| | | /* Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM_GOODS); |
| | | map.put("notification_time", LocalDateTime.now()); |
| | | map.put("goodsSkuId", auctionSalesroomGoods.getId()); |
| | | map.put("message_type", "start"); |
| | | String msg = null; |
| | | try { |
| | | msg = objectMapper.writeValueAsString(map); |
| | | } catch (JsonProcessingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.AUCTIONEER.getCode(), msg);*/ |
| | | } |
| | | |
| | | |
| | |
| | | * |
| | | */ |
| | | @Override |
| | | public void auctionSalesroomGoodsEnd(AuctionSalesroomGoodsDTO auctionSalesroomGoodsDTO) { |
| | | public void auctionSalesroomGoodsEnd(AuctionSalesroomDTO auctionSalesroomGoodsDTO) { |
| | | LambdaQueryWrapper<AuctionSalesroomGoods> wrapper2=Wrappers.lambdaQuery(); |
| | | wrapper2.eq(AuctionSalesroomGoods::getAuctionSalesroomId,auctionSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper2.eq(AuctionSalesroomGoods::getDelFlag,0); |
| | | wrapper2.eq(AuctionSalesroomGoods::getGoodsSkuId,auctionSalesroomGoodsDTO.getGoodsSkuId()); |
| | | AuctionSalesroomGoods auctionSalesroomGood = this.getOne(wrapper2); |
| | | AuctionSalesroomGoods auctionSalesroomGoods=this.getOne(wrapper2); |
| | | AuctionSalesroom auctionSalesroom=iAuctionSalesroomService.getById(auctionSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | |
| | | AuctionSalesroom auctionSalesroom = auctionSalesroomMapper.selectById( |
| | | auctionSalesroomGood.getAuctionSalesroomId()); |
| | | |
| | | AuctionSalesroomGoods auctionSalesroomGoods = this.getById( |
| | | auctionSalesroomGoodsDTO.getGoodsSkuId()); |
| | | List<AuctionBidRecord> auctionBidRecordList=new ArrayList<>(); |
| | | |
| | | if (auctionSalesroomGoods.getStatus().getCode()==1) { |
| | | LambdaQueryWrapper<AuctionBidRecord> wrapper = Wrappers.lambdaQuery(); |
| | | wrapper.eq(AuctionBidRecord::getAuctionSalesroomId,auctionSalesroomGoodsDTO.getAuctionSalesroomId()); |
| | | wrapper.eq(AuctionBidRecord::getTargetId, auctionSalesroomGoodsDTO.getGoodsSkuId()); |
| | | wrapper.eq(AuctionBidRecord::getDelFlag, 0); |
| | | wrapper.orderByDesc(AuctionBidRecord::getLastBidAmount); |
| | | auctionBidRecordList = auctionBidRecordMapper.selectList(wrapper); |
| | | //判断 |
| | | if (auctionBidRecordList.size() >= auctionSalesroomGoods.getSalesroomStock()) { |
| | | for (int i = 0; i <= auctionSalesroomGoods.getSalesroomStock(); i++) { |
| | | AuctionBidRecord auctionBidRecord = auctionBidRecordList.get(i); |
| | | auctionBidRecord.setStatus(BidStatusEnum.SUCCESSFUL); |
| | | AddOrder(auctionBidRecord.getTargetId(), auctionBidRecord.getMemberId(), |
| | | auctionBidRecord.getLastBidAmount(), auctionSalesroom.getBond()); |
| | | } |
| | | } else { |
| | | for (int i = 0; i <= auctionBidRecordList.size(); i++) { |
| | | AuctionBidRecord auctionBidRecord = auctionBidRecordList.get(i); |
| | | auctionBidRecord.setStatus(BidStatusEnum.SUCCESSFUL); |
| | | AddOrder(auctionBidRecord.getTargetId(), auctionBidRecord.getMemberId(), |
| | | auctionBidRecord.getLastBidAmount(), auctionSalesroom.getBond()); |
| | | if(auctionBidRecordList.size()>0){ |
| | | //判断 |
| | | if (auctionBidRecordList.size() >= auctionSalesroomGoods.getSalesroomStock()) { |
| | | for (int i = 0; i <= auctionSalesroomGoods.getSalesroomStock(); i++) { |
| | | AuctionBidRecord auctionBidRecord = auctionBidRecordList.get(i); |
| | | auctionBidRecord.setStatus(BidStatusEnum.SUCCESSFUL); |
| | | AddOrder(auctionBidRecord.getTargetId(), auctionBidRecord.getMemberId(), |
| | | auctionBidRecord.getLastBidAmount(), auctionSalesroom.getBond()); |
| | | } |
| | | } else { |
| | | GoodsStockUpdDTO goodsStockUpdDTO = new GoodsStockUpdDTO(); |
| | | goodsStockUpdDTO.setGoodsSkuId(auctionSalesroomGoods.getGoodsSkuId()); |
| | | goodsStockUpdDTO.setAuctionStock(auctionSalesroomGoods.getSalesroomStock()- auctionBidRecordList.size()); |
| | | goodsSkuClient.updGoodsStock(Lists.newArrayList(goodsStockUpdDTO), |
| | | SecurityConstants.INNER); |
| | | |
| | | |
| | | for (int i = 0; i <= auctionBidRecordList.size(); i++) { |
| | | AuctionBidRecord auctionBidRecord = auctionBidRecordList.get(i); |
| | | auctionBidRecord.setStatus(BidStatusEnum.SUCCESSFUL); |
| | | AddOrder(auctionBidRecord.getTargetId(), auctionBidRecord.getMemberId(), |
| | | auctionBidRecord.getLastBidAmount(), auctionSalesroom.getBond()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | auctionSalesroomGood.setStatus(AuctionStartStatusEnum.ENDED); |
| | | this.updateById(auctionSalesroomGood); |
| | | auctionSalesroomGoods.setStatus(AuctionGoodsStatusEnum.ENDED); |
| | | this.updateById(auctionSalesroomGoods); |
| | | |
| | | /* Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | map.put("notification_type", NotificationTypeConstant.AUCTION_SALESROOM_GOODS); |
| | | map.put("notification_time", LocalDateTime.now()); |
| | | map.put("goodsSkuId", auctionSalesroomGoods.getId()); |
| | | map.put("message_type", "end"); |
| | | String msg = null; |
| | | try { |
| | | msg = objectMapper.writeValueAsString(map); |
| | | } catch (JsonProcessingException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.AUCTIONEER.getCode(), msg);*/ |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public AuctionSalesroomGoodsInfoVO getAuctionSalesroomGoodsInfo(AuctionSalesroomGoodsInfoDTO auctionSalesroomGoodsInfoDTO) { |
| | | AuctionSalesroom byId = auctionSalesroomMapper.selectById( |
| | | auctionSalesroomGoodsInfoDTO.getAuctionSalesroomId()); |
| | | AuctionSalesroom byId = auctionSalesroomMapper.selectById(auctionSalesroomGoodsInfoDTO.getAuctionSalesroomId()); |
| | | AuctionSalesroomGoods byId1 = this.getById(auctionSalesroomGoodsInfoDTO.getGoodsSkuId()); |
| | | GoodsSku goodsSku = goodsSkuClient.getGoodsSkuOne(byId1.getGoodsSkuId(), SecurityConstants.INNER).getData(); |
| | | AuctionSalesroomGoodsInfoVO AuctionSalesroomGoodsInfoVO=new AuctionSalesroomGoodsInfoVO(); |
| | |
| | | AuctionSalesroomGoodsInfoVO.setStartTime(byId1.getStartTime()); |
| | | AuctionSalesroomGoodsInfoVO.setUnit(goodsSku.getUnit()); |
| | | AuctionSalesroomGoodsInfoVO.setDescription(goodsSku.getDescription()); |
| | | AuctionSalesroomGoodsInfoVO.setYears(goodsSku.getYears()); |
| | | AuctionSalesroomGoodsInfoVO.setDetail(goodsSku.getDetail()); |
| | | AuctionSalesroomGoodsInfoVO.setYears(String.valueOf(goodsSku.getYears().getYear())); |
| | | GoodsBrand data = goodsSkuClient.getBrandOne(goodsSku.getBrandId(), SecurityConstants.INNER).getData(); |
| | | GoodsCategory data1 = goodsSkuClient.getCategoryOne(goodsSku.getCategoryId(), SecurityConstants.INNER).getData(); |
| | | GoodsSeries data2 = goodsSkuClient.getSeriesOne(goodsSku.getSeriesId(), SecurityConstants.INNER).getData(); |
| | |
| | | order.setOrderFrom(OrderFromEnum.AUCTION_ORDERS); |
| | | order.setMemberId(memberId); |
| | | AuctionSalesroomGoods auctionSalesroomGoods = this.getById(goodsSkuId); |
| | | |
| | | order.setGoodsQuantity(1); |
| | | order.setTotalAmount(lastBidAmount); |
| | | order.setAuctionSalesroomId(auctionSalesroomGoods.getAuctionSalesroomId()); |
| | | |
| | | R<MemberAddress> memberAddressR = emberClient.getMemberAddressOne(memberId, |
| | | SecurityConstants.INNER); |
| | | MemberAddress memberAddress=memberAddressR.getData(); |
| | | |
| | | |
| | | CustomConfig memberPointsMoney = sysUserClient.getconfig("MEMBER_POINTS_MONEY").getData(); |
| | | CustomConfig memberPointsPoints = sysUserClient.getconfig("MEMBER_POINTS_POINTS").getData(); |
| | | Double aDouble= Double.valueOf(memberPointsMoney.getConfigValue()) * Double.valueOf(memberPointsPoints.getConfigValue()); |
| | | BigDecimal pi=lastBidAmount.multiply(new BigDecimal(aDouble)); |
| | | order.setPoints(pi.intValue()); |
| | | |
| | | |
| | | order.setReceiverCity(memberAddress.getCity()); |
| | | order.setReceiverDetailAddress(memberAddress.getDetailedAddress()); |
| | | order.setReceiverphone(memberAddress.getRecipientPhone()); |
| | | order.setReceiverName(memberAddress.getRecipientName()); |
| | | order.setBound(bound); |
| | | order.setAuctionType(AuctionOrderTypeEnum.AUCTION_ITEMS); |
| | | |
| | | GoodsSku goodsSku = goodsSkuClient.getGoodsSkuOne(auctionSalesroomGoods.getGoodsSkuId(), SecurityConstants.INNER) |
| | | .getData(); |
| | | order.setSkuName(goodsSku.getSkuName()); |
| | | order.setCoverPic(goodsSku.getCoverPic()); |
| | | order.setPrice(lastBidAmount); |
| | | orderClient.saveOrderOne(order,SecurityConstants.INNER); |
| | | } |
| | | |
| | | |