Merge remote-tracking branch 'origin/preview' into preview

master
ChenYan 2025-02-14 10:34:24 +08:00
commit 27fac6cf9c
55 changed files with 421 additions and 332 deletions

View File

@ -3,6 +3,7 @@ package com.mcwl.web.controller.communityCenter;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.mcwl.common.core.domain.AjaxResult; 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.PageDomain;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.Community; import com.mcwl.communityCenter.domain.Community;
@ -49,9 +50,9 @@ public class CommunityController {
*/ */
@ApiOperation(value = "添加社区") @ApiOperation(value = "添加社区")
@PostMapping("add") @PostMapping("add")
public AjaxResult addCommunity(@RequestBody @Valid CommunityRes communityRes) { public R<Object> addCommunity(@RequestBody @Valid CommunityRes communityRes) {
communityService.addCommunity(communityRes); communityService.addCommunity(communityRes);
return AjaxResult.success(); return R.ok();
} }
/** /**
@ -62,12 +63,12 @@ public class CommunityController {
*/ */
@ApiOperation(value = "删除社区") @ApiOperation(value = "删除社区")
@GetMapping("delete") @GetMapping("delete")
public AjaxResult deleteCommunity(@NotNull(message = "id不能为空") public R<Object> deleteCommunity(@NotNull(message = "id不能为空")
@ApiParam(value = "id", required = true) @ApiParam(value = "id", required = true)
@Valid @Valid
Long id) { Long id) {
communityService.removeById(id); communityService.removeById(id);
return AjaxResult.success(); return R.ok();
} }
} }

View File

@ -2,6 +2,7 @@ package com.mcwl.web.controller.communityCenter;
import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.domain.R;
import com.mcwl.common.utils.StringUtils; import com.mcwl.common.utils.StringUtils;
import com.mcwl.communityCenter.domain.Community; import com.mcwl.communityCenter.domain.Community;
import com.mcwl.communityCenter.service.InviteService; import com.mcwl.communityCenter.service.InviteService;
@ -23,7 +24,7 @@ import java.util.List;
/** /**
* *
*/ */
@Api(tags = "邀请") @Api(tags = "社区邀请")
@RestController @RestController
@RequestMapping("invite") @RequestMapping("invite")
@RequiredArgsConstructor @RequiredArgsConstructor
@ -37,15 +38,15 @@ public class InviteController {
*/ */
@ApiOperation(value = "邀请码链接") @ApiOperation(value = "邀请码链接")
@GetMapping("inviteCode") @GetMapping("inviteCode")
public AjaxResult inviteCode(@NotNull(message = "社区不能为空") public R<String> inviteCode(@NotNull(message = "社区不能为空")
@ApiParam(value = "社区", required = true) @ApiParam(value = "社区", required = true)
Long communityId) { Long communityId) {
// 获取邀请码链接 // 获取邀请码链接
String inviteCode = inviteService.getInviteCode(communityId); String inviteCode = inviteService.getInviteCode(communityId);
if (StringUtils.isBlank(inviteCode)) { 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 = "接受邀请") @ApiOperation(value = "接受邀请")
@GetMapping("acceptInvite") @GetMapping("acceptInvite")
@Valid @Valid
public AjaxResult acceptInvite(@NotNull(message = "社区不能为空") public R<Object> acceptInvite(@NotNull(message = "社区不能为空")
@ApiParam(value = "社区", required = true) @ApiParam(value = "社区", required = true)
Long communityId, Long communityId,
@NotBlank(message = "邀请码不能为空") @NotBlank(message = "邀请码不能为空")

View File

@ -2,6 +2,7 @@ package com.mcwl.web.controller.communityCenter;
import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult; 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.CommentDelRes;
import com.mcwl.communityCenter.domain.dto.CommentDetailRes; import com.mcwl.communityCenter.domain.dto.CommentDetailRes;
import com.mcwl.communityCenter.domain.dto.CommentRes; import com.mcwl.communityCenter.domain.dto.CommentRes;
@ -37,7 +38,7 @@ public class PublishCommentController extends BaseController {
*/ */
@ApiOperation(value = "添加评论") @ApiOperation(value = "添加评论")
@PostMapping("/save") @PostMapping("/save")
public AjaxResult save(@RequestBody @Valid CommentRes commentRes) { public R<Object> save(@RequestBody @Valid CommentRes commentRes) {
return publishCommentService.addComment(commentRes); return publishCommentService.addComment(commentRes);
} }
@ -51,7 +52,7 @@ public class PublishCommentController extends BaseController {
*/ */
@ApiOperation(value = "获取评论详情") @ApiOperation(value = "获取评论详情")
@PostMapping("/detail") @PostMapping("/detail")
public AjaxResult getComment(@RequestBody @Valid CommentDetailRes commentDetailRes) { public R<Object> getComment(@RequestBody @Valid CommentDetailRes commentDetailRes) {
return publishCommentService.getComment(commentDetailRes); return publishCommentService.getComment(commentDetailRes);
} }
@ -72,7 +73,7 @@ public class PublishCommentController extends BaseController {
@ApiOperation(value = "删除评论") @ApiOperation(value = "删除评论")
@PostMapping("/delete") @PostMapping("/delete")
public AjaxResult delete(@RequestBody @Valid CommentDelRes commentDelRes) { public R<Object> delete(@RequestBody @Valid CommentDelRes commentDelRes) {
return publishCommentService.removeCommentById(commentDelRes); return publishCommentService.removeCommentById(commentDelRes);
} }

View File

@ -2,6 +2,7 @@ package com.mcwl.web.controller.communityCenter;
import com.mcwl.common.core.domain.AjaxResult; 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.page.TableDataInfo;
import com.mcwl.communityCenter.domain.dto.PublishDetailRes; import com.mcwl.communityCenter.domain.dto.PublishDetailRes;
import com.mcwl.communityCenter.domain.dto.PublishPageRes; import com.mcwl.communityCenter.domain.dto.PublishPageRes;
@ -44,13 +45,13 @@ public class PublishController {
*/ */
@ApiOperation(value = "获取发布详情") @ApiOperation(value = "获取发布详情")
@PostMapping("detail") @PostMapping("detail")
public AjaxResult getPublishDetail(@RequestBody @Valid PublishDetailRes publishDetailRes) { public R<PublishVo> getPublishDetail(@RequestBody @Valid PublishDetailRes publishDetailRes) {
PublishVo publishVo = publishService.getDetail(publishDetailRes); PublishVo publishVo = publishService.getDetail(publishDetailRes);
if (Objects.isNull(publishVo)) { 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 = "发布") @ApiOperation(value = "发布")
@PostMapping("publish") @PostMapping("publish")
public AjaxResult publish(@RequestBody @Valid PublishRes publishRes) { public R<Object> publish(@RequestBody @Valid PublishRes publishRes) {
return publishService.publish(publishRes); return publishService.publish(publishRes);
} }
@ -85,8 +86,9 @@ public class PublishController {
*/ */
@ApiOperation(value = "删除") @ApiOperation(value = "删除")
@GetMapping("remove") @GetMapping("remove")
public AjaxResult deletePublish(@NotNull(message = "id不能为空") @ApiParam(value = "id") @Valid Long id) { public R<Object> deletePublish(@NotNull(message = "id不能为空") @ApiParam(value = "id") @Valid Long id) {
return AjaxResult.success(publishService.removeById(id)); publishService.removeById(id);
return R.ok();
} }
} }

View File

@ -2,6 +2,7 @@ package com.mcwl.web.controller.communityCenter;
import com.mcwl.common.core.domain.AjaxResult; 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.page.TableDataInfo;
import com.mcwl.communityCenter.domain.dto.*; import com.mcwl.communityCenter.domain.dto.*;
import com.mcwl.communityCenter.service.QuestionCommentService; import com.mcwl.communityCenter.service.QuestionCommentService;
@ -18,7 +19,7 @@ import javax.validation.Valid;
/** /**
* *
*/ */
@Api(tags = "提问评论") @Api(tags = "社区提问评论")
@RestController @RestController
@RequestMapping("questionComment") @RequestMapping("questionComment")
@RequiredArgsConstructor @RequiredArgsConstructor
@ -32,7 +33,7 @@ public class QuestionCommentController {
*/ */
@PostMapping("comment") @PostMapping("comment")
@ApiOperation(value = "新增提问评论") @ApiOperation(value = "新增提问评论")
public AjaxResult comment(@Valid @RequestBody QuestionCommentRes questionCommentRes) { public R<Object> comment(@Valid @RequestBody QuestionCommentRes questionCommentRes) {
return questionCommentService.comment(questionCommentRes); return questionCommentService.comment(questionCommentRes);
} }
@ -52,7 +53,7 @@ public class QuestionCommentController {
*/ */
@PostMapping("adopt") @PostMapping("adopt")
@ApiOperation(value = "采纳评论") @ApiOperation(value = "采纳评论")
public AjaxResult adopt(@Valid @RequestBody QuestionCommentAdoptRes questionCommentAdoptRes) { public R<Object> adopt(@Valid @RequestBody QuestionCommentAdoptRes questionCommentAdoptRes) {
return questionCommentService.adopt(questionCommentAdoptRes); return questionCommentService.adopt(questionCommentAdoptRes);
} }

View File

@ -2,6 +2,7 @@ package com.mcwl.web.controller.communityCenter;
import com.mcwl.common.core.domain.AjaxResult; 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.domain.entity.SysUser;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.SecurityUtils;
@ -24,7 +25,7 @@ import java.util.Objects;
/** /**
* *
*/ */
@Api(tags = "提问") @Api(tags = "社区提问")
@RestController @RestController
@RequestMapping("question") @RequestMapping("question")
@RequiredArgsConstructor @RequiredArgsConstructor
@ -40,7 +41,7 @@ public class QuestionController {
*/ */
@PostMapping("addQuestion") @PostMapping("addQuestion")
@ApiOperation(value = "提问") @ApiOperation(value = "提问")
public AjaxResult addQuestion(@RequestBody @Valid QuestionRes questionRes) { public R<Object> addQuestion(@RequestBody @Valid QuestionRes questionRes) {
// 提问类型 // 提问类型
Integer type = questionRes.getType(); Integer type = questionRes.getType();
@ -50,7 +51,7 @@ public class QuestionController {
// 类型为1时付费金额不能为空 // 类型为1时付费金额不能为空
if (Objects.equals(type, 1) && Objects.isNull(amount)) { if (Objects.equals(type, 1) && Objects.isNull(amount)) {
return AjaxResult.error("付费金额不能为空"); return R.fail("付费金额不能为空");
} }
// 付费类型为1时判断钱包余额是否充足 // 付费类型为1时判断钱包余额是否充足
@ -59,7 +60,7 @@ public class QuestionController {
SysUser sysUser = sysUserService.selectUserById(userId); SysUser sysUser = sysUserService.selectUserById(userId);
Double wallet = sysUser.getWallet(); Double wallet = sysUser.getWallet();
if (wallet < amount) { if (wallet < amount) {
return AjaxResult.error("钱包余额不足"); return R.fail("钱包余额不足");
} }
} else { } else {
questionRes.setAmount(0.0); questionRes.setAmount(0.0);
@ -95,12 +96,12 @@ public class QuestionController {
*/ */
@PostMapping("detail") @PostMapping("detail")
@ApiOperation(value = "获取问题详情") @ApiOperation(value = "获取问题详情")
public AjaxResult getQuestionDetail(@RequestBody @Valid QuestionDetailRes questionDetailRes) { public R<QuestionVo> getQuestionDetail(@RequestBody @Valid QuestionDetailRes questionDetailRes) {
QuestionVo questionVo = questionService.getDetail(questionDetailRes); QuestionVo questionVo = questionService.getDetail(questionDetailRes);
if (Objects.isNull(questionVo)) { if (Objects.isNull(questionVo)) {
return AjaxResult.error("获取详情失败"); return R.fail("获取详情失败");
} }
return AjaxResult.success(questionVo); return R.ok(questionVo);
} }
// /** // /**

View File

@ -1,6 +1,7 @@
package com.mcwl.web.controller.memberCenter; package com.mcwl.web.controller.memberCenter;
import com.mcwl.common.core.domain.AjaxResult; 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.domain.entity.SysUser;
import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.memberCenter.domain.MemberConsume; import com.mcwl.memberCenter.domain.MemberConsume;
@ -53,7 +54,7 @@ public class MemberController {
* @return * @return
*/ */
@PostMapping("createMember") @PostMapping("createMember")
public AjaxResult createMemberCenter(@RequestBody @Valid UserMemberDto userMemberDto) { public R<Member> createMemberCenter(@RequestBody @Valid UserMemberDto userMemberDto) {
Long userId = userMemberDto.getUserId(); Long userId = userMemberDto.getUserId();
Long memberLevelId = userMemberDto.getMemberLevelId(); Long memberLevelId = userMemberDto.getMemberLevelId();
String paymentMethod = userMemberDto.getPaymentMethod(); String paymentMethod = userMemberDto.getPaymentMethod();
@ -61,20 +62,20 @@ public class MemberController {
SysUser sysUser = sysUserService.selectUserById(userId); SysUser sysUser = sysUserService.selectUserById(userId);
if (!Optional.ofNullable(sysUser).isPresent()) { if (!Optional.ofNullable(sysUser).isPresent()) {
return AjaxResult.warn("用户不存在"); return R.fail("用户不存在");
} }
MemberLevel memberLevel = memberLevelService.getById(memberLevelId); MemberLevel memberLevel = memberLevelService.getById(memberLevelId);
if (!Optional.ofNullable(memberLevel).isPresent()) { if (!Optional.ofNullable(memberLevel).isPresent()) {
return AjaxResult.warn("会员等级不存在"); return R.fail("会员等级不存在");
} }
Member member = memberService.createUserMember(userId, memberLevelId, paymentMethod, promotionId); Member member = memberService.createUserMember(userId, memberLevelId, paymentMethod, promotionId);
if (!Optional.ofNullable(member).isPresent()) { if (!Optional.ofNullable(member).isPresent()) {
return AjaxResult.warn("创建会员失败"); return R.fail("创建会员失败");
} }
return AjaxResult.success(member); return R.ok(member);
} }
@ -85,7 +86,7 @@ public class MemberController {
*/ */
@GetMapping("getPoints") @GetMapping("getPoints")
@ApiOperation(value = "获取积分余额和历史记录") @ApiOperation(value = "获取积分余额和历史记录")
public AjaxResult getPoints() { public R<PointsVO> getPoints() {
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
SysUser sysUser = sysUserService.selectUserById(userId); SysUser sysUser = sysUserService.selectUserById(userId);
@ -109,7 +110,7 @@ public class MemberController {
pointsVO.setPoints(points); pointsVO.setPoints(points);
pointsVO.setMemberConsumeList(memberConsumeList); pointsVO.setMemberConsumeList(memberConsumeList);
return AjaxResult.success(pointsVO); return R.ok(pointsVO);
} }
@ -118,25 +119,23 @@ public class MemberController {
*/ */
@PostMapping("rechargePoints") @PostMapping("rechargePoints")
@ApiOperation(value = "会员积分充值") @ApiOperation(value = "会员积分充值")
public AjaxResult rechargePoints(@RequestBody @Valid RechargePointsDto rechargePointsDto) { public R<Object> rechargePoints(@RequestBody @Valid RechargePointsDto rechargePointsDto) {
Long userId = rechargePointsDto.getUserId(); Long userId = rechargePointsDto.getUserId();
Double amount = rechargePointsDto.getAmount(); Double amount = rechargePointsDto.getAmount();
SysUser sysUser = sysUserService.selectUserById(userId); SysUser sysUser = sysUserService.selectUserById(userId);
if (!Optional.ofNullable(sysUser).isPresent()) { if (!Optional.ofNullable(sysUser).isPresent()) {
return AjaxResult.warn("用户不存在"); return R.fail("用户不存在");
} }
Member member = memberService.rechargePoints(userId, amount * 100); Member member = memberService.rechargePoints(userId, amount * 100);
// 返回充值积分 // 返回充值积分
if (!Optional.ofNullable(member).isPresent()) { if (!Optional.ofNullable(member).isPresent()) {
return AjaxResult.warn("充值积分失败"); return R.fail("充值积分失败");
} }
rechargePointsDto.setPoints(member.getPoints()); return R.ok();
return AjaxResult.success(rechargePointsDto);
} }
@ -145,14 +144,14 @@ public class MemberController {
*/ */
@GetMapping("consumePoints/{consumePoints}") @GetMapping("consumePoints/{consumePoints}")
@ApiOperation(value = "消费积分") @ApiOperation(value = "消费积分")
public AjaxResult consumePoints(@PathVariable Double consumePoints) { public R<Object> consumePoints(@PathVariable Double consumePoints) {
if (consumePoints == null || consumePoints <= 0) { if (consumePoints == null || consumePoints <= 0) {
return AjaxResult.warn("消费积分不能为空或小于0"); return R.fail("消费积分不能为空或小于0");
} }
memberService.consumePoints(consumePoints); memberService.consumePoints(consumePoints);
return AjaxResult.success(); return R.ok();
} }
@ -162,7 +161,7 @@ public class MemberController {
*/ */
@GetMapping("calculatePayment") @GetMapping("calculatePayment")
@ApiOperation(value = "根据会员等级和活动计算支付金额") @ApiOperation(value = "根据会员等级和活动计算支付金额")
public AjaxResult calculatePayment(@Valid @NotNull(message = "请选择会员") Long memberLevelId, @RequestParam(required = false) Long promotionId) { public R<Double> calculatePayment(@Valid @NotNull(message = "请选择会员") Long memberLevelId, @RequestParam(required = false) Long promotionId) {
// 获取当前用户 // 获取当前用户
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
@ -179,7 +178,7 @@ public class MemberController {
MemberLevel memberLevel = memberLevelService.getById(memberLevelId); MemberLevel memberLevel = memberLevelService.getById(memberLevelId);
Double unitPrice = memberLevel.getUnitPrice(); Double unitPrice = memberLevel.getUnitPrice();
unitPrice = memberService.calculatePayment(unitPrice, promotionId); unitPrice = memberService.calculatePayment(unitPrice, promotionId);
return AjaxResult.success(unitPrice); return R.ok(unitPrice);
} }
/** /**
@ -187,7 +186,7 @@ public class MemberController {
*/ */
@GetMapping("isMember") @GetMapping("isMember")
@ApiOperation(value = "是否是会员") @ApiOperation(value = "是否是会员")
public AjaxResult isMember() { public R<Map<String, String>> isMember() {
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
Member member = memberService.getUseUserMemberByUserId(userId); Member member = memberService.getUseUserMemberByUserId(userId);
@ -198,11 +197,11 @@ public class MemberController {
map.put("result", "1"); map.put("result", "1");
map.put("startDate", sdf.format(startDate)); map.put("startDate", sdf.format(startDate));
map.put("endDate", sdf.format(endDate)); map.put("endDate", sdf.format(endDate));
return AjaxResult.success(map); return R.ok(map);
} }
map.put("result", "0"); map.put("result", "0");
return AjaxResult.success(map); return R.ok(map);
} }
} }

View File

@ -1,6 +1,7 @@
package com.mcwl.web.controller.memberCenter; package com.mcwl.web.controller.memberCenter;
import com.mcwl.common.core.domain.AjaxResult; 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.MemberBenefit;
import com.mcwl.memberCenter.domain.MemberLevel; import com.mcwl.memberCenter.domain.MemberLevel;
import com.mcwl.memberCenter.service.MemberBenefitService; import com.mcwl.memberCenter.service.MemberBenefitService;
@ -36,11 +37,11 @@ public class MemberLevelController {
*/ */
@GetMapping("list") @GetMapping("list")
@ApiOperation(value = "获取会员等级列表") @ApiOperation(value = "获取会员等级列表")
public AjaxResult list() { public R<List<MemberLevel>> list() {
List<MemberLevel> memberLevelList = memberLevelService.list(); List<MemberLevel> memberLevelList = memberLevelService.list();
return AjaxResult.success(memberLevelList); return R.ok(memberLevelList);
} }
@ -49,9 +50,9 @@ public class MemberLevelController {
*/ */
@GetMapping("getMemberBenefitList") @GetMapping("getMemberBenefitList")
@ApiOperation(value = "获取会员等级及权益列表") @ApiOperation(value = "获取会员等级及权益列表")
public AjaxResult getMemberBenefitList() { public R<List<MemberBenefitVO>> getMemberBenefitList() {
return AjaxResult.success(memberBenefitService.getMemberBenefitList()); return R.ok(memberBenefitService.getMemberBenefitList());
} }
} }

View File

@ -3,6 +3,7 @@ package com.mcwl.web.controller.memberCenter;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.mcwl.common.core.domain.AjaxResult; 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.SecurityUtils;
import com.mcwl.memberCenter.domain.Member; import com.mcwl.memberCenter.domain.Member;
import com.mcwl.memberCenter.domain.MemberPromotion; import com.mcwl.memberCenter.domain.MemberPromotion;
@ -46,12 +47,12 @@ public class PromotionController {
*/ */
@PostMapping("createPromotion") @PostMapping("createPromotion")
@ApiOperation(value = "创建活动") @ApiOperation(value = "创建活动")
public AjaxResult createPromotion(@RequestBody @Valid PromotionDto promotionDto) { public R<Object> createPromotion(@RequestBody @Valid PromotionDto promotionDto) {
Date startTime = promotionDto.getStartTime(); Date startTime = promotionDto.getStartTime();
Date endTime = promotionDto.getEndTime(); Date endTime = promotionDto.getEndTime();
if (startTime.after(endTime)) { if (startTime.after(endTime)) {
return AjaxResult.warn("活动开始时间不能大于结束时间"); return R.fail("活动开始时间不能大于结束时间");
} }
Promotion promotion = new Promotion(); Promotion promotion = new Promotion();
@ -59,7 +60,7 @@ public class PromotionController {
promotionService.save(promotion); promotionService.save(promotion);
return AjaxResult.success(); return R.ok();
} }
@ -68,11 +69,11 @@ public class PromotionController {
*/ */
@GetMapping("promotionList") @GetMapping("promotionList")
@ApiOperation(value = "活动列表") @ApiOperation(value = "活动列表")
public AjaxResult promotionList() { public R<List<Promotion>> promotionList() {
List<Promotion> promotionList = promotionService.lambdaQuery() List<Promotion> promotionList = promotionService.lambdaQuery()
.gt(Promotion::getEndTime, new Date()) .gt(Promotion::getEndTime, new Date())
.list(); .list();
return AjaxResult.success(promotionList); return R.ok(promotionList);
} }
/** /**
@ -80,13 +81,13 @@ public class PromotionController {
*/ */
@GetMapping("myPromotionList") @GetMapping("myPromotionList")
@ApiOperation(value = "获取当前用户参与的活动") @ApiOperation(value = "获取当前用户参与的活动")
public AjaxResult myPromotionList() { public R<List<MemberPromotion>> myPromotionList() {
// 获取当前用户 // 获取当前用户
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
List<MemberPromotion> memberPromotionList = memberPromotionService.lambdaQuery() List<MemberPromotion> memberPromotionList = memberPromotionService.lambdaQuery()
.eq(MemberPromotion::getUserId, userId) .eq(MemberPromotion::getUserId, userId)
.list(); .list();
return AjaxResult.success(memberPromotionList); return R.ok(memberPromotionList);
} }
/** /**
@ -94,7 +95,7 @@ public class PromotionController {
*/ */
@PostMapping("joinPromotion") @PostMapping("joinPromotion")
@ApiOperation(value = "参与活动") @ApiOperation(value = "参与活动")
public AjaxResult joinPromotion(@RequestBody @Valid JoinPromotionDto joinPromotionDto) { public R<Object> joinPromotion(@RequestBody @Valid JoinPromotionDto joinPromotionDto) {
// 用户id // 用户id
Long userId = joinPromotionDto.getUserId(); Long userId = joinPromotionDto.getUserId();
// 活动id // 活动id
@ -103,21 +104,21 @@ public class PromotionController {
Promotion promotion = promotionService.getById(promotionId); Promotion promotion = promotionService.getById(promotionId);
if (!Optional.ofNullable(promotion).isPresent()) { if (!Optional.ofNullable(promotion).isPresent()) {
return AjaxResult.warn("活动不存在"); return R.fail("活动不存在");
} }
if (promotion.getStartTime().after(new Date())) { if (promotion.getStartTime().after(new Date())) {
return AjaxResult.warn("活动未开始"); return R.fail("活动未开始");
} }
// 活动是否过期 // 活动是否过期
if (promotion.getEndTime().before(new Date())) { if (promotion.getEndTime().before(new Date())) {
return AjaxResult.warn("活动已过期"); return R.fail("活动已过期");
} }
// 获取当前用户是否参与过该活动 // 获取当前用户是否参与过该活动
if (isJoinPromotion(userId, promotionId)) { if (isJoinPromotion(userId, promotionId)) {
return AjaxResult.warn("您已参与过该活动"); return R.fail("您已参与过该活动");
} }
// 是否在活动期间内订阅或续订会员 // 是否在活动期间内订阅或续订会员
@ -129,13 +130,13 @@ public class PromotionController {
String memberLevelIds = promotion.getMemberLevelIds(); String memberLevelIds = promotion.getMemberLevelIds();
if (!memberLevelIds.contains(member.getMemberLevelId().toString())) { if (!memberLevelIds.contains(member.getMemberLevelId().toString())) {
return AjaxResult.warn("无法参与该活动,请查看活动条件"); return R.fail("无法参与该活动,请查看活动条件");
} }
MemberPromotion memberPromotion = getMemberPromotion(userId, promotionId); MemberPromotion memberPromotion = getMemberPromotion(userId, promotionId);
memberPromotionService.save(memberPromotion); memberPromotionService.save(memberPromotion);
return AjaxResult.success(); return R.ok();
} }
// private boolean isSubscribe(Long userId, Promotion promotion) { // private boolean isSubscribe(Long userId, Promotion promotion) {

View File

@ -2,6 +2,7 @@ package com.mcwl.web.controller.myInvitation;
import com.mcwl.common.core.domain.AjaxResult; 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.SecurityUtils;
import com.mcwl.myInvitation.domain.Invitation; import com.mcwl.myInvitation.domain.Invitation;
import com.mcwl.myInvitation.domain.dto.EarningsDisplayDto; import com.mcwl.myInvitation.domain.dto.EarningsDisplayDto;
@ -34,37 +35,38 @@ public class InvitationController {
private final InvitationService invitationService; private final InvitationService invitationService;
/** /**
* *
*
* @return * @return
*/ */
@GetMapping("/getInvitationCode") @GetMapping("/getInvitationCode")
@ApiOperation(value = "获取邀请码") @ApiOperation(value = "获取邀请码")
public AjaxResult getInvitationCode() { public R<String> getInvitationCode() {
// 获取当前用户 // 获取当前用户
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
String invitationCode = invitationService.getInvitationCode(userId); String invitationCode = invitationService.getInvitationCode(userId);
if (StringUtils.isEmpty(invitationCode)) { if (StringUtils.isEmpty(invitationCode)) {
return AjaxResult.warn("获取邀请码失败"); return R.fail("获取邀请码失败");
} }
return success("操作成功", invitationCode); return R.ok("操作成功", invitationCode);
} }
/** /**
* *
*
* @param userId id * @param userId id
* @return * @return
*/ */
@GetMapping("/list/{userId}") @GetMapping("/list/{userId}")
@ApiOperation(value = "获取邀请列表") @ApiOperation(value = "获取邀请列表")
public AjaxResult list(@PathVariable Long userId) { public R<List<Invitation>> list(@PathVariable Long userId) {
List<Invitation> list = invitationService.lambdaQuery() List<Invitation> list = invitationService.lambdaQuery()
.eq(Invitation::getUserId, userId) .eq(Invitation::getUserId, userId)
.list(); .list();
return success(list); return R.ok(list);
} }
@ -73,7 +75,7 @@ public class InvitationController {
*/ */
@GetMapping("earningsDisplay") @GetMapping("earningsDisplay")
@ApiOperation(value = "邀请人收益展示") @ApiOperation(value = "邀请人收益展示")
public AjaxResult earningsDisplay() { public R<EarningsDisplayVO> earningsDisplay() {
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
EarningsDisplayVO earningsDisplayVO = new EarningsDisplayVO(); EarningsDisplayVO earningsDisplayVO = new EarningsDisplayVO();
@ -84,16 +86,14 @@ public class InvitationController {
// 获取我的团员 // 获取我的团员
List<EarningsDisplayDto> earningsDisplay = invitationService.getEarningsDisplay(userId); List<EarningsDisplayDto> earningsDisplay = invitationService.getEarningsDisplay(userId);
if (earningsDisplay == null || earningsDisplay.isEmpty()) { if (earningsDisplay == null || earningsDisplay.isEmpty()) {
return AjaxResult.warn("暂无收益"); return R.fail("暂无收益");
} }
earningsDisplayVO.setTotalAmount(totalAmount); earningsDisplayVO.setTotalAmount(totalAmount);
earningsDisplayVO.setEarningsDisplayList(earningsDisplay); earningsDisplayVO.setEarningsDisplayList(earningsDisplay);
return success(earningsDisplayVO); return R.ok(earningsDisplayVO);
} }
} }

View File

@ -6,6 +6,7 @@ import com.alipay.easysdk.factory.Factory;
import com.mcwl.common.annotation.Anonymous; import com.mcwl.common.annotation.Anonymous;
import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult; 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.core.redis.RedisCache;
import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.ShareCodeUtils; import com.mcwl.common.utils.ShareCodeUtils;
@ -16,6 +17,7 @@ import com.mcwl.pay.service.AliPayService;
import com.mcwl.pay.service.OrderTradeService; import com.mcwl.pay.service.OrderTradeService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -65,7 +67,7 @@ public class AliPayController extends BaseController {
*/ */
@ApiOperation(value = "支付宝绑定") @ApiOperation(value = "支付宝绑定")
@GetMapping("/generateQrCode") @GetMapping("/generateQrCode")
public AjaxResult generateQrCode(HttpServletResponse response) throws Exception { public R<String> generateQrCode(HttpServletResponse response) throws Exception {
String scope = "auth_user"; // 需要获取用户信息 String scope = "auth_user"; // 需要获取用户信息
String appId = "2021005114616085"; String appId = "2021005114616085";
String state = ShareCodeUtils.idToCode(SecurityUtils.getUserId()); // 防止CSRF攻击 String state = ShareCodeUtils.idToCode(SecurityUtils.getUserId()); // 防止CSRF攻击
@ -77,7 +79,7 @@ public class AliPayController extends BaseController {
); );
// QrCodeUtil.generate(authUrl, 300, 300, "png", response.getOutputStream()); // 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") @PostMapping("/doPay")
@ApiOperation(value = "支付宝支付") @ApiOperation(value = "支付宝支付")
@ResponseBody @ResponseBody
public AjaxResult doPay(@Valid public R<PayVo> doPay(@Valid
@RequestBody @RequestBody
OrderTradeDto orderTradeDto, OrderTradeDto orderTradeDto,
HttpServletResponse response) throws Exception { HttpServletResponse response) throws Exception {
@ -129,7 +131,7 @@ public class AliPayController extends BaseController {
if ("member".equalsIgnoreCase(type)) { if ("member".equalsIgnoreCase(type)) {
if (!Optional.ofNullable(orderTradeDto.getProductId()).isPresent()) { if (!Optional.ofNullable(orderTradeDto.getProductId()).isPresent()) {
return AjaxResult.error("商品id不能为空"); return R.fail("商品id不能为空");
} }
payVo = aliPayService.memberPay(orderTradeDto); payVo = aliPayService.memberPay(orderTradeDto);
// QrCodeUtil.generate(payVo.getUrl(), 300, 300, "png", response.getOutputStream()); // QrCodeUtil.generate(payVo.getUrl(), 300, 300, "png", response.getOutputStream());
@ -139,15 +141,15 @@ public class AliPayController extends BaseController {
} else if ("wallet".equalsIgnoreCase(type)) { } else if ("wallet".equalsIgnoreCase(type)) {
// 充值金额只能是整数 // 充值金额只能是整数
if (orderTradeDto.getAmount() % 1 != 0) { if (orderTradeDto.getAmount() % 1 != 0) {
return AjaxResult.error("充值金额只能是整数"); return R.fail("充值金额只能是整数");
} }
payVo = aliPayService.walletPay(orderTradeDto.getAmount()); payVo = aliPayService.walletPay(orderTradeDto.getAmount());
// QrCodeUtil.generate(payVo.getUrl(), 300, 300, "png", response.getOutputStream()); // QrCodeUtil.generate(payVo.getUrl(), 300, 300, "png", response.getOutputStream());
} else { } 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") @GetMapping("/fetch")
@ResponseBody @ResponseBody
@ApiOperation(value = "提现") @ApiOperation(value = "提现")
public AjaxResult fetch(@Valid public R<String> fetch(@Valid
@NotNull(message = "提现金额不能为空") @NotNull(message = "提现金额不能为空")
Double amount) throws Exception { Double amount) throws Exception {
if (amount < 0.1) { if (amount < 0.1) {
return AjaxResult.error("提现金额最小为0.1"); return R.fail("提现金额最小为0.1");
} }
String outBizNo = UUID.fastUUID().toString(true); String outBizNo = UUID.fastUUID().toString(true);

View File

@ -8,6 +8,7 @@ import com.alipay.easysdk.payment.common.models.AlipayTradeQueryResponse;
import com.mcwl.common.JSONUtils; import com.mcwl.common.JSONUtils;
import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult; 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.page.TableDataInfo;
import com.mcwl.common.core.redis.RedisCache; import com.mcwl.common.core.redis.RedisCache;
import com.mcwl.common.domain.IdsParam; import com.mcwl.common.domain.IdsParam;
@ -69,15 +70,15 @@ public class OrderTradeController extends BaseController {
*/ */
@PostMapping("/add") @PostMapping("/add")
@ApiOperation(value = "新增订单") @ApiOperation(value = "新增订单")
public AjaxResult add(@RequestBody OrderTrade orderTrade) { public R<Object> add(@RequestBody OrderTrade orderTrade) {
// 获取当前用户 // 获取当前用户
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
if (userId == null) { if (userId == null) {
return AjaxResult.warn("用户未登录"); return R.fail("用户未登录");
} }
orderTrade.setUserId(userId); orderTrade.setUserId(userId);
orderTrade.setCreateBy(getUsername()); 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") @PostMapping("/upda")
@ApiOperation(value = "修改订单") @ApiOperation(value = "修改订单")
public AjaxResult upda(@RequestBody OrderTrade orderTrade) { public R<Object> upda(@RequestBody OrderTrade orderTrade) {
// 获取当前用户 // 获取当前用户
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
if (userId == null) { if (userId == null) {
return AjaxResult.warn("用户未登录"); return R.fail("用户未登录");
} }
orderTrade.setUserId(userId); orderTrade.setUserId(userId);
orderTrade.setUpdateBy(getUsername()); orderTrade.setUpdateBy(getUsername());
return toAjax(orderTradeService.updateMallProduct(orderTrade)); orderTradeService.updateMallProduct(orderTrade);
return R.ok();
} }
/** /**
@ -101,9 +103,9 @@ public class OrderTradeController extends BaseController {
*/ */
@PostMapping @PostMapping
@ApiOperation(value = "删除订单") @ApiOperation(value = "删除订单")
public AjaxResult remove(@RequestBody IdsParam ids) { public R<Object> remove(@RequestBody IdsParam ids) {
orderTradeService.deleteMallProductByIds(ids); orderTradeService.deleteMallProductByIds(ids);
return success(); return R.ok();
} }
@ -112,40 +114,25 @@ public class OrderTradeController extends BaseController {
*/ */
@GetMapping("/queryTradeStatus") @GetMapping("/queryTradeStatus")
@ApiOperation(value = "查询交易状态") @ApiOperation(value = "查询交易状态")
public AjaxResult queryTradeStatus(@Valid @NotBlank(message = "订单号不能为空") String outTradeNo) throws Exception { public R<Object> queryTradeStatus(@Valid @NotBlank(message = "订单号不能为空") String outTradeNo) throws Exception {
return aliPayService.queryTradeStatus(outTradeNo); return aliPayService.queryTradeStatus(outTradeNo);
} }
@GetMapping("/getTradStatus")
public Object getTradStatus(String outTradeNo) throws Exception {
Factory.setOptions(config);
AlipayTradeQueryResponse query = Factory.Payment.Common().query(outTradeNo);
Map<String, Object> 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") // @GetMapping("/cancelTrade")
public AjaxResult cancelTrade(String outTradeNo) throws Exception { // public AjaxResult cancelTrade(String outTradeNo) throws Exception {
// 关闭交易 // // 关闭交易
AlipayTradeCancelResponse cancel = Factory.Payment.Common().cancel(outTradeNo); // AlipayTradeCancelResponse cancel = Factory.Payment.Common().cancel(outTradeNo);
if (cancel.getCode().equals("10000")) { // if (cancel.getCode().equals("10000")) {
return AjaxResult.success("关闭成功"); // return AjaxResult.success("关闭成功");
} // }
return AjaxResult.error("关闭失败"); // return AjaxResult.error("关闭失败");
} // }
/** /**
* *

View File

@ -2,6 +2,7 @@ package com.mcwl.web.controller.resource;
import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult; 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.PageDomain;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.SecurityUtils;
@ -68,15 +69,15 @@ public class MallProductController extends BaseController {
@ApiOperation(value = "模型详情") @ApiOperation(value = "模型详情")
@PostMapping("finbyid") @PostMapping("finbyid")
public AjaxResult finbyid(@RequestBody ModelProduct modelVersion) { public R<ModelProduct> finbyid(@RequestBody ModelProduct modelVersion) {
ModelProduct modelVersion1 = modelService.getById(modelVersion.getId()); ModelProduct modelVersion1 = modelService.getById(modelVersion.getId());
return AjaxResult.success(modelVersion1); return R.ok(modelVersion1);
} }
@ApiOperation(value = "添加模型") @ApiOperation(value = "添加模型")
@PostMapping("/insert") @PostMapping("/insert")
public AjaxResult addupdateModel(@RequestBody RequestModel requestModel) { public R<String> addupdateModel(@RequestBody RequestModel requestModel) {
ModelProduct modelProduct = requestModel.getModelProduct(); ModelProduct modelProduct = requestModel.getModelProduct();
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
modelProduct.setUserId(userId); modelProduct.setUserId(userId);
@ -86,7 +87,7 @@ public class MallProductController extends BaseController {
@ApiOperation(value = "修改模型") @ApiOperation(value = "修改模型")
@PostMapping("/update") @PostMapping("/update")
public AjaxResult updateModel(@RequestBody RequestModel requestModel) { public R<Object> updateModel(@RequestBody RequestModel requestModel) {
ModelProduct modelProduct = requestModel.getModelProduct(); ModelProduct modelProduct = requestModel.getModelProduct();
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
@ -94,15 +95,15 @@ public class MallProductController extends BaseController {
modelProduct.setUpdateBy(getUsername()); modelProduct.setUpdateBy(getUsername());
modelService.updaModel(requestModel); modelService.updaModel(requestModel);
return AjaxResult.success("修改成功"); return R.ok();
} }
@ApiOperation(value = "删除模型") @ApiOperation(value = "删除模型")
@GetMapping("delete") @GetMapping("delete")
public AjaxResult delete(@Valid @NotNull(message = "模型id不能为空") Long id) { public R<Object> delete(@Valid @NotNull(message = "模型id不能为空") Long id) {
modelService.removeById(id); modelService.removeById(id);
return AjaxResult.success(); return R.ok();
} }
/** /**
@ -113,7 +114,7 @@ public class MallProductController extends BaseController {
*/ */
@ApiOperation(value = "查询模型详情") @ApiOperation(value = "查询模型详情")
@GetMapping("/selectModelById") @GetMapping("/selectModelById")
public AjaxResult selectModelById(@RequestParam Long id) { public R<ModelProduct> selectModelById(@RequestParam Long id) {
return modelService.selectModelById(id); return modelService.selectModelById(id);
} }
@ -128,9 +129,9 @@ public class MallProductController extends BaseController {
*/ */
@ApiOperation(value = "设置模型置顶状态") @ApiOperation(value = "设置模型置顶状态")
@GetMapping("/{id}/top") @GetMapping("/{id}/top")
public AjaxResult setModelTop(@PathVariable Long id, @RequestParam boolean isTop) { public R<Object> setModelTop(@PathVariable Long id, @RequestParam boolean isTop) {
modelService.setModelTop(id, isTop); modelService.setModelTop(id, isTop);
return AjaxResult.success(); return R.ok();
} }
@ -141,9 +142,9 @@ public class MallProductController extends BaseController {
*/ */
@ApiOperation(value = "获取置顶的模型列表") @ApiOperation(value = "获取置顶的模型列表")
@GetMapping @GetMapping
public ResponseEntity<List<ModelProduct>> fetchModelsSortedByTopStatus() { public R<List<ModelProduct>> fetchModelsSortedByTopStatus() {
List<ModelProduct> models = modelService.fetchModelsSortedByTopStatus(); List<ModelProduct> models = modelService.fetchModelsSortedByTopStatus();
return ResponseEntity.ok(models); return R.ok(models);
} }

View File

@ -2,6 +2,7 @@ package com.mcwl.web.controller.resource;
import com.mcwl.common.annotation.RepeatSubmit; import com.mcwl.common.annotation.RepeatSubmit;
import com.mcwl.common.core.domain.AjaxResult; 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.dto.ModelCommentRes;
import com.mcwl.resource.domain.vo.ModelCommentVo; import com.mcwl.resource.domain.vo.ModelCommentVo;
import com.mcwl.resource.service.ModelCommentLikeService; import com.mcwl.resource.service.ModelCommentLikeService;
@ -46,12 +47,12 @@ public class ModelCommentController {
@ApiOperation(value = "模型点赞/取消") @ApiOperation(value = "模型点赞/取消")
@RepeatSubmit @RepeatSubmit
@GetMapping("/modelLike") @GetMapping("/modelLike")
public AjaxResult like(@Valid public R<Object> like(@Valid
@NotNull(message = "模型id不能为空") @NotNull(message = "模型id不能为空")
@ApiParam(value = "模型id", required = true) @ApiParam(value = "模型id", required = true)
Long modelId) { Long modelId) {
modelLikeService.like(modelId); modelLikeService.like(modelId);
return AjaxResult.success(); return R.ok();
} }
@ -60,9 +61,9 @@ public class ModelCommentController {
*/ */
@ApiOperation(value = "模型评论发布") @ApiOperation(value = "模型评论发布")
@PostMapping("/comment") @PostMapping("/comment")
public AjaxResult comment(@Valid @RequestBody ModelCommentRes modelCommentRes) { public R<Object> comment(@Valid @RequestBody ModelCommentRes modelCommentRes) {
modelCommentService.comment(modelCommentRes); modelCommentService.comment(modelCommentRes);
return AjaxResult.success(); return R.ok();
} }
/** /**
@ -71,12 +72,12 @@ public class ModelCommentController {
@ApiOperation(value = "模型评论点赞/取消") @ApiOperation(value = "模型评论点赞/取消")
@RepeatSubmit @RepeatSubmit
@GetMapping("/commentLike") @GetMapping("/commentLike")
public AjaxResult commentLike(@Valid public R<Object> commentLike(@Valid
@NotNull(message = "评论id不能为空") @NotNull(message = "评论id不能为空")
@ApiParam(value = "评论id", required = true) @ApiParam(value = "评论id", required = true)
Long commentId) { Long commentId) {
modelCommentLikeService.like(commentId); modelCommentLikeService.like(commentId);
return AjaxResult.success(); return R.ok();
} }
@ -86,7 +87,7 @@ public class ModelCommentController {
@ApiOperation(value = "获取模型评论") @ApiOperation(value = "获取模型评论")
@GetMapping("/comment") @GetMapping("/comment")
@Valid @Valid
public AjaxResult getComment(@Valid public R<List<ModelCommentVo>> getComment(@Valid
@NotNull(message = "模型id不能为空") @NotNull(message = "模型id不能为空")
@ApiParam(value = "模型id", required = true) @ApiParam(value = "模型id", required = true)
Long modelId, Long modelId,
@ -95,7 +96,7 @@ public class ModelCommentController {
@ApiParam(value = "排序方式 0最热 1最新", required = true) @ApiParam(value = "排序方式 0最热 1最新", required = true)
Integer sortType) { Integer sortType) {
List<ModelCommentVo> modelCommentList = modelCommentService.getComment(modelId, sortType); List<ModelCommentVo> modelCommentList = modelCommentService.getComment(modelId, sortType);
return AjaxResult.success(modelCommentList); return R.ok(modelCommentList);
} }
@ -104,12 +105,12 @@ public class ModelCommentController {
*/ */
@ApiOperation(value = "删除模型评论") @ApiOperation(value = "删除模型评论")
@GetMapping("/commentDelete") @GetMapping("/commentDelete")
public AjaxResult commentDelete(@Valid public R<Object> commentDelete(@Valid
@NotNull(message = "评论id不能为空") @NotNull(message = "评论id不能为空")
@ApiParam(value = "评论id", required = true) @ApiParam(value = "评论id", required = true)
Long commentId) { Long commentId) {
modelCommentService.removeById(commentId); modelCommentService.removeById(commentId);
return AjaxResult.success(); return R.ok();
} }
/** /**
@ -117,12 +118,12 @@ public class ModelCommentController {
*/ */
@ApiOperation(value = "获取模型评论数量") @ApiOperation(value = "获取模型评论数量")
@GetMapping("/commentCount") @GetMapping("/commentCount")
public AjaxResult getCommentCount(@Valid public R<Integer> getCommentCount(@Valid
@NotNull(message = "模型id不能为空") @NotNull(message = "模型id不能为空")
@ApiParam(value = "模型id", required = true) @ApiParam(value = "模型id", required = true)
Long modelId) { Long modelId) {
Integer commentCount = modelCommentService.getCommentCount(modelId); Integer commentCount = modelCommentService.getCommentCount(modelId);
return AjaxResult.success(commentCount); return R.ok(commentCount);
} }
} }

View File

@ -2,6 +2,7 @@ package com.mcwl.web.controller.resource;
import com.mcwl.common.annotation.RepeatSubmit; import com.mcwl.common.annotation.RepeatSubmit;
import com.mcwl.common.core.domain.AjaxResult; 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.dto.ModelImageCommentRes;
import com.mcwl.resource.domain.vo.ModelImageCommentVo; import com.mcwl.resource.domain.vo.ModelImageCommentVo;
import com.mcwl.resource.service.ModelImageCommentLikeService; import com.mcwl.resource.service.ModelImageCommentLikeService;
@ -38,9 +39,9 @@ public class ModelImageCommentController {
*/ */
@ApiOperation(value = "图片评论发布") @ApiOperation(value = "图片评论发布")
@PostMapping("/comment") @PostMapping("/comment")
public AjaxResult comment(@Valid @RequestBody ModelImageCommentRes modelImageCommentRes) { public R<Object> comment(@Valid @RequestBody ModelImageCommentRes modelImageCommentRes) {
modelImageCommentService.comment(modelImageCommentRes); modelImageCommentService.comment(modelImageCommentRes);
return AjaxResult.success(); return R.ok();
} }
/** /**
@ -49,12 +50,12 @@ public class ModelImageCommentController {
@ApiOperation(value = "图片评论点赞/取消") @ApiOperation(value = "图片评论点赞/取消")
@RepeatSubmit @RepeatSubmit
@GetMapping("/commentLike") @GetMapping("/commentLike")
public AjaxResult commentLike(@Valid public R<Object> commentLike(@Valid
@NotNull(message = "评论id不能为空") @NotNull(message = "评论id不能为空")
@ApiParam(value = "评论id", required = true) @ApiParam(value = "评论id", required = true)
Long commentId) { Long commentId) {
modelImageCommentLikeService.like(commentId); modelImageCommentLikeService.like(commentId);
return AjaxResult.success(); return R.ok();
} }
/** /**
@ -62,11 +63,11 @@ public class ModelImageCommentController {
*/ */
@ApiOperation(value = "删除图片评论") @ApiOperation(value = "删除图片评论")
@GetMapping("/commentDelete") @GetMapping("/commentDelete")
public AjaxResult commentDelete(@Valid public R<Object> commentDelete(@Valid
@NotNull(message = "评论id不能为空") @NotNull(message = "评论id不能为空")
@ApiParam(value = "评论id", required = true) Long commentId) { @ApiParam(value = "评论id", required = true) Long commentId) {
modelImageCommentService.removeById(commentId); modelImageCommentService.removeById(commentId);
return AjaxResult.success(); return R.ok();
} }
/** /**
@ -75,7 +76,7 @@ public class ModelImageCommentController {
@ApiOperation(value = "获取图片评论") @ApiOperation(value = "获取图片评论")
@GetMapping("/comment") @GetMapping("/comment")
@Valid @Valid
public AjaxResult getComment(@Valid public R<List<ModelImageCommentVo>> getComment(@Valid
@NotNull(message = "图片id不能为空") @NotNull(message = "图片id不能为空")
@ApiParam(value = "评论id", required = true) @ApiParam(value = "评论id", required = true)
Long imageId, Long imageId,
@ -84,7 +85,7 @@ public class ModelImageCommentController {
@ApiParam(value = "排序方式 0最热 1最新", required = true) @ApiParam(value = "排序方式 0最热 1最新", required = true)
Integer sortType) { Integer sortType) {
List<ModelImageCommentVo> modelImageCommentVoList = modelImageCommentService.getComment(imageId, sortType); List<ModelImageCommentVo> modelImageCommentVoList = modelImageCommentService.getComment(imageId, sortType);
return AjaxResult.success(modelImageCommentVoList); return R.ok(modelImageCommentVoList);
} }
/** /**
@ -92,12 +93,12 @@ public class ModelImageCommentController {
*/ */
@ApiOperation(value = "获取图片评论数量") @ApiOperation(value = "获取图片评论数量")
@GetMapping("/commentCount") @GetMapping("/commentCount")
public AjaxResult getCommentCount(@Valid public R<Integer> getCommentCount(@Valid
@NotNull(message = "图片id不能为空") @NotNull(message = "图片id不能为空")
@ApiParam(value = "图片id", required = true) @ApiParam(value = "图片id", required = true)
Long imageId) { Long imageId) {
Integer commentCount = modelImageCommentService.getCommentCount(imageId); Integer commentCount = modelImageCommentService.getCommentCount(imageId);
return AjaxResult.success(commentCount); return R.ok(commentCount);
} }

View File

@ -3,6 +3,7 @@ package com.mcwl.web.controller.resource;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.mcwl.common.annotation.RepeatSubmit; import com.mcwl.common.annotation.RepeatSubmit;
import com.mcwl.common.core.domain.AjaxResult; 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.PageDomain;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.resource.domain.ModelImage; import com.mcwl.resource.domain.ModelImage;
@ -56,9 +57,9 @@ public class ModelImageController {
*/ */
@ApiOperation(value = "图片详情") @ApiOperation(value = "图片详情")
@GetMapping("/detail") @GetMapping("/detail")
public AjaxResult detail(@Valid @NotNull(message = "图片id不能为空") Long id) { public R<ModelImageVo> detail(@Valid @NotNull(message = "图片id不能为空") Long id) {
ModelImageVo modelImageVo = modelImageService.getDetail(id); ModelImageVo modelImageVo = modelImageService.getDetail(id);
return AjaxResult.success(modelImageVo); return R.ok(modelImageVo);
} }
/** /**
@ -66,9 +67,9 @@ public class ModelImageController {
*/ */
@ApiOperation(value = "图片删除") @ApiOperation(value = "图片删除")
@GetMapping("/delete") @GetMapping("/delete")
public AjaxResult delete(@Valid @NotNull(message = "图片id不能为空") Long id) { public R<Object> delete(@Valid @NotNull(message = "图片id不能为空") Long id) {
modelImageService.removeById(id); modelImageService.removeById(id);
return AjaxResult.success(); return R.ok();
} }
/** /**
@ -76,9 +77,9 @@ public class ModelImageController {
*/ */
@ApiOperation(value = "图片修改") @ApiOperation(value = "图片修改")
@PostMapping("/update") @PostMapping("/update")
public AjaxResult update(@Valid @RequestBody ModelImageRes modelImageRes) { public R<Object> update(@Valid @RequestBody ModelImageRes modelImageRes) {
modelImageService.updateById(modelImageRes); modelImageService.updateById(modelImageRes);
return AjaxResult.success(); return R.ok();
} }
@ -87,9 +88,9 @@ public class ModelImageController {
*/ */
@ApiOperation(value = "图片发布") @ApiOperation(value = "图片发布")
@PostMapping("/publish") @PostMapping("/publish")
public AjaxResult publish(@Valid @RequestBody ModelImageRes modelImageRes) { public R<Object> publish(@Valid @RequestBody ModelImageRes modelImageRes) {
modelImageService.publish(modelImageRes); modelImageService.publish(modelImageRes);
return AjaxResult.success(); return R.ok();
} }
/** /**
@ -98,9 +99,9 @@ public class ModelImageController {
@ApiOperation(value = "图片点赞/取消") @ApiOperation(value = "图片点赞/取消")
@RepeatSubmit @RepeatSubmit
@GetMapping("/imageLike") @GetMapping("/imageLike")
public AjaxResult like(@Valid @NotNull(message = "图片id不能为空") Long id) { public R<Object> like(@Valid @NotNull(message = "图片id不能为空") Long id) {
modelImageLikeService.like(id); modelImageLikeService.like(id);
return AjaxResult.success(); return R.ok();
} }
@ -113,9 +114,9 @@ public class ModelImageController {
*/ */
@ApiOperation(value = "设置图片置顶状态") @ApiOperation(value = "设置图片置顶状态")
@GetMapping("/{id}/top") @GetMapping("/{id}/top")
public AjaxResult setModelImageTop(@PathVariable Long id, @RequestParam boolean isTop) { public R<Object> setModelImageTop(@PathVariable Long id, @RequestParam boolean isTop) {
modelImageLikeService.setModelImageTop(id, isTop); modelImageLikeService.setModelImageTop(id, isTop);
return AjaxResult.success(); return R.ok();
} }
@ -126,9 +127,9 @@ public class ModelImageController {
*/ */
@ApiOperation(value = "获取置顶的图片列表") @ApiOperation(value = "获取置顶的图片列表")
@GetMapping @GetMapping
public ResponseEntity<List<ModelImage>> fetchModelImagesSortedByTopStatus() { public R<List<ModelImage>> fetchModelImagesSortedByTopStatus() {
List<ModelImage> models = modelImageLikeService.fetchModelImageSortedByTopStatus(); List<ModelImage> models = modelImageLikeService.fetchModelImageSortedByTopStatus();
return ResponseEntity.ok(models); return R.ok(models);
} }
} }

View File

@ -2,6 +2,7 @@ package com.mcwl.web.controller.resource;
import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult; 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.page.TableDataInfo;
import com.mcwl.resource.domain.ModelVersion; import com.mcwl.resource.domain.ModelVersion;
import com.mcwl.resource.service.ModelVersionService; import com.mcwl.resource.service.ModelVersionService;
@ -35,7 +36,7 @@ public class ModelVersionController extends BaseController {
* @return * @return
*/ */
@GetMapping("/selectByModelId") @GetMapping("/selectByModelId")
public AjaxResult selectByModelId(@RequestParam Long modelId){ public R<List<ModelVersion>> selectByModelId(@RequestParam Long modelId){
return modelVersionService.selectByModelId(modelId); return modelVersionService.selectByModelId(modelId);
} }
@ -52,42 +53,42 @@ public class ModelVersionController extends BaseController {
@ApiOperation(value = "模型版本详情") @ApiOperation(value = "模型版本详情")
@GetMapping("finbyid") @GetMapping("finbyid")
public AjaxResult finbyid(@RequestParam Long id) public R<ModelVersion> finbyid(@RequestParam Long id)
{ {
ModelVersion modelVersion1 = modelVersionService.getById(id); ModelVersion modelVersion1 = modelVersionService.getById(id);
return AjaxResult.success(modelVersion1); return R.ok(modelVersion1);
} }
@ApiOperation(value = "模型版本添加") @ApiOperation(value = "模型版本添加")
@PostMapping("insert") @PostMapping("insert")
public AjaxResult insert(@RequestBody ModelVersion modelVersion) public R<Object> insert(@RequestBody ModelVersion modelVersion)
{ {
modelVersionService.save(modelVersion); modelVersionService.save(modelVersion);
return AjaxResult.success(); return R.ok();
} }
@ApiOperation(value = "模型版本修改") @ApiOperation(value = "模型版本修改")
@PostMapping("update") @PostMapping("update")
public AjaxResult update(@RequestBody ModelVersion modelVersion) public R<Object> update(@RequestBody ModelVersion modelVersion)
{ {
modelVersionService.updateById(modelVersion); modelVersionService.updateById(modelVersion);
return AjaxResult.success(); return R.ok();
} }
@ApiOperation(value = "模型版本删除") @ApiOperation(value = "模型版本删除")
@PostMapping("delete") @PostMapping("delete")
public AjaxResult delete(@RequestBody ModelVersion modelVersion) public R<Object> delete(@RequestBody ModelVersion modelVersion)
{ {
modelVersionService.removeById(modelVersion.getId()); modelVersionService.removeById(modelVersion.getId());
return AjaxResult.success(); return R.ok();
} }

View File

@ -1,6 +1,8 @@
package com.mcwl.web.controller.resource; 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.AjaxResult;
import com.mcwl.common.core.domain.R;
import com.mcwl.resource.domain.Report; import com.mcwl.resource.domain.Report;
import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.service.ReportService; import com.mcwl.resource.service.ReportService;
@ -29,10 +31,10 @@ public class ReportController {
*/ */
@ApiOperation(value = "新增举报内容") @ApiOperation(value = "新增举报内容")
@PostMapping("/addReport") @PostMapping("/addReport")
public AjaxResult addReport(@RequestBody Report report){ public R<Object> addReport(@RequestBody Report report){
reportService.addReport(report); reportService.addReport(report);
return AjaxResult.success("举报成功"); return R.ok();
} }
@ -44,7 +46,7 @@ public class ReportController {
*/ */
@ApiOperation(value = "查询举报列表") @ApiOperation(value = "查询举报列表")
@PostMapping("/selectReport") @PostMapping("/selectReport")
public AjaxResult selectReport(@RequestBody PageVo pageVo){ public R<Page<Report>> selectReport(@RequestBody PageVo pageVo){
return reportService.selectReport(pageVo); return reportService.selectReport(pageVo);
@ -57,10 +59,10 @@ public class ReportController {
*/ */
@ApiOperation(value = "删除举报") @ApiOperation(value = "删除举报")
@GetMapping("/deleteReport") @GetMapping("/deleteReport")
public AjaxResult deleteReport(@RequestParam Long id){ public R<Object> deleteReport(@RequestParam Long id){
reportService.deleteReport(id); reportService.deleteReport(id);
return AjaxResult.success("删除成功"); return R.ok();
} }
/** /**
@ -70,10 +72,10 @@ public class ReportController {
*/ */
@ApiOperation(value = "修改状态") @ApiOperation(value = "修改状态")
@GetMapping("/updateStatus") @GetMapping("/updateStatus")
public AjaxResult updateStatus(@RequestParam Long id){ public R<Object> updateStatus(@RequestParam Long id){
reportService.updateStatus(id); reportService.updateStatus(id);
return AjaxResult.success("修改成功"); return R.ok();
} }
} }

View File

@ -3,6 +3,7 @@ package com.mcwl.web.controller.resource;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.mcwl.common.annotation.RepeatSubmit; import com.mcwl.common.annotation.RepeatSubmit;
import com.mcwl.common.core.domain.AjaxResult; 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.domain.entity.SysUser;
import com.mcwl.resource.domain.SysUserInfo; import com.mcwl.resource.domain.SysUserInfo;
import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.domain.vo.PageVo;
@ -34,7 +35,7 @@ public class SysUserAttentionController {
@ApiOperation(value = "添加/取消关注") @ApiOperation(value = "添加/取消关注")
@RepeatSubmit @RepeatSubmit
@GetMapping("/addAttention") @GetMapping("/addAttention")
public AjaxResult addAttention(@RequestParam Long userId) { public R<Boolean> addAttention(@RequestParam Long userId) {
return sysUserAttentionService.addAttention(userId); return sysUserAttentionService.addAttention(userId);
@ -47,11 +48,11 @@ public class SysUserAttentionController {
*/ */
@ApiOperation(value = "查询是否关注用户") @ApiOperation(value = "查询是否关注用户")
@GetMapping("/selectAttention") @GetMapping("/selectAttention")
public AjaxResult selectAttention(@RequestParam Long userId) { public R<Boolean> selectAttention(@RequestParam Long userId) {
Boolean aBoolean = sysUserAttentionService.selectAttention(userId); Boolean aBoolean = sysUserAttentionService.selectAttention(userId);
return AjaxResult.success(aBoolean); return R.ok(aBoolean);
} }
/** /**
@ -60,11 +61,11 @@ public class SysUserAttentionController {
*/ */
@ApiOperation(value = "查询个人粉丝,关注,下载量,喜欢") @ApiOperation(value = "查询个人粉丝,关注,下载量,喜欢")
@GetMapping("/selectUserInfo") @GetMapping("/selectUserInfo")
public AjaxResult selectUserInfo(){ public R<SysUserInfo> selectUserInfo(){
SysUserInfo sysUserInfo = sysUserAttentionService.selectUserInfo(); SysUserInfo sysUserInfo = sysUserAttentionService.selectUserInfo();
return AjaxResult.success(sysUserInfo); return R.ok(sysUserInfo);
} }
@ -74,11 +75,11 @@ public class SysUserAttentionController {
*/ */
@ApiOperation(value = "查询关注列表") @ApiOperation(value = "查询关注列表")
@PostMapping("/selectAttention") @PostMapping("/selectAttention")
public AjaxResult selectAttention(PageVo pageVo){ public R<PageInfo<SysUser>> selectAttention(PageVo pageVo){
PageInfo<SysUser> sysUserList = sysUserAttentionService.selectAttentionPage(pageVo); PageInfo<SysUser> sysUserList = sysUserAttentionService.selectAttentionPage(pageVo);
return AjaxResult.success(sysUserList); return R.ok(sysUserList);
} }
@ -88,10 +89,10 @@ public class SysUserAttentionController {
*/ */
@ApiOperation(value = "查询粉丝列表") @ApiOperation(value = "查询粉丝列表")
@PostMapping("/selectToAttention") @PostMapping("/selectToAttention")
public AjaxResult selectToAttention(PageVo pageVo){ public R<PageInfo<SysUser>> selectToAttention(PageVo pageVo){
PageInfo<SysUser> sysUserList = sysUserAttentionService.selectToAttentionPage(pageVo); PageInfo<SysUser> sysUserList = sysUserAttentionService.selectToAttentionPage(pageVo);
return AjaxResult.success(sysUserList); return R.ok(sysUserList);
} }
} }

View File

@ -2,6 +2,7 @@ package com.mcwl.web.controller.resource;
import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult; 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.page.TableDataInfo;
import com.mcwl.resource.domain.ToActivity; import com.mcwl.resource.domain.ToActivity;
import com.mcwl.resource.service.ToActivityService; import com.mcwl.resource.service.ToActivityService;
@ -46,41 +47,45 @@ public class ToActivityController extends BaseController {
@ApiOperation(value = "活动详情") @ApiOperation(value = "活动详情")
@PostMapping("finById") @PostMapping("finById")
public AjaxResult finById(@RequestBody ToActivity toActivity) public R<ToActivity> finById(@RequestBody ToActivity toActivity)
{ {
return AjaxResult.success(toActivityService.getById(toActivity.getId())); return R.ok(toActivityService.getById(toActivity.getId()));
} }
@ApiOperation(value = "活动添加") @ApiOperation(value = "活动添加")
@PostMapping("add") @PostMapping("add")
public AjaxResult add(@RequestBody ToActivity toActivity) public R<Object> add(@RequestBody ToActivity toActivity)
{ {
return AjaxResult.success(toActivityService.save(toActivity)); toActivityService.save(toActivity);
return R.ok();
} }
@ApiOperation(value = "活动修改") @ApiOperation(value = "活动修改")
@PostMapping("update") @PostMapping("update")
public AjaxResult update(@RequestBody ToActivity toActivity) public R<Object> update(@RequestBody ToActivity toActivity)
{ {
return AjaxResult.success(toActivityService.updateById(toActivity)); toActivityService.updateById(toActivity);
return R.ok();
} }
@ApiOperation(value = "活动删除") @ApiOperation(value = "活动删除")
@PostMapping("delete") @PostMapping("delete")
public AjaxResult delete(@RequestBody ToActivity toActivity) public R<Object> delete(@RequestBody ToActivity toActivity)
{ {
return AjaxResult.success(toActivityService.removeById(toActivity)); toActivityService.removeById(toActivity);
return R.ok();
} }
@ApiOperation(value = "活动批量删除") @ApiOperation(value = "活动批量删除")
@PostMapping("deleteByIds") @PostMapping("deleteByIds")
public AjaxResult deleteByIds(@RequestBody List<ToActivity> toActivity) public R<Object> deleteByIds(@RequestBody List<ToActivity> toActivity)
{ {
return AjaxResult.success(toActivityService.removeByIds(toActivity)); toActivityService.removeByIds(toActivity);
return R.ok();
} }

View File

@ -1,6 +1,7 @@
package com.mcwl.web.controller.resource; package com.mcwl.web.controller.resource;
import com.mcwl.common.core.domain.AjaxResult; 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.dto.WorkFlowCommentRes;
import com.mcwl.resource.domain.vo.WorkFlowCommentVo; import com.mcwl.resource.domain.vo.WorkFlowCommentVo;
import com.mcwl.resource.service.WorkFlowCommentLikeService; import com.mcwl.resource.service.WorkFlowCommentLikeService;
@ -44,12 +45,12 @@ public class WorkFlowCommentController {
*/ */
@ApiOperation(value = "工作流点赞/取消") @ApiOperation(value = "工作流点赞/取消")
@GetMapping("/like") @GetMapping("/like")
public AjaxResult like(@Valid public R<Object> like(@Valid
@NotNull(message = "模型id不能为空") @NotNull(message = "模型id不能为空")
@ApiParam(value = "模型id", required = true) @ApiParam(value = "模型id", required = true)
Long workFlowId) { Long workFlowId) {
workFlowLikeService.like(workFlowId); workFlowLikeService.like(workFlowId);
return AjaxResult.success(); return R.ok();
} }
@ -58,11 +59,11 @@ public class WorkFlowCommentController {
*/ */
@ApiOperation(value = "工作流评论发布") @ApiOperation(value = "工作流评论发布")
@PostMapping("/comment") @PostMapping("/comment")
public AjaxResult comment(@Valid public R<Object> comment(@Valid
@RequestBody @RequestBody
WorkFlowCommentRes workFlowCommentRes) { WorkFlowCommentRes workFlowCommentRes) {
workFlowCommentService.comment(workFlowCommentRes); workFlowCommentService.comment(workFlowCommentRes);
return AjaxResult.success(); return R.ok();
} }
/** /**
@ -70,12 +71,12 @@ public class WorkFlowCommentController {
*/ */
@ApiOperation(value = "工作流评论点赞/取消") @ApiOperation(value = "工作流评论点赞/取消")
@GetMapping("/commentLike") @GetMapping("/commentLike")
public AjaxResult commentLike(@Valid public R<Object> commentLike(@Valid
@NotNull(message = "评论id不能为空") @NotNull(message = "评论id不能为空")
@ApiParam(value = "评论id", required = true) @ApiParam(value = "评论id", required = true)
Long commentId) { Long commentId) {
workFlowCommentLikeService.like(commentId); workFlowCommentLikeService.like(commentId);
return AjaxResult.success(); return R.ok();
} }
@ -84,7 +85,7 @@ public class WorkFlowCommentController {
*/ */
@ApiOperation(value = "获取工作流评论") @ApiOperation(value = "获取工作流评论")
@GetMapping("/comment") @GetMapping("/comment")
public AjaxResult getComment(@Valid public R<List<WorkFlowCommentVo>> getComment(@Valid
@NotNull(message = "模型id不能为空") @NotNull(message = "模型id不能为空")
@ApiParam(value = "模型id", required = true) @ApiParam(value = "模型id", required = true)
Long commentId, Long commentId,
@ -93,7 +94,7 @@ public class WorkFlowCommentController {
@ApiParam(value = "排序方式 0最热 1最新", required = true) @ApiParam(value = "排序方式 0最热 1最新", required = true)
Integer sortType) { Integer sortType) {
List<WorkFlowCommentVo> modelCommentList = workFlowCommentService.getComment(commentId, sortType); List<WorkFlowCommentVo> modelCommentList = workFlowCommentService.getComment(commentId, sortType);
return AjaxResult.success(modelCommentList); return R.ok(modelCommentList);
} }
@ -102,12 +103,12 @@ public class WorkFlowCommentController {
*/ */
@ApiOperation(value = "删除工作流评论") @ApiOperation(value = "删除工作流评论")
@GetMapping("/commentDelete") @GetMapping("/commentDelete")
public AjaxResult commentDelete(@Valid public R<Object> commentDelete(@Valid
@NotNull(message = "评论id不能为空") @NotNull(message = "评论id不能为空")
@ApiParam(value = "评论id", required = true) @ApiParam(value = "评论id", required = true)
Long commentId) { Long commentId) {
workFlowCommentService.removeById(commentId); workFlowCommentService.removeById(commentId);
return AjaxResult.success(); return R.ok();
} }
/** /**
@ -115,12 +116,12 @@ public class WorkFlowCommentController {
*/ */
@ApiOperation(value = "获取工作流评论数量") @ApiOperation(value = "获取工作流评论数量")
@GetMapping("/commentCount") @GetMapping("/commentCount")
public AjaxResult getCommentCount(@Valid public R<Integer> getCommentCount(@Valid
@NotNull(message = "工作流id不能为空") @NotNull(message = "工作流id不能为空")
@ApiParam(value = "工作流id", required = true) @ApiParam(value = "工作流id", required = true)
Long workFlowId) { Long workFlowId) {
Integer commentCount = workFlowCommentService.getCommentCount(workFlowId); Integer commentCount = workFlowCommentService.getCommentCount(workFlowId);
return AjaxResult.success(commentCount); return R.ok(commentCount);
} }
} }

View File

@ -1,11 +1,14 @@
package com.mcwl.web.controller.resource; 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.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult; 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.WorkFlow;
import com.mcwl.resource.domain.dto.AddRequestWorkFlow; import com.mcwl.resource.domain.dto.AddRequestWorkFlow;
import com.mcwl.resource.domain.request.RequestWorkFlow; import com.mcwl.resource.domain.request.RequestWorkFlow;
import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.service.WorkFlowService;
import com.mcwl.resource.service.impl.WorkFlowServiceImpl; import com.mcwl.resource.service.impl.WorkFlowServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -21,6 +24,7 @@ import java.util.List;
/** /**
* *
*
* @AuthorChenYan * @AuthorChenYan
* @ProjectMcWl * @ProjectMcWl
* @Packagecom.mcwl.web.controller.resource * @Packagecom.mcwl.web.controller.resource
@ -35,85 +39,90 @@ public class WorkFlowController extends BaseController {
@Autowired @Autowired
private WorkFlowServiceImpl workFlowService; private WorkFlowService workFlowService;
/** /**
* *
*
* @param id * @param id
* @param isTop * @param isTop
* @return * @return
*/ */
@ApiOperation(value = "设置工作流的置顶状态") @ApiOperation(value = "设置工作流的置顶状态")
@GetMapping("/{id}/top") @GetMapping("/{id}/top")
public AjaxResult setWorkFlowTop(@PathVariable Long id, @RequestParam boolean isTop) { public R<Object> setWorkFlowTop(@PathVariable Long id, @RequestParam boolean isTop) {
workFlowService.setworkFlowTop(id, isTop); workFlowService.setworkFlowTop(id, isTop);
return AjaxResult.success(); return R.ok();
} }
/** /**
* *
*
* @return * @return
*/ */
@ApiOperation(value = "获取置顶的模型列表") @ApiOperation(value = "获取置顶的模型列表")
@GetMapping @GetMapping
public ResponseEntity<List<WorkFlow>> fetchWorkFlowSortedByTopStatus() { public R<List<WorkFlow>> fetchWorkFlowSortedByTopStatus() {
List<WorkFlow> models = workFlowService.fetchWorkFlowSortedByTopStatus(); List<WorkFlow> models = workFlowService.fetchWorkFlowSortedByTopStatus();
return ResponseEntity.ok(models); return R.ok(models);
} }
/** /**
* *
*
* @param addRequestWorkFlow * @param addRequestWorkFlow
* @return * @return
*/ */
@ApiOperation(value = "添加工作流") @ApiOperation(value = "添加工作流")
@PostMapping("/addWorkFlow") @PostMapping("/addWorkFlow")
public AjaxResult addWorkFlow(@Validated @RequestBody AddRequestWorkFlow addRequestWorkFlow){ public R<Object> addWorkFlow(@Validated @RequestBody AddRequestWorkFlow addRequestWorkFlow) {
return workFlowService.addWorkFlow(addRequestWorkFlow); return workFlowService.addWorkFlow(addRequestWorkFlow);
} }
/** /**
* *
*
* @param requestWorkFlow * @param requestWorkFlow
* @return * @return
*/ */
@ApiOperation(value = "修改工作流") @ApiOperation(value = "修改工作流")
@PostMapping("/updateWorkFlow") @PostMapping("/updateWorkFlow")
public AjaxResult updateWorkFlow(@RequestBody RequestWorkFlow requestWorkFlow){ public R<Object> updateWorkFlow(@RequestBody RequestWorkFlow requestWorkFlow) {
workFlowService.updateWorkFlow(requestWorkFlow); workFlowService.updateWorkFlow(requestWorkFlow);
return AjaxResult.success("修改成功"); return R.ok();
} }
/** /**
* *
*
* @param id * @param id
* @return * @return
*/ */
@ApiOperation(value = "删除工作流") @ApiOperation(value = "删除工作流")
@GetMapping("/deleteWorkFlow") @GetMapping("/deleteWorkFlow")
public AjaxResult deleteWorkFlow(@RequestParam @Valid @NotNull(message = "工作流id不能为空") Long id){ public R<Object> deleteWorkFlow(@RequestParam @Valid @NotNull(message = "工作流id不能为空") Long id) {
workFlowService.deleteWorkFlow(id); workFlowService.deleteWorkFlow(id);
return AjaxResult.success("删除成功"); return R.ok();
} }
/** /**
* *
*
* @param pageVo * @param pageVo
* @return * @return
*/ */
@ApiOperation(value = "查询工作流列表") @ApiOperation(value = "查询工作流列表")
@PostMapping("/selectWorkFlow") @PostMapping("/selectWorkFlow")
public AjaxResult selectWorkFlow(@RequestBody PageVo pageVo){ public R<Page<WorkFlow>> selectWorkFlow(@RequestBody PageVo pageVo) {
return workFlowService.selectWorkFlow(pageVo); return workFlowService.selectWorkFlow(pageVo);
} }
@ -121,37 +130,40 @@ public class WorkFlowController extends BaseController {
/** /**
* *
*
* @param id * @param id
* @return * @return
*/ */
@ApiOperation(value = "查询工作流详情") @ApiOperation(value = "查询工作流详情")
@GetMapping("/selectWorkFlowById") @GetMapping("/selectWorkFlowById")
public AjaxResult selectWorkFlowById(@RequestParam @Valid @NotNull(message = "工作流id不能为空") Long id){ public R<WorkFlow> selectWorkFlowById(@RequestParam @Valid @NotNull(message = "工作流id不能为空") Long id) {
return workFlowService.selectWorkFlowById(id); return workFlowService.selectWorkFlowById(id);
} }
/** /**
* *
*
* @param name * @param name
* @return * @return
*/ */
@ApiOperation(value = "校验名字是否重复") @ApiOperation(value = "校验名字是否重复")
@GetMapping("/selectWorkFlowByName") @GetMapping("/selectWorkFlowByName")
public AjaxResult selectWorkFlowByName(@RequestParam String name){ public R<Long> selectWorkFlowByName(@RequestParam String name) {
Long sign = workFlowService.selectWorkFlowByName(name); Long sign = workFlowService.selectWorkFlowByName(name);
return AjaxResult.success(sign); return R.ok(sign);
} }
/** /**
* *
*
* @return * @return
*/ */
@ApiOperation(value = "工作流回显接口") @ApiOperation(value = "工作流回显接口")
@GetMapping("/selectWorkFlowVersionById") @GetMapping("/selectWorkFlowVersionById")
public AjaxResult selectWorkFlowVersionById(@RequestParam @Valid @NotNull(message = "图片id不能为空") Long id){ public R<RequestWorkFlow> selectWorkFlowVersionById(@RequestParam @Valid @NotNull(message = "图片id不能为空") Long id) {
return workFlowService.selectWorkFlowVersionById(id); return workFlowService.selectWorkFlowVersionById(id);
} }

View File

@ -1,6 +1,9 @@
package com.mcwl.web.controller.resource; package com.mcwl.web.controller.resource;
import com.mcwl.common.core.domain.AjaxResult; 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 com.mcwl.resource.service.impl.WorkFlowVersionServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; 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.RequestParam;
import org.springframework.web.bind.annotation.RestController; 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 { public class WorkFlowVersionController {
@Autowired @Autowired
private WorkFlowVersionServiceImpl workFlowVersionService; private WorkFlowVersionService workFlowVersionService;
/** /**
* *
@ -33,7 +38,7 @@ public class WorkFlowVersionController {
*/ */
@ApiOperation(value = "查询工作流下的所有版本信息") @ApiOperation(value = "查询工作流下的所有版本信息")
@GetMapping("/selectVersionByWorkId") @GetMapping("/selectVersionByWorkId")
public AjaxResult selectVersionByWorkId(@RequestParam Long workId) { public R<List<WorkFlowVersion>> selectVersionByWorkId(@RequestParam Long workId) {
return workFlowVersionService.selectVersionByWorkId(workId); return workFlowVersionService.selectVersionByWorkId(workId);
} }

View File

@ -2,12 +2,15 @@ package com.mcwl.common.core.domain;
import java.io.Serializable; import java.io.Serializable;
import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.constant.HttpStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/** /**
* *
* *
* @author mcwl * @author mcwl
*/ */
@ApiModel(value = "响应结果")
public class R<T> implements Serializable public class R<T> implements Serializable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -18,10 +21,13 @@ public class R<T> implements Serializable
/** 失败 */ /** 失败 */
public static final int FAIL = HttpStatus.ERROR; public static final int FAIL = HttpStatus.ERROR;
@ApiModelProperty(value = "状态码")
private int code; private int code;
@ApiModelProperty(value = "提示信息")
private String msg; private String msg;
@ApiModelProperty(value = "数据对象")
private T data; private T data;
public static <T> R<T> ok() public static <T> R<T> ok()

View File

@ -2,6 +2,7 @@ package com.mcwl.communityCenter.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.domain.AjaxResult; 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.PageDomain;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.Invite; import com.mcwl.communityCenter.domain.Invite;
@ -26,5 +27,5 @@ public interface InviteService extends IService<Invite> {
* @param inviteCode * @param inviteCode
* @return * @return
*/ */
AjaxResult acceptInvite(@NotNull(message = "communityId不能为空") Long communityId, @NotBlank(message = "inviteCode不能为空") String inviteCode); R<Object> acceptInvite(@NotNull(message = "communityId不能为空") Long communityId, @NotBlank(message = "inviteCode不能为空") String inviteCode);
} }

View File

@ -2,6 +2,7 @@ package com.mcwl.communityCenter.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.domain.AjaxResult; 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.CommentDelRes;
import com.mcwl.communityCenter.domain.dto.CommentDetailRes; import com.mcwl.communityCenter.domain.dto.CommentDetailRes;
import com.mcwl.communityCenter.domain.dto.CommentRes; import com.mcwl.communityCenter.domain.dto.CommentRes;
@ -27,9 +28,9 @@ public interface PublishCommentService extends IService<PublishComment> {
* @param commentDetailRes * @param commentDetailRes
* @return * @return
*/ */
AjaxResult getComment(CommentDetailRes commentDetailRes); R<Object> getComment(CommentDetailRes commentDetailRes);
AjaxResult addComment(CommentRes commentRes); R<Object> addComment(CommentRes commentRes);
AjaxResult removeCommentById(CommentDelRes commentDelRes); R<Object> removeCommentById(CommentDelRes commentDelRes);
} }

View File

@ -2,6 +2,7 @@ package com.mcwl.communityCenter.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.domain.AjaxResult; 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.PageDomain;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.communityCenter.domain.Community; import com.mcwl.communityCenter.domain.Community;
@ -23,7 +24,7 @@ public interface PublishService extends IService<Publish> {
* *
* @param publishRes * @param publishRes
*/ */
AjaxResult publish(PublishRes publishRes); R<Object> publish(PublishRes publishRes);
TableDataInfo getPublishList(PublishPageRes publishPageRes); TableDataInfo getPublishList(PublishPageRes publishPageRes);

View File

@ -2,6 +2,7 @@ package com.mcwl.communityCenter.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.domain.AjaxResult; 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.page.TableDataInfo;
import com.mcwl.communityCenter.domain.Question; import com.mcwl.communityCenter.domain.Question;
import com.mcwl.communityCenter.domain.QuestionComment; import com.mcwl.communityCenter.domain.QuestionComment;
@ -12,9 +13,9 @@ import javax.validation.Valid;
public interface QuestionCommentService extends IService<QuestionComment> { public interface QuestionCommentService extends IService<QuestionComment> {
AjaxResult comment(@Valid QuestionCommentRes questionCommentRes); R<Object> comment(@Valid QuestionCommentRes questionCommentRes);
TableDataInfo listByPage(@Valid QuestionCommentPageRes questionCommentPageRes); TableDataInfo listByPage(@Valid QuestionCommentPageRes questionCommentPageRes);
AjaxResult adopt(@Valid QuestionCommentAdoptRes questionCommentAdoptRes); R<Object> adopt(@Valid QuestionCommentAdoptRes questionCommentAdoptRes);
} }

View File

@ -2,6 +2,7 @@ package com.mcwl.communityCenter.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.domain.AjaxResult; 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.page.TableDataInfo;
import com.mcwl.communityCenter.domain.Question; import com.mcwl.communityCenter.domain.Question;
import com.mcwl.communityCenter.domain.dto.QuestionDetailRes; import com.mcwl.communityCenter.domain.dto.QuestionDetailRes;
@ -19,7 +20,7 @@ public interface QuestionService extends IService<Question> {
* *
* @param questionRes * @param questionRes
*/ */
AjaxResult addQuestion(QuestionRes questionRes); R<Object> addQuestion(QuestionRes questionRes);
TableDataInfo list(QuestionPageRes questionPageRes); TableDataInfo list(QuestionPageRes questionPageRes);

View File

@ -3,6 +3,7 @@ package com.mcwl.communityCenter.service.impl;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.core.domain.AjaxResult; 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.SecurityUtils;
import com.mcwl.common.utils.ShareCodeUtils; import com.mcwl.common.utils.ShareCodeUtils;
import com.mcwl.communityCenter.constant.InviteConstant; import com.mcwl.communityCenter.constant.InviteConstant;
@ -61,17 +62,17 @@ public class InviteServiceImpl extends ServiceImpl<InviteMapper, Invite> impleme
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult acceptInvite(Long communityId, String inviteCode) { public R<Object> acceptInvite(Long communityId, String inviteCode) {
// 解析邀请码 // 解析邀请码
Long userId = ShareCodeUtils.codeToId(inviteCode); Long userId = ShareCodeUtils.codeToId(inviteCode);
if (Objects.isNull(userId)) { if (Objects.isNull(userId)) {
return AjaxResult.error("邀请码有误"); return R.fail("邀请码有误");
} }
// 判断是否是同一个人 // 判断是否是同一个人
if (Objects.equals(userId, SecurityUtils.getUserId())) { if (Objects.equals(userId, SecurityUtils.getUserId())) {
return AjaxResult.error("不能邀请自己"); return R.fail("不能邀请自己");
} }
// 查询邀请码 // 查询邀请码
@ -83,13 +84,13 @@ public class InviteServiceImpl extends ServiceImpl<InviteMapper, Invite> impleme
.one(); .one();
if (Objects.isNull(inviteCodeMapping)) { if (Objects.isNull(inviteCodeMapping)) {
return AjaxResult.error("没查询到该邀请码"); return R.fail("没查询到该邀请码");
} }
// 判断是否已经邀请过 // 判断是否已经邀请过
Invite inv = inviteMapper.isInvite(userId, communityId, SecurityUtils.getUserId()); Invite inv = inviteMapper.isInvite(userId, communityId, SecurityUtils.getUserId());
if (Objects.nonNull(inv)) { if (Objects.nonNull(inv)) {
return AjaxResult.error("不能重复邀请"); return R.fail("不能重复邀请");
} }
@ -103,6 +104,6 @@ public class InviteServiceImpl extends ServiceImpl<InviteMapper, Invite> impleme
invite.setType(InviteConstant.INVITE_ADMIN); invite.setType(InviteConstant.INVITE_ADMIN);
invite.setFeeType(InviteConstant.INVITE_FEE); invite.setFeeType(InviteConstant.INVITE_FEE);
baseMapper.insert(invite); baseMapper.insert(invite);
return AjaxResult.success("邀请成功"); return R.ok(null, "邀请成功");
} }
} }

View File

@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.core.domain.AjaxResult; 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.domain.entity.SysUser;
import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.communityCenter.domain.Publish; import com.mcwl.communityCenter.domain.Publish;
@ -51,7 +52,7 @@ public class PublishCommentServiceImpl extends ServiceImpl<PublishCommentMapper,
private final PublishMapper publishMapper; private final PublishMapper publishMapper;
@Override @Override
public AjaxResult getComment(CommentDetailRes commentDetailRes) { public R<Object> getComment(CommentDetailRes commentDetailRes) {
Long tenantId = commentDetailRes.getTenantId(); Long tenantId = commentDetailRes.getTenantId();
Long communityId = commentDetailRes.getCommunityId(); Long communityId = commentDetailRes.getCommunityId();
Long operatorId = commentDetailRes.getOperatorId(); Long operatorId = commentDetailRes.getOperatorId();
@ -69,18 +70,18 @@ public class PublishCommentServiceImpl extends ServiceImpl<PublishCommentMapper,
commentVo.setUserAvatar(sysUser.getAvatar()); commentVo.setUserAvatar(sysUser.getAvatar());
} }
return AjaxResult.success(commentVoList); return R.ok(commentVoList);
} }
@Override @Override
public AjaxResult addComment(CommentRes commentRes) { public R<Object> addComment(CommentRes commentRes) {
Long tenantId = commentRes.getTenantId(); Long tenantId = commentRes.getTenantId();
Long communityId = commentRes.getCommunityId(); Long communityId = commentRes.getCommunityId();
Long operatorId = commentRes.getOperatorId(); Long operatorId = commentRes.getOperatorId();
Publish publish = publishMapper.selectByIdAndTenantIdAndCommunityId(operatorId, tenantId, communityId); Publish publish = publishMapper.selectByIdAndTenantIdAndCommunityId(operatorId, tenantId, communityId);
if (Objects.isNull(publish)) { if (Objects.isNull(publish)) {
return AjaxResult.error("评论失败,该内容不存在"); return R.fail("评论失败,该内容不存在");
} }
PublishComment publishComment = new PublishComment(); PublishComment publishComment = new PublishComment();
@ -91,11 +92,11 @@ public class PublishCommentServiceImpl extends ServiceImpl<PublishCommentMapper,
publishCommentMapper.insert(publishComment); publishCommentMapper.insert(publishComment);
return AjaxResult.success("评论成功"); return R.ok(null, "评论成功");
} }
@Override @Override
public AjaxResult removeCommentById(CommentDelRes commentDelRes) { public R<Object> removeCommentById(CommentDelRes commentDelRes) {
Long id = commentDelRes.getId(); Long id = commentDelRes.getId();
Long tenantId = commentDelRes.getTenantId(); Long tenantId = commentDelRes.getTenantId();
Long communityId = commentDelRes.getCommunityId(); Long communityId = commentDelRes.getCommunityId();
@ -104,12 +105,12 @@ public class PublishCommentServiceImpl extends ServiceImpl<PublishCommentMapper,
PublishComment publishComment = publishCommentMapper.selectByIdAndTenantIdAndCommunityIdAndOperatorId(id, tenantId, communityId, operatorId); PublishComment publishComment = publishCommentMapper.selectByIdAndTenantIdAndCommunityIdAndOperatorId(id, tenantId, communityId, operatorId);
if (Objects.isNull(publishComment)) { if (Objects.isNull(publishComment)) {
return AjaxResult.error("删除失败,该评论不存在"); return R.fail("删除失败,该评论不存在");
} }
publishCommentMapper.deleteByIdAndTenantIdAndCommunityIdAndOperatorId(id, tenantId, communityId, operatorId); publishCommentMapper.deleteByIdAndTenantIdAndCommunityIdAndOperatorId(id, tenantId, communityId, operatorId);
return AjaxResult.success("删除成功"); return R.ok(null, "删除成功");
} }
} }

View File

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.AjaxResult; 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.domain.entity.SysUser;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.SecurityUtils;
@ -65,14 +66,14 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
} }
@Override @Override
public AjaxResult publish(PublishRes publishRes) { public R<Object> publish(PublishRes publishRes) {
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
Community community = communityMapper.getByTenantIdAndCommunityId(publishRes.getTenantId(), publishRes.getCommunityId()); Community community = communityMapper.getByTenantIdAndCommunityId(publishRes.getTenantId(), publishRes.getCommunityId());
if (Objects.isNull(community)) { if (Objects.isNull(community)) {
return AjaxResult.error(HttpStatus.ERROR, "用户社区未创建"); return R.fail("用户社区未创建");
} }
@ -82,7 +83,7 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
if (!Objects.equals(userId, publishRes.getTenantId())) { if (!Objects.equals(userId, publishRes.getTenantId())) {
// 判断用户是否被邀请 // 判断用户是否被邀请
if (invites.isEmpty() || !invites.contains(userId)) { if (invites.isEmpty() || !invites.contains(userId)) {
return AjaxResult.error(HttpStatus.ERROR, "您没有被邀请"); return R.fail("您没有被邀请");
} }
} }
Publish publish = new Publish(); Publish publish = new Publish();
@ -92,7 +93,7 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
publish.setPublishTime(new Date()); publish.setPublishTime(new Date());
} }
baseMapper.insert(publish); baseMapper.insert(publish);
return AjaxResult.success(); return R.ok();
} }
@Override @Override

View File

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.AjaxResult; 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.domain.entity.SysUser;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.SecurityUtils;
@ -38,7 +39,7 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
private final ISysUserService sysUserService; private final ISysUserService sysUserService;
@Override @Override
public AjaxResult comment(QuestionCommentRes questionCommentRes) { public R<Object> comment(QuestionCommentRes questionCommentRes) {
Long tenantId = questionCommentRes.getTenantId(); Long tenantId = questionCommentRes.getTenantId();
Long communityId = questionCommentRes.getCommunityId(); Long communityId = questionCommentRes.getCommunityId();
@ -47,7 +48,7 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
Question question = questionMapper.selectByIdAndTenantIdAndCommunityId(questionId, tenantId, communityId); Question question = questionMapper.selectByIdAndTenantIdAndCommunityId(questionId, tenantId, communityId);
if (Objects.isNull(question)) { if (Objects.isNull(question)) {
return AjaxResult.error("提问不存在"); return R.fail("提问不存在");
} }
QuestionComment questionComment = new QuestionComment(); QuestionComment questionComment = new QuestionComment();
@ -57,7 +58,7 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
baseMapper.insert(questionComment); baseMapper.insert(questionComment);
return AjaxResult.success("评论成功"); return R.ok(null, "评论成功");
} }
@ -88,7 +89,7 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult adopt(QuestionCommentAdoptRes questionCommentAdoptRes) { public R<Object> adopt(QuestionCommentAdoptRes questionCommentAdoptRes) {
Long tenantId = questionCommentAdoptRes.getTenantId(); Long tenantId = questionCommentAdoptRes.getTenantId();
Long communityId = questionCommentAdoptRes.getCommunityId(); Long communityId = questionCommentAdoptRes.getCommunityId();
@ -97,25 +98,25 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
Question question = questionMapper.selectByIdAndTenantIdAndCommunityId(questionId, tenantId, communityId); Question question = questionMapper.selectByIdAndTenantIdAndCommunityId(questionId, tenantId, communityId);
if (Objects.isNull(question)) { if (Objects.isNull(question)) {
return AjaxResult.error("提问不存在"); return R.fail("提问不存在");
} }
if (question.getStatus() == 1) { if (question.getStatus() == 1) {
return AjaxResult.error("该提问已解决"); return R.fail("该提问已解决");
} }
QuestionComment questionComment = baseMapper.selectByIdAndTenantIdAndCommunityIdAndQuestionIdAndCommentId(tenantId, communityId, questionId, commentId); QuestionComment questionComment = baseMapper.selectByIdAndTenantIdAndCommunityIdAndQuestionIdAndCommentId(tenantId, communityId, questionId, commentId);
if (Objects.isNull(questionComment)) { if (Objects.isNull(questionComment)) {
return AjaxResult.error("评论不存在"); return R.fail("评论不存在");
} }
if (questionComment.getIsAccept() == 1) { if (questionComment.getIsAccept() == 1) {
return AjaxResult.error("该评论已被采纳"); return R.fail("该评论已被采纳");
} }
Long questionUserId = question.getQuestionUserId(); Long questionUserId = question.getQuestionUserId();
if (questionComment.getUserId().equals(questionUserId)) { if (questionComment.getUserId().equals(questionUserId)) {
return AjaxResult.error("您不能采纳自己的评论"); return R.fail("您不能采纳自己的评论");
} }
questionComment.setIsAccept(1); questionComment.setIsAccept(1);
@ -135,7 +136,7 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
sysUserService.updateUser(sysUser); sysUserService.updateUser(sysUser);
return AjaxResult.success(); return R.ok();
} }

View File

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.AjaxResult; 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.domain.entity.SysUser;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.SecurityUtils;
@ -58,7 +59,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult addQuestion(QuestionRes questionRes) { public R<Object> addQuestion(QuestionRes questionRes) {
Long communityId = questionRes.getCommunityId(); Long communityId = questionRes.getCommunityId();
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
@ -68,7 +69,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
Community community = communityMapper.getByTenantIdAndCommunityId(tenantId, communityId); Community community = communityMapper.getByTenantIdAndCommunityId(tenantId, communityId);
if (Objects.isNull(community)) { if (Objects.isNull(community)) {
return AjaxResult.error("租户或社区不存在"); return R.fail("租户或社区不存在");
} }
// if (Objects.equals(tenantId, userId)) { // if (Objects.equals(tenantId, userId)) {
@ -108,7 +109,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
// communityAdviceMapper.insert(communityAdvice); // communityAdviceMapper.insert(communityAdvice);
return AjaxResult.success(); return R.ok();
} }

View File

@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.mcwl.common.core.domain.BaseEntity; import com.mcwl.common.core.domain.BaseEntity;
import com.mcwl.memberCenter.enums.MemberEnum; import com.mcwl.memberCenter.enums.MemberEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -16,42 +18,55 @@ import java.util.Date;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@TableName("mem_member") @TableName("mem_member")
@ApiModel(description = "会员表")
public class Member extends BaseEntity { public class Member extends BaseEntity {
@TableId @TableId
@ApiModelProperty(value = "会员ID")
private Long id; private Long id;
// 用户ID // 用户ID
@ApiModelProperty(value = "用户ID")
private Long userId; private Long userId;
// 会员等级ID // 会员等级ID
@ApiModelProperty(value = "会员等级ID")
private Long memberLevelId; private Long memberLevelId;
// 会员开始时间 // 会员开始时间
@ApiModelProperty(value = "会员开始时间")
private Date startDate; private Date startDate;
// 会员结束时间 // 会员结束时间
@ApiModelProperty(value = "会员结束时间")
private Date endDate; private Date endDate;
// 会员积分 // 会员积分
@ApiModelProperty(value = "会员积分")
private Double points; private Double points;
// 订阅状态 active活跃连续包月、inactive非活跃不连续包月、pending待支付和expired过期 // 订阅状态 active活跃连续包月、inactive非活跃不连续包月、pending待支付和expired过期
@ApiModelProperty(value = "订阅状态 active活跃连续包月、inactive非活跃不连续包月、pending待支付和expired过期")
private MemberEnum subscriptionStatus; private MemberEnum subscriptionStatus;
// 支付方式 // 支付方式
@ApiModelProperty(value = "支付方式")
private String paymentMethod; private String paymentMethod;
// 上次支付时间 // 上次支付时间
@ApiModelProperty(value = "上次支付时间")
private Date lastPaymentDate; private Date lastPaymentDate;
// 下次计费时间 // 下次计费时间
@ApiModelProperty(value = "下次计费时间")
private Date nextBillingDate; private Date nextBillingDate;
// 上次登录时间 // 上次登录时间
@ApiModelProperty(value = "上次登录时间")
private Date lastLoginDate; private Date lastLoginDate;
// 状态(0:正常 1:禁用) // 状态(0:正常 1:禁用)
@ApiModelProperty(value = "状态(0:正常 1:禁用)")
private String status; private String status;
} }

View File

@ -1,12 +1,17 @@
package com.mcwl.pay.domain.vo; package com.mcwl.pay.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@Data @Data
@ApiModel(value = "支付返回对象")
public class PayVo { public class PayVo {
@ApiModelProperty(value = "二维码url")
private String url; private String url;
@ApiModelProperty(value = "订单号")
private String orderNo; private String orderNo;
} }

View File

@ -2,6 +2,7 @@ package com.mcwl.pay.service;
import com.alipay.api.AlipayApiException; import com.alipay.api.AlipayApiException;
import com.mcwl.common.core.domain.AjaxResult; 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.OrderTradeDto;
import com.mcwl.pay.domain.vo.PayVo; import com.mcwl.pay.domain.vo.PayVo;
@ -14,10 +15,10 @@ public interface AliPayService {
PayVo pointsPay(Double paymentAmount) throws Exception; PayVo pointsPay(Double paymentAmount) throws Exception;
AjaxResult fetch(String outBizNo, String amount) throws AlipayApiException; R<String> fetch(String outBizNo, String amount) throws AlipayApiException;
// 查询订单状态 // 查询订单状态
AjaxResult queryTradeStatus(String outTradeNo) throws Exception; R<Object> queryTradeStatus(String outTradeNo) throws Exception;
String balance() throws AlipayApiException; String balance() throws AlipayApiException;

View File

@ -25,6 +25,7 @@ import com.alipay.easysdk.payment.common.models.AlipayTradeQueryResponse;
import com.alipay.easysdk.payment.facetoface.models.AlipayTradePrecreateResponse; import com.alipay.easysdk.payment.facetoface.models.AlipayTradePrecreateResponse;
import com.mcwl.common.JSONUtils; import com.mcwl.common.JSONUtils;
import com.mcwl.common.core.domain.AjaxResult; 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.domain.entity.SysUser;
import com.mcwl.common.core.redis.RedisCache; import com.mcwl.common.core.redis.RedisCache;
import com.mcwl.common.exception.ServiceException; import com.mcwl.common.exception.ServiceException;
@ -279,11 +280,11 @@ public class AliPayServiceImpl implements AliPayService {
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult fetch(String outBizNo, String amount) throws AlipayApiException { public R<String> fetch(String outBizNo, String amount) throws AlipayApiException {
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
SysUser sysUser = sysUserService.selectUserById(userId); SysUser sysUser = sysUserService.selectUserById(userId);
if (sysUser.getWallet() < Double.parseDouble(amount)) { if (sysUser.getWallet() < Double.parseDouble(amount)) {
return AjaxResult.error("钱包余额不足"); return R.fail("钱包余额不足");
} }
// 初始化SDK // 初始化SDK
@ -315,9 +316,12 @@ public class AliPayServiceImpl implements AliPayService {
.eq(SysUserPayAccount::getType, 0) .eq(SysUserPayAccount::getType, 0)
.one(); .one();
if (Objects.isNull(sysUserPayAccount)) { if (Objects.isNull(sysUserPayAccount)) {
return AjaxResult.error("请先绑定支付宝账号"); return R.fail("请先绑定支付宝账号");
} }
// 添加提现记录和修改用户钱包
this.addLogAndUpdateUserWallet(sysUser, amount);
// 收款方信息 // 收款方信息
Participant payeeInfo = new Participant(); Participant payeeInfo = new Participant();
@ -337,9 +341,7 @@ public class AliPayServiceImpl implements AliPayService {
System.out.println(response.getBody()); System.out.println(response.getBody());
if (response.isSuccess()) { if (response.isSuccess()) {
// 记录日志和修改用户钱包 return R.ok("提现成功");
this.addLogAndUpdateUserWallet(sysUser, amount);
return AjaxResult.success("转账成功");
} }
if (response.getSubCode().equals("PAYER_BALANCE_NOT_ENOUGH")) { if (response.getSubCode().equals("PAYER_BALANCE_NOT_ENOUGH")) {
@ -348,14 +350,14 @@ public class AliPayServiceImpl implements AliPayService {
String content = String.format("账户余额不足:用户%s提现%s", sysUser.getUserName(), amount); String content = String.format("账户余额不足:用户%s提现%s", sysUser.getUserName(), amount);
MailUtil.send(tos, "上海辰风互娱", content, false); MailUtil.send(tos, "上海辰风互娱", content, false);
throw new ServiceException("系统繁忙,请稍后重试"); throw new ServiceException("网络连接出错,请稍后再试");
} }
System.out.println("提现失败:" + response.getSubMsg());
throw new ServiceException("转账失败:" + response.getSubMsg()); throw new ServiceException("提现失败");
} }
@Override @Override
public AjaxResult queryTradeStatus(String outTradeNo) throws Exception { public R<Object> queryTradeStatus(String outTradeNo) throws Exception {
// 查询redis中订单信息 // 查询redis中订单信息
String orderTradeJson = redisCache.getCacheObject(outTradeNo); String orderTradeJson = redisCache.getCacheObject(outTradeNo);
@ -365,7 +367,7 @@ public class AliPayServiceImpl implements AliPayService {
} }
// 如果redis中存在该订单, 则直接返回该订单的支付状态 // 如果redis中存在该订单, 则直接返回该订单的支付状态
if (Objects.nonNull(orderTrade)) { if (Objects.nonNull(orderTrade)) {
return AjaxResult.success("查询成功", orderTrade.getOrderStatus()); return R.ok(orderTrade.getOrderStatus());
} }
// 查询支付宝订单 // 查询支付宝订单
@ -375,7 +377,7 @@ public class AliPayServiceImpl implements AliPayService {
// 如果数据库中不存在该订单, 则返回订单不存在 // 如果数据库中不存在该订单, 则返回订单不存在
if (Objects.isNull(orderTrade)) { if (Objects.isNull(orderTrade)) {
return AjaxResult.error("订单不存在"); return R.fail("订单不存在");
} }
@ -396,7 +398,7 @@ public class AliPayServiceImpl implements AliPayService {
// 获取订单后缀 // 获取订单后缀
String suffix = code.substring(code.lastIndexOf("_") + 1); String suffix = code.substring(code.lastIndexOf("_") + 1);
orderTradeService.orderHandler(orderTrade, suffix, params); orderTradeService.orderHandler(orderTrade, suffix, params);
return AjaxResult.success("查询成功", orderTrade.getOrderStatus()); return R.ok(orderTrade.getOrderStatus());
} }
long time = (System.currentTimeMillis() - orderTrade.getCreateTime().getTime()) / 1000 / 60; long time = (System.currentTimeMillis() - orderTrade.getCreateTime().getTime()) / 1000 / 60;
// time 超过15分钟则删除redis中订单信息 // time 超过15分钟则删除redis中订单信息
@ -408,7 +410,7 @@ public class AliPayServiceImpl implements AliPayService {
} }
redisCache.setCacheObject(outTradeNo, JSONUtil.toJsonStr(orderTrade), 4, TimeUnit.SECONDS); redisCache.setCacheObject(outTradeNo, JSONUtil.toJsonStr(orderTrade), 4, TimeUnit.SECONDS);
return AjaxResult.success("查询成功", orderTrade.getOrderStatus()); return R.ok(orderTrade.getOrderStatus());
} }

View File

@ -75,6 +75,7 @@ public class WorkFlowCommentVo {
/** /**
* *
*/ */
@ApiModelProperty(value = "评论点赞数")
private Integer isLike; private Integer isLike;
/** /**

View File

@ -3,6 +3,7 @@ package com.mcwl.resource.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.domain.AjaxResult; 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.page.TableDataInfo;
import com.mcwl.common.domain.IdsParam; import com.mcwl.common.domain.IdsParam;
import com.mcwl.resource.domain.ModelProduct; import com.mcwl.resource.domain.ModelProduct;
@ -29,12 +30,12 @@ public interface ModelService extends IService<ModelProduct> {
TableDataInfo listByPage(ModelImagePageRes imagePageRes); TableDataInfo listByPage(ModelImagePageRes imagePageRes);
AjaxResult addModel(RequestModel requestModel); R<String> addModel(RequestModel requestModel);
void updaModel(RequestModel requestModel); void updaModel(RequestModel requestModel);
AjaxResult selectModelById(Long id); R<ModelProduct> selectModelById(Long id);
void setModelTop(Long id, boolean isTop); void setModelTop(Long id, boolean isTop);

View File

@ -2,6 +2,7 @@ package com.mcwl.resource.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.domain.R;
import com.mcwl.resource.domain.ModelVersion; import com.mcwl.resource.domain.ModelVersion;
import java.util.List; import java.util.List;
@ -19,6 +20,6 @@ public interface ModelVersionService extends IService<ModelVersion> {
List<ModelVersion> selectLogininforList(ModelVersion modelVersion); List<ModelVersion> selectLogininforList(ModelVersion modelVersion);
AjaxResult selectByModelId(Long modelId); R<List<ModelVersion>> selectByModelId(Long modelId);
} }

View File

@ -1,6 +1,8 @@
package com.mcwl.resource.service; 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.AjaxResult;
import com.mcwl.common.core.domain.R;
import com.mcwl.resource.domain.Report; import com.mcwl.resource.domain.Report;
import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.domain.vo.PageVo;
@ -15,7 +17,7 @@ import com.mcwl.resource.domain.vo.PageVo;
public interface ReportService { public interface ReportService {
void addReport(Report report); void addReport(Report report);
AjaxResult selectReport(PageVo pageVo); R<Page<Report>> selectReport(PageVo pageVo);
void deleteReport(Long id); void deleteReport(Long id);

View File

@ -2,6 +2,7 @@ package com.mcwl.resource.service;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.mcwl.common.core.domain.AjaxResult; 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.domain.entity.SysUser;
import com.mcwl.resource.domain.SysUserInfo; import com.mcwl.resource.domain.SysUserInfo;
import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.domain.vo.PageVo;
@ -14,7 +15,7 @@ import com.mcwl.resource.domain.vo.PageVo;
*/ */
public interface SysUserAttentionService { public interface SysUserAttentionService {
AjaxResult addAttention(Long userId); R<Boolean> addAttention(Long userId);
Boolean selectAttention(Long userId); Boolean selectAttention(Long userId);

View File

@ -1,7 +1,9 @@
package com.mcwl.resource.service; package com.mcwl.resource.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.domain.AjaxResult; 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.page.TableDataInfo;
import com.mcwl.resource.domain.WorkFlow; import com.mcwl.resource.domain.WorkFlow;
import com.mcwl.resource.domain.dto.AddRequestWorkFlow; import com.mcwl.resource.domain.dto.AddRequestWorkFlow;
@ -19,15 +21,15 @@ import java.util.List;
*/ */
public interface WorkFlowService extends IService<WorkFlow> { public interface WorkFlowService extends IService<WorkFlow> {
AjaxResult addWorkFlow(AddRequestWorkFlow addRequestWorkFlo); R<Object> addWorkFlow(AddRequestWorkFlow addRequestWorkFlo);
void updateWorkFlow(RequestWorkFlow requestWorkFlow); void updateWorkFlow(RequestWorkFlow requestWorkFlow);
void deleteWorkFlow(Long id); void deleteWorkFlow(Long id);
AjaxResult selectWorkFlow(PageVo pageVo); R<Page<WorkFlow>> selectWorkFlow(PageVo pageVo);
AjaxResult selectWorkFlowById(Long id); R<WorkFlow> selectWorkFlowById(Long id);
TableDataInfo listByPage(ModelImagePageRes imagePageRes); TableDataInfo listByPage(ModelImagePageRes imagePageRes);
@ -39,5 +41,5 @@ public interface WorkFlowService extends IService<WorkFlow> {
Long selectWorkFlowByName(String name); Long selectWorkFlowByName(String name);
AjaxResult selectWorkFlowVersionById(Long id); R<RequestWorkFlow> selectWorkFlowVersionById(Long id);
} }

View File

@ -1,6 +1,10 @@
package com.mcwl.resource.service; package com.mcwl.resource.service;
import com.mcwl.common.core.domain.AjaxResult; 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 { public interface WorkFlowVersionService {
AjaxResult selectVersionByWorkId(Long workId); R<List<WorkFlowVersion>> selectVersionByWorkId(Long workId);
} }

View File

@ -72,7 +72,7 @@ public class ModelCommentServiceImpl extends ServiceImpl<ModelCommentMapper, Mod
.isNull(ModelComment::getParentId); .isNull(ModelComment::getParentId);
if (sortType == 0) { if (sortType == 0) {
// 按点赞数降序,创建时间升序 // 按点赞数降序,创建时间升序
lqw.orderByAsc(ModelComment::getLikeNum) lqw.orderByDesc(ModelComment::getLikeNum)
.orderByAsc(ModelComment::getCreateTime); .orderByAsc(ModelComment::getCreateTime);
} else { } else {
lqw.orderByDesc(ModelComment::getCreateTime); lqw.orderByDesc(ModelComment::getCreateTime);
@ -121,6 +121,7 @@ public class ModelCommentServiceImpl extends ServiceImpl<ModelCommentMapper, Mod
// 获取所模型父评论 // 获取所模型父评论
List<ModelComment> modelCommentList = baseMapper.selectList( List<ModelComment> modelCommentList = baseMapper.selectList(
new LambdaQueryWrapper<ModelComment>() new LambdaQueryWrapper<ModelComment>()
.isNull(ModelComment::getParentId)
.eq(ModelComment::getModelId, modelId)); .eq(ModelComment::getModelId, modelId));
// 获取所有父评论的ID // 获取所有父评论的ID

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.resource.domain.ModelComment;
import com.mcwl.resource.domain.ModelImageComment; import com.mcwl.resource.domain.ModelImageComment;
import com.mcwl.resource.domain.ModelImageCommentLike; import com.mcwl.resource.domain.ModelImageCommentLike;
import com.mcwl.resource.domain.WorkFlowComment; import com.mcwl.resource.domain.WorkFlowComment;
@ -64,7 +65,7 @@ public class ModelImageCommentServiceImpl extends ServiceImpl<ModelImageCommentM
.isNull(ModelImageComment::getParentId); .isNull(ModelImageComment::getParentId);
if (sortType == 0) { if (sortType == 0) {
// 按点赞数降序,创建时间升序 // 按点赞数降序,创建时间升序
lqw.orderByAsc(ModelImageComment::getLikeNum) lqw.orderByDesc(ModelImageComment::getLikeNum)
.orderByAsc(ModelImageComment::getCreateTime); .orderByAsc(ModelImageComment::getCreateTime);
} else { } else {
lqw.orderByDesc(ModelImageComment::getCreateTime); lqw.orderByDesc(ModelImageComment::getCreateTime);
@ -108,6 +109,7 @@ public class ModelImageCommentServiceImpl extends ServiceImpl<ModelImageCommentM
// 获取所有图片父评论 // 获取所有图片父评论
List<ModelImageComment> modelImageCommentList = baseMapper.selectList( List<ModelImageComment> modelImageCommentList = baseMapper.selectList(
new LambdaQueryWrapper<ModelImageComment>() new LambdaQueryWrapper<ModelImageComment>()
.isNull(ModelImageComment::getParentId)
.eq(ModelImageComment::getModelImageId, imageId)); .eq(ModelImageComment::getModelImageId, imageId));
// 获取所有父评论的ID // 获取所有父评论的ID

View File

@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.constant.DictConstants; import com.mcwl.common.constant.DictConstants;
import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.AjaxResult; 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.domain.entity.SysUser;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.core.redis.RedisCache; import com.mcwl.common.core.redis.RedisCache;
@ -184,7 +185,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
} }
@Override @Override
public AjaxResult addModel(RequestModel requestModel) { public R<String> addModel(RequestModel requestModel) {
//获取封面图 //获取封面图
String filePath = requestModel.getModelVersionList().get(0).getFilePath(); String filePath = requestModel.getModelVersionList().get(0).getFilePath();
String[] split = filePath.split(","); String[] split = filePath.split(",");
@ -204,7 +205,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
//执行审核方法 //执行审核方法
audit(requestModel); audit(requestModel);
return AjaxResult.success("添加成功,等待审核"); return R.ok("添加成功,等待审核");
} }
@Override @Override
@ -427,7 +428,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
@Override @Override
public AjaxResult selectModelById(Long id) { public R<ModelProduct> selectModelById(Long id) {
//查询详情 //查询详情
ModelProduct modelProduct = postMapper.selectById(id); ModelProduct modelProduct = postMapper.selectById(id);
@ -459,7 +460,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
modelProduct.setActivityId(toActivityService.getById(modelProduct.getActivityId()).getActivityName()); modelProduct.setActivityId(toActivityService.getById(modelProduct.getActivityId()).getActivityName());
} }
return AjaxResult.success(modelProduct); return R.ok(modelProduct);
} }

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.constant.DictConstants; import com.mcwl.common.constant.DictConstants;
import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.domain.R;
import com.mcwl.common.utils.StringUtils; import com.mcwl.common.utils.StringUtils;
import com.mcwl.resource.domain.ModelVersion; import com.mcwl.resource.domain.ModelVersion;
import com.mcwl.resource.mapper.ModelVersionMapper; import com.mcwl.resource.mapper.ModelVersionMapper;
@ -54,7 +55,7 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo
} }
@Override @Override
public AjaxResult selectByModelId(Long modelId) { public R<List<ModelVersion>> selectByModelId(Long modelId) {
//根据模型ID查询所有的版本信息 //根据模型ID查询所有的版本信息
LambdaQueryWrapper<ModelVersion> modelVersionLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ModelVersion> modelVersionLambdaQueryWrapper = new LambdaQueryWrapper<>();
@ -75,7 +76,7 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo
modelVersion.setHighList(arrayList); modelVersion.setHighList(arrayList);
} }
return AjaxResult.success(modelVersions); return R.ok(modelVersions);
} }

View File

@ -3,6 +3,7 @@ package com.mcwl.resource.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcwl.common.core.domain.AjaxResult; 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.SecurityUtils;
import com.mcwl.resource.domain.Report; import com.mcwl.resource.domain.Report;
import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.domain.vo.PageVo;
@ -37,7 +38,7 @@ public class ReportServiceImpl implements ReportService {
} }
@Override @Override
public AjaxResult selectReport(PageVo pageVo) { public R<Page<Report>> selectReport(PageVo pageVo) {
Page<Report> page = new Page<>(pageVo.getPageNumber(), pageVo.getPageSize()); Page<Report> page = new Page<>(pageVo.getPageNumber(), pageVo.getPageSize());
@ -48,7 +49,7 @@ public class ReportServiceImpl implements ReportService {
reportLambdaQueryWrapper.eq(Report::getStatus, 0); reportLambdaQueryWrapper.eq(Report::getStatus, 0);
} }
return AjaxResult.success(reportMapper.selectPage(page, reportLambdaQueryWrapper)); return R.ok(reportMapper.selectPage(page, reportLambdaQueryWrapper));
} }
@Override @Override

View File

@ -3,6 +3,7 @@ package com.mcwl.resource.service.impl;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.mcwl.common.core.domain.AjaxResult; 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.domain.entity.SysUser;
import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.resource.domain.SysUserAttention; import com.mcwl.resource.domain.SysUserAttention;
@ -48,14 +49,14 @@ public class SysUserAttentionServiceImpl implements SysUserAttentionService {
private SysUserMapper sysUserMapper; private SysUserMapper sysUserMapper;
@Override @Override
public AjaxResult addAttention(Long userId) { public R<Boolean> addAttention(Long userId) {
//查看是否已关注 //查看是否已关注
Boolean aBoolean = selectAttention(userId); Boolean aBoolean = selectAttention(userId);
if (aBoolean == true) { if (aBoolean == true) {
//取关 //取关
sysUserAttentionMapper.deleteByUserId(SecurityUtils.getUserId(), userId); 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()) .createTime(new Date())
.build(); .build();
sysUserAttentionMapper.insert(sysUserAttention); sysUserAttentionMapper.insert(sysUserAttention);
return AjaxResult.success(true); return R.ok(true);
} }
@Override @Override

View File

@ -39,7 +39,7 @@ public class WorkFlowCommentLikeServiceImpl extends ServiceImpl<WorkFlowCommentL
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
WorkFlowCommentLike workFlowCommentLike = baseMapper.getLikeComment(userId, commentId); WorkFlowCommentLike workFlowCommentLike = baseMapper.getLikeComment(userId, commentId);
if (Objects.nonNull(workFlowCommentLike)) { if (Objects.nonNull(workFlowCommentLike)) {
if (Objects.equals(workFlowComment.getDelFlag(), "0")) { if (Objects.equals(workFlowCommentLike.getDelFlag(), "0")) {
workFlowCommentLike.setDelFlag("2"); workFlowCommentLike.setDelFlag("2");
int likeNum = workFlowComment.getLikeNum() - 1; int likeNum = workFlowComment.getLikeNum() - 1;
likeNum = Math.max(likeNum, 0); likeNum = Math.max(likeNum, 0);

View File

@ -69,7 +69,7 @@ public class WorkFlowCommentServiceImpl extends ServiceImpl<WorkFlowCommentMappe
.isNull(WorkFlowComment::getParentId); .isNull(WorkFlowComment::getParentId);
if (sortType == 0) { if (sortType == 0) {
// 按点赞数降序,创建时间升序 // 按点赞数降序,创建时间升序
lqw.orderByAsc(WorkFlowComment::getLikeNum) lqw.orderByDesc(WorkFlowComment::getLikeNum)
.orderByAsc(WorkFlowComment::getCreateTime); .orderByAsc(WorkFlowComment::getCreateTime);
} else { } else {
lqw.orderByDesc(WorkFlowComment::getCreateTime); lqw.orderByDesc(WorkFlowComment::getCreateTime);
@ -112,6 +112,7 @@ public class WorkFlowCommentServiceImpl extends ServiceImpl<WorkFlowCommentMappe
// 获取所工作流父评论 // 获取所工作流父评论
List<WorkFlowComment> modelCommentList = baseMapper.selectList( List<WorkFlowComment> modelCommentList = baseMapper.selectList(
new LambdaQueryWrapper<WorkFlowComment>() new LambdaQueryWrapper<WorkFlowComment>()
.isNull(WorkFlowComment::getParentId)
.eq(WorkFlowComment::getWorkFlowId, workFlowId)); .eq(WorkFlowComment::getWorkFlowId, workFlowId));
// 获取所有父评论的ID // 获取所有父评论的ID

View File

@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.constant.DictConstants; import com.mcwl.common.constant.DictConstants;
import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.constant.HttpStatus;
import com.mcwl.common.core.domain.AjaxResult; 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.domain.entity.SysUser;
import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.SecurityUtils;
@ -74,7 +75,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
@Override @Override
public AjaxResult addWorkFlow(AddRequestWorkFlow addRequestWorkFlo) { public R<Object> addWorkFlow(AddRequestWorkFlow addRequestWorkFlo) {
RequestWorkFlow requestWorkFlow = new RequestWorkFlow(); RequestWorkFlow requestWorkFlow = new RequestWorkFlow();
BeanUtil.copyProperties(addRequestWorkFlo, requestWorkFlow); BeanUtil.copyProperties(addRequestWorkFlo, requestWorkFlow);
@ -99,7 +100,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
audit(requestWorkFlow); audit(requestWorkFlow);
return AjaxResult.success("添加成功,等待审核"); return R.ok();
} }
private void audit(RequestWorkFlow requestWorkFlow) { private void audit(RequestWorkFlow requestWorkFlow) {
@ -349,7 +350,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
} }
@Override @Override
public AjaxResult selectWorkFlow(PageVo pageVo) { public R<Page<WorkFlow>> selectWorkFlow(PageVo pageVo) {
Page<WorkFlow> page = new Page<>(pageVo.getPageNumber(), pageVo.getPageSize()); Page<WorkFlow> page = new Page<>(pageVo.getPageNumber(), pageVo.getPageSize());
@ -365,16 +366,16 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
lambdaQueryWrapper.select(WorkFlow::getId, WorkFlow::getWorkflowName, WorkFlow::getCoverPath); lambdaQueryWrapper.select(WorkFlow::getId, WorkFlow::getWorkflowName, WorkFlow::getCoverPath);
return AjaxResult.success(flowMapper.selectPage(page, lambdaQueryWrapper)); return R.ok(flowMapper.selectPage(page, lambdaQueryWrapper));
} }
@Override @Override
public AjaxResult selectWorkFlowById(Long id) { public R<WorkFlow> selectWorkFlowById(Long id) {
//查询详情 //查询详情
WorkFlow workFlow = flowMapper.selectById(id); WorkFlow workFlow = flowMapper.selectById(id);
if (workFlow == null) { if (workFlow == null) {
return AjaxResult.error("工作流不存在"); return R.fail("工作流不存在");
} }
//类别 //类别
@ -393,7 +394,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
if (sysUserAttention == null){ if (sysUserAttention == null){
workFlow.setIsAttention(1); workFlow.setIsAttention(1);
} }
return AjaxResult.success(workFlow); return R.ok(workFlow);
} }
@ -471,18 +472,18 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
} }
@Override @Override
public AjaxResult selectWorkFlowVersionById(Long id) { public R<RequestWorkFlow> selectWorkFlowVersionById(Long id) {
RequestWorkFlow requestWorkFlow = new RequestWorkFlow(); RequestWorkFlow requestWorkFlow = new RequestWorkFlow();
WorkFlow workFlow = baseMapper.selectById(id); WorkFlow workFlow = baseMapper.selectById(id);
if (workFlow == null){ if (workFlow == null){
return AjaxResult.error("数据不存在"); return R.fail("数据不存在");
} }
if (workFlow.getDelFlag() == 2){ if (workFlow.getDelFlag() == 2){
return AjaxResult.error("数据不存在"); return R.fail("数据不存在");
} }
LambdaQueryWrapper<WorkFlowVersion> workFlowVersionLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<WorkFlowVersion> workFlowVersionLambdaQueryWrapper = new LambdaQueryWrapper<>();
@ -491,7 +492,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
List<WorkFlowVersion> workFlowVersions = workFlowVersionMapper.selectList(workFlowVersionLambdaQueryWrapper); List<WorkFlowVersion> workFlowVersions = workFlowVersionMapper.selectList(workFlowVersionLambdaQueryWrapper);
requestWorkFlow.setWorkFlow(workFlow); requestWorkFlow.setWorkFlow(workFlow);
requestWorkFlow.setWorkFlowVersionList(workFlowVersions); requestWorkFlow.setWorkFlowVersionList(workFlowVersions);
return AjaxResult.success(requestWorkFlow); return R.ok(requestWorkFlow);
} }

View File

@ -2,6 +2,7 @@ package com.mcwl.resource.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.domain.R;
import com.mcwl.resource.domain.WorkFlowVersion; import com.mcwl.resource.domain.WorkFlowVersion;
import com.mcwl.resource.mapper.WorkFlowVersionMapper; import com.mcwl.resource.mapper.WorkFlowVersionMapper;
import com.mcwl.resource.service.WorkFlowVersionService; import com.mcwl.resource.service.WorkFlowVersionService;
@ -24,7 +25,7 @@ public class WorkFlowVersionServiceImpl implements WorkFlowVersionService {
private WorkFlowVersionMapper workFlowVersionMapper; private WorkFlowVersionMapper workFlowVersionMapper;
@Override @Override
public AjaxResult selectVersionByWorkId(Long workId) { public R<List<WorkFlowVersion>> selectVersionByWorkId(Long workId) {
LambdaQueryWrapper<WorkFlowVersion> workFlowVersionLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<WorkFlowVersion> workFlowVersionLambdaQueryWrapper = new LambdaQueryWrapper<>();
@ -33,6 +34,6 @@ public class WorkFlowVersionServiceImpl implements WorkFlowVersionService {
List<WorkFlowVersion> workFlowVersions = workFlowVersionMapper.selectList(workFlowVersionLambdaQueryWrapper); List<WorkFlowVersion> workFlowVersions = workFlowVersionMapper.selectList(workFlowVersionLambdaQueryWrapper);
return AjaxResult.success(workFlowVersions); return R.ok(workFlowVersions);
} }
} }