From d222f1d7baaf195a65dfdfe9bc8f38adcde20b52 Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期四, 13 六月 2024 21:05:16 +0800 Subject: [PATCH] 提交【管理后台】订单管理相关接口 --- ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtLogisticsController.java | 42 +++ ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionGoodsServiceImpl.java | 19 + ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/impl/ArticleServiceImpl.java | 30 ++ ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtOrderController.java | 46 ++++ ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionSalesroomServiceImpl.java | 128 +++++++---- ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/Order.java | 5 ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/dto/MgtArticleUpdDTO.java | 27 ++ ruoyi-modules/ruoyi-order/pom.xml | 12 - ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/IGoodsSkuService.java | 2 ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/impl/PromotionWishListServiceImpl.java | 10 ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/MgtArticleCommentsController.java | 8 ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/controller/management/MgtAuctionScreenController.java | 24 + ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/IOrderService.java | 23 ++ ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/IArticleService.java | 8 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/LogisticsServiceImpl.java | 6 ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/MgtSensitiveWordsController.java | 16 + ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/controller/management/dto/MgtAuctionSalesroomGoodsQuery.java | 5 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtOrderConfirmShipmentDTO.java | 31 ++ ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/dto/MgtArticleAuditDTO.java | 3 ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/impl/ArticleCommentsServiceImpl.java | 10 ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsSkuServiceImpl.java | 5 ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsSeckillServiceImpl.java | 2 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java | 120 ++++++++++ ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/management/dto/MgtMemberLevelDetailDTO.java | 4 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/vo/MgtMallOrderVO.java | 7 ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/MemberPointsServiceImpl.java | 8 ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/IAuctionSalesroomService.java | 7 ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/forepart/ForepartGoodsSkuController.java | 10 ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/MgtArticleController.java | 26 ++ 29 files changed, 529 insertions(+), 115 deletions(-) diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/Order.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/Order.java index d0abc5a..0713367 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/Order.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/Order.java @@ -105,7 +105,6 @@ @TableLogic private Integer delFlag; - @ApiModelProperty(value = "快递单号") private String courierNumber; @@ -118,10 +117,8 @@ @ApiModelProperty(value = "城市") private String receiverCity; - @ApiModelProperty(value = "详细地址") private String receiverDetailAddress; - @ApiModelProperty(value = "保证金") private BigDecimal bound; @@ -147,5 +144,7 @@ @ApiModelProperty(value = "积分") private Integer points; + @ApiModelProperty("发货快递") + private String logisticsNum; } diff --git a/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/MgtArticleCommentsController.java b/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/MgtArticleCommentsController.java index 31b6873..b8277d5 100644 --- a/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/MgtArticleCommentsController.java +++ b/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/MgtArticleCommentsController.java @@ -1,7 +1,6 @@ package com.ruoyi.article.controller.management; -import com.ruoyi.article.controller.forepart.dto.ArticleCommentsDTO; import com.ruoyi.article.controller.management.dto.MgtArticleCommentsQuery; import com.ruoyi.article.controller.management.vo.MgtArticleCommentsVO; import com.ruoyi.article.service.IArticleCommentsService; @@ -34,13 +33,6 @@ public class MgtArticleCommentsController { private final IArticleCommentsService articleCommentsService; - - @PostMapping("/delMemberArticleComments") - @ApiOperation(value = "用户端-删除用户评论/回复") - public R delMemberArticleComments(@RequestBody ArticleCommentsDTO articleCommentsDTO) { - articleCommentsService.delMemberArticleComments(articleCommentsDTO); - return R.ok(); - } /** * 查看详情-评论详情 diff --git a/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/MgtArticleController.java b/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/MgtArticleController.java index adf237e..5442eac 100644 --- a/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/MgtArticleController.java +++ b/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/MgtArticleController.java @@ -4,6 +4,7 @@ import com.ruoyi.article.controller.management.dto.MgtArticleAuditDTO; import com.ruoyi.article.controller.management.dto.MgtArticleDTO; import com.ruoyi.article.controller.management.dto.MgtArticleQuery; +import com.ruoyi.article.controller.management.dto.MgtArticleUpdDTO; import com.ruoyi.article.controller.management.vo.MgtArticleVO; import com.ruoyi.article.service.IArticleService; import com.ruoyi.common.core.domain.R; @@ -13,6 +14,7 @@ import io.swagger.annotations.ApiParam; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -99,4 +101,28 @@ return R.ok(); } + /** + * 上架/下架 + * + * @param dto 资讯上下架数据传输对象 + */ + @ApiOperation("上架/下架") + @PutMapping("/upd-status") + public R<?> updStatus(@Validated @RequestBody MgtArticleUpdDTO dto) { + articleService.updStatus(dto); + return R.ok(); + } + + /** + * 删除资讯 + * + * @param id 资讯id + */ + @ApiOperation("删除资讯") + @DeleteMapping("/{id}") + public R<?> removeById( + @ApiParam(name = "id", value = "资讯id", required = true) @PathVariable("id") Long id) { + articleService.removeById(id); + return R.ok(); + } } diff --git a/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/MgtSensitiveWordsController.java b/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/MgtSensitiveWordsController.java index 4060722..dfa802e 100644 --- a/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/MgtSensitiveWordsController.java +++ b/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/MgtSensitiveWordsController.java @@ -9,8 +9,11 @@ import com.ruoyi.common.core.utils.page.PageDTO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -56,4 +59,17 @@ sensitiveWordsService.saveSensitiveWords(dto); return R.ok(); } + + /** + * 上传敏感词 + * + * @param id 敏感词id + */ + @ApiOperation("删除敏感词") + @DeleteMapping("/{id}") + public R<?> delSensitiveWords( + @ApiParam(name = "id", value = "敏感词id", required = true) @PathVariable("id") Long id) { + sensitiveWordsService.removeById(id); + return R.ok(); + } } diff --git a/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/dto/MgtArticleAuditDTO.java b/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/dto/MgtArticleAuditDTO.java index 5cfab62..4361355 100644 --- a/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/dto/MgtArticleAuditDTO.java +++ b/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/dto/MgtArticleAuditDTO.java @@ -23,4 +23,7 @@ @ApiModelProperty(value = "审核状态 已通过 已拒绝") @NotNull(message = "审核状态不能为空") private AuditStatusEnum status; + + @ApiModelProperty(value = "拒绝原因") + private String refuseComment; } diff --git a/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/dto/MgtArticleUpdDTO.java b/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/dto/MgtArticleUpdDTO.java new file mode 100644 index 0000000..08b3bc6 --- /dev/null +++ b/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/controller/management/dto/MgtArticleUpdDTO.java @@ -0,0 +1,27 @@ +package com.ruoyi.article.controller.management.dto; + +import com.ruoyi.common.core.enums.ListingStatusEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author mitao + * @date 2024/6/13 + */ +@Data +@ApiModel("资讯上下架数据传输对象") +public class MgtArticleUpdDTO implements Serializable { + + private static final long serialVersionUID = -3392887724191574253L; + + @ApiModelProperty(value = "资讯id") + @NotNull(message = "资讯id不能为空") + private Long id; + + @ApiModelProperty(value = "上架状态 上架中 已下架") + @NotNull(message = "上架状态不能为空") + private ListingStatusEnum listingStatus; +} diff --git a/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/IArticleService.java b/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/IArticleService.java index 63afd36..0a140d6 100644 --- a/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/IArticleService.java +++ b/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/IArticleService.java @@ -7,6 +7,7 @@ import com.ruoyi.article.controller.management.dto.MgtArticleAuditDTO; import com.ruoyi.article.controller.management.dto.MgtArticleDTO; import com.ruoyi.article.controller.management.dto.MgtArticleQuery; +import com.ruoyi.article.controller.management.dto.MgtArticleUpdDTO; import com.ruoyi.article.controller.management.vo.MgtArticleVO; import com.ruoyi.article.domain.Article; import com.ruoyi.common.core.utils.page.PageDTO; @@ -70,4 +71,11 @@ * @param dto 管理后台-资讯审核传输对象 */ void audit(MgtArticleAuditDTO dto); + + /** + * 上架/下架 + * + * @param dto 资讯上下架数据传输对象 + */ + void updStatus(MgtArticleUpdDTO dto); } diff --git a/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/impl/ArticleCommentsServiceImpl.java b/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/impl/ArticleCommentsServiceImpl.java index 5def371..d0acc66 100644 --- a/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/impl/ArticleCommentsServiceImpl.java +++ b/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/impl/ArticleCommentsServiceImpl.java @@ -94,17 +94,19 @@ public PageDTO<MgtArticleCommentsVO> getArticleCommentsPage(MgtArticleCommentsQuery query) { PageDTO<MgtArticleCommentsVO> result; Set<Long> memberIdSet = null; + Page<ArticleComments> page = new Page<>(query.getPageCurr(), query.getPageSize()); if (StringUtils.isNotBlank(query.getNickname())) { MemberDTO memberDTO = new MemberDTO(); memberDTO.setNickname(query.getNickname()); List<Member> data = memberClient.getMemberListByCondition(memberDTO, SecurityConstants.INNER).getData(); - if (StringUtils.isNotEmpty(data)) { - memberIdSet = data.stream().map(Member::getId) - .collect(Collectors.toSet()); + if (StringUtils.isEmpty(data)) { + // 搜索结果为空,直接返回空 + return PageDTO.empty(page); } + memberIdSet = data.stream().map(Member::getId).collect(Collectors.toSet()); } - Page<ArticleComments> page = this.lambdaQuery() + page = this.lambdaQuery() .eq(ArticleComments::getArticleId, query.getArticleId()) .in(StringUtils.isNotEmpty(memberIdSet), ArticleComments::getMemberId, memberIdSet) .page(new Page<>(query.getPageCurr(), query.getPageSize())); diff --git a/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/impl/ArticleServiceImpl.java b/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/impl/ArticleServiceImpl.java index 7c11d38..1b176ea 100644 --- a/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/impl/ArticleServiceImpl.java +++ b/ruoyi-modules/ruoyi-article/src/main/java/com/ruoyi/article/service/impl/ArticleServiceImpl.java @@ -11,6 +11,7 @@ import com.ruoyi.article.controller.management.dto.MgtArticleAuditDTO; import com.ruoyi.article.controller.management.dto.MgtArticleDTO; import com.ruoyi.article.controller.management.dto.MgtArticleQuery; +import com.ruoyi.article.controller.management.dto.MgtArticleUpdDTO; import com.ruoyi.article.controller.management.vo.MgtArticleVO; import com.ruoyi.article.domain.Article; import com.ruoyi.article.domain.ArticleComments; @@ -26,7 +27,6 @@ import com.ruoyi.common.core.enums.ArticleTypeEnum; import com.ruoyi.common.core.enums.AuditStatusEnum; import com.ruoyi.common.core.exception.ServiceException; -import com.ruoyi.common.core.enums.ListingStatusEnum; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.page.BeanUtils; import com.ruoyi.common.core.utils.page.PageDTO; @@ -305,6 +305,7 @@ // 构建查询条件 Set<Long> sysUserIdSet = null; Set<Long> memberIdSet = null; + Page<Article> page = new Page<>(query.getPageCurr(), query.getPageSize()); if (StringUtils.isNotBlank(query.getCreateBy()) || StringUtils.isNotBlank( query.getPhone())) { SysUser user = new SysUser(); @@ -321,20 +322,23 @@ SecurityConstants.INNER).getData(); memberIdSet = memberlist.stream().map(Member::getId) .collect(Collectors.toSet()); + if (StringUtils.isEmpty(sysUserIdSet) && StringUtils.isEmpty(memberIdSet)) { + return PageDTO.empty(page); + } } // 分页查询 - Page<Article> page = this.lambdaQuery() + page = this.lambdaQuery() .in(StringUtils.isNotEmpty(sysUserIdSet), Article::getCreateBy, sysUserIdSet) .in(StringUtils.isNotEmpty(memberIdSet), Article::getMemberId, memberIdSet) .eq(StringUtils.isNotNull(query.getListingStatus()), Article::getListingStatus, query.getListingStatus()) .like(StringUtils.isNotBlank(query.getTitle()), Article::getTitle, query.getTitle()) - .orderByDesc(Article::getStatus) + .orderByDesc(Article::getReported) .page(new Page<>(query.getPageCurr(), query.getPageSize())); // 若为空直接返回 - if (StringUtils.isNotEmpty(page.getRecords())) { + if (StringUtils.isEmpty(page.getRecords())) { return PageDTO.empty(page); } /*根据资讯的发布类型分别从系统用户表和会员表中查询发布人信息并封装VO*/ @@ -360,8 +364,7 @@ Collectors.toSet()); if (StringUtils.isNotEmpty(memIds)) { List<Member> memberList = memberClient.getMemberListByIds(memIds, - SecurityConstants.INNER) - .getData(); + SecurityConstants.INNER).getData(); memberMap = memberList.stream().collect( Collectors.toMap(Member::getId, Function.identity())); } else { @@ -400,6 +403,7 @@ Article article = BeanUtils.copyBean(dto, Article.class); if (StringUtils.isNull(article.getId())) { article.setStatus(AuditStatusEnum.PASSED); + article.setArticleType(ArticleTypeEnum.PLATFORM_RELEASE); this.save(article); } else { Article articleById = this.getById(article.getId()); @@ -455,6 +459,20 @@ throw new ServiceException("资讯不存在"); } article.setStatus(dto.getStatus()); + if (AuditStatusEnum.REJECTED.equals(dto.getStatus())) { + article.setRefuseComment(dto.getRefuseComment()); + } this.updateById(article); } + + /** + * 上架/下架 + * + * @param dto 资讯上下架数据传输对象 + */ + @Override + public void updStatus(MgtArticleUpdDTO dto) { + this.lambdaUpdate().set(Article::getListingStatus, dto.getListingStatus()) + .eq(Article::getId, dto.getId()).update(); + } } diff --git a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/controller/management/MgtAuctionScreenController.java b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/controller/management/MgtAuctionScreenController.java index 5ad8e39..299ef25 100644 --- a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/controller/management/MgtAuctionScreenController.java +++ b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/controller/management/MgtAuctionScreenController.java @@ -1,6 +1,7 @@ package com.ruoyi.auction.controller.management; +import com.fasterxml.jackson.core.JsonProcessingException; import com.ruoyi.auction.controller.management.dto.MgtAuctionSalesroomGoodsQuery; import com.ruoyi.auction.controller.management.dto.MgtAuctionSalesroomQuery; import com.ruoyi.auction.controller.management.dto.MgtScreenBidPage; @@ -14,9 +15,10 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.page.PageDTO; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; @@ -25,6 +27,7 @@ import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; /** @@ -114,8 +117,11 @@ */ @PutMapping("/add-backup-goods") @ApiOperation(value = "选择备选商品", notes = "选择备选商品") - public R<?> addBackupGoods(@RequestBody List<Long> idList) { - auctionSalesroomService.addBackupGoods(idList); + @ApiImplicitParams({ + @ApiImplicitParam(name = "idStr", value = "商品id集合", required = true) + }) + public R<?> addBackupGoods(@RequestParam("idStr") String idStr) { + auctionSalesroomService.addBackupGoods(idStr); return R.ok(); } @@ -181,7 +187,11 @@ public R<?> startCurrentAuctionSalesroom( @ApiParam(name = "auctionSalesroomId", value = "拍卖场id", required = true) @PathVariable("auctionSalesroomId") Long auctionSalesroomId) { - auctionSalesroomService.startCurrentAuctionSalesroom(auctionSalesroomId); + try { + auctionSalesroomService.startCurrentAuctionSalesroom(auctionSalesroomId); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } return R.ok(); } @@ -195,7 +205,11 @@ public R<?> stopCurrentAuctionSalesroom( @ApiParam(name = "auctionSalesroomId", value = "拍卖场id", required = true) @PathVariable("auctionSalesroomId") Long auctionSalesroomId) { - auctionSalesroomService.stopCurrentAuctionSalesroom(auctionSalesroomId); + try { + auctionSalesroomService.stopCurrentAuctionSalesroom(auctionSalesroomId); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } return R.ok(); } } diff --git a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/controller/management/dto/MgtAuctionSalesroomGoodsQuery.java b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/controller/management/dto/MgtAuctionSalesroomGoodsQuery.java index 17babb2..918eaf5 100644 --- a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/controller/management/dto/MgtAuctionSalesroomGoodsQuery.java +++ b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/controller/management/dto/MgtAuctionSalesroomGoodsQuery.java @@ -16,7 +16,10 @@ public class MgtAuctionSalesroomGoodsQuery extends BasePage { private static final long serialVersionUID = 9040206486072802788L; - + @ApiModelProperty("拍卖场id") + private Long auctionSalesroomId; + @ApiModelProperty(value = "商品名称") private String goodsName; + } diff --git a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/IAuctionSalesroomService.java b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/IAuctionSalesroomService.java index 07c10bb..23cb88e 100644 --- a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/IAuctionSalesroomService.java +++ b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/IAuctionSalesroomService.java @@ -1,6 +1,7 @@ package com.ruoyi.auction.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.fasterxml.jackson.core.JsonProcessingException; import com.google.zxing.WriterException; import com.ruoyi.auction.controller.management.dto.MgtAuctionSaleroomBidRecordQuery; import com.ruoyi.auction.controller.management.dto.MgtAuctionSalesroomDTO; @@ -152,7 +153,7 @@ * * @param idList 备选商品id集合 */ - void addBackupGoods(List<Long> idList); + void addBackupGoods(String idStr); /** * 结束当前拍卖商品 @@ -187,7 +188,7 @@ * * @param auctionSalesroomId 拍卖场id */ - void startCurrentAuctionSalesroom(Long auctionSalesroomId); + void startCurrentAuctionSalesroom(Long auctionSalesroomId) throws JsonProcessingException; - void stopCurrentAuctionSalesroom(Long auctionSalesroomId); + void stopCurrentAuctionSalesroom(Long auctionSalesroomId) throws JsonProcessingException; } diff --git a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionGoodsServiceImpl.java b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionGoodsServiceImpl.java index 1bac1a8..c913bbb 100644 --- a/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionGoodsServiceImpl.java +++ b/ruoyi-modules/ruoyi-auction/src/main/java/com/ruoyi/auction/service/impl/AuctionGoodsServiceImpl.java @@ -59,7 +59,12 @@ import io.seata.spring.annotation.GlobalTransactional; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.*; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; import javax.annotation.Resource; @@ -108,14 +113,18 @@ @Override public PageDTO<MgtAuctionGoodsVO> getAuctionGoodsPage(MgtAuctionGoodsQuery query) { Set<Long> goodsSkuIdList = null; + Page<AuctionGoods> page = new Page<>(query.getPageCurr(), query.getPageSize()); if (StringUtils.isNotEmpty(query.getGoodsSkuName())) { List<GoodsSku> goodsSku = goodsSkuClient.getGoodsByName(query.getGoodsSkuName(), - SecurityConstants.INNER) - .getData(); + SecurityConstants.INNER).getData(); + if (StringUtils.isEmpty(goodsSku)) { + return PageDTO.empty(page); + } goodsSkuIdList = goodsSku.stream().map(GoodsSku::getId) .collect(Collectors.toSet()); + } - Page<AuctionGoods> page = this.lambdaQuery() + page = this.lambdaQuery() .select(AuctionGoods::getId, AuctionGoods::getGoodsSkuId, AuctionGoods::getListingStatus, AuctionGoods::getStartStatus, AuctionGoods::getStartTime, AuctionGoods::getEndTime, @@ -130,7 +139,7 @@ query.getStartStatus()) .page(new Page<>(query.getPageCurr(), query.getPageSize())); if (StringUtils.isEmpty(page.getRecords())) { - return PageDTO.empty(page.getTotal(), page.getPages()); + return PageDTO.empty(page); } // 查询商品信息 Set<Long> goodsIdList = page.getRecords().stream().map(AuctionGoods::getGoodsSkuId) 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 a591c8f..af777b5 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 @@ -13,6 +13,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Lists; import com.google.zxing.WriterException; import com.ruoyi.auction.controller.management.dto.MgtAuctionSaleroomBidRecordQuery; @@ -49,6 +51,7 @@ import com.ruoyi.common.core.enums.AuctionStartStatusEnum; import com.ruoyi.common.core.enums.BidStatusEnum; import com.ruoyi.common.core.enums.BondStatusEnum; +import com.ruoyi.common.core.enums.ClientTypeEnum; import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.IDhelper; import com.ruoyi.common.core.utils.StringUtils; @@ -57,6 +60,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.constants.NotificationTypeConstant; import com.ruoyi.system.api.domain.AppMiniLoginVO; import com.ruoyi.system.api.domain.AuctionGoods; import com.ruoyi.system.api.domain.AuctionSalesroom; @@ -86,11 +90,19 @@ 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; import java.time.LocalDateTime; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Function; import java.util.stream.Collectors; @@ -194,7 +206,7 @@ */ private static final String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAh+tCVKqUmlHDL8Ki1TUJtzE5IKV1irJuoHWZTvndJCKJJ8bdWxL9mu5xsy8KkfrnS6wJIKBMLTxMoYQHG7l2Gt07YyUCYHS5+yvbHtTkyFFy2KRPeUEWXz1Tm4juvInDvvr+n7v9ETepToGhC+UDlQcBvuSppw8N+463E+1GRrC4APwXYGLzaIvYvDHcQAULkWhXsjzxJSmeSi12kqWKlgnVJC1y0FT8xQtvhwShfaIqKwzErn9S2z7JjdXboJMUYQHoqF1A4SmWY8c0qawqvx2hGP36W3RDQ4cczzFwUHS1Cylhsbgh1COc4OdANCX4Np2NUzaRDCNzN0WVFKtK+QIDAQAB"; - + private static final ObjectMapper objectMapper = new ObjectMapper(); @Override public List<AuctionSalesroom> getAuctionBidRecordList(AuctionSalesroomDTO ationSalesroomGoodsDTO) { @@ -999,44 +1011,46 @@ mgtAuctionSalesroomVO, MgtAuctionSalesroomScreenVO.class); if (vo.getStatus().equals(AuctionStartStatusEnum.IN_AUCTION)) { List<MgtAuctionSalesroomGoodsVO> auctionSalesroomGoodsVOS = vo.getAuctionSalesroomGoodsVOS(); - List<MgtAuctionSalesroomGoodsVO> collect = auctionSalesroomGoodsVOS.stream() - .peek(goods -> { - List<AuctionBidRecord> list = auctionBidRecordService.lambdaQuery() - .eq(AuctionBidRecord::getTargetId, goods.getId()) - .eq(AuctionBidRecord::getAuctionType, - AuctionOrderTypeEnum.AUCTION_ITEMS) - .list(); - if (StringUtils.isNotEmpty(list)) { - long bidCount = list.stream() - .filter(item -> BidStatusEnum.SUCCESSFUL.equals( - item.getStatus())) - .count(); - goods.setBidCount((int) bidCount); - goods.setBidQuantity((int) bidCount); - goods.setBidPersonCount(list.size()); - } - if (goods.getStatus().equals(AuctionGoodsStatusEnum.IN_PROGRESS)) { - vo.setCurrentAuctionSalesroomGoods(goods); - } - }).collect(Collectors.toList()); - vo.setAuctionSalesroomGoodsVOS(collect); - if (StringUtils.isNotNull(vo.getCurrentAuctionSalesroomGoods())) { - int index = collect.indexOf(vo.getCurrentAuctionSalesroomGoods()); - vo.setNextAuctionSalesroomGoods(collect.get(index + 1)); - // 分页查询当前拍品出价信息 - List<AuctionBidRecord> list = auctionBidRecordService.lambdaQuery() - .eq(AuctionBidRecord::getTargetId, - vo.getCurrentAuctionSalesroomGoods().getId()) - .eq(AuctionBidRecord::getAuctionType, - AuctionOrderTypeEnum.AUCTION_ITEMS) - .list(); - if (StringUtils.isNotEmpty(list)) { - vo.setMgtAuctionBidRecordVOList(CollUtils.emptyList()); + if (StringUtils.isNotEmpty(auctionSalesroomGoodsVOS)) { + List<MgtAuctionSalesroomGoodsVO> collect = auctionSalesroomGoodsVOS.stream() + .peek(goods -> { + List<AuctionBidRecord> list = auctionBidRecordService.lambdaQuery() + .eq(AuctionBidRecord::getTargetId, goods.getId()) + .eq(AuctionBidRecord::getAuctionType, + AuctionOrderTypeEnum.AUCTION_ITEMS) + .list(); + if (StringUtils.isNotEmpty(list)) { + long bidCount = list.stream() + .filter(item -> BidStatusEnum.SUCCESSFUL.equals( + item.getStatus())) + .count(); + goods.setBidCount((int) bidCount); + goods.setBidQuantity((int) bidCount); + goods.setBidPersonCount(list.size()); + } + if (goods.getStatus().equals(AuctionGoodsStatusEnum.IN_PROGRESS)) { + vo.setCurrentAuctionSalesroomGoods(goods); + } + }).collect(Collectors.toList()); + vo.setAuctionSalesroomGoodsVOS(collect); + if (StringUtils.isNotNull(vo.getCurrentAuctionSalesroomGoods())) { + int index = collect.indexOf(vo.getCurrentAuctionSalesroomGoods()); + vo.setNextAuctionSalesroomGoods(collect.get(index + 1)); + // 分页查询当前拍品出价信息 + List<AuctionBidRecord> list = auctionBidRecordService.lambdaQuery() + .eq(AuctionBidRecord::getTargetId, + vo.getCurrentAuctionSalesroomGoods().getId()) + .eq(AuctionBidRecord::getAuctionType, + AuctionOrderTypeEnum.AUCTION_ITEMS) + .list(); + if (StringUtils.isNotEmpty(list)) { + vo.setMgtAuctionBidRecordVOList(CollUtils.emptyList()); + } + vo.setMgtAuctionBidRecordVOList( + BeanUtils.copyList(list, MgtAuctionBidRecordVO.class)); + } else { + vo.setNextAuctionSalesroomGoods(collect.get(0)); } - vo.setMgtAuctionBidRecordVOList( - BeanUtils.copyList(list, MgtAuctionBidRecordVO.class)); - } else { - vo.setNextAuctionSalesroomGoods(collect.get(0)); } } return vo; @@ -1113,6 +1127,7 @@ */ @Override 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(), @@ -1120,14 +1135,19 @@ if (StringUtils.isNotEmpty(data)) { goodsSkuIdSet = data.stream().map(GoodsSku::getId) .collect(Collectors.toSet()); + } else { + return PageDTO.empty(page); } } - Page<AuctionSalesroomGoods> page = auctionSalesroomGoodsMapper.selectPage( + page = auctionSalesroomGoodsMapper.selectPage( new Page<>(query.getPageCurr(), query.getPageSize()), Wrappers.<AuctionSalesroomGoods>lambdaQuery() + .eq(AuctionSalesroomGoods::getAuctionSalesroomId, + query.getAuctionSalesroomId()) + .eq(AuctionSalesroomGoods::getBackupStatus, Boolean.TRUE) .in(StringUtils.isNotEmpty(goodsSkuIdSet), AuctionSalesroomGoods::getGoodsSkuId, goodsSkuIdSet)); - if (StringUtils.isNotEmpty(page.getRecords())) { + if (StringUtils.isEmpty(page.getRecords())) { return PageDTO.empty(page); } Set<Long> skuIdList = page.getRecords().stream().map(AuctionSalesroomGoods::getGoodsSkuId) @@ -1147,10 +1167,12 @@ /** * 选择备选商品 * - * @param idList 备选商品id集合 + * @param idStr 备选商品id集合 */ @Override - public void addBackupGoods(List<Long> idList) { + public void addBackupGoods(String idStr) { + String[] idArr = idStr.split(","); + List<Long> idList = Arrays.stream(idArr).map(Long::valueOf).collect(Collectors.toList()); List<AuctionSalesroomGoods> auctionSalesroomGoods = auctionSalesroomGoodsMapper.selectList( Wrappers.<AuctionSalesroomGoods>lambdaQuery() .in(AuctionSalesroomGoods::getId, idList) @@ -1158,6 +1180,7 @@ if (StringUtils.isNotEmpty(auctionSalesroomGoods)) { auctionSalesroomGoods.forEach(item -> { item.setStatus(AuctionGoodsStatusEnum.WAITING); + item.setBackupStatus(Boolean.FALSE); }); auctionSalesroomGoodsMapper.updateBatchById(auctionSalesroomGoods); } @@ -1229,7 +1252,8 @@ * @param auctionSalesroomId 拍卖场id */ @Override - public void startCurrentAuctionSalesroom(Long auctionSalesroomId) { + public void startCurrentAuctionSalesroom(Long auctionSalesroomId) + throws JsonProcessingException { // 修改拍卖场开始状态 AuctionSalesroom auctionSalesroom = this.getById(auctionSalesroomId); auctionSalesroom.setStatus(AuctionStartStatusEnum.IN_AUCTION); @@ -1246,12 +1270,20 @@ auctionSalesroomGoods.setStatus(AuctionGoodsStatusEnum.IN_PROGRESS); auctionSalesroomGoods.setStartTime(LocalDateTime.now()); auctionSalesroomGoodsMapper.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 = objectMapper.writeValueAsString(map); + WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.AUCTIONEER.getCode(), msg); } @Override @GlobalTransactional(rollbackFor = Exception.class) @Transactional - public void stopCurrentAuctionSalesroom(Long auctionSalesroomId) { + public void stopCurrentAuctionSalesroom(Long auctionSalesroomId) + throws JsonProcessingException { // 修改拍卖场开始状态 AuctionSalesroom auctionSalesroom = this.getById(auctionSalesroomId); auctionSalesroom.setStatus(AuctionStartStatusEnum.ENDED); @@ -1289,5 +1321,11 @@ orderAuctionBondDTO.setUserList(memberIdlist); 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 = objectMapper.writeValueAsString(map); + WebSocketUsers.sendMessageToUsersByType(ClientTypeEnum.AUCTIONEER.getCode(), msg); } } diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/forepart/ForepartGoodsSkuController.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/forepart/ForepartGoodsSkuController.java index 9a90c28..33beff6 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/forepart/ForepartGoodsSkuController.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/forepart/ForepartGoodsSkuController.java @@ -5,15 +5,15 @@ import com.ruoyi.common.core.utils.page.PageDTO; import com.ruoyi.goods.service.IGoodsSkuService; import com.ruoyi.system.api.domain.dto.HomeGoodsSkuDTO; -import com.ruoyi.system.api.domain.vo.HomeGoodsSkuListVO; import com.ruoyi.system.api.domain.vo.HomeGoodsSkuInfoVO; -import com.ruoyi.system.api.domain.vo.getHomeGoodsSkuXxiVO; +import com.ruoyi.system.api.domain.vo.HomeGoodsSkuListVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.springframework.web.bind.annotation.*; - import javax.annotation.Resource; -import java.util.List; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; /** * <p> diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/IGoodsSkuService.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/IGoodsSkuService.java index dae4dfd..af349c5 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/IGoodsSkuService.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/IGoodsSkuService.java @@ -13,8 +13,6 @@ import com.ruoyi.system.api.domain.vo.HomeGoodsSkuInfoVO; import com.ruoyi.system.api.domain.vo.HomeGoodsSkuListVO; import java.util.List; - -import com.ruoyi.system.api.domain.vo.getHomeGoodsSkuXxiVO; import org.springframework.web.bind.annotation.RequestBody; /** diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsSeckillServiceImpl.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsSeckillServiceImpl.java index dfcc88f..dbd5231 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsSeckillServiceImpl.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsSeckillServiceImpl.java @@ -180,7 +180,7 @@ Optional.of(goods).ifPresent(goodsSku -> vo.setGoodsSkuName(goodsSku.getSkuName())); Integer num = orderClient.getSeckillMembers(goodsSeckill.getGoodsSkuId(), SecurityConstants.INNER).getData(); - vo.setNumberOfPurchasedMembers(num); + vo.setNumberOfPurchasedMembers(StringUtils.isNull(num) ? 0 : num); return vo; } diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsSkuServiceImpl.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsSkuServiceImpl.java index 9c3ce3f..9e5d69c 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsSkuServiceImpl.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/GoodsSkuServiceImpl.java @@ -39,11 +39,12 @@ import com.ruoyi.system.api.domain.dto.ListStatusDTO; import com.ruoyi.system.api.domain.vo.HomeGoodsSkuInfoVO; import com.ruoyi.system.api.domain.vo.HomeGoodsSkuListVO; -import com.ruoyi.system.api.domain.vo.getHomeGoodsSkuXxiVO; import com.ruoyi.system.api.feignClient.GoodsSkuClient; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.*; +import java.util.List; +import java.util.Map; +import java.util.Objects; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import javax.annotation.Resource; diff --git a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/management/dto/MgtMemberLevelDetailDTO.java b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/management/dto/MgtMemberLevelDetailDTO.java index 363e155..868acb6 100644 --- a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/management/dto/MgtMemberLevelDetailDTO.java +++ b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/management/dto/MgtMemberLevelDetailDTO.java @@ -12,6 +12,10 @@ public class MgtMemberLevelDetailDTO implements Serializable { private static final long serialVersionUID = 841295965476674650L; + + @ApiModelProperty(value = "会员等级id") + @NotNull(message = "会员等级id不能为空") + private Long id; @ApiModelProperty(value = "会员等级") @NotNull(message = "会员等级不能为空") diff --git a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/MemberPointsServiceImpl.java b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/MemberPointsServiceImpl.java index c3d2409..4759e30 100644 --- a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/MemberPointsServiceImpl.java +++ b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/MemberPointsServiceImpl.java @@ -55,17 +55,21 @@ @Override public PageDTO<MgtMemberPointsVO> getMemberPointsPage(MgtMemberPointsQuery query) { Set<Long> memberIdSet = null; + Page<MemberPoints> page = new Page<>(query.getPageCurr(), query.getPageSize()); MemberDTO memberDTO = getMemberQueryParam(query); if (StringUtils.isNotNull(memberDTO)) { memberIdSet = getMemberIdSet(memberDTO); + if (StringUtils.isEmpty(memberIdSet)) { + return PageDTO.empty(page); + } } // 分页查询积分 - Page<MemberPoints> page = this.lambdaQuery() + page = this.lambdaQuery() .eq(StringUtils.isNotNull(query.getPointsStatus()), MemberPoints::getPointsStatus, query.getPointsStatus()) .in(StringUtils.isNotEmpty(memberIdSet), MemberPoints::getMemberId, memberIdSet) .orderByDesc(MemberPoints::getCreateTime) - .page(new Page<>(query.getPageCurr(), query.getPageSize())); + .page(page); if (StringUtils.isEmpty(page.getRecords())) { return PageDTO.empty(page); } diff --git a/ruoyi-modules/ruoyi-order/pom.xml b/ruoyi-modules/ruoyi-order/pom.xml index 903dafb..2e3b1ea 100644 --- a/ruoyi-modules/ruoyi-order/pom.xml +++ b/ruoyi-modules/ruoyi-order/pom.xml @@ -120,12 +120,6 @@ </dependency> <dependency> - <groupId>com.alibaba</groupId> - <artifactId>fastjson</artifactId> - <version>1.2.4</version> - </dependency> - - <dependency> <groupId>net.sf.json-lib</groupId> <artifactId>json-lib</artifactId> <version>2.4</version> @@ -149,12 +143,6 @@ </exclusion> </exclusions> </dependency> - <dependency> - <groupId>com.alibaba</groupId> - <artifactId>fastjson</artifactId> - <version>1.2.47</version> - <scope>compile</scope> - </dependency> <!-- 分布式事务 --> <dependency> diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtLogisticsController.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtLogisticsController.java new file mode 100644 index 0000000..ef40d2c --- /dev/null +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtLogisticsController.java @@ -0,0 +1,42 @@ +package com.ruoyi.order.controller.management; + + +import com.ruoyi.common.core.domain.R; +import com.ruoyi.order.service.ILogisticsService; +import com.ruoyi.system.api.domain.Logistics; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import java.util.List; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * <p> + * 物流公司 前端控制器 + * </p> + * + * @author mitao + * @since 2024-06-07 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/mgt/logistics") +@Api(value = "管理后台-获取物流快递信息", tags = "管理后台-获取物流快递信息") +public class MgtLogisticsController { + + private ILogisticsService iLogisticsService; + + /** + * 获取物流公司列表 + * + * @return List<Logistics> + */ + @GetMapping("/list") + @ApiOperation(value = "物流公司列表") + public R<List<Logistics>> getLogistics() { + return R.ok(iLogisticsService.list()); + } + +} diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtOrderController.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtOrderController.java index ec9519e..fa43bc2 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtOrderController.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/MgtOrderController.java @@ -4,13 +4,19 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.page.PageDTO; import com.ruoyi.order.controller.management.dto.MgtMallOrderQuery; +import com.ruoyi.order.controller.management.dto.MgtOrderConfirmShipmentDTO; import com.ruoyi.order.controller.management.vo.MgtMallOrderVO; import com.ruoyi.order.service.IOrderService; +import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -28,6 +34,7 @@ @RestController @RequestMapping("/mgt/order") @RequiredArgsConstructor +@Api(tags = "管理后台-订单管理相关接口", value = "管理后台-订单管理相关接口") public class MgtOrderController { private final IOrderService orderService; @@ -44,4 +51,43 @@ @Validated @RequestBody MgtMallOrderQuery query) { return R.ok(orderService.getMallOrderPage(query)); } + + /** + * 获取商城订单详情 + * + * @param id 订单id + * @return MgtMallOrderVO + */ + @ApiOperation("查看详情") + @GetMapping("/detail/{id}") + public R<MgtMallOrderVO> getMallOrderDetail( + @ApiParam(name = "id", value = "订单id", required = true) + @Validated @RequestBody Long id) { + return R.ok(orderService.getMallOrderDetail(id)); + } + + /** + * 确认发货 + * + * @param dto 确认收货请求对象 + */ + @ApiOperation("确认收货") + @PutMapping("/confirm-shipment") + public R<?> confirmShipmentOrder(@Validated @RequestBody MgtOrderConfirmShipmentDTO dto) { + orderService.confirmShipmentOrder(dto); + return R.ok(); + } + + /** + * 已收货 + * + * @param id 订单id + */ + @ApiOperation("已收货") + @PutMapping("/received-goods/{id}") + public R<?> receivedGoods( + @ApiParam(name = "id", value = "订单id", required = true) @PathVariable("id") Long id) { + orderService.receivedGoods(id); + return R.ok(); + } } diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtOrderConfirmShipmentDTO.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtOrderConfirmShipmentDTO.java new file mode 100644 index 0000000..f2b4aee --- /dev/null +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/dto/MgtOrderConfirmShipmentDTO.java @@ -0,0 +1,31 @@ +package com.ruoyi.order.controller.management.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import lombok.Data; + +/** + * @author mitao + * @date 2024/6/13 + */ +@Data +@ApiModel(value = "确认收货请求对象", description = "确认收货请求对象") +public class MgtOrderConfirmShipmentDTO implements Serializable { + + private static final long serialVersionUID = -7033967657700963452L; + + @ApiModelProperty(value = "订单id") + @NotNull(message = "订单id不能为空") + private Long id; + + @ApiModelProperty("发货快递") + @NotBlank(message = "发货快递不能为空") + private String logisticsNum; + + @ApiModelProperty("发货快递") + @NotBlank(message = "发货快递单号不能为空") + private String courierNumber; +} diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/vo/MgtMallOrderVO.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/vo/MgtMallOrderVO.java index 6851732..ae72017 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/vo/MgtMallOrderVO.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/management/vo/MgtMallOrderVO.java @@ -1,5 +1,6 @@ package com.ruoyi.order.controller.management.vo; +import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.common.core.enums.OrderFromEnum; import com.ruoyi.common.core.enums.OrderStatusEnum; import com.ruoyi.common.core.enums.PaymentMethodEnum; @@ -27,6 +28,7 @@ private String orderNo; @ApiModelProperty(value = "下单时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime orderTime; @ApiModelProperty(value = "订单来源 1=商品订单 2=秒杀订单 3=团购订单 4=拍卖订单") @@ -51,9 +53,11 @@ private OrderStatusEnum orderStatus; @ApiModelProperty(value = "支付时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime payTime; @ApiModelProperty(value = "取消时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime cancelTime; @ApiModelProperty(value = "订单备注") @@ -63,6 +67,7 @@ private LocalDateTime deliveryTime; @ApiModelProperty(value = "确认收货时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime receiveTime; @ApiModelProperty(value = "优惠金额") @@ -78,7 +83,7 @@ private String receiverName; @ApiModelProperty(value = "收货人电话") - private String receiverphone; + private String receiverPhone; @ApiModelProperty(value = "城市") private String receiverCity; diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/IOrderService.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/IOrderService.java index 1ea3d76..8903573 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/IOrderService.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/IOrderService.java @@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.common.core.utils.page.PageDTO; import com.ruoyi.order.controller.management.dto.MgtMallOrderQuery; +import com.ruoyi.order.controller.management.dto.MgtOrderConfirmShipmentDTO; import com.ruoyi.order.controller.management.vo.MgtMallOrderVO; import com.ruoyi.system.api.domain.Order; import com.ruoyi.system.api.domain.dto.HomeGoodsSkuDTO; @@ -81,4 +82,26 @@ * @return PageDTO<MgtMallOrderVO> */ PageDTO<MgtMallOrderVO> getMallOrderPage(MgtMallOrderQuery query); + + /** + * 获取商城订单详情 + * + * @param id 订单id + * @return MgtMallOrderVO + */ + MgtMallOrderVO getMallOrderDetail(Long id); + + /** + * 确认发货 + * + * @param dto 确认收货请求对象 + */ + void confirmShipmentOrder(MgtOrderConfirmShipmentDTO dto); + + /** + * 已收货 + * + * @param id 订单id + */ + void receivedGoods(Long id); } diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/LogisticsServiceImpl.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/LogisticsServiceImpl.java index 8288bdc..240c2cb 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/LogisticsServiceImpl.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/LogisticsServiceImpl.java @@ -2,6 +2,9 @@ import com.alibaba.nacos.shaded.com.google.gson.Gson; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.kuaidi100.sdk.api.QueryTrack; +import com.kuaidi100.sdk.core.IBaseClient; +import com.kuaidi100.sdk.pojo.HttpResult; import com.kuaidi100.sdk.request.QueryTrackParam; import com.kuaidi100.sdk.request.QueryTrackReq; import com.kuaidi100.sdk.utils.SignUtils; @@ -10,9 +13,6 @@ import com.ruoyi.system.api.domain.Logistics; import com.ruoyi.system.api.domain.dto.LogisticsDTO; import com.ruoyi.system.api.domain.vo.Express100VO; -import com.kuaidi100.sdk.core.IBaseClient; -import com.kuaidi100.sdk.pojo.HttpResult; -import com.kuaidi100.sdk.api.QueryTrack; import org.springframework.stereotype.Service; /** diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java index 2b24628..1f887b0 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java @@ -11,12 +11,17 @@ import com.ruoyi.common.core.enums.PaymentMethodEnum; import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.common.core.utils.page.BeanUtils; import com.ruoyi.common.core.utils.page.PageDTO; import com.ruoyi.order.controller.management.dto.MgtMallOrderQuery; +import com.ruoyi.order.controller.management.dto.MgtOrderConfirmShipmentDTO; import com.ruoyi.order.controller.management.vo.MgtMallOrderVO; +import com.ruoyi.order.controller.management.vo.MgtOrderReturnRequestVO; +import com.ruoyi.order.domain.OrderReturnRequest; import com.ruoyi.order.domain.Paylog; import com.ruoyi.order.mapper.OrderAuctionBondMapper; import com.ruoyi.order.mapper.OrderMapper; +import com.ruoyi.order.service.IOrderReturnRequestService; import com.ruoyi.order.service.IOrderService; import com.ruoyi.order.service.IPaylogService; import com.ruoyi.order.util.OrderUtil; @@ -26,12 +31,14 @@ import com.ruoyi.system.api.domain.GoodsGroupPurchase; import com.ruoyi.system.api.domain.GoodsSeckill; 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.Order; import com.ruoyi.system.api.domain.OrderAuctionBond; import com.ruoyi.system.api.domain.dto.CouponMemberDTO; import com.ruoyi.system.api.domain.dto.GoodsStockUpdDTO; import com.ruoyi.system.api.domain.dto.HomeGoodsSkuDTO; +import com.ruoyi.system.api.domain.dto.MemberDTO; import com.ruoyi.system.api.domain.dto.MemberOrderDTO; import com.ruoyi.system.api.domain.dto.MemberOrderListDTO; import com.ruoyi.system.api.domain.dto.OrderDTO; @@ -47,10 +54,11 @@ import java.time.LocalDateTime; import java.util.Collection; import java.util.List; +import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; import javax.annotation.Resource; -import org.apache.commons.beanutils.BeanUtils; import org.springframework.stereotype.Service; /** @@ -84,7 +92,8 @@ @Resource private SysUserClient sysUserClient; - + @Resource + private IOrderReturnRequestService orderReturnRequestService; @Override public void saveOrderOne(OrderDTO OrderDTO) { @@ -510,7 +519,7 @@ Order order = baseMapper.selectById(memberOrderListDTO.getId()); OrderVO orderVO=new OrderVO(); try { - BeanUtils.copyProperties(orderVO,order); + orderVO = BeanUtils.copyBean(order, OrderVO.class); } catch (Exception e) { throw new RuntimeException(e); } @@ -639,6 +648,109 @@ */ @Override public PageDTO<MgtMallOrderVO> getMallOrderPage(MgtMallOrderQuery query) { - return null; + PageDTO<MgtMallOrderVO> pageVO; + // 封装会员条件查询对象 + MemberDTO memberDTO = null; + Set<Long> memberIdSet = null; + Page<Order> page = new Page<>(query.getPageCurr(), query.getPageSize()); + if (StringUtils.isNotBlank(query.getNickname()) || StringUtils.isNotBlank( + query.getPhone())) { + memberDTO = new MemberDTO(); + memberDTO.setNickname(query.getNickname()); + memberDTO.setPhone(query.getPhone()); + } + if (StringUtils.isNotNull(memberDTO)) { + // 远程调用会员服务进行条件查询 + List<Member> memberList = memberClient.getMemberListByCondition(memberDTO, + SecurityConstants.INNER).getData(); + if (StringUtils.isEmpty(memberList)) { + return PageDTO.empty(page); + } + memberIdSet = memberList.stream().map(Member::getId) + .collect(Collectors.toSet()); + } + page = this.lambdaQuery() + .in(StringUtils.isNotEmpty(memberIdSet), Order::getMemberId, memberIdSet) + .like(StringUtils.isNotBlank(query.getOrderNo()), Order::getOrderNo, + query.getOrderNo()) + .eq(StringUtils.isNotNull(query.getOrderFrom()), Order::getOrderFrom, + query.getOrderFrom()) + .like(StringUtils.isNotBlank(query.getSkuName()), Order::getSkuName, + query.getSkuName()) + .eq(StringUtils.isNotNull(query.getOrderStatus()), Order::getOrderStatus, + query.getOrderStatus()) + .page(new Page<>(query.getPageCurr(), query.getPageSize())); + if (StringUtils.isEmpty(page.getRecords())) { + pageVO = PageDTO.empty(page); + } + pageVO = PageDTO.of(page, MgtMallOrderVO.class); + return pageVO; + } + + /** + * 获取商城订单详情 + * + * @param id 订单id + * @return MgtMallOrderVO + */ + @Override + public MgtMallOrderVO getMallOrderDetail(Long id) { + Order order = this.getById(id); + MgtMallOrderVO mgtMallOrderVO = BeanUtils.copyBean(order, MgtMallOrderVO.class); + // 查询用户信息 + Member member = memberClient.getMembeOne(order.getMemberId(), SecurityConstants.INNER) + .getData(); + if (StringUtils.isNotNull(member)) { + mgtMallOrderVO.setNickname(member.getNickname()); + mgtMallOrderVO.setPhone(member.getPhone()); + } + // 查询售后信息 + if (order.getOrderStatus() == OrderStatusEnum.AFTER_SALE) { + OrderReturnRequest orderReturnRequest = orderReturnRequestService.getOne( + Wrappers.lambdaQuery(OrderReturnRequest.class) + .eq(OrderReturnRequest::getOrderId, + order.getId()).last("limit 1")); + if (StringUtils.isNotNull(orderReturnRequest)) { + mgtMallOrderVO.setReturnRequestVO(BeanUtils.copyBean(orderReturnRequest, + MgtOrderReturnRequestVO.class)); + } + } + return mgtMallOrderVO; + } + + /** + * 确认发货 + * + * @param dto 确认收货请求对象 + */ + @Override + public void confirmShipmentOrder(MgtOrderConfirmShipmentDTO dto) { + Order order = this.getById(dto.getId()); + if (StringUtils.isNull(order)) { + throw new ServiceException("订单不存在"); + } + order.setOrderStatus(OrderStatusEnum.GOODS_TO_BE_RECEIVED); + order.setDeliveryTime(LocalDateTime.now()); + order.setCourierNumber(dto.getCourierNumber()); + order.setLogisticsNum(dto.getLogisticsNum()); + this.updateById(order); + } + + /** + * 已收货 + * + * @param id 订单id + */ + @Override + public void receivedGoods(Long id) { + Order order = this.getById(id); + if (StringUtils.isNull(order)) { + throw new ServiceException("订单不存在"); + } + if (order.getOrderStatus() == OrderStatusEnum.GOODS_TO_BE_RECEIVED) { + order.setOrderStatus(OrderStatusEnum.FINISHED); + order.setReceiveTime(LocalDateTime.now()); + this.updateById(order); + } } } diff --git a/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/impl/PromotionWishListServiceImpl.java b/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/impl/PromotionWishListServiceImpl.java index c36c276..797afe7 100644 --- a/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/impl/PromotionWishListServiceImpl.java +++ b/ruoyi-modules/ruoyi-promotion/src/main/java/com/ruoyi/promotion/service/impl/PromotionWishListServiceImpl.java @@ -88,6 +88,8 @@ // 封装会员条件查询对象 MemberDTO memberDTO = null; Set<Long> memberIdSet = null; + Page<PromotionWishList> page = new Page<>(query.getPageCurr(), query + .getPageSize()); if (StringUtils.isNotBlank(query.getNickname()) || StringUtils.isNotBlank( query.getPhone())) { memberDTO = new MemberDTO(); @@ -98,17 +100,19 @@ // 远程调用会员服务进行条件查询 List<Member> memberList = memberClient.getMemberListByCondition(memberDTO, SecurityConstants.INNER).getData(); + if (StringUtils.isEmpty(memberList)) { + return PageDTO.empty(page); + } memberIdSet = memberList.stream().map(Member::getId) .collect(Collectors.toSet()); } // 分页查询心愿求购列表 - Page<PromotionWishList> page = this.lambdaQuery() + page = this.lambdaQuery() .eq(StringUtils.isNotNull(query.getReplyStatus()), PromotionWishList::getReplyStatus, query.getReplyStatus()) .in(StringUtils.isNotEmpty(memberIdSet), PromotionWishList::getMemberId, - memberIdSet).page(new Page<>(query.getPageCurr(), query - .getPageSize())); + memberIdSet).page(page); if (StringUtils.isEmpty(page.getRecords())) { return PageDTO.empty(page); } -- Gitblit v1.7.1