diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/CommunityController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/CommunityController.java index fb8e1b5..5885654 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/CommunityController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/CommunityController.java @@ -3,6 +3,7 @@ package com.mcwl.web.controller.communityCenter; import cn.hutool.core.bean.BeanUtil; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.page.PageDomain; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.communityCenter.domain.Community; @@ -49,9 +50,9 @@ public class CommunityController { */ @ApiOperation(value = "添加社区") @PostMapping("add") - public AjaxResult addCommunity(@RequestBody @Valid CommunityRes communityRes) { + public R addCommunity(@RequestBody @Valid CommunityRes communityRes) { communityService.addCommunity(communityRes); - return AjaxResult.success(); + return R.ok(); } /** @@ -62,12 +63,12 @@ public class CommunityController { */ @ApiOperation(value = "删除社区") @GetMapping("delete") - public AjaxResult deleteCommunity(@NotNull(message = "id不能为空") + public R deleteCommunity(@NotNull(message = "id不能为空") @ApiParam(value = "id", required = true) @Valid Long id) { communityService.removeById(id); - return AjaxResult.success(); + return R.ok(); } } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/InviteController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/InviteController.java index 1b929c7..8902ad5 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/InviteController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/InviteController.java @@ -2,6 +2,7 @@ package com.mcwl.web.controller.communityCenter; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.utils.StringUtils; import com.mcwl.communityCenter.domain.Community; import com.mcwl.communityCenter.service.InviteService; @@ -23,7 +24,7 @@ import java.util.List; /** * 邀请 */ -@Api(tags = "邀请") +@Api(tags = "社区邀请") @RestController @RequestMapping("invite") @RequiredArgsConstructor @@ -37,15 +38,15 @@ public class InviteController { */ @ApiOperation(value = "邀请码链接") @GetMapping("inviteCode") - public AjaxResult inviteCode(@NotNull(message = "社区不能为空") + public R inviteCode(@NotNull(message = "社区不能为空") @ApiParam(value = "社区", required = true) Long communityId) { // 获取邀请码链接 String inviteCode = inviteService.getInviteCode(communityId); if (StringUtils.isBlank(inviteCode)) { - return AjaxResult.warn("获取邀请码失败"); + return R.fail("获取邀请码失败"); } - return AjaxResult.success(inviteCode); + return R.ok(inviteCode); } /** @@ -54,7 +55,7 @@ public class InviteController { @ApiOperation(value = "接受邀请") @GetMapping("acceptInvite") @Valid - public AjaxResult acceptInvite(@NotNull(message = "社区不能为空") + public R acceptInvite(@NotNull(message = "社区不能为空") @ApiParam(value = "社区", required = true) Long communityId, @NotBlank(message = "邀请码不能为空") diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PublishCommentController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PublishCommentController.java index 3b61d2c..ec7d5e5 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PublishCommentController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PublishCommentController.java @@ -2,6 +2,7 @@ package com.mcwl.web.controller.communityCenter; import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.communityCenter.domain.dto.CommentDelRes; import com.mcwl.communityCenter.domain.dto.CommentDetailRes; import com.mcwl.communityCenter.domain.dto.CommentRes; @@ -37,7 +38,7 @@ public class PublishCommentController extends BaseController { */ @ApiOperation(value = "添加评论") @PostMapping("/save") - public AjaxResult save(@RequestBody @Valid CommentRes commentRes) { + public R save(@RequestBody @Valid CommentRes commentRes) { return publishCommentService.addComment(commentRes); } @@ -51,7 +52,7 @@ public class PublishCommentController extends BaseController { */ @ApiOperation(value = "获取评论详情") @PostMapping("/detail") - public AjaxResult getComment(@RequestBody @Valid CommentDetailRes commentDetailRes) { + public R getComment(@RequestBody @Valid CommentDetailRes commentDetailRes) { return publishCommentService.getComment(commentDetailRes); } @@ -72,7 +73,7 @@ public class PublishCommentController extends BaseController { @ApiOperation(value = "删除评论") @PostMapping("/delete") - public AjaxResult delete(@RequestBody @Valid CommentDelRes commentDelRes) { + public R delete(@RequestBody @Valid CommentDelRes commentDelRes) { return publishCommentService.removeCommentById(commentDelRes); } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PublishController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PublishController.java index 5a014fe..6c86498 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PublishController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PublishController.java @@ -2,6 +2,7 @@ package com.mcwl.web.controller.communityCenter; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.communityCenter.domain.dto.PublishDetailRes; import com.mcwl.communityCenter.domain.dto.PublishPageRes; @@ -44,13 +45,13 @@ public class PublishController { */ @ApiOperation(value = "获取发布详情") @PostMapping("detail") - public AjaxResult getPublishDetail(@RequestBody @Valid PublishDetailRes publishDetailRes) { + public R getPublishDetail(@RequestBody @Valid PublishDetailRes publishDetailRes) { PublishVo publishVo = publishService.getDetail(publishDetailRes); if (Objects.isNull(publishVo)) { - return AjaxResult.error("获取详情失败"); + return R.fail("获取详情失败"); } - return AjaxResult.success(publishVo); + return R.ok(publishVo); } /** @@ -58,7 +59,7 @@ public class PublishController { */ @ApiOperation(value = "发布") @PostMapping("publish") - public AjaxResult publish(@RequestBody @Valid PublishRes publishRes) { + public R publish(@RequestBody @Valid PublishRes publishRes) { return publishService.publish(publishRes); } @@ -85,8 +86,9 @@ public class PublishController { */ @ApiOperation(value = "删除") @GetMapping("remove") - public AjaxResult deletePublish(@NotNull(message = "id不能为空") @ApiParam(value = "id") @Valid Long id) { - return AjaxResult.success(publishService.removeById(id)); + public R deletePublish(@NotNull(message = "id不能为空") @ApiParam(value = "id") @Valid Long id) { + publishService.removeById(id); + return R.ok(); } } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/QuestionCommentController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/QuestionCommentController.java index ff91ce9..149c159 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/QuestionCommentController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/QuestionCommentController.java @@ -2,6 +2,7 @@ package com.mcwl.web.controller.communityCenter; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.communityCenter.domain.dto.*; import com.mcwl.communityCenter.service.QuestionCommentService; @@ -18,7 +19,7 @@ import javax.validation.Valid; /** * 提问评论 */ -@Api(tags = "提问评论") +@Api(tags = "社区提问评论") @RestController @RequestMapping("questionComment") @RequiredArgsConstructor @@ -32,7 +33,7 @@ public class QuestionCommentController { */ @PostMapping("comment") @ApiOperation(value = "新增提问评论") - public AjaxResult comment(@Valid @RequestBody QuestionCommentRes questionCommentRes) { + public R comment(@Valid @RequestBody QuestionCommentRes questionCommentRes) { return questionCommentService.comment(questionCommentRes); } @@ -52,7 +53,7 @@ public class QuestionCommentController { */ @PostMapping("adopt") @ApiOperation(value = "采纳评论") - public AjaxResult adopt(@Valid @RequestBody QuestionCommentAdoptRes questionCommentAdoptRes) { + public R adopt(@Valid @RequestBody QuestionCommentAdoptRes questionCommentAdoptRes) { return questionCommentService.adopt(questionCommentAdoptRes); } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/QuestionController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/QuestionController.java index 465c2f1..16c8123 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/QuestionController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/QuestionController.java @@ -2,6 +2,7 @@ package com.mcwl.web.controller.communityCenter; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.utils.SecurityUtils; @@ -24,7 +25,7 @@ import java.util.Objects; /** * 提问 */ -@Api(tags = "提问") +@Api(tags = "社区提问") @RestController @RequestMapping("question") @RequiredArgsConstructor @@ -40,7 +41,7 @@ public class QuestionController { */ @PostMapping("addQuestion") @ApiOperation(value = "提问") - public AjaxResult addQuestion(@RequestBody @Valid QuestionRes questionRes) { + public R addQuestion(@RequestBody @Valid QuestionRes questionRes) { // 提问类型 Integer type = questionRes.getType(); @@ -50,7 +51,7 @@ public class QuestionController { // 类型为1时,付费金额不能为空 if (Objects.equals(type, 1) && Objects.isNull(amount)) { - return AjaxResult.error("付费金额不能为空"); + return R.fail("付费金额不能为空"); } // 付费类型为1时,判断钱包余额是否充足 @@ -59,7 +60,7 @@ public class QuestionController { SysUser sysUser = sysUserService.selectUserById(userId); Double wallet = sysUser.getWallet(); if (wallet < amount) { - return AjaxResult.error("钱包余额不足"); + return R.fail("钱包余额不足"); } } else { questionRes.setAmount(0.0); @@ -95,12 +96,12 @@ public class QuestionController { */ @PostMapping("detail") @ApiOperation(value = "获取问题详情") - public AjaxResult getQuestionDetail(@RequestBody @Valid QuestionDetailRes questionDetailRes) { + public R getQuestionDetail(@RequestBody @Valid QuestionDetailRes questionDetailRes) { QuestionVo questionVo = questionService.getDetail(questionDetailRes); if (Objects.isNull(questionVo)) { - return AjaxResult.error("获取详情失败"); + return R.fail("获取详情失败"); } - return AjaxResult.success(questionVo); + return R.ok(questionVo); } // /** diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/MemberController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/MemberController.java index d2f0501..22e9c78 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/MemberController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/MemberController.java @@ -1,6 +1,7 @@ package com.mcwl.web.controller.memberCenter; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.utils.SecurityUtils; import com.mcwl.memberCenter.domain.MemberConsume; @@ -50,7 +51,7 @@ public class MemberController { * @return 用户会员 */ @PostMapping("createMember") - public AjaxResult createMemberCenter(@RequestBody @Valid UserMemberDto userMemberDto) { + public R createMemberCenter(@RequestBody @Valid UserMemberDto userMemberDto) { Long userId = userMemberDto.getUserId(); Long memberLevelId = userMemberDto.getMemberLevelId(); String paymentMethod = userMemberDto.getPaymentMethod(); @@ -58,20 +59,20 @@ public class MemberController { SysUser sysUser = sysUserService.selectUserById(userId); if (!Optional.ofNullable(sysUser).isPresent()) { - return AjaxResult.warn("用户不存在"); + return R.fail("用户不存在"); } MemberLevel memberLevel = memberLevelService.getById(memberLevelId); if (!Optional.ofNullable(memberLevel).isPresent()) { - return AjaxResult.warn("会员等级不存在"); + return R.fail("会员等级不存在"); } Member member = memberService.createUserMember(userId, memberLevelId, paymentMethod, promotionId); if (!Optional.ofNullable(member).isPresent()) { - return AjaxResult.warn("创建会员失败"); + return R.fail("创建会员失败"); } - return AjaxResult.success(member); + return R.ok(member); } @@ -82,7 +83,7 @@ public class MemberController { */ @GetMapping("getPoints") @ApiOperation(value = "获取积分余额和历史记录") - public AjaxResult getPoints() { + public R getPoints() { Long userId = SecurityUtils.getUserId(); SysUser sysUser = sysUserService.selectUserById(userId); @@ -106,7 +107,7 @@ public class MemberController { pointsVO.setPoints(points); pointsVO.setMemberConsumeList(memberConsumeList); - return AjaxResult.success(pointsVO); + return R.ok(pointsVO); } @@ -115,25 +116,23 @@ public class MemberController { */ @PostMapping("rechargePoints") @ApiOperation(value = "会员积分充值") - public AjaxResult rechargePoints(@RequestBody @Valid RechargePointsDto rechargePointsDto) { + public R rechargePoints(@RequestBody @Valid RechargePointsDto rechargePointsDto) { Long userId = rechargePointsDto.getUserId(); Double amount = rechargePointsDto.getAmount(); SysUser sysUser = sysUserService.selectUserById(userId); if (!Optional.ofNullable(sysUser).isPresent()) { - return AjaxResult.warn("用户不存在"); + return R.fail("用户不存在"); } Member member = memberService.rechargePoints(userId, amount * 100); // 返回充值积分 if (!Optional.ofNullable(member).isPresent()) { - return AjaxResult.warn("充值积分失败"); + return R.fail("充值积分失败"); } - rechargePointsDto.setPoints(member.getPoints()); - - return AjaxResult.success(rechargePointsDto); + return R.ok(); } @@ -142,14 +141,14 @@ public class MemberController { */ @GetMapping("consumePoints/{consumePoints}") @ApiOperation(value = "消费积分") - public AjaxResult consumePoints(@PathVariable Double consumePoints) { + public R consumePoints(@PathVariable Double consumePoints) { if (consumePoints == null || consumePoints <= 0) { - return AjaxResult.warn("消费积分不能为空或小于0"); + return R.fail("消费积分不能为空或小于0"); } memberService.consumePoints(consumePoints); - return AjaxResult.success(); + return R.ok(); } @@ -159,7 +158,7 @@ public class MemberController { */ @GetMapping("calculatePayment") @ApiOperation(value = "根据会员等级和活动计算支付金额") - public AjaxResult calculatePayment(@Valid @NotNull(message = "请选择会员") Long memberLevelId, @RequestParam(required = false) Long promotionId) { + public R calculatePayment(@Valid @NotNull(message = "请选择会员") Long memberLevelId, @RequestParam(required = false) Long promotionId) { // 获取当前用户 Long userId = SecurityUtils.getUserId(); @@ -176,7 +175,7 @@ public class MemberController { MemberLevel memberLevel = memberLevelService.getById(memberLevelId); Double unitPrice = memberLevel.getUnitPrice(); unitPrice = memberService.calculatePayment(unitPrice, promotionId); - return AjaxResult.success(unitPrice); + return R.ok(unitPrice); } /** @@ -184,7 +183,7 @@ public class MemberController { */ @GetMapping("isMember") @ApiOperation(value = "是否是会员") - public AjaxResult isMember() { + public R> isMember() { Long userId = SecurityUtils.getUserId(); Map map = new HashMap<>(); Member member = memberService.getUseUserMemberByUserId(userId); @@ -195,11 +194,11 @@ public class MemberController { map.put("result", "1"); map.put("startDate", sdf.format(startDate)); map.put("endDate", sdf.format(endDate)); - return AjaxResult.success(map); + return R.ok(map); } map.put("result", "0"); - return AjaxResult.success(map); + return R.ok(map); } } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/MemberLevelController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/MemberLevelController.java index f1a2d59..0b64659 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/MemberLevelController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/MemberLevelController.java @@ -1,6 +1,7 @@ package com.mcwl.web.controller.memberCenter; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.memberCenter.domain.MemberBenefit; import com.mcwl.memberCenter.domain.MemberLevel; import com.mcwl.memberCenter.service.MemberBenefitService; @@ -33,11 +34,11 @@ public class MemberLevelController { */ @GetMapping("list") @ApiOperation(value = "获取会员等级列表") - public AjaxResult list() { + public R> list() { List memberLevelList = memberLevelService.list(); - return AjaxResult.success(memberLevelList); + return R.ok(memberLevelList); } @@ -46,9 +47,9 @@ public class MemberLevelController { */ @GetMapping("getMemberBenefitList") @ApiOperation(value = "获取会员等级及权益列表") - public AjaxResult getMemberBenefitList() { + public R> getMemberBenefitList() { - return AjaxResult.success(memberBenefitService.getMemberBenefitList()); + return R.ok(memberBenefitService.getMemberBenefitList()); } } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/PromotionController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/PromotionController.java index 60f804a..90e14bc 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/PromotionController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/PromotionController.java @@ -3,6 +3,7 @@ package com.mcwl.web.controller.memberCenter; import cn.hutool.core.bean.BeanUtil; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.utils.SecurityUtils; import com.mcwl.memberCenter.domain.Member; import com.mcwl.memberCenter.domain.MemberPromotion; @@ -46,12 +47,12 @@ public class PromotionController { */ @PostMapping("createPromotion") @ApiOperation(value = "创建活动") - public AjaxResult createPromotion(@RequestBody @Valid PromotionDto promotionDto) { + public R createPromotion(@RequestBody @Valid PromotionDto promotionDto) { Date startTime = promotionDto.getStartTime(); Date endTime = promotionDto.getEndTime(); if (startTime.after(endTime)) { - return AjaxResult.warn("活动开始时间不能大于结束时间"); + return R.fail("活动开始时间不能大于结束时间"); } Promotion promotion = new Promotion(); @@ -59,7 +60,7 @@ public class PromotionController { promotionService.save(promotion); - return AjaxResult.success(); + return R.ok(); } @@ -68,11 +69,11 @@ public class PromotionController { */ @GetMapping("promotionList") @ApiOperation(value = "活动列表") - public AjaxResult promotionList() { + public R> promotionList() { List promotionList = promotionService.lambdaQuery() .gt(Promotion::getEndTime, new Date()) .list(); - return AjaxResult.success(promotionList); + return R.ok(promotionList); } /** @@ -80,13 +81,13 @@ public class PromotionController { */ @GetMapping("myPromotionList") @ApiOperation(value = "获取当前用户参与的活动") - public AjaxResult myPromotionList() { + public R> myPromotionList() { // 获取当前用户 Long userId = SecurityUtils.getUserId(); List memberPromotionList = memberPromotionService.lambdaQuery() .eq(MemberPromotion::getUserId, userId) .list(); - return AjaxResult.success(memberPromotionList); + return R.ok(memberPromotionList); } /** @@ -94,7 +95,7 @@ public class PromotionController { */ @PostMapping("joinPromotion") @ApiOperation(value = "参与活动") - public AjaxResult joinPromotion(@RequestBody @Valid JoinPromotionDto joinPromotionDto) { + public R joinPromotion(@RequestBody @Valid JoinPromotionDto joinPromotionDto) { // 用户id Long userId = joinPromotionDto.getUserId(); // 活动id @@ -103,21 +104,21 @@ public class PromotionController { Promotion promotion = promotionService.getById(promotionId); if (!Optional.ofNullable(promotion).isPresent()) { - return AjaxResult.warn("活动不存在"); + return R.fail("活动不存在"); } if (promotion.getStartTime().after(new Date())) { - return AjaxResult.warn("活动未开始"); + return R.fail("活动未开始"); } // 活动是否过期 if (promotion.getEndTime().before(new Date())) { - return AjaxResult.warn("活动已过期"); + return R.fail("活动已过期"); } // 获取当前用户是否参与过该活动 if (isJoinPromotion(userId, promotionId)) { - return AjaxResult.warn("您已参与过该活动"); + return R.fail("您已参与过该活动"); } // 是否在活动期间内订阅或续订会员 @@ -129,13 +130,13 @@ public class PromotionController { String memberLevelIds = promotion.getMemberLevelIds(); if (!memberLevelIds.contains(member.getMemberLevelId().toString())) { - return AjaxResult.warn("无法参与该活动,请查看活动条件"); + return R.fail("无法参与该活动,请查看活动条件"); } MemberPromotion memberPromotion = getMemberPromotion(userId, promotionId); memberPromotionService.save(memberPromotion); - return AjaxResult.success(); + return R.ok(); } // private boolean isSubscribe(Long userId, Promotion promotion) { diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/myInvitation/InvitationController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/myInvitation/InvitationController.java index 394a744..9113d71 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/myInvitation/InvitationController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/myInvitation/InvitationController.java @@ -2,6 +2,7 @@ package com.mcwl.web.controller.myInvitation; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.utils.SecurityUtils; import com.mcwl.myInvitation.domain.Invitation; import com.mcwl.myInvitation.domain.dto.EarningsDisplayDto; @@ -34,37 +35,38 @@ public class InvitationController { private final InvitationService invitationService; - /** * 获取邀请码 + * * @return 邀请码 */ @GetMapping("/getInvitationCode") @ApiOperation(value = "获取邀请码") - public AjaxResult getInvitationCode() { + public R getInvitationCode() { // 获取当前用户 Long userId = SecurityUtils.getUserId(); String invitationCode = invitationService.getInvitationCode(userId); if (StringUtils.isEmpty(invitationCode)) { - return AjaxResult.warn("获取邀请码失败"); + return R.fail("获取邀请码失败"); } - return success("操作成功", invitationCode); + return R.ok("操作成功", invitationCode); } /** * 获取邀请列表 + * * @param userId 用户id * @return 邀请列表 */ @GetMapping("/list/{userId}") @ApiOperation(value = "获取邀请列表") - public AjaxResult list(@PathVariable Long userId) { + public R> list(@PathVariable Long userId) { List list = invitationService.lambdaQuery() .eq(Invitation::getUserId, userId) .list(); - return success(list); + return R.ok(list); } @@ -73,7 +75,7 @@ public class InvitationController { */ @GetMapping("earningsDisplay") @ApiOperation(value = "邀请人收益展示") - public AjaxResult earningsDisplay() { + public R earningsDisplay() { Long userId = SecurityUtils.getUserId(); EarningsDisplayVO earningsDisplayVO = new EarningsDisplayVO(); @@ -82,18 +84,16 @@ public class InvitationController { Double totalAmount = invitationService.getTotalAmount(userId); // 获取我的团员 - List earningsDisplay = invitationService.getEarningsDisplay(userId); + List earningsDisplay = invitationService.getEarningsDisplay(userId); if (earningsDisplay == null || earningsDisplay.isEmpty()) { - return AjaxResult.warn("暂无收益"); + return R.fail("暂无收益"); } earningsDisplayVO.setTotalAmount(totalAmount); earningsDisplayVO.setEarningsDisplayList(earningsDisplay); - return success(earningsDisplayVO); + return R.ok(earningsDisplayVO); } - - } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/pay/AliPay/AliPayController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/pay/AliPay/AliPayController.java index 1b20de3..d42c593 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/pay/AliPay/AliPayController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/pay/AliPay/AliPayController.java @@ -6,6 +6,7 @@ import com.alipay.easysdk.factory.Factory; import com.mcwl.common.annotation.Anonymous; import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.redis.RedisCache; import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.ShareCodeUtils; @@ -16,6 +17,7 @@ import com.mcwl.pay.service.AliPayService; import com.mcwl.pay.service.OrderTradeService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.validation.annotation.Validated; @@ -65,7 +67,7 @@ public class AliPayController extends BaseController { */ @ApiOperation(value = "支付宝绑定") @GetMapping("/generateQrCode") - public AjaxResult generateQrCode(HttpServletResponse response) throws Exception { + public R generateQrCode(HttpServletResponse response) throws Exception { String scope = "auth_user"; // 需要获取用户信息 String appId = "2021005114616085"; String state = ShareCodeUtils.idToCode(SecurityUtils.getUserId()); // 防止CSRF攻击 @@ -77,7 +79,7 @@ public class AliPayController extends BaseController { ); // QrCodeUtil.generate(authUrl, 300, 300, "png", response.getOutputStream()); - return AjaxResult.success("成功", authUrl); + return R.ok("成功", authUrl); } /** @@ -119,7 +121,7 @@ public class AliPayController extends BaseController { @PostMapping("/doPay") @ApiOperation(value = "支付宝支付") @ResponseBody - public AjaxResult doPay(@Valid + public R doPay(@Valid @RequestBody OrderTradeDto orderTradeDto, HttpServletResponse response) throws Exception { @@ -129,7 +131,7 @@ public class AliPayController extends BaseController { if ("member".equalsIgnoreCase(type)) { if (!Optional.ofNullable(orderTradeDto.getProductId()).isPresent()) { - return AjaxResult.error("商品id不能为空"); + return R.fail("商品id不能为空"); } payVo = aliPayService.memberPay(orderTradeDto); // QrCodeUtil.generate(payVo.getUrl(), 300, 300, "png", response.getOutputStream()); @@ -139,15 +141,15 @@ public class AliPayController extends BaseController { } else if ("wallet".equalsIgnoreCase(type)) { // 充值金额只能是整数 if (orderTradeDto.getAmount() % 1 != 0) { - return AjaxResult.error("充值金额只能是整数"); + return R.fail("充值金额只能是整数"); } payVo = aliPayService.walletPay(orderTradeDto.getAmount()); // QrCodeUtil.generate(payVo.getUrl(), 300, 300, "png", response.getOutputStream()); } else { - return AjaxResult.error("订单类型错误"); + return R.fail("订单类型错误"); } - return AjaxResult.success(payVo); + return R.ok(payVo); } /** @@ -157,11 +159,11 @@ public class AliPayController extends BaseController { @GetMapping("/fetch") @ResponseBody @ApiOperation(value = "提现") - public AjaxResult fetch(@Valid + public R fetch(@Valid @NotNull(message = "提现金额不能为空") Double amount) throws Exception { if (amount < 0.1) { - return AjaxResult.error("提现金额最小为0.1"); + return R.fail("提现金额最小为0.1"); } String outBizNo = UUID.fastUUID().toString(true); diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/pay/AliPay/OrderTradeController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/pay/AliPay/OrderTradeController.java index 25458cb..fb8408e 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/pay/AliPay/OrderTradeController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/pay/AliPay/OrderTradeController.java @@ -8,6 +8,7 @@ import com.alipay.easysdk.payment.common.models.AlipayTradeQueryResponse; import com.mcwl.common.JSONUtils; import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.redis.RedisCache; import com.mcwl.common.domain.IdsParam; @@ -69,15 +70,15 @@ public class OrderTradeController extends BaseController { */ @PostMapping("/add") @ApiOperation(value = "新增订单") - public AjaxResult add(@RequestBody OrderTrade orderTrade) { + public R add(@RequestBody OrderTrade orderTrade) { // 获取当前用户 Long userId = SecurityUtils.getUserId(); if (userId == null) { - return AjaxResult.warn("用户未登录"); + return R.fail("用户未登录"); } orderTrade.setUserId(userId); orderTrade.setCreateBy(getUsername()); - return toAjax(orderTradeService.insertMallProduct(orderTrade)); + return R.ok(orderTradeService.insertMallProduct(orderTrade)); } /** @@ -85,15 +86,16 @@ public class OrderTradeController extends BaseController { */ @PostMapping("/upda") @ApiOperation(value = "修改订单") - public AjaxResult upda(@RequestBody OrderTrade orderTrade) { + public R upda(@RequestBody OrderTrade orderTrade) { // 获取当前用户 Long userId = SecurityUtils.getUserId(); if (userId == null) { - return AjaxResult.warn("用户未登录"); + return R.fail("用户未登录"); } orderTrade.setUserId(userId); orderTrade.setUpdateBy(getUsername()); - return toAjax(orderTradeService.updateMallProduct(orderTrade)); + orderTradeService.updateMallProduct(orderTrade); + return R.ok(); } /** @@ -101,9 +103,9 @@ public class OrderTradeController extends BaseController { */ @PostMapping @ApiOperation(value = "删除订单") - public AjaxResult remove(@RequestBody IdsParam ids) { + public R remove(@RequestBody IdsParam ids) { orderTradeService.deleteMallProductByIds(ids); - return success(); + return R.ok(); } @@ -112,40 +114,25 @@ public class OrderTradeController extends BaseController { */ @GetMapping("/queryTradeStatus") @ApiOperation(value = "查询交易状态") - public AjaxResult queryTradeStatus(@Valid @NotBlank(message = "订单号不能为空") String outTradeNo) throws Exception { + public R queryTradeStatus(@Valid @NotBlank(message = "订单号不能为空") String outTradeNo) throws Exception { return aliPayService.queryTradeStatus(outTradeNo); } - @GetMapping("/getTradStatus") - public Object getTradStatus(String outTradeNo) throws Exception { - Factory.setOptions(config); - AlipayTradeQueryResponse query = Factory.Payment.Common().query(outTradeNo); - Map map = JSONUtils.jsonToMap(query.getHttpBody()); - - // 返回交易结果, 是否交易成功需要根据该对象中的 trade_status 来确定 - // trade_status 的枚举值如下, 请见 https://opendocs.alipay.com/apis/api_1/alipay.trade.query - // WAIT_BUYER_PAY(交易创建,等待买家付款) - // TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款) - // TRADE_SUCCESS(交易支付成功) - // TRADE_FINISHED(交易结束,不可退款) - return map.get("alipay_trade_query_response"); - } - /** * 撤销交易 */ - @GetMapping("/cancelTrade") - public AjaxResult cancelTrade(String outTradeNo) throws Exception { - // 关闭交易 - AlipayTradeCancelResponse cancel = Factory.Payment.Common().cancel(outTradeNo); - if (cancel.getCode().equals("10000")) { - return AjaxResult.success("关闭成功"); - } - return AjaxResult.error("关闭失败"); - } +// @GetMapping("/cancelTrade") +// public AjaxResult cancelTrade(String outTradeNo) throws Exception { +// // 关闭交易 +// AlipayTradeCancelResponse cancel = Factory.Payment.Common().cancel(outTradeNo); +// if (cancel.getCode().equals("10000")) { +// return AjaxResult.success("关闭成功"); +// } +// return AjaxResult.error("关闭失败"); +// } /** * 关闭交易 diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/MallProductController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/MallProductController.java index 09ad9bf..189cf3e 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/MallProductController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/MallProductController.java @@ -2,6 +2,7 @@ package com.mcwl.web.controller.resource; import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.page.PageDomain; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.utils.SecurityUtils; @@ -68,15 +69,15 @@ public class MallProductController extends BaseController { @ApiOperation(value = "模型详情") @PostMapping("finbyid") - public AjaxResult finbyid(@RequestBody ModelProduct modelVersion) { + public R finbyid(@RequestBody ModelProduct modelVersion) { ModelProduct modelVersion1 = modelService.getById(modelVersion.getId()); - return AjaxResult.success(modelVersion1); + return R.ok(modelVersion1); } @ApiOperation(value = "添加模型") @PostMapping("/insert") - public AjaxResult addupdateModel(@RequestBody RequestModel requestModel) { + public R addupdateModel(@RequestBody RequestModel requestModel) { ModelProduct modelProduct = requestModel.getModelProduct(); Long userId = SecurityUtils.getUserId(); modelProduct.setUserId(userId); @@ -86,7 +87,7 @@ public class MallProductController extends BaseController { @ApiOperation(value = "修改模型") @PostMapping("/update") - public AjaxResult updateModel(@RequestBody RequestModel requestModel) { + public R updateModel(@RequestBody RequestModel requestModel) { ModelProduct modelProduct = requestModel.getModelProduct(); Long userId = SecurityUtils.getUserId(); @@ -94,15 +95,15 @@ public class MallProductController extends BaseController { modelProduct.setUpdateBy(getUsername()); modelService.updaModel(requestModel); - return AjaxResult.success("修改成功"); + return R.ok(); } @ApiOperation(value = "删除模型") @GetMapping("delete") - public AjaxResult delete(@Valid @NotNull(message = "模型id不能为空") Long id) { + public R delete(@Valid @NotNull(message = "模型id不能为空") Long id) { modelService.removeById(id); - return AjaxResult.success(); + return R.ok(); } /** @@ -113,7 +114,7 @@ public class MallProductController extends BaseController { */ @ApiOperation(value = "查询模型详情") @GetMapping("/selectModelById") - public AjaxResult selectModelById(@RequestParam Long id) { + public R selectModelById(@RequestParam Long id) { return modelService.selectModelById(id); } @@ -128,9 +129,9 @@ public class MallProductController extends BaseController { */ @ApiOperation(value = "设置模型置顶状态") @GetMapping("/{id}/top") - public AjaxResult setModelTop(@PathVariable Long id, @RequestParam boolean isTop) { + public R setModelTop(@PathVariable Long id, @RequestParam boolean isTop) { modelService.setModelTop(id, isTop); - return AjaxResult.success(); + return R.ok(); } @@ -141,9 +142,9 @@ public class MallProductController extends BaseController { */ @ApiOperation(value = "获取置顶的模型列表") @GetMapping - public ResponseEntity> fetchModelsSortedByTopStatus() { + public R> fetchModelsSortedByTopStatus() { List models = modelService.fetchModelsSortedByTopStatus(); - return ResponseEntity.ok(models); + return R.ok(models); } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelCommentController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelCommentController.java index 2a7c441..0c65079 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelCommentController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelCommentController.java @@ -2,6 +2,7 @@ package com.mcwl.web.controller.resource; import com.mcwl.common.annotation.RepeatSubmit; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.resource.domain.dto.ModelCommentRes; import com.mcwl.resource.domain.vo.ModelCommentVo; import com.mcwl.resource.service.ModelCommentLikeService; @@ -46,12 +47,12 @@ public class ModelCommentController { @ApiOperation(value = "模型点赞/取消") @RepeatSubmit @GetMapping("/modelLike") - public AjaxResult like(@Valid + public R like(@Valid @NotNull(message = "模型id不能为空") @ApiParam(value = "模型id", required = true) Long modelId) { modelLikeService.like(modelId); - return AjaxResult.success(); + return R.ok(); } @@ -60,9 +61,9 @@ public class ModelCommentController { */ @ApiOperation(value = "模型评论发布") @PostMapping("/comment") - public AjaxResult comment(@Valid @RequestBody ModelCommentRes modelCommentRes) { + public R comment(@Valid @RequestBody ModelCommentRes modelCommentRes) { modelCommentService.comment(modelCommentRes); - return AjaxResult.success(); + return R.ok(); } /** @@ -71,12 +72,12 @@ public class ModelCommentController { @ApiOperation(value = "模型评论点赞/取消") @RepeatSubmit @GetMapping("/commentLike") - public AjaxResult commentLike(@Valid + public R commentLike(@Valid @NotNull(message = "评论id不能为空") @ApiParam(value = "评论id", required = true) Long commentId) { modelCommentLikeService.like(commentId); - return AjaxResult.success(); + return R.ok(); } @@ -86,16 +87,16 @@ public class ModelCommentController { @ApiOperation(value = "获取模型评论") @GetMapping("/comment") @Valid - public AjaxResult getComment(@Valid + public R> getComment(@Valid @NotNull(message = "模型id不能为空") @ApiParam(value = "模型id", required = true) Long modelId, - @Valid + @Valid @NotNull(message = "排序方式不能为空") @ApiParam(value = "排序方式 0最热 1最新", required = true) Integer sortType) { List modelCommentList = modelCommentService.getComment(modelId, sortType); - return AjaxResult.success(modelCommentList); + return R.ok(modelCommentList); } @@ -104,12 +105,12 @@ public class ModelCommentController { */ @ApiOperation(value = "删除模型评论") @GetMapping("/commentDelete") - public AjaxResult commentDelete(@Valid + public R commentDelete(@Valid @NotNull(message = "评论id不能为空") @ApiParam(value = "评论id", required = true) Long commentId) { modelCommentService.removeById(commentId); - return AjaxResult.success(); + return R.ok(); } /** @@ -117,12 +118,12 @@ public class ModelCommentController { */ @ApiOperation(value = "获取模型评论数量") @GetMapping("/commentCount") - public AjaxResult getCommentCount(@Valid + public R getCommentCount(@Valid @NotNull(message = "模型id不能为空") @ApiParam(value = "模型id", required = true) Long modelId) { Integer commentCount = modelCommentService.getCommentCount(modelId); - return AjaxResult.success(commentCount); + return R.ok(commentCount); } } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelImageCommentController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelImageCommentController.java index e77f4ec..3d16e15 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelImageCommentController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelImageCommentController.java @@ -2,6 +2,7 @@ package com.mcwl.web.controller.resource; import com.mcwl.common.annotation.RepeatSubmit; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.resource.domain.dto.ModelImageCommentRes; import com.mcwl.resource.domain.vo.ModelImageCommentVo; import com.mcwl.resource.service.ModelImageCommentLikeService; @@ -38,9 +39,9 @@ public class ModelImageCommentController { */ @ApiOperation(value = "图片评论发布") @PostMapping("/comment") - public AjaxResult comment(@Valid @RequestBody ModelImageCommentRes modelImageCommentRes) { + public R comment(@Valid @RequestBody ModelImageCommentRes modelImageCommentRes) { modelImageCommentService.comment(modelImageCommentRes); - return AjaxResult.success(); + return R.ok(); } /** @@ -49,12 +50,12 @@ public class ModelImageCommentController { @ApiOperation(value = "图片评论点赞/取消") @RepeatSubmit @GetMapping("/commentLike") - public AjaxResult commentLike(@Valid + public R commentLike(@Valid @NotNull(message = "评论id不能为空") @ApiParam(value = "评论id", required = true) Long commentId) { modelImageCommentLikeService.like(commentId); - return AjaxResult.success(); + return R.ok(); } /** @@ -62,11 +63,11 @@ public class ModelImageCommentController { */ @ApiOperation(value = "删除图片评论") @GetMapping("/commentDelete") - public AjaxResult commentDelete(@Valid + public R commentDelete(@Valid @NotNull(message = "评论id不能为空") @ApiParam(value = "评论id", required = true) Long commentId) { modelImageCommentService.removeById(commentId); - return AjaxResult.success(); + return R.ok(); } /** @@ -75,16 +76,16 @@ public class ModelImageCommentController { @ApiOperation(value = "获取图片评论") @GetMapping("/comment") @Valid - public AjaxResult getComment(@Valid + public R> getComment(@Valid @NotNull(message = "图片id不能为空") @ApiParam(value = "评论id", required = true) Long imageId, - @Valid + @Valid @NotNull(message = "排序方式不能为空") @ApiParam(value = "排序方式 0最热 1最新", required = true) Integer sortType) { List modelImageCommentVoList = modelImageCommentService.getComment(imageId, sortType); - return AjaxResult.success(modelImageCommentVoList); + return R.ok(modelImageCommentVoList); } /** @@ -92,12 +93,12 @@ public class ModelImageCommentController { */ @ApiOperation(value = "获取图片评论数量") @GetMapping("/commentCount") - public AjaxResult getCommentCount(@Valid + public R getCommentCount(@Valid @NotNull(message = "图片id不能为空") @ApiParam(value = "图片id", required = true) Long imageId) { Integer commentCount = modelImageCommentService.getCommentCount(imageId); - return AjaxResult.success(commentCount); + return R.ok(commentCount); } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelImageController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelImageController.java index 7be5c8d..5b933d5 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelImageController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelImageController.java @@ -3,6 +3,7 @@ package com.mcwl.web.controller.resource; import cn.hutool.core.bean.BeanUtil; import com.mcwl.common.annotation.RepeatSubmit; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.page.PageDomain; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.resource.domain.ModelImage; @@ -56,9 +57,9 @@ public class ModelImageController { */ @ApiOperation(value = "图片详情") @GetMapping("/detail") - public AjaxResult detail(@Valid @NotNull(message = "图片id不能为空") Long id) { + public R detail(@Valid @NotNull(message = "图片id不能为空") Long id) { ModelImageVo modelImageVo = modelImageService.getDetail(id); - return AjaxResult.success(modelImageVo); + return R.ok(modelImageVo); } /** @@ -66,9 +67,9 @@ public class ModelImageController { */ @ApiOperation(value = "图片删除") @GetMapping("/delete") - public AjaxResult delete(@Valid @NotNull(message = "图片id不能为空") Long id) { + public R delete(@Valid @NotNull(message = "图片id不能为空") Long id) { modelImageService.removeById(id); - return AjaxResult.success(); + return R.ok(); } /** @@ -76,9 +77,9 @@ public class ModelImageController { */ @ApiOperation(value = "图片修改") @PostMapping("/update") - public AjaxResult update(@Valid @RequestBody ModelImageRes modelImageRes) { + public R update(@Valid @RequestBody ModelImageRes modelImageRes) { modelImageService.updateById(modelImageRes); - return AjaxResult.success(); + return R.ok(); } @@ -87,9 +88,9 @@ public class ModelImageController { */ @ApiOperation(value = "图片发布") @PostMapping("/publish") - public AjaxResult publish(@Valid @RequestBody ModelImageRes modelImageRes) { + public R publish(@Valid @RequestBody ModelImageRes modelImageRes) { modelImageService.publish(modelImageRes); - return AjaxResult.success(); + return R.ok(); } /** @@ -98,9 +99,9 @@ public class ModelImageController { @ApiOperation(value = "图片点赞/取消") @RepeatSubmit @GetMapping("/imageLike") - public AjaxResult like(@Valid @NotNull(message = "图片id不能为空") Long id) { + public R like(@Valid @NotNull(message = "图片id不能为空") Long id) { modelImageLikeService.like(id); - return AjaxResult.success(); + return R.ok(); } @@ -113,9 +114,9 @@ public class ModelImageController { */ @ApiOperation(value = "设置图片置顶状态") @GetMapping("/{id}/top") - public AjaxResult setModelImageTop(@PathVariable Long id, @RequestParam boolean isTop) { + public R setModelImageTop(@PathVariable Long id, @RequestParam boolean isTop) { modelImageLikeService.setModelImageTop(id, isTop); - return AjaxResult.success(); + return R.ok(); } @@ -126,9 +127,9 @@ public class ModelImageController { */ @ApiOperation(value = "获取置顶的图片列表") @GetMapping - public ResponseEntity> fetchModelImagesSortedByTopStatus() { + public R> fetchModelImagesSortedByTopStatus() { List models = modelImageLikeService.fetchModelImageSortedByTopStatus(); - return ResponseEntity.ok(models); + return R.ok(models); } } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelVersionController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelVersionController.java index 6c8064a..0599050 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelVersionController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelVersionController.java @@ -2,6 +2,7 @@ package com.mcwl.web.controller.resource; import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.resource.domain.ModelVersion; import com.mcwl.resource.service.ModelVersionService; @@ -35,7 +36,7 @@ public class ModelVersionController extends BaseController { * @return */ @GetMapping("/selectByModelId") - public AjaxResult selectByModelId(@RequestParam Long modelId){ + public R> selectByModelId(@RequestParam Long modelId){ return modelVersionService.selectByModelId(modelId); } @@ -52,42 +53,42 @@ public class ModelVersionController extends BaseController { @ApiOperation(value = "模型版本详情") @GetMapping("finbyid") - public AjaxResult finbyid(@RequestParam Long id) + public R finbyid(@RequestParam Long id) { ModelVersion modelVersion1 = modelVersionService.getById(id); - return AjaxResult.success(modelVersion1); + return R.ok(modelVersion1); } @ApiOperation(value = "模型版本添加") @PostMapping("insert") - public AjaxResult insert(@RequestBody ModelVersion modelVersion) + public R insert(@RequestBody ModelVersion modelVersion) { modelVersionService.save(modelVersion); - return AjaxResult.success(); + return R.ok(); } @ApiOperation(value = "模型版本修改") @PostMapping("update") - public AjaxResult update(@RequestBody ModelVersion modelVersion) + public R update(@RequestBody ModelVersion modelVersion) { modelVersionService.updateById(modelVersion); - return AjaxResult.success(); + return R.ok(); } @ApiOperation(value = "模型版本删除") @PostMapping("delete") - public AjaxResult delete(@RequestBody ModelVersion modelVersion) + public R delete(@RequestBody ModelVersion modelVersion) { modelVersionService.removeById(modelVersion.getId()); - return AjaxResult.success(); + return R.ok(); } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ReportController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ReportController.java index f2d2842..27a0412 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ReportController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ReportController.java @@ -1,6 +1,8 @@ package com.mcwl.web.controller.resource; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.resource.domain.Report; import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.service.ReportService; @@ -29,10 +31,10 @@ public class ReportController { */ @ApiOperation(value = "新增举报内容") @PostMapping("/addReport") - public AjaxResult addReport(@RequestBody Report report){ + public R addReport(@RequestBody Report report){ reportService.addReport(report); - return AjaxResult.success("举报成功"); + return R.ok(); } @@ -44,7 +46,7 @@ public class ReportController { */ @ApiOperation(value = "查询举报列表") @PostMapping("/selectReport") - public AjaxResult selectReport(@RequestBody PageVo pageVo){ + public R> selectReport(@RequestBody PageVo pageVo){ return reportService.selectReport(pageVo); @@ -57,10 +59,10 @@ public class ReportController { */ @ApiOperation(value = "删除举报") @GetMapping("/deleteReport") - public AjaxResult deleteReport(@RequestParam Long id){ + public R deleteReport(@RequestParam Long id){ reportService.deleteReport(id); - return AjaxResult.success("删除成功"); + return R.ok(); } /** @@ -70,10 +72,10 @@ public class ReportController { */ @ApiOperation(value = "修改状态") @GetMapping("/updateStatus") - public AjaxResult updateStatus(@RequestParam Long id){ + public R updateStatus(@RequestParam Long id){ reportService.updateStatus(id); - return AjaxResult.success("修改成功"); + return R.ok(); } } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/SysUserAttentionController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/SysUserAttentionController.java index e136435..9b8dd0f 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/SysUserAttentionController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/SysUserAttentionController.java @@ -3,6 +3,7 @@ package com.mcwl.web.controller.resource; import com.github.pagehelper.PageInfo; import com.mcwl.common.annotation.RepeatSubmit; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.resource.domain.SysUserInfo; import com.mcwl.resource.domain.vo.PageVo; @@ -34,7 +35,7 @@ public class SysUserAttentionController { @ApiOperation(value = "添加/取消关注") @RepeatSubmit @GetMapping("/addAttention") - public AjaxResult addAttention(@RequestParam Long userId) { + public R addAttention(@RequestParam Long userId) { return sysUserAttentionService.addAttention(userId); @@ -47,11 +48,11 @@ public class SysUserAttentionController { */ @ApiOperation(value = "查询是否关注用户") @GetMapping("/selectAttention") - public AjaxResult selectAttention(@RequestParam Long userId) { + public R selectAttention(@RequestParam Long userId) { Boolean aBoolean = sysUserAttentionService.selectAttention(userId); - return AjaxResult.success(aBoolean); + return R.ok(aBoolean); } /** @@ -60,11 +61,11 @@ public class SysUserAttentionController { */ @ApiOperation(value = "查询个人粉丝,关注,下载量,喜欢") @GetMapping("/selectUserInfo") - public AjaxResult selectUserInfo(){ + public R selectUserInfo(){ SysUserInfo sysUserInfo = sysUserAttentionService.selectUserInfo(); - return AjaxResult.success(sysUserInfo); + return R.ok(sysUserInfo); } @@ -74,11 +75,11 @@ public class SysUserAttentionController { */ @ApiOperation(value = "查询关注列表") @PostMapping("/selectAttention") - public AjaxResult selectAttention(PageVo pageVo){ + public R> selectAttention(PageVo pageVo){ PageInfo sysUserList = sysUserAttentionService.selectAttentionPage(pageVo); - return AjaxResult.success(sysUserList); + return R.ok(sysUserList); } @@ -88,10 +89,10 @@ public class SysUserAttentionController { */ @ApiOperation(value = "查询粉丝列表") @PostMapping("/selectToAttention") - public AjaxResult selectToAttention(PageVo pageVo){ + public R> selectToAttention(PageVo pageVo){ PageInfo sysUserList = sysUserAttentionService.selectToAttentionPage(pageVo); - return AjaxResult.success(sysUserList); + return R.ok(sysUserList); } } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ToActivityController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ToActivityController.java index 9d7e514..e41ef1e 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ToActivityController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ToActivityController.java @@ -2,6 +2,7 @@ package com.mcwl.web.controller.resource; import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.resource.domain.ToActivity; import com.mcwl.resource.service.ToActivityService; @@ -46,41 +47,45 @@ public class ToActivityController extends BaseController { @ApiOperation(value = "活动详情") @PostMapping("finById") - public AjaxResult finById(@RequestBody ToActivity toActivity) + public R finById(@RequestBody ToActivity toActivity) { - return AjaxResult.success(toActivityService.getById(toActivity.getId())); + return R.ok(toActivityService.getById(toActivity.getId())); } @ApiOperation(value = "活动添加") @PostMapping("add") - public AjaxResult add(@RequestBody ToActivity toActivity) + public R add(@RequestBody ToActivity toActivity) { - return AjaxResult.success(toActivityService.save(toActivity)); + toActivityService.save(toActivity); + return R.ok(); } @ApiOperation(value = "活动修改") @PostMapping("update") - public AjaxResult update(@RequestBody ToActivity toActivity) + public R update(@RequestBody ToActivity toActivity) { - return AjaxResult.success(toActivityService.updateById(toActivity)); + toActivityService.updateById(toActivity); + return R.ok(); } @ApiOperation(value = "活动删除") @PostMapping("delete") - public AjaxResult delete(@RequestBody ToActivity toActivity) + public R delete(@RequestBody ToActivity toActivity) { - return AjaxResult.success(toActivityService.removeById(toActivity)); + toActivityService.removeById(toActivity); + return R.ok(); } @ApiOperation(value = "活动批量删除") @PostMapping("deleteByIds") - public AjaxResult deleteByIds(@RequestBody List toActivity) + public R deleteByIds(@RequestBody List toActivity) { - return AjaxResult.success(toActivityService.removeByIds(toActivity)); + toActivityService.removeByIds(toActivity); + return R.ok(); } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowCommentController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowCommentController.java index 326edc7..5a01ccb 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowCommentController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowCommentController.java @@ -1,6 +1,7 @@ package com.mcwl.web.controller.resource; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.resource.domain.dto.WorkFlowCommentRes; import com.mcwl.resource.domain.vo.WorkFlowCommentVo; import com.mcwl.resource.service.WorkFlowCommentLikeService; @@ -44,12 +45,12 @@ public class WorkFlowCommentController { */ @ApiOperation(value = "工作流点赞/取消") @GetMapping("/like") - public AjaxResult like(@Valid + public R like(@Valid @NotNull(message = "模型id不能为空") @ApiParam(value = "模型id", required = true) Long workFlowId) { workFlowLikeService.like(workFlowId); - return AjaxResult.success(); + return R.ok(); } @@ -58,11 +59,11 @@ public class WorkFlowCommentController { */ @ApiOperation(value = "工作流评论发布") @PostMapping("/comment") - public AjaxResult comment(@Valid + public R comment(@Valid @RequestBody WorkFlowCommentRes workFlowCommentRes) { workFlowCommentService.comment(workFlowCommentRes); - return AjaxResult.success(); + return R.ok(); } /** @@ -70,12 +71,12 @@ public class WorkFlowCommentController { */ @ApiOperation(value = "工作流评论点赞/取消") @GetMapping("/commentLike") - public AjaxResult commentLike(@Valid + public R commentLike(@Valid @NotNull(message = "评论id不能为空") @ApiParam(value = "评论id", required = true) Long commentId) { workFlowCommentLikeService.like(commentId); - return AjaxResult.success(); + return R.ok(); } @@ -84,16 +85,16 @@ public class WorkFlowCommentController { */ @ApiOperation(value = "获取工作流评论") @GetMapping("/comment") - public AjaxResult getComment(@Valid + public R> getComment(@Valid @NotNull(message = "模型id不能为空") @ApiParam(value = "模型id", required = true) Long commentId, - @Valid + @Valid @NotNull(message = "排序方式不能为空") @ApiParam(value = "排序方式 0最热 1最新", required = true) Integer sortType) { List modelCommentList = workFlowCommentService.getComment(commentId, sortType); - return AjaxResult.success(modelCommentList); + return R.ok(modelCommentList); } @@ -102,12 +103,12 @@ public class WorkFlowCommentController { */ @ApiOperation(value = "删除工作流评论") @GetMapping("/commentDelete") - public AjaxResult commentDelete(@Valid + public R commentDelete(@Valid @NotNull(message = "评论id不能为空") @ApiParam(value = "评论id", required = true) Long commentId) { workFlowCommentService.removeById(commentId); - return AjaxResult.success(); + return R.ok(); } /** @@ -115,12 +116,12 @@ public class WorkFlowCommentController { */ @ApiOperation(value = "获取工作流评论数量") @GetMapping("/commentCount") - public AjaxResult getCommentCount(@Valid + public R getCommentCount(@Valid @NotNull(message = "工作流id不能为空") @ApiParam(value = "工作流id", required = true) Long workFlowId) { Integer commentCount = workFlowCommentService.getCommentCount(workFlowId); - return AjaxResult.success(commentCount); + return R.ok(commentCount); } } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowController.java index 0369134..21c728c 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowController.java @@ -1,11 +1,14 @@ package com.mcwl.web.controller.resource; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.resource.domain.WorkFlow; import com.mcwl.resource.domain.dto.AddRequestWorkFlow; import com.mcwl.resource.domain.request.RequestWorkFlow; import com.mcwl.resource.domain.vo.PageVo; +import com.mcwl.resource.service.WorkFlowService; import com.mcwl.resource.service.impl.WorkFlowServiceImpl; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -21,6 +24,7 @@ import java.util.List; /** * 工作流 + * * @Author:ChenYan * @Project:McWl * @Package:com.mcwl.web.controller.resource @@ -35,85 +39,90 @@ public class WorkFlowController extends BaseController { @Autowired - private WorkFlowServiceImpl workFlowService; + private WorkFlowService workFlowService; /** * 设置工作流的置顶状态 + * * @param id * @param isTop * @return */ @ApiOperation(value = "设置工作流的置顶状态") @GetMapping("/{id}/top") - public AjaxResult setWorkFlowTop(@PathVariable Long id, @RequestParam boolean isTop) { + public R setWorkFlowTop(@PathVariable Long id, @RequestParam boolean isTop) { - workFlowService.setworkFlowTop(id, isTop); - return AjaxResult.success(); + workFlowService.setworkFlowTop(id, isTop); + return R.ok(); } -/** + /** * 获取所有工作流,按照置顶状态排序 + * * @return */ @ApiOperation(value = "获取置顶的模型列表") @GetMapping - public ResponseEntity> fetchWorkFlowSortedByTopStatus() { + public R> fetchWorkFlowSortedByTopStatus() { List models = workFlowService.fetchWorkFlowSortedByTopStatus(); - return ResponseEntity.ok(models); + return R.ok(models); } - /** * 添加工作流 + * * @param addRequestWorkFlow * @return */ @ApiOperation(value = "添加工作流") @PostMapping("/addWorkFlow") - public AjaxResult addWorkFlow(@Validated @RequestBody AddRequestWorkFlow addRequestWorkFlow){ + public R addWorkFlow(@Validated @RequestBody AddRequestWorkFlow addRequestWorkFlow) { return workFlowService.addWorkFlow(addRequestWorkFlow); } /** * 修改工作流 + * * @param requestWorkFlow * @return */ @ApiOperation(value = "修改工作流") @PostMapping("/updateWorkFlow") - public AjaxResult updateWorkFlow(@RequestBody RequestWorkFlow requestWorkFlow){ + public R updateWorkFlow(@RequestBody RequestWorkFlow requestWorkFlow) { workFlowService.updateWorkFlow(requestWorkFlow); - return AjaxResult.success("修改成功"); + return R.ok(); } /** * 删除工作流 + * * @param id * @return */ @ApiOperation(value = "删除工作流") @GetMapping("/deleteWorkFlow") - public AjaxResult deleteWorkFlow(@RequestParam @Valid @NotNull(message = "工作流id不能为空") Long id){ + public R deleteWorkFlow(@RequestParam @Valid @NotNull(message = "工作流id不能为空") Long id) { workFlowService.deleteWorkFlow(id); - return AjaxResult.success("删除成功"); + return R.ok(); } /** * 查询工作流列表 + * * @param pageVo * @return */ @ApiOperation(value = "查询工作流列表") @PostMapping("/selectWorkFlow") - public AjaxResult selectWorkFlow(@RequestBody PageVo pageVo){ + public R> selectWorkFlow(@RequestBody PageVo pageVo) { return workFlowService.selectWorkFlow(pageVo); } @@ -121,37 +130,40 @@ public class WorkFlowController extends BaseController { /** * 查询工作流详情 + * * @param id * @return */ @ApiOperation(value = "查询工作流详情") @GetMapping("/selectWorkFlowById") - public AjaxResult selectWorkFlowById(@RequestParam @Valid @NotNull(message = "工作流id不能为空") Long id){ + public R selectWorkFlowById(@RequestParam @Valid @NotNull(message = "工作流id不能为空") Long id) { return workFlowService.selectWorkFlowById(id); } /** * 校验名字是否重复 + * * @param name * @return */ @ApiOperation(value = "校验名字是否重复") @GetMapping("/selectWorkFlowByName") - public AjaxResult selectWorkFlowByName(@RequestParam String name){ + public R selectWorkFlowByName(@RequestParam String name) { Long sign = workFlowService.selectWorkFlowByName(name); - return AjaxResult.success(sign); + return R.ok(sign); } /** * 回显接口 + * * @return */ @ApiOperation(value = "工作流回显接口") @GetMapping("/selectWorkFlowVersionById") - public AjaxResult selectWorkFlowVersionById(@RequestParam @Valid @NotNull(message = "图片id不能为空") Long id){ + public R selectWorkFlowVersionById(@RequestParam @Valid @NotNull(message = "图片id不能为空") Long id) { return workFlowService.selectWorkFlowVersionById(id); } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowVersionController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowVersionController.java index 009e73e..c346313 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowVersionController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowVersionController.java @@ -1,6 +1,9 @@ package com.mcwl.web.controller.resource; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; +import com.mcwl.resource.domain.WorkFlowVersion; +import com.mcwl.resource.service.WorkFlowVersionService; import com.mcwl.resource.service.impl.WorkFlowVersionServiceImpl; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -10,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * 工作流版本 * @@ -23,7 +28,7 @@ import org.springframework.web.bind.annotation.RestController; public class WorkFlowVersionController { @Autowired - private WorkFlowVersionServiceImpl workFlowVersionService; + private WorkFlowVersionService workFlowVersionService; /** * 查询工作流下的所有版本信息 @@ -33,7 +38,7 @@ public class WorkFlowVersionController { */ @ApiOperation(value = "查询工作流下的所有版本信息") @GetMapping("/selectVersionByWorkId") - public AjaxResult selectVersionByWorkId(@RequestParam Long workId) { + public R> selectVersionByWorkId(@RequestParam Long workId) { return workFlowVersionService.selectVersionByWorkId(workId); } diff --git a/mcwl-common/src/main/java/com/mcwl/common/core/domain/R.java b/mcwl-common/src/main/java/com/mcwl/common/core/domain/R.java index a6bb71d..bea45d5 100644 --- a/mcwl-common/src/main/java/com/mcwl/common/core/domain/R.java +++ b/mcwl-common/src/main/java/com/mcwl/common/core/domain/R.java @@ -2,12 +2,15 @@ package com.mcwl.common.core.domain; import java.io.Serializable; import com.mcwl.common.constant.HttpStatus; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; /** * 响应信息主体 * * @author mcwl */ +@ApiModel(value = "响应结果") public class R implements Serializable { private static final long serialVersionUID = 1L; @@ -18,10 +21,13 @@ public class R implements Serializable /** 失败 */ public static final int FAIL = HttpStatus.ERROR; + @ApiModelProperty(value = "状态码") private int code; + @ApiModelProperty(value = "提示信息") private String msg; + @ApiModelProperty(value = "数据对象") private T data; public static R ok() diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/InviteService.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/InviteService.java index 53842fa..ee9a4a3 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/InviteService.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/InviteService.java @@ -2,6 +2,7 @@ package com.mcwl.communityCenter.service; import com.baomidou.mybatisplus.extension.service.IService; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.page.PageDomain; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.communityCenter.domain.Invite; @@ -26,5 +27,5 @@ public interface InviteService extends IService { * @param inviteCode 邀请码 * @return 结果 */ - AjaxResult acceptInvite(@NotNull(message = "communityId不能为空") Long communityId, @NotBlank(message = "inviteCode不能为空") String inviteCode); + R acceptInvite(@NotNull(message = "communityId不能为空") Long communityId, @NotBlank(message = "inviteCode不能为空") String inviteCode); } diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/PublishCommentService.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/PublishCommentService.java index 43aae8d..9ba82f8 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/PublishCommentService.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/PublishCommentService.java @@ -2,6 +2,7 @@ package com.mcwl.communityCenter.service; import com.baomidou.mybatisplus.extension.service.IService; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.communityCenter.domain.dto.CommentDelRes; import com.mcwl.communityCenter.domain.dto.CommentDetailRes; import com.mcwl.communityCenter.domain.dto.CommentRes; @@ -27,9 +28,9 @@ public interface PublishCommentService extends IService { * @param commentDetailRes 评论详情参数 * @return 评论详情 */ - AjaxResult getComment(CommentDetailRes commentDetailRes); + R getComment(CommentDetailRes commentDetailRes); - AjaxResult addComment(CommentRes commentRes); + R addComment(CommentRes commentRes); - AjaxResult removeCommentById(CommentDelRes commentDelRes); + R removeCommentById(CommentDelRes commentDelRes); } diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/PublishService.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/PublishService.java index 0478a1d..1cad04b 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/PublishService.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/PublishService.java @@ -2,6 +2,7 @@ package com.mcwl.communityCenter.service; import com.baomidou.mybatisplus.extension.service.IService; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.page.PageDomain; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.communityCenter.domain.Community; @@ -23,7 +24,7 @@ public interface PublishService extends IService { * 发布 * @param publishRes 发布对象 */ - AjaxResult publish(PublishRes publishRes); + R publish(PublishRes publishRes); TableDataInfo getPublishList(PublishPageRes publishPageRes); diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/QuestionCommentService.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/QuestionCommentService.java index b278404..a60a97a 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/QuestionCommentService.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/QuestionCommentService.java @@ -2,6 +2,7 @@ package com.mcwl.communityCenter.service; import com.baomidou.mybatisplus.extension.service.IService; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.communityCenter.domain.Question; import com.mcwl.communityCenter.domain.QuestionComment; @@ -12,9 +13,9 @@ import javax.validation.Valid; public interface QuestionCommentService extends IService { - AjaxResult comment(@Valid QuestionCommentRes questionCommentRes); + R comment(@Valid QuestionCommentRes questionCommentRes); TableDataInfo listByPage(@Valid QuestionCommentPageRes questionCommentPageRes); - AjaxResult adopt(@Valid QuestionCommentAdoptRes questionCommentAdoptRes); + R adopt(@Valid QuestionCommentAdoptRes questionCommentAdoptRes); } diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/QuestionService.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/QuestionService.java index ef57ed7..b2eb495 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/QuestionService.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/QuestionService.java @@ -2,6 +2,7 @@ package com.mcwl.communityCenter.service; import com.baomidou.mybatisplus.extension.service.IService; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.communityCenter.domain.Question; import com.mcwl.communityCenter.domain.dto.QuestionDetailRes; @@ -19,7 +20,7 @@ public interface QuestionService extends IService { * 添加问题 * @param questionRes 问题信息 */ - AjaxResult addQuestion(QuestionRes questionRes); + R addQuestion(QuestionRes questionRes); TableDataInfo list(QuestionPageRes questionPageRes); diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/InviteServiceImpl.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/InviteServiceImpl.java index 182dafe..cf02761 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/InviteServiceImpl.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/InviteServiceImpl.java @@ -3,6 +3,7 @@ package com.mcwl.communityCenter.service.impl; import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.ShareCodeUtils; import com.mcwl.communityCenter.constant.InviteConstant; @@ -61,17 +62,17 @@ public class InviteServiceImpl extends ServiceImpl impleme @Override @Transactional(rollbackFor = Exception.class) - public AjaxResult acceptInvite(Long communityId, String inviteCode) { + public R acceptInvite(Long communityId, String inviteCode) { // 解析邀请码 Long userId = ShareCodeUtils.codeToId(inviteCode); if (Objects.isNull(userId)) { - return AjaxResult.error("邀请码有误"); + return R.fail("邀请码有误"); } // 判断是否是同一个人 if (Objects.equals(userId, SecurityUtils.getUserId())) { - return AjaxResult.error("不能邀请自己"); + return R.fail("不能邀请自己"); } // 查询邀请码 @@ -83,13 +84,13 @@ public class InviteServiceImpl extends ServiceImpl impleme .one(); if (Objects.isNull(inviteCodeMapping)) { - return AjaxResult.error("没查询到该邀请码"); + return R.fail("没查询到该邀请码"); } // 判断是否已经邀请过 Invite inv = inviteMapper.isInvite(userId, communityId, SecurityUtils.getUserId()); if (Objects.nonNull(inv)) { - return AjaxResult.error("不能重复邀请"); + return R.fail("不能重复邀请"); } @@ -103,6 +104,6 @@ public class InviteServiceImpl extends ServiceImpl impleme invite.setType(InviteConstant.INVITE_ADMIN); invite.setFeeType(InviteConstant.INVITE_FEE); baseMapper.insert(invite); - return AjaxResult.success("邀请成功"); + return R.ok(null, "邀请成功"); } } diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/PublishCommentServiceImpl.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/PublishCommentServiceImpl.java index 1470974..265d9aa 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/PublishCommentServiceImpl.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/PublishCommentServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.utils.SecurityUtils; import com.mcwl.communityCenter.domain.Publish; @@ -51,7 +52,7 @@ public class PublishCommentServiceImpl extends ServiceImpl getComment(CommentDetailRes commentDetailRes) { Long tenantId = commentDetailRes.getTenantId(); Long communityId = commentDetailRes.getCommunityId(); Long operatorId = commentDetailRes.getOperatorId(); @@ -69,18 +70,18 @@ public class PublishCommentServiceImpl extends ServiceImpl addComment(CommentRes commentRes) { Long tenantId = commentRes.getTenantId(); Long communityId = commentRes.getCommunityId(); Long operatorId = commentRes.getOperatorId(); Publish publish = publishMapper.selectByIdAndTenantIdAndCommunityId(operatorId, tenantId, communityId); if (Objects.isNull(publish)) { - return AjaxResult.error("评论失败,该内容不存在"); + return R.fail("评论失败,该内容不存在"); } PublishComment publishComment = new PublishComment(); @@ -91,11 +92,11 @@ public class PublishCommentServiceImpl extends ServiceImpl removeCommentById(CommentDelRes commentDelRes) { Long id = commentDelRes.getId(); Long tenantId = commentDelRes.getTenantId(); Long communityId = commentDelRes.getCommunityId(); @@ -104,12 +105,12 @@ public class PublishCommentServiceImpl extends ServiceImpl impl } @Override - public AjaxResult publish(PublishRes publishRes) { + public R publish(PublishRes publishRes) { Long userId = SecurityUtils.getUserId(); Community community = communityMapper.getByTenantIdAndCommunityId(publishRes.getTenantId(), publishRes.getCommunityId()); if (Objects.isNull(community)) { - return AjaxResult.error(HttpStatus.ERROR, "用户社区未创建"); + return R.fail("用户社区未创建"); } @@ -82,7 +83,7 @@ public class PublishServiceImpl extends ServiceImpl impl if (!Objects.equals(userId, publishRes.getTenantId())) { // 判断用户是否被邀请 if (invites.isEmpty() || !invites.contains(userId)) { - return AjaxResult.error(HttpStatus.ERROR, "您没有被邀请"); + return R.fail("您没有被邀请"); } } Publish publish = new Publish(); @@ -92,7 +93,7 @@ public class PublishServiceImpl extends ServiceImpl impl publish.setPublishTime(new Date()); } baseMapper.insert(publish); - return AjaxResult.success(); + return R.ok(); } @Override diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/QuestionCommentServiceImpl.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/QuestionCommentServiceImpl.java index 5403953..6343f18 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/QuestionCommentServiceImpl.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/QuestionCommentServiceImpl.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.utils.SecurityUtils; @@ -38,7 +39,7 @@ public class QuestionCommentServiceImpl extends ServiceImpl comment(QuestionCommentRes questionCommentRes) { Long tenantId = questionCommentRes.getTenantId(); Long communityId = questionCommentRes.getCommunityId(); @@ -47,7 +48,7 @@ public class QuestionCommentServiceImpl extends ServiceImpl adopt(QuestionCommentAdoptRes questionCommentAdoptRes) { Long tenantId = questionCommentAdoptRes.getTenantId(); Long communityId = questionCommentAdoptRes.getCommunityId(); @@ -97,25 +98,25 @@ public class QuestionCommentServiceImpl extends ServiceImpl i */ @Override @Transactional(rollbackFor = Exception.class) - public AjaxResult addQuestion(QuestionRes questionRes) { + public R addQuestion(QuestionRes questionRes) { Long communityId = questionRes.getCommunityId(); Long userId = SecurityUtils.getUserId(); @@ -68,7 +69,7 @@ public class QuestionServiceImpl extends ServiceImpl i Community community = communityMapper.getByTenantIdAndCommunityId(tenantId, communityId); if (Objects.isNull(community)) { - return AjaxResult.error("租户或社区不存在"); + return R.fail("租户或社区不存在"); } // if (Objects.equals(tenantId, userId)) { @@ -108,7 +109,7 @@ public class QuestionServiceImpl extends ServiceImpl i // communityAdviceMapper.insert(communityAdvice); - return AjaxResult.success(); + return R.ok(); } diff --git a/mcwl-memberCenter/src/main/java/com/mcwl/memberCenter/domain/Member.java b/mcwl-memberCenter/src/main/java/com/mcwl/memberCenter/domain/Member.java index 7b6614f..2833445 100644 --- a/mcwl-memberCenter/src/main/java/com/mcwl/memberCenter/domain/Member.java +++ b/mcwl-memberCenter/src/main/java/com/mcwl/memberCenter/domain/Member.java @@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.mcwl.common.core.domain.BaseEntity; import com.mcwl.memberCenter.enums.MemberEnum; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; @@ -16,42 +18,55 @@ import java.util.Date; @Data @EqualsAndHashCode(callSuper = false) @TableName("mem_member") +@ApiModel(description = "会员表") public class Member extends BaseEntity { @TableId + @ApiModelProperty(value = "会员ID") private Long id; // 用户ID + @ApiModelProperty(value = "用户ID") private Long userId; // 会员等级ID + @ApiModelProperty(value = "会员等级ID") private Long memberLevelId; // 会员开始时间 + @ApiModelProperty(value = "会员开始时间") private Date startDate; // 会员结束时间 + @ApiModelProperty(value = "会员结束时间") private Date endDate; // 会员积分 + @ApiModelProperty(value = "会员积分") private Double points; // 订阅状态 active(活跃,连续包月)、inactive(非活跃,不连续包月)、pending(待支付)和expired(过期) + @ApiModelProperty(value = "订阅状态 active(活跃,连续包月)、inactive(非活跃,不连续包月)、pending(待支付)和expired(过期)") private MemberEnum subscriptionStatus; // 支付方式 + @ApiModelProperty(value = "支付方式") private String paymentMethod; // 上次支付时间 + @ApiModelProperty(value = "上次支付时间") private Date lastPaymentDate; // 下次计费时间 + @ApiModelProperty(value = "下次计费时间") private Date nextBillingDate; // 上次登录时间 + @ApiModelProperty(value = "上次登录时间") private Date lastLoginDate; // 状态(0:正常 1:禁用) + @ApiModelProperty(value = "状态(0:正常 1:禁用)") private String status; } diff --git a/mcwl-pay/src/main/java/com/mcwl/pay/domain/vo/PayVo.java b/mcwl-pay/src/main/java/com/mcwl/pay/domain/vo/PayVo.java index bfc0a36..1fb200b 100644 --- a/mcwl-pay/src/main/java/com/mcwl/pay/domain/vo/PayVo.java +++ b/mcwl-pay/src/main/java/com/mcwl/pay/domain/vo/PayVo.java @@ -1,12 +1,17 @@ package com.mcwl.pay.domain.vo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data +@ApiModel(value = "支付返回对象") public class PayVo { + @ApiModelProperty(value = "二维码url") private String url; + @ApiModelProperty(value = "订单号") private String orderNo; } diff --git a/mcwl-pay/src/main/java/com/mcwl/pay/service/AliPayService.java b/mcwl-pay/src/main/java/com/mcwl/pay/service/AliPayService.java index d380390..21bb746 100644 --- a/mcwl-pay/src/main/java/com/mcwl/pay/service/AliPayService.java +++ b/mcwl-pay/src/main/java/com/mcwl/pay/service/AliPayService.java @@ -2,6 +2,7 @@ package com.mcwl.pay.service; import com.alipay.api.AlipayApiException; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.pay.domain.OrderTradeDto; import com.mcwl.pay.domain.vo.PayVo; @@ -14,10 +15,10 @@ public interface AliPayService { PayVo pointsPay(Double paymentAmount) throws Exception; - AjaxResult fetch(String outBizNo, String amount) throws AlipayApiException; + R fetch(String outBizNo, String amount) throws AlipayApiException; // 查询订单状态 - AjaxResult queryTradeStatus(String outTradeNo) throws Exception; + R queryTradeStatus(String outTradeNo) throws Exception; String balance() throws AlipayApiException; diff --git a/mcwl-pay/src/main/java/com/mcwl/pay/service/impl/AliPayServiceImpl.java b/mcwl-pay/src/main/java/com/mcwl/pay/service/impl/AliPayServiceImpl.java index bb56934..3dc8b31 100644 --- a/mcwl-pay/src/main/java/com/mcwl/pay/service/impl/AliPayServiceImpl.java +++ b/mcwl-pay/src/main/java/com/mcwl/pay/service/impl/AliPayServiceImpl.java @@ -25,6 +25,7 @@ import com.alipay.easysdk.payment.common.models.AlipayTradeQueryResponse; import com.alipay.easysdk.payment.facetoface.models.AlipayTradePrecreateResponse; import com.mcwl.common.JSONUtils; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.core.redis.RedisCache; import com.mcwl.common.exception.ServiceException; @@ -279,11 +280,11 @@ public class AliPayServiceImpl implements AliPayService { */ @Override @Transactional(rollbackFor = Exception.class) - public AjaxResult fetch(String outBizNo, String amount) throws AlipayApiException { + public R fetch(String outBizNo, String amount) throws AlipayApiException { Long userId = SecurityUtils.getUserId(); SysUser sysUser = sysUserService.selectUserById(userId); if (sysUser.getWallet() < Double.parseDouble(amount)) { - return AjaxResult.error("钱包余额不足"); + return R.fail("钱包余额不足"); } // 初始化SDK @@ -315,7 +316,7 @@ public class AliPayServiceImpl implements AliPayService { .eq(SysUserPayAccount::getType, 0) .one(); if (Objects.isNull(sysUserPayAccount)) { - return AjaxResult.error("请先绑定支付宝账号"); + return R.fail("请先绑定支付宝账号"); } // 收款方信息 @@ -339,7 +340,7 @@ public class AliPayServiceImpl implements AliPayService { if (response.isSuccess()) { // 记录日志和修改用户钱包 this.addLogAndUpdateUserWallet(sysUser, amount); - return AjaxResult.success("转账成功"); + return R.ok("转账成功"); } if (response.getSubCode().equals("PAYER_BALANCE_NOT_ENOUGH")) { @@ -355,7 +356,7 @@ public class AliPayServiceImpl implements AliPayService { } @Override - public AjaxResult queryTradeStatus(String outTradeNo) throws Exception { + public R queryTradeStatus(String outTradeNo) throws Exception { // 查询redis中订单信息 String orderTradeJson = redisCache.getCacheObject(outTradeNo); @@ -365,7 +366,7 @@ public class AliPayServiceImpl implements AliPayService { } // 如果redis中存在该订单, 则直接返回该订单的支付状态 if (Objects.nonNull(orderTrade)) { - return AjaxResult.success("查询成功", orderTrade.getOrderStatus()); + return R.ok(orderTrade.getOrderStatus()); } // 查询支付宝订单 @@ -375,7 +376,7 @@ public class AliPayServiceImpl implements AliPayService { // 如果数据库中不存在该订单, 则返回订单不存在 if (Objects.isNull(orderTrade)) { - return AjaxResult.error("订单不存在"); + return R.fail("订单不存在"); } @@ -396,7 +397,7 @@ public class AliPayServiceImpl implements AliPayService { // 获取订单后缀 String suffix = code.substring(code.lastIndexOf("_") + 1); orderTradeService.orderHandler(orderTrade, suffix, params); - return AjaxResult.success("查询成功", orderTrade.getOrderStatus()); + return R.ok(orderTrade.getOrderStatus()); } long time = (System.currentTimeMillis() - orderTrade.getCreateTime().getTime()) / 1000 / 60; // time 超过15分钟,则删除redis中订单信息 @@ -408,7 +409,7 @@ public class AliPayServiceImpl implements AliPayService { } redisCache.setCacheObject(outTradeNo, JSONUtil.toJsonStr(orderTrade), 4, TimeUnit.SECONDS); - return AjaxResult.success("查询成功", orderTrade.getOrderStatus()); + return R.ok(orderTrade.getOrderStatus()); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/WorkFlowCommentVo.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/WorkFlowCommentVo.java index b874cb5..61151b8 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/WorkFlowCommentVo.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/WorkFlowCommentVo.java @@ -75,6 +75,7 @@ public class WorkFlowCommentVo { /** * 是否点赞 */ + @ApiModelProperty(value = "评论点赞数") private Integer isLike; /** diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelService.java index 29bf529..3529122 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelService.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelService.java @@ -3,6 +3,7 @@ package com.mcwl.resource.service; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.domain.IdsParam; import com.mcwl.resource.domain.ModelProduct; @@ -29,12 +30,12 @@ public interface ModelService extends IService { TableDataInfo listByPage(ModelImagePageRes imagePageRes); - AjaxResult addModel(RequestModel requestModel); + R addModel(RequestModel requestModel); void updaModel(RequestModel requestModel); - AjaxResult selectModelById(Long id); + R selectModelById(Long id); void setModelTop(Long id, boolean isTop); diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelVersionService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelVersionService.java index f98735e..4f67dae 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelVersionService.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelVersionService.java @@ -2,6 +2,7 @@ package com.mcwl.resource.service; import com.baomidou.mybatisplus.extension.service.IService; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.resource.domain.ModelVersion; import java.util.List; @@ -19,6 +20,6 @@ public interface ModelVersionService extends IService { List selectLogininforList(ModelVersion modelVersion); - AjaxResult selectByModelId(Long modelId); + R> selectByModelId(Long modelId); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/ReportService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/ReportService.java index a45b898..7d6478b 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/ReportService.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/ReportService.java @@ -1,6 +1,8 @@ package com.mcwl.resource.service; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.resource.domain.Report; import com.mcwl.resource.domain.vo.PageVo; @@ -15,7 +17,7 @@ import com.mcwl.resource.domain.vo.PageVo; public interface ReportService { void addReport(Report report); - AjaxResult selectReport(PageVo pageVo); + R> selectReport(PageVo pageVo); void deleteReport(Long id); diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/SysUserAttentionService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/SysUserAttentionService.java index 502e5da..c4430ea 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/SysUserAttentionService.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/SysUserAttentionService.java @@ -2,6 +2,7 @@ package com.mcwl.resource.service; import com.github.pagehelper.PageInfo; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.resource.domain.SysUserInfo; import com.mcwl.resource.domain.vo.PageVo; @@ -14,7 +15,7 @@ import com.mcwl.resource.domain.vo.PageVo; */ public interface SysUserAttentionService { - AjaxResult addAttention(Long userId); + R addAttention(Long userId); Boolean selectAttention(Long userId); diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowService.java index 461eb3b..362dab5 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowService.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowService.java @@ -1,7 +1,9 @@ package com.mcwl.resource.service; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.resource.domain.WorkFlow; import com.mcwl.resource.domain.dto.AddRequestWorkFlow; @@ -19,15 +21,15 @@ import java.util.List; */ public interface WorkFlowService extends IService { - AjaxResult addWorkFlow(AddRequestWorkFlow addRequestWorkFlo); + R addWorkFlow(AddRequestWorkFlow addRequestWorkFlo); void updateWorkFlow(RequestWorkFlow requestWorkFlow); void deleteWorkFlow(Long id); - AjaxResult selectWorkFlow(PageVo pageVo); + R> selectWorkFlow(PageVo pageVo); - AjaxResult selectWorkFlowById(Long id); + R selectWorkFlowById(Long id); TableDataInfo listByPage(ModelImagePageRes imagePageRes); @@ -39,5 +41,5 @@ public interface WorkFlowService extends IService { Long selectWorkFlowByName(String name); - AjaxResult selectWorkFlowVersionById(Long id); + R selectWorkFlowVersionById(Long id); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowVersionService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowVersionService.java index 14c80f3..49fb0ac 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowVersionService.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowVersionService.java @@ -1,6 +1,10 @@ package com.mcwl.resource.service; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; +import com.mcwl.resource.domain.WorkFlowVersion; + +import java.util.List; /** * 工作流版本 业务层 @@ -10,5 +14,5 @@ import com.mcwl.common.core.domain.AjaxResult; */ public interface WorkFlowVersionService { - AjaxResult selectVersionByWorkId(Long workId); + R> selectVersionByWorkId(Long workId); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java index a67f498..b06465c 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java @@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.mcwl.common.constant.DictConstants; import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.redis.RedisCache; @@ -184,7 +185,7 @@ public class ModelServiceImpl extends ServiceImpl impl } @Override - public AjaxResult addModel(RequestModel requestModel) { + public R addModel(RequestModel requestModel) { //获取封面图 String filePath = requestModel.getModelVersionList().get(0).getFilePath(); String[] split = filePath.split(","); @@ -204,7 +205,7 @@ public class ModelServiceImpl extends ServiceImpl impl //执行审核方法 audit(requestModel); - return AjaxResult.success("添加成功,等待审核"); + return R.ok("添加成功,等待审核"); } @Override @@ -427,7 +428,7 @@ public class ModelServiceImpl extends ServiceImpl impl @Override - public AjaxResult selectModelById(Long id) { + public R selectModelById(Long id) { //查询详情 ModelProduct modelProduct = postMapper.selectById(id); @@ -459,7 +460,7 @@ public class ModelServiceImpl extends ServiceImpl impl modelProduct.setActivityId(toActivityService.getById(modelProduct.getActivityId()).getActivityName()); } - return AjaxResult.success(modelProduct); + return R.ok(modelProduct); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java index 773a9e1..7836296 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.mcwl.common.constant.DictConstants; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.utils.StringUtils; import com.mcwl.resource.domain.ModelVersion; import com.mcwl.resource.mapper.ModelVersionMapper; @@ -54,7 +55,7 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo } @Override - public AjaxResult selectByModelId(Long modelId) { + public R> selectByModelId(Long modelId) { //根据模型ID查询所有的版本信息 LambdaQueryWrapper modelVersionLambdaQueryWrapper = new LambdaQueryWrapper<>(); @@ -75,7 +76,7 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo modelVersion.setHighList(arrayList); } - return AjaxResult.success(modelVersions); + return R.ok(modelVersions); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ReportServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ReportServiceImpl.java index 552505a..4103aba 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ReportServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ReportServiceImpl.java @@ -3,6 +3,7 @@ package com.mcwl.resource.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.utils.SecurityUtils; import com.mcwl.resource.domain.Report; import com.mcwl.resource.domain.vo.PageVo; @@ -37,7 +38,7 @@ public class ReportServiceImpl implements ReportService { } @Override - public AjaxResult selectReport(PageVo pageVo) { + public R> selectReport(PageVo pageVo) { Page page = new Page<>(pageVo.getPageNumber(), pageVo.getPageSize()); @@ -48,7 +49,7 @@ public class ReportServiceImpl implements ReportService { reportLambdaQueryWrapper.eq(Report::getStatus, 0); } - return AjaxResult.success(reportMapper.selectPage(page, reportLambdaQueryWrapper)); + return R.ok(reportMapper.selectPage(page, reportLambdaQueryWrapper)); } @Override diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/SysUserAttentionServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/SysUserAttentionServiceImpl.java index 5e2b386..e5d2ac3 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/SysUserAttentionServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/SysUserAttentionServiceImpl.java @@ -3,6 +3,7 @@ package com.mcwl.resource.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.utils.SecurityUtils; import com.mcwl.resource.domain.SysUserAttention; @@ -48,14 +49,14 @@ public class SysUserAttentionServiceImpl implements SysUserAttentionService { private SysUserMapper sysUserMapper; @Override - public AjaxResult addAttention(Long userId) { + public R addAttention(Long userId) { //查看是否已关注 Boolean aBoolean = selectAttention(userId); if (aBoolean == true) { //取关 sysUserAttentionMapper.deleteByUserId(SecurityUtils.getUserId(), userId); - return AjaxResult.success(false); + return R.ok(false); } //关注 @@ -65,7 +66,7 @@ public class SysUserAttentionServiceImpl implements SysUserAttentionService { .createTime(new Date()) .build(); sysUserAttentionMapper.insert(sysUserAttention); - return AjaxResult.success(true); + return R.ok(true); } @Override diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowServiceImpl.java index f407293..f691c8b 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowServiceImpl.java @@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.mcwl.common.constant.DictConstants; import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.utils.SecurityUtils; @@ -74,7 +75,7 @@ public class WorkFlowServiceImpl extends ServiceImpl i @Override - public AjaxResult addWorkFlow(AddRequestWorkFlow addRequestWorkFlo) { + public R addWorkFlow(AddRequestWorkFlow addRequestWorkFlo) { RequestWorkFlow requestWorkFlow = new RequestWorkFlow(); BeanUtil.copyProperties(addRequestWorkFlo, requestWorkFlow); @@ -99,7 +100,7 @@ public class WorkFlowServiceImpl extends ServiceImpl i audit(requestWorkFlow); - return AjaxResult.success("添加成功,等待审核"); + return R.ok(); } private void audit(RequestWorkFlow requestWorkFlow) { @@ -349,7 +350,7 @@ public class WorkFlowServiceImpl extends ServiceImpl i } @Override - public AjaxResult selectWorkFlow(PageVo pageVo) { + public R> selectWorkFlow(PageVo pageVo) { Page page = new Page<>(pageVo.getPageNumber(), pageVo.getPageSize()); @@ -365,16 +366,16 @@ public class WorkFlowServiceImpl extends ServiceImpl i lambdaQueryWrapper.select(WorkFlow::getId, WorkFlow::getWorkflowName, WorkFlow::getCoverPath); - return AjaxResult.success(flowMapper.selectPage(page, lambdaQueryWrapper)); + return R.ok(flowMapper.selectPage(page, lambdaQueryWrapper)); } @Override - public AjaxResult selectWorkFlowById(Long id) { + public R selectWorkFlowById(Long id) { //查询详情 WorkFlow workFlow = flowMapper.selectById(id); if (workFlow == null) { - return AjaxResult.error("工作流不存在"); + return R.fail("工作流不存在"); } //类别 @@ -393,7 +394,7 @@ public class WorkFlowServiceImpl extends ServiceImpl i if (sysUserAttention == null){ workFlow.setIsAttention(1); } - return AjaxResult.success(workFlow); + return R.ok(workFlow); } @@ -471,18 +472,18 @@ public class WorkFlowServiceImpl extends ServiceImpl i } @Override - public AjaxResult selectWorkFlowVersionById(Long id) { + public R selectWorkFlowVersionById(Long id) { RequestWorkFlow requestWorkFlow = new RequestWorkFlow(); WorkFlow workFlow = baseMapper.selectById(id); if (workFlow == null){ - return AjaxResult.error("数据不存在"); + return R.fail("数据不存在"); } if (workFlow.getDelFlag() == 2){ - return AjaxResult.error("数据不存在"); + return R.fail("数据不存在"); } LambdaQueryWrapper workFlowVersionLambdaQueryWrapper = new LambdaQueryWrapper<>(); @@ -491,7 +492,7 @@ public class WorkFlowServiceImpl extends ServiceImpl i List workFlowVersions = workFlowVersionMapper.selectList(workFlowVersionLambdaQueryWrapper); requestWorkFlow.setWorkFlow(workFlow); requestWorkFlow.setWorkFlowVersionList(workFlowVersions); - return AjaxResult.success(requestWorkFlow); + return R.ok(requestWorkFlow); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowVersionServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowVersionServiceImpl.java index 95bf82b..42123c9 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowVersionServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowVersionServiceImpl.java @@ -2,6 +2,7 @@ package com.mcwl.resource.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.R; import com.mcwl.resource.domain.WorkFlowVersion; import com.mcwl.resource.mapper.WorkFlowVersionMapper; import com.mcwl.resource.service.WorkFlowVersionService; @@ -24,7 +25,7 @@ public class WorkFlowVersionServiceImpl implements WorkFlowVersionService { private WorkFlowVersionMapper workFlowVersionMapper; @Override - public AjaxResult selectVersionByWorkId(Long workId) { + public R> selectVersionByWorkId(Long workId) { LambdaQueryWrapper workFlowVersionLambdaQueryWrapper = new LambdaQueryWrapper<>(); @@ -33,6 +34,6 @@ public class WorkFlowVersionServiceImpl implements WorkFlowVersionService { List workFlowVersions = workFlowVersionMapper.selectList(workFlowVersionLambdaQueryWrapper); - return AjaxResult.success(workFlowVersions); + return R.ok(workFlowVersions); } }