Merge remote-tracking branch 'origin/preview' into preview
commit
27fac6cf9c
|
@ -3,6 +3,7 @@ package com.mcwl.web.controller.communityCenter;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.Community;
|
||||
|
@ -49,9 +50,9 @@ public class CommunityController {
|
|||
*/
|
||||
@ApiOperation(value = "添加社区")
|
||||
@PostMapping("add")
|
||||
public AjaxResult addCommunity(@RequestBody @Valid CommunityRes communityRes) {
|
||||
public R<Object> addCommunity(@RequestBody @Valid CommunityRes communityRes) {
|
||||
communityService.addCommunity(communityRes);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,12 +63,12 @@ public class CommunityController {
|
|||
*/
|
||||
@ApiOperation(value = "删除社区")
|
||||
@GetMapping("delete")
|
||||
public AjaxResult deleteCommunity(@NotNull(message = "id不能为空")
|
||||
public R<Object> deleteCommunity(@NotNull(message = "id不能为空")
|
||||
@ApiParam(value = "id", required = true)
|
||||
@Valid
|
||||
Long id) {
|
||||
communityService.removeById(id);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.web.controller.communityCenter;
|
|||
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.communityCenter.domain.Community;
|
||||
import com.mcwl.communityCenter.service.InviteService;
|
||||
|
@ -23,7 +24,7 @@ import java.util.List;
|
|||
/**
|
||||
* 邀请
|
||||
*/
|
||||
@Api(tags = "邀请")
|
||||
@Api(tags = "社区邀请")
|
||||
@RestController
|
||||
@RequestMapping("invite")
|
||||
@RequiredArgsConstructor
|
||||
|
@ -37,15 +38,15 @@ public class InviteController {
|
|||
*/
|
||||
@ApiOperation(value = "邀请码链接")
|
||||
@GetMapping("inviteCode")
|
||||
public AjaxResult inviteCode(@NotNull(message = "社区不能为空")
|
||||
public R<String> inviteCode(@NotNull(message = "社区不能为空")
|
||||
@ApiParam(value = "社区", required = true)
|
||||
Long communityId) {
|
||||
// 获取邀请码链接
|
||||
String inviteCode = inviteService.getInviteCode(communityId);
|
||||
if (StringUtils.isBlank(inviteCode)) {
|
||||
return AjaxResult.warn("获取邀请码失败");
|
||||
return R.fail("获取邀请码失败");
|
||||
}
|
||||
return AjaxResult.success(inviteCode);
|
||||
return R.ok(inviteCode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,7 +55,7 @@ public class InviteController {
|
|||
@ApiOperation(value = "接受邀请")
|
||||
@GetMapping("acceptInvite")
|
||||
@Valid
|
||||
public AjaxResult acceptInvite(@NotNull(message = "社区不能为空")
|
||||
public R<Object> acceptInvite(@NotNull(message = "社区不能为空")
|
||||
@ApiParam(value = "社区", required = true)
|
||||
Long communityId,
|
||||
@NotBlank(message = "邀请码不能为空")
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.web.controller.communityCenter;
|
|||
|
||||
import com.mcwl.common.core.controller.BaseController;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.communityCenter.domain.dto.CommentDelRes;
|
||||
import com.mcwl.communityCenter.domain.dto.CommentDetailRes;
|
||||
import com.mcwl.communityCenter.domain.dto.CommentRes;
|
||||
|
@ -37,7 +38,7 @@ public class PublishCommentController extends BaseController {
|
|||
*/
|
||||
@ApiOperation(value = "添加评论")
|
||||
@PostMapping("/save")
|
||||
public AjaxResult save(@RequestBody @Valid CommentRes commentRes) {
|
||||
public R<Object> save(@RequestBody @Valid CommentRes commentRes) {
|
||||
|
||||
return publishCommentService.addComment(commentRes);
|
||||
}
|
||||
|
@ -51,7 +52,7 @@ public class PublishCommentController extends BaseController {
|
|||
*/
|
||||
@ApiOperation(value = "获取评论详情")
|
||||
@PostMapping("/detail")
|
||||
public AjaxResult getComment(@RequestBody @Valid CommentDetailRes commentDetailRes) {
|
||||
public R<Object> getComment(@RequestBody @Valid CommentDetailRes commentDetailRes) {
|
||||
|
||||
return publishCommentService.getComment(commentDetailRes);
|
||||
}
|
||||
|
@ -72,7 +73,7 @@ public class PublishCommentController extends BaseController {
|
|||
|
||||
@ApiOperation(value = "删除评论")
|
||||
@PostMapping("/delete")
|
||||
public AjaxResult delete(@RequestBody @Valid CommentDelRes commentDelRes) {
|
||||
public R<Object> delete(@RequestBody @Valid CommentDelRes commentDelRes) {
|
||||
|
||||
return publishCommentService.removeCommentById(commentDelRes);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.web.controller.communityCenter;
|
|||
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.dto.PublishDetailRes;
|
||||
import com.mcwl.communityCenter.domain.dto.PublishPageRes;
|
||||
|
@ -44,13 +45,13 @@ public class PublishController {
|
|||
*/
|
||||
@ApiOperation(value = "获取发布详情")
|
||||
@PostMapping("detail")
|
||||
public AjaxResult getPublishDetail(@RequestBody @Valid PublishDetailRes publishDetailRes) {
|
||||
public R<PublishVo> getPublishDetail(@RequestBody @Valid PublishDetailRes publishDetailRes) {
|
||||
|
||||
PublishVo publishVo = publishService.getDetail(publishDetailRes);
|
||||
if (Objects.isNull(publishVo)) {
|
||||
return AjaxResult.error("获取详情失败");
|
||||
return R.fail("获取详情失败");
|
||||
}
|
||||
return AjaxResult.success(publishVo);
|
||||
return R.ok(publishVo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,7 +59,7 @@ public class PublishController {
|
|||
*/
|
||||
@ApiOperation(value = "发布")
|
||||
@PostMapping("publish")
|
||||
public AjaxResult publish(@RequestBody @Valid PublishRes publishRes) {
|
||||
public R<Object> publish(@RequestBody @Valid PublishRes publishRes) {
|
||||
return publishService.publish(publishRes);
|
||||
}
|
||||
|
||||
|
@ -85,8 +86,9 @@ public class PublishController {
|
|||
*/
|
||||
@ApiOperation(value = "删除")
|
||||
@GetMapping("remove")
|
||||
public AjaxResult deletePublish(@NotNull(message = "id不能为空") @ApiParam(value = "id") @Valid Long id) {
|
||||
return AjaxResult.success(publishService.removeById(id));
|
||||
public R<Object> deletePublish(@NotNull(message = "id不能为空") @ApiParam(value = "id") @Valid Long id) {
|
||||
publishService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.web.controller.communityCenter;
|
|||
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.dto.*;
|
||||
import com.mcwl.communityCenter.service.QuestionCommentService;
|
||||
|
@ -18,7 +19,7 @@ import javax.validation.Valid;
|
|||
/**
|
||||
* 提问评论
|
||||
*/
|
||||
@Api(tags = "提问评论")
|
||||
@Api(tags = "社区提问评论")
|
||||
@RestController
|
||||
@RequestMapping("questionComment")
|
||||
@RequiredArgsConstructor
|
||||
|
@ -32,7 +33,7 @@ public class QuestionCommentController {
|
|||
*/
|
||||
@PostMapping("comment")
|
||||
@ApiOperation(value = "新增提问评论")
|
||||
public AjaxResult comment(@Valid @RequestBody QuestionCommentRes questionCommentRes) {
|
||||
public R<Object> comment(@Valid @RequestBody QuestionCommentRes questionCommentRes) {
|
||||
return questionCommentService.comment(questionCommentRes);
|
||||
}
|
||||
|
||||
|
@ -52,7 +53,7 @@ public class QuestionCommentController {
|
|||
*/
|
||||
@PostMapping("adopt")
|
||||
@ApiOperation(value = "采纳评论")
|
||||
public AjaxResult adopt(@Valid @RequestBody QuestionCommentAdoptRes questionCommentAdoptRes) {
|
||||
public R<Object> adopt(@Valid @RequestBody QuestionCommentAdoptRes questionCommentAdoptRes) {
|
||||
return questionCommentService.adopt(questionCommentAdoptRes);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.web.controller.communityCenter;
|
|||
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
|
@ -24,7 +25,7 @@ import java.util.Objects;
|
|||
/**
|
||||
* 提问
|
||||
*/
|
||||
@Api(tags = "提问")
|
||||
@Api(tags = "社区提问")
|
||||
@RestController
|
||||
@RequestMapping("question")
|
||||
@RequiredArgsConstructor
|
||||
|
@ -40,7 +41,7 @@ public class QuestionController {
|
|||
*/
|
||||
@PostMapping("addQuestion")
|
||||
@ApiOperation(value = "提问")
|
||||
public AjaxResult addQuestion(@RequestBody @Valid QuestionRes questionRes) {
|
||||
public R<Object> addQuestion(@RequestBody @Valid QuestionRes questionRes) {
|
||||
|
||||
// 提问类型
|
||||
Integer type = questionRes.getType();
|
||||
|
@ -50,7 +51,7 @@ public class QuestionController {
|
|||
|
||||
// 类型为1时,付费金额不能为空
|
||||
if (Objects.equals(type, 1) && Objects.isNull(amount)) {
|
||||
return AjaxResult.error("付费金额不能为空");
|
||||
return R.fail("付费金额不能为空");
|
||||
}
|
||||
|
||||
// 付费类型为1时,判断钱包余额是否充足
|
||||
|
@ -59,7 +60,7 @@ public class QuestionController {
|
|||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
Double wallet = sysUser.getWallet();
|
||||
if (wallet < amount) {
|
||||
return AjaxResult.error("钱包余额不足");
|
||||
return R.fail("钱包余额不足");
|
||||
}
|
||||
} else {
|
||||
questionRes.setAmount(0.0);
|
||||
|
@ -95,12 +96,12 @@ public class QuestionController {
|
|||
*/
|
||||
@PostMapping("detail")
|
||||
@ApiOperation(value = "获取问题详情")
|
||||
public AjaxResult getQuestionDetail(@RequestBody @Valid QuestionDetailRes questionDetailRes) {
|
||||
public R<QuestionVo> getQuestionDetail(@RequestBody @Valid QuestionDetailRes questionDetailRes) {
|
||||
QuestionVo questionVo = questionService.getDetail(questionDetailRes);
|
||||
if (Objects.isNull(questionVo)) {
|
||||
return AjaxResult.error("获取详情失败");
|
||||
return R.fail("获取详情失败");
|
||||
}
|
||||
return AjaxResult.success(questionVo);
|
||||
return R.ok(questionVo);
|
||||
}
|
||||
|
||||
// /**
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.mcwl.web.controller.memberCenter;
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.memberCenter.domain.MemberConsume;
|
||||
|
@ -53,7 +54,7 @@ public class MemberController {
|
|||
* @return 用户会员
|
||||
*/
|
||||
@PostMapping("createMember")
|
||||
public AjaxResult createMemberCenter(@RequestBody @Valid UserMemberDto userMemberDto) {
|
||||
public R<Member> createMemberCenter(@RequestBody @Valid UserMemberDto userMemberDto) {
|
||||
Long userId = userMemberDto.getUserId();
|
||||
Long memberLevelId = userMemberDto.getMemberLevelId();
|
||||
String paymentMethod = userMemberDto.getPaymentMethod();
|
||||
|
@ -61,20 +62,20 @@ public class MemberController {
|
|||
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
if (!Optional.ofNullable(sysUser).isPresent()) {
|
||||
return AjaxResult.warn("用户不存在");
|
||||
return R.fail("用户不存在");
|
||||
}
|
||||
|
||||
MemberLevel memberLevel = memberLevelService.getById(memberLevelId);
|
||||
if (!Optional.ofNullable(memberLevel).isPresent()) {
|
||||
return AjaxResult.warn("会员等级不存在");
|
||||
return R.fail("会员等级不存在");
|
||||
}
|
||||
|
||||
Member member = memberService.createUserMember(userId, memberLevelId, paymentMethod, promotionId);
|
||||
if (!Optional.ofNullable(member).isPresent()) {
|
||||
return AjaxResult.warn("创建会员失败");
|
||||
return R.fail("创建会员失败");
|
||||
}
|
||||
|
||||
return AjaxResult.success(member);
|
||||
return R.ok(member);
|
||||
}
|
||||
|
||||
|
||||
|
@ -85,7 +86,7 @@ public class MemberController {
|
|||
*/
|
||||
@GetMapping("getPoints")
|
||||
@ApiOperation(value = "获取积分余额和历史记录")
|
||||
public AjaxResult getPoints() {
|
||||
public R<PointsVO> getPoints() {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
|
@ -109,7 +110,7 @@ public class MemberController {
|
|||
pointsVO.setPoints(points);
|
||||
pointsVO.setMemberConsumeList(memberConsumeList);
|
||||
|
||||
return AjaxResult.success(pointsVO);
|
||||
return R.ok(pointsVO);
|
||||
}
|
||||
|
||||
|
||||
|
@ -118,25 +119,23 @@ public class MemberController {
|
|||
*/
|
||||
@PostMapping("rechargePoints")
|
||||
@ApiOperation(value = "会员积分充值")
|
||||
public AjaxResult rechargePoints(@RequestBody @Valid RechargePointsDto rechargePointsDto) {
|
||||
public R<Object> rechargePoints(@RequestBody @Valid RechargePointsDto rechargePointsDto) {
|
||||
Long userId = rechargePointsDto.getUserId();
|
||||
Double amount = rechargePointsDto.getAmount();
|
||||
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
if (!Optional.ofNullable(sysUser).isPresent()) {
|
||||
return AjaxResult.warn("用户不存在");
|
||||
return R.fail("用户不存在");
|
||||
}
|
||||
|
||||
Member member = memberService.rechargePoints(userId, amount * 100);
|
||||
|
||||
// 返回充值积分
|
||||
if (!Optional.ofNullable(member).isPresent()) {
|
||||
return AjaxResult.warn("充值积分失败");
|
||||
return R.fail("充值积分失败");
|
||||
}
|
||||
|
||||
rechargePointsDto.setPoints(member.getPoints());
|
||||
|
||||
return AjaxResult.success(rechargePointsDto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -145,14 +144,14 @@ public class MemberController {
|
|||
*/
|
||||
@GetMapping("consumePoints/{consumePoints}")
|
||||
@ApiOperation(value = "消费积分")
|
||||
public AjaxResult consumePoints(@PathVariable Double consumePoints) {
|
||||
public R<Object> consumePoints(@PathVariable Double consumePoints) {
|
||||
|
||||
if (consumePoints == null || consumePoints <= 0) {
|
||||
return AjaxResult.warn("消费积分不能为空或小于0");
|
||||
return R.fail("消费积分不能为空或小于0");
|
||||
}
|
||||
|
||||
memberService.consumePoints(consumePoints);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
|
||||
}
|
||||
|
||||
|
@ -162,7 +161,7 @@ public class MemberController {
|
|||
*/
|
||||
@GetMapping("calculatePayment")
|
||||
@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();
|
||||
|
@ -179,7 +178,7 @@ public class MemberController {
|
|||
MemberLevel memberLevel = memberLevelService.getById(memberLevelId);
|
||||
Double unitPrice = memberLevel.getUnitPrice();
|
||||
unitPrice = memberService.calculatePayment(unitPrice, promotionId);
|
||||
return AjaxResult.success(unitPrice);
|
||||
return R.ok(unitPrice);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -187,7 +186,7 @@ public class MemberController {
|
|||
*/
|
||||
@GetMapping("isMember")
|
||||
@ApiOperation(value = "是否是会员")
|
||||
public AjaxResult isMember() {
|
||||
public R<Map<String, String>> isMember() {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
Member member = memberService.getUseUserMemberByUserId(userId);
|
||||
|
@ -198,11 +197,11 @@ public class MemberController {
|
|||
map.put("result", "1");
|
||||
map.put("startDate", sdf.format(startDate));
|
||||
map.put("endDate", sdf.format(endDate));
|
||||
return AjaxResult.success(map);
|
||||
return R.ok(map);
|
||||
}
|
||||
map.put("result", "0");
|
||||
|
||||
return AjaxResult.success(map);
|
||||
return R.ok(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.mcwl.web.controller.memberCenter;
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.memberCenter.domain.MemberBenefit;
|
||||
import com.mcwl.memberCenter.domain.MemberLevel;
|
||||
import com.mcwl.memberCenter.service.MemberBenefitService;
|
||||
|
@ -36,11 +37,11 @@ public class MemberLevelController {
|
|||
*/
|
||||
@GetMapping("list")
|
||||
@ApiOperation(value = "获取会员等级列表")
|
||||
public AjaxResult list() {
|
||||
public R<List<MemberLevel>> list() {
|
||||
|
||||
List<MemberLevel> memberLevelList = memberLevelService.list();
|
||||
|
||||
return AjaxResult.success(memberLevelList);
|
||||
return R.ok(memberLevelList);
|
||||
}
|
||||
|
||||
|
||||
|
@ -49,9 +50,9 @@ public class MemberLevelController {
|
|||
*/
|
||||
@GetMapping("getMemberBenefitList")
|
||||
@ApiOperation(value = "获取会员等级及权益列表")
|
||||
public AjaxResult getMemberBenefitList() {
|
||||
public R<List<MemberBenefitVO>> getMemberBenefitList() {
|
||||
|
||||
return AjaxResult.success(memberBenefitService.getMemberBenefitList());
|
||||
return R.ok(memberBenefitService.getMemberBenefitList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.mcwl.web.controller.memberCenter;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.memberCenter.domain.Member;
|
||||
import com.mcwl.memberCenter.domain.MemberPromotion;
|
||||
|
@ -46,12 +47,12 @@ public class PromotionController {
|
|||
*/
|
||||
@PostMapping("createPromotion")
|
||||
@ApiOperation(value = "创建活动")
|
||||
public AjaxResult createPromotion(@RequestBody @Valid PromotionDto promotionDto) {
|
||||
public R<Object> createPromotion(@RequestBody @Valid PromotionDto promotionDto) {
|
||||
|
||||
Date startTime = promotionDto.getStartTime();
|
||||
Date endTime = promotionDto.getEndTime();
|
||||
if (startTime.after(endTime)) {
|
||||
return AjaxResult.warn("活动开始时间不能大于结束时间");
|
||||
return R.fail("活动开始时间不能大于结束时间");
|
||||
}
|
||||
Promotion promotion = new Promotion();
|
||||
|
||||
|
@ -59,7 +60,7 @@ public class PromotionController {
|
|||
|
||||
promotionService.save(promotion);
|
||||
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -68,11 +69,11 @@ public class PromotionController {
|
|||
*/
|
||||
@GetMapping("promotionList")
|
||||
@ApiOperation(value = "活动列表")
|
||||
public AjaxResult promotionList() {
|
||||
public R<List<Promotion>> promotionList() {
|
||||
List<Promotion> promotionList = promotionService.lambdaQuery()
|
||||
.gt(Promotion::getEndTime, new Date())
|
||||
.list();
|
||||
return AjaxResult.success(promotionList);
|
||||
return R.ok(promotionList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,13 +81,13 @@ public class PromotionController {
|
|||
*/
|
||||
@GetMapping("myPromotionList")
|
||||
@ApiOperation(value = "获取当前用户参与的活动")
|
||||
public AjaxResult myPromotionList() {
|
||||
public R<List<MemberPromotion>> myPromotionList() {
|
||||
// 获取当前用户
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<MemberPromotion> memberPromotionList = memberPromotionService.lambdaQuery()
|
||||
.eq(MemberPromotion::getUserId, userId)
|
||||
.list();
|
||||
return AjaxResult.success(memberPromotionList);
|
||||
return R.ok(memberPromotionList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,7 +95,7 @@ public class PromotionController {
|
|||
*/
|
||||
@PostMapping("joinPromotion")
|
||||
@ApiOperation(value = "参与活动")
|
||||
public AjaxResult joinPromotion(@RequestBody @Valid JoinPromotionDto joinPromotionDto) {
|
||||
public R<Object> joinPromotion(@RequestBody @Valid JoinPromotionDto joinPromotionDto) {
|
||||
// 用户id
|
||||
Long userId = joinPromotionDto.getUserId();
|
||||
// 活动id
|
||||
|
@ -103,21 +104,21 @@ public class PromotionController {
|
|||
Promotion promotion = promotionService.getById(promotionId);
|
||||
|
||||
if (!Optional.ofNullable(promotion).isPresent()) {
|
||||
return AjaxResult.warn("活动不存在");
|
||||
return R.fail("活动不存在");
|
||||
}
|
||||
|
||||
if (promotion.getStartTime().after(new Date())) {
|
||||
return AjaxResult.warn("活动未开始");
|
||||
return R.fail("活动未开始");
|
||||
}
|
||||
|
||||
// 活动是否过期
|
||||
if (promotion.getEndTime().before(new Date())) {
|
||||
return AjaxResult.warn("活动已过期");
|
||||
return R.fail("活动已过期");
|
||||
}
|
||||
|
||||
// 获取当前用户是否参与过该活动
|
||||
if (isJoinPromotion(userId, promotionId)) {
|
||||
return AjaxResult.warn("您已参与过该活动");
|
||||
return R.fail("您已参与过该活动");
|
||||
}
|
||||
|
||||
// 是否在活动期间内订阅或续订会员
|
||||
|
@ -129,13 +130,13 @@ public class PromotionController {
|
|||
|
||||
String memberLevelIds = promotion.getMemberLevelIds();
|
||||
if (!memberLevelIds.contains(member.getMemberLevelId().toString())) {
|
||||
return AjaxResult.warn("无法参与该活动,请查看活动条件");
|
||||
return R.fail("无法参与该活动,请查看活动条件");
|
||||
}
|
||||
MemberPromotion memberPromotion = getMemberPromotion(userId, promotionId);
|
||||
memberPromotionService.save(memberPromotion);
|
||||
|
||||
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
// private boolean isSubscribe(Long userId, Promotion promotion) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.web.controller.myInvitation;
|
|||
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.myInvitation.domain.Invitation;
|
||||
import com.mcwl.myInvitation.domain.dto.EarningsDisplayDto;
|
||||
|
@ -34,37 +35,38 @@ public class InvitationController {
|
|||
private final InvitationService invitationService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取邀请码
|
||||
*
|
||||
* @return 邀请码
|
||||
*/
|
||||
@GetMapping("/getInvitationCode")
|
||||
@ApiOperation(value = "获取邀请码")
|
||||
public AjaxResult getInvitationCode() {
|
||||
public R<String> getInvitationCode() {
|
||||
// 获取当前用户
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
String invitationCode = invitationService.getInvitationCode(userId);
|
||||
if (StringUtils.isEmpty(invitationCode)) {
|
||||
return AjaxResult.warn("获取邀请码失败");
|
||||
return R.fail("获取邀请码失败");
|
||||
}
|
||||
return success("操作成功", invitationCode);
|
||||
return R.ok("操作成功", invitationCode);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取邀请列表
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @return 邀请列表
|
||||
*/
|
||||
|
||||
@GetMapping("/list/{userId}")
|
||||
@ApiOperation(value = "获取邀请列表")
|
||||
public AjaxResult list(@PathVariable Long userId) {
|
||||
public R<List<Invitation>> list(@PathVariable Long userId) {
|
||||
List<Invitation> list = invitationService.lambdaQuery()
|
||||
.eq(Invitation::getUserId, userId)
|
||||
.list();
|
||||
return success(list);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
|
@ -73,7 +75,7 @@ public class InvitationController {
|
|||
*/
|
||||
@GetMapping("earningsDisplay")
|
||||
@ApiOperation(value = "邀请人收益展示")
|
||||
public AjaxResult earningsDisplay() {
|
||||
public R<EarningsDisplayVO> earningsDisplay() {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
|
||||
EarningsDisplayVO earningsDisplayVO = new EarningsDisplayVO();
|
||||
|
@ -82,18 +84,16 @@ public class InvitationController {
|
|||
Double totalAmount = invitationService.getTotalAmount(userId);
|
||||
|
||||
// 获取我的团员
|
||||
List<EarningsDisplayDto> earningsDisplay = invitationService.getEarningsDisplay(userId);
|
||||
List<EarningsDisplayDto> earningsDisplay = invitationService.getEarningsDisplay(userId);
|
||||
if (earningsDisplay == null || earningsDisplay.isEmpty()) {
|
||||
return AjaxResult.warn("暂无收益");
|
||||
return R.fail("暂无收益");
|
||||
}
|
||||
|
||||
earningsDisplayVO.setTotalAmount(totalAmount);
|
||||
earningsDisplayVO.setEarningsDisplayList(earningsDisplay);
|
||||
|
||||
return success(earningsDisplayVO);
|
||||
return R.ok(earningsDisplayVO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.alipay.easysdk.factory.Factory;
|
|||
import com.mcwl.common.annotation.Anonymous;
|
||||
import com.mcwl.common.core.controller.BaseController;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.redis.RedisCache;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.ShareCodeUtils;
|
||||
|
@ -16,6 +17,7 @@ import com.mcwl.pay.service.AliPayService;
|
|||
import com.mcwl.pay.service.OrderTradeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -65,7 +67,7 @@ public class AliPayController extends BaseController {
|
|||
*/
|
||||
@ApiOperation(value = "支付宝绑定")
|
||||
@GetMapping("/generateQrCode")
|
||||
public AjaxResult generateQrCode(HttpServletResponse response) throws Exception {
|
||||
public R<String> generateQrCode(HttpServletResponse response) throws Exception {
|
||||
String scope = "auth_user"; // 需要获取用户信息
|
||||
String appId = "2021005114616085";
|
||||
String state = ShareCodeUtils.idToCode(SecurityUtils.getUserId()); // 防止CSRF攻击
|
||||
|
@ -77,7 +79,7 @@ public class AliPayController extends BaseController {
|
|||
);
|
||||
|
||||
// QrCodeUtil.generate(authUrl, 300, 300, "png", response.getOutputStream());
|
||||
return AjaxResult.success("成功", authUrl);
|
||||
return R.ok("成功", authUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,7 +121,7 @@ public class AliPayController extends BaseController {
|
|||
@PostMapping("/doPay")
|
||||
@ApiOperation(value = "支付宝支付")
|
||||
@ResponseBody
|
||||
public AjaxResult doPay(@Valid
|
||||
public R<PayVo> doPay(@Valid
|
||||
@RequestBody
|
||||
OrderTradeDto orderTradeDto,
|
||||
HttpServletResponse response) throws Exception {
|
||||
|
@ -129,7 +131,7 @@ public class AliPayController extends BaseController {
|
|||
|
||||
if ("member".equalsIgnoreCase(type)) {
|
||||
if (!Optional.ofNullable(orderTradeDto.getProductId()).isPresent()) {
|
||||
return AjaxResult.error("商品id不能为空");
|
||||
return R.fail("商品id不能为空");
|
||||
}
|
||||
payVo = aliPayService.memberPay(orderTradeDto);
|
||||
// QrCodeUtil.generate(payVo.getUrl(), 300, 300, "png", response.getOutputStream());
|
||||
|
@ -139,15 +141,15 @@ public class AliPayController extends BaseController {
|
|||
} else if ("wallet".equalsIgnoreCase(type)) {
|
||||
// 充值金额只能是整数
|
||||
if (orderTradeDto.getAmount() % 1 != 0) {
|
||||
return AjaxResult.error("充值金额只能是整数");
|
||||
return R.fail("充值金额只能是整数");
|
||||
}
|
||||
payVo = aliPayService.walletPay(orderTradeDto.getAmount());
|
||||
// QrCodeUtil.generate(payVo.getUrl(), 300, 300, "png", response.getOutputStream());
|
||||
} else {
|
||||
return AjaxResult.error("订单类型错误");
|
||||
return R.fail("订单类型错误");
|
||||
}
|
||||
|
||||
return AjaxResult.success(payVo);
|
||||
return R.ok(payVo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -157,11 +159,11 @@ public class AliPayController extends BaseController {
|
|||
@GetMapping("/fetch")
|
||||
@ResponseBody
|
||||
@ApiOperation(value = "提现")
|
||||
public AjaxResult fetch(@Valid
|
||||
public R<String> fetch(@Valid
|
||||
@NotNull(message = "提现金额不能为空")
|
||||
Double amount) throws Exception {
|
||||
if (amount < 0.1) {
|
||||
return AjaxResult.error("提现金额最小为0.1");
|
||||
return R.fail("提现金额最小为0.1");
|
||||
}
|
||||
String outBizNo = UUID.fastUUID().toString(true);
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.alipay.easysdk.payment.common.models.AlipayTradeQueryResponse;
|
|||
import com.mcwl.common.JSONUtils;
|
||||
import com.mcwl.common.core.controller.BaseController;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.core.redis.RedisCache;
|
||||
import com.mcwl.common.domain.IdsParam;
|
||||
|
@ -69,15 +70,15 @@ public class OrderTradeController extends BaseController {
|
|||
*/
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value = "新增订单")
|
||||
public AjaxResult add(@RequestBody OrderTrade orderTrade) {
|
||||
public R<Object> add(@RequestBody OrderTrade orderTrade) {
|
||||
// 获取当前用户
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
if (userId == null) {
|
||||
return AjaxResult.warn("用户未登录");
|
||||
return R.fail("用户未登录");
|
||||
}
|
||||
orderTrade.setUserId(userId);
|
||||
orderTrade.setCreateBy(getUsername());
|
||||
return toAjax(orderTradeService.insertMallProduct(orderTrade));
|
||||
return R.ok(orderTradeService.insertMallProduct(orderTrade));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,15 +86,16 @@ public class OrderTradeController extends BaseController {
|
|||
*/
|
||||
@PostMapping("/upda")
|
||||
@ApiOperation(value = "修改订单")
|
||||
public AjaxResult upda(@RequestBody OrderTrade orderTrade) {
|
||||
public R<Object> upda(@RequestBody OrderTrade orderTrade) {
|
||||
// 获取当前用户
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
if (userId == null) {
|
||||
return AjaxResult.warn("用户未登录");
|
||||
return R.fail("用户未登录");
|
||||
}
|
||||
orderTrade.setUserId(userId);
|
||||
orderTrade.setUpdateBy(getUsername());
|
||||
return toAjax(orderTradeService.updateMallProduct(orderTrade));
|
||||
orderTradeService.updateMallProduct(orderTrade);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -101,9 +103,9 @@ public class OrderTradeController extends BaseController {
|
|||
*/
|
||||
@PostMapping
|
||||
@ApiOperation(value = "删除订单")
|
||||
public AjaxResult remove(@RequestBody IdsParam ids) {
|
||||
public R<Object> remove(@RequestBody IdsParam ids) {
|
||||
orderTradeService.deleteMallProductByIds(ids);
|
||||
return success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,40 +114,25 @@ public class OrderTradeController extends BaseController {
|
|||
*/
|
||||
@GetMapping("/queryTradeStatus")
|
||||
@ApiOperation(value = "查询交易状态")
|
||||
public AjaxResult queryTradeStatus(@Valid @NotBlank(message = "订单号不能为空") String outTradeNo) throws Exception {
|
||||
public R<Object> queryTradeStatus(@Valid @NotBlank(message = "订单号不能为空") String outTradeNo) throws Exception {
|
||||
return aliPayService.queryTradeStatus(outTradeNo);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/getTradStatus")
|
||||
public Object getTradStatus(String outTradeNo) throws Exception {
|
||||
Factory.setOptions(config);
|
||||
AlipayTradeQueryResponse query = Factory.Payment.Common().query(outTradeNo);
|
||||
Map<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")
|
||||
public AjaxResult cancelTrade(String outTradeNo) throws Exception {
|
||||
// 关闭交易
|
||||
AlipayTradeCancelResponse cancel = Factory.Payment.Common().cancel(outTradeNo);
|
||||
if (cancel.getCode().equals("10000")) {
|
||||
return AjaxResult.success("关闭成功");
|
||||
}
|
||||
return AjaxResult.error("关闭失败");
|
||||
}
|
||||
// @GetMapping("/cancelTrade")
|
||||
// public AjaxResult cancelTrade(String outTradeNo) throws Exception {
|
||||
// // 关闭交易
|
||||
// AlipayTradeCancelResponse cancel = Factory.Payment.Common().cancel(outTradeNo);
|
||||
// if (cancel.getCode().equals("10000")) {
|
||||
// return AjaxResult.success("关闭成功");
|
||||
// }
|
||||
// return AjaxResult.error("关闭失败");
|
||||
// }
|
||||
|
||||
/**
|
||||
* 关闭交易
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.web.controller.resource;
|
|||
|
||||
import com.mcwl.common.core.controller.BaseController;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
|
@ -68,15 +69,15 @@ public class MallProductController extends BaseController {
|
|||
|
||||
@ApiOperation(value = "模型详情")
|
||||
@PostMapping("finbyid")
|
||||
public AjaxResult finbyid(@RequestBody ModelProduct modelVersion) {
|
||||
public R<ModelProduct> finbyid(@RequestBody ModelProduct modelVersion) {
|
||||
ModelProduct modelVersion1 = modelService.getById(modelVersion.getId());
|
||||
return AjaxResult.success(modelVersion1);
|
||||
return R.ok(modelVersion1);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "添加模型")
|
||||
@PostMapping("/insert")
|
||||
public AjaxResult addupdateModel(@RequestBody RequestModel requestModel) {
|
||||
public R<String> addupdateModel(@RequestBody RequestModel requestModel) {
|
||||
ModelProduct modelProduct = requestModel.getModelProduct();
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
modelProduct.setUserId(userId);
|
||||
|
@ -86,7 +87,7 @@ public class MallProductController extends BaseController {
|
|||
|
||||
@ApiOperation(value = "修改模型")
|
||||
@PostMapping("/update")
|
||||
public AjaxResult updateModel(@RequestBody RequestModel requestModel) {
|
||||
public R<Object> updateModel(@RequestBody RequestModel requestModel) {
|
||||
ModelProduct modelProduct = requestModel.getModelProduct();
|
||||
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
|
@ -94,15 +95,15 @@ public class MallProductController extends BaseController {
|
|||
modelProduct.setUpdateBy(getUsername());
|
||||
modelService.updaModel(requestModel);
|
||||
|
||||
return AjaxResult.success("修改成功");
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "删除模型")
|
||||
@GetMapping("delete")
|
||||
public AjaxResult delete(@Valid @NotNull(message = "模型id不能为空") Long id) {
|
||||
public R<Object> delete(@Valid @NotNull(message = "模型id不能为空") Long id) {
|
||||
modelService.removeById(id);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -113,7 +114,7 @@ public class MallProductController extends BaseController {
|
|||
*/
|
||||
@ApiOperation(value = "查询模型详情")
|
||||
@GetMapping("/selectModelById")
|
||||
public AjaxResult selectModelById(@RequestParam Long id) {
|
||||
public R<ModelProduct> selectModelById(@RequestParam Long id) {
|
||||
|
||||
return modelService.selectModelById(id);
|
||||
}
|
||||
|
@ -128,9 +129,9 @@ public class MallProductController extends BaseController {
|
|||
*/
|
||||
@ApiOperation(value = "设置模型置顶状态")
|
||||
@GetMapping("/{id}/top")
|
||||
public AjaxResult setModelTop(@PathVariable Long id, @RequestParam boolean isTop) {
|
||||
public R<Object> setModelTop(@PathVariable Long id, @RequestParam boolean isTop) {
|
||||
modelService.setModelTop(id, isTop);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -141,9 +142,9 @@ public class MallProductController extends BaseController {
|
|||
*/
|
||||
@ApiOperation(value = "获取置顶的模型列表")
|
||||
@GetMapping
|
||||
public ResponseEntity<List<ModelProduct>> fetchModelsSortedByTopStatus() {
|
||||
public R<List<ModelProduct>> fetchModelsSortedByTopStatus() {
|
||||
List<ModelProduct> models = modelService.fetchModelsSortedByTopStatus();
|
||||
return ResponseEntity.ok(models);
|
||||
return R.ok(models);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.web.controller.resource;
|
|||
|
||||
import com.mcwl.common.annotation.RepeatSubmit;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.resource.domain.dto.ModelCommentRes;
|
||||
import com.mcwl.resource.domain.vo.ModelCommentVo;
|
||||
import com.mcwl.resource.service.ModelCommentLikeService;
|
||||
|
@ -46,12 +47,12 @@ public class ModelCommentController {
|
|||
@ApiOperation(value = "模型点赞/取消")
|
||||
@RepeatSubmit
|
||||
@GetMapping("/modelLike")
|
||||
public AjaxResult like(@Valid
|
||||
public R<Object> like(@Valid
|
||||
@NotNull(message = "模型id不能为空")
|
||||
@ApiParam(value = "模型id", required = true)
|
||||
Long modelId) {
|
||||
modelLikeService.like(modelId);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,9 +61,9 @@ public class ModelCommentController {
|
|||
*/
|
||||
@ApiOperation(value = "模型评论发布")
|
||||
@PostMapping("/comment")
|
||||
public AjaxResult comment(@Valid @RequestBody ModelCommentRes modelCommentRes) {
|
||||
public R<Object> comment(@Valid @RequestBody ModelCommentRes modelCommentRes) {
|
||||
modelCommentService.comment(modelCommentRes);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,12 +72,12 @@ public class ModelCommentController {
|
|||
@ApiOperation(value = "模型评论点赞/取消")
|
||||
@RepeatSubmit
|
||||
@GetMapping("/commentLike")
|
||||
public AjaxResult commentLike(@Valid
|
||||
public R<Object> commentLike(@Valid
|
||||
@NotNull(message = "评论id不能为空")
|
||||
@ApiParam(value = "评论id", required = true)
|
||||
Long commentId) {
|
||||
modelCommentLikeService.like(commentId);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,16 +87,16 @@ public class ModelCommentController {
|
|||
@ApiOperation(value = "获取模型评论")
|
||||
@GetMapping("/comment")
|
||||
@Valid
|
||||
public AjaxResult getComment(@Valid
|
||||
public R<List<ModelCommentVo>> getComment(@Valid
|
||||
@NotNull(message = "模型id不能为空")
|
||||
@ApiParam(value = "模型id", required = true)
|
||||
Long modelId,
|
||||
@Valid
|
||||
@Valid
|
||||
@NotNull(message = "排序方式不能为空")
|
||||
@ApiParam(value = "排序方式 0最热 1最新", required = true)
|
||||
Integer sortType) {
|
||||
List<ModelCommentVo> modelCommentList = modelCommentService.getComment(modelId, sortType);
|
||||
return AjaxResult.success(modelCommentList);
|
||||
return R.ok(modelCommentList);
|
||||
}
|
||||
|
||||
|
||||
|
@ -104,12 +105,12 @@ public class ModelCommentController {
|
|||
*/
|
||||
@ApiOperation(value = "删除模型评论")
|
||||
@GetMapping("/commentDelete")
|
||||
public AjaxResult commentDelete(@Valid
|
||||
public R<Object> commentDelete(@Valid
|
||||
@NotNull(message = "评论id不能为空")
|
||||
@ApiParam(value = "评论id", required = true)
|
||||
Long commentId) {
|
||||
modelCommentService.removeById(commentId);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -117,12 +118,12 @@ public class ModelCommentController {
|
|||
*/
|
||||
@ApiOperation(value = "获取模型评论数量")
|
||||
@GetMapping("/commentCount")
|
||||
public AjaxResult getCommentCount(@Valid
|
||||
public R<Integer> getCommentCount(@Valid
|
||||
@NotNull(message = "模型id不能为空")
|
||||
@ApiParam(value = "模型id", required = true)
|
||||
Long modelId) {
|
||||
Integer commentCount = modelCommentService.getCommentCount(modelId);
|
||||
return AjaxResult.success(commentCount);
|
||||
return R.ok(commentCount);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.web.controller.resource;
|
|||
|
||||
import com.mcwl.common.annotation.RepeatSubmit;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
|
||||
import com.mcwl.resource.domain.vo.ModelImageCommentVo;
|
||||
import com.mcwl.resource.service.ModelImageCommentLikeService;
|
||||
|
@ -38,9 +39,9 @@ public class ModelImageCommentController {
|
|||
*/
|
||||
@ApiOperation(value = "图片评论发布")
|
||||
@PostMapping("/comment")
|
||||
public AjaxResult comment(@Valid @RequestBody ModelImageCommentRes modelImageCommentRes) {
|
||||
public R<Object> comment(@Valid @RequestBody ModelImageCommentRes modelImageCommentRes) {
|
||||
modelImageCommentService.comment(modelImageCommentRes);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,12 +50,12 @@ public class ModelImageCommentController {
|
|||
@ApiOperation(value = "图片评论点赞/取消")
|
||||
@RepeatSubmit
|
||||
@GetMapping("/commentLike")
|
||||
public AjaxResult commentLike(@Valid
|
||||
public R<Object> commentLike(@Valid
|
||||
@NotNull(message = "评论id不能为空")
|
||||
@ApiParam(value = "评论id", required = true)
|
||||
Long commentId) {
|
||||
modelImageCommentLikeService.like(commentId);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,11 +63,11 @@ public class ModelImageCommentController {
|
|||
*/
|
||||
@ApiOperation(value = "删除图片评论")
|
||||
@GetMapping("/commentDelete")
|
||||
public AjaxResult commentDelete(@Valid
|
||||
public R<Object> commentDelete(@Valid
|
||||
@NotNull(message = "评论id不能为空")
|
||||
@ApiParam(value = "评论id", required = true) Long commentId) {
|
||||
modelImageCommentService.removeById(commentId);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,16 +76,16 @@ public class ModelImageCommentController {
|
|||
@ApiOperation(value = "获取图片评论")
|
||||
@GetMapping("/comment")
|
||||
@Valid
|
||||
public AjaxResult getComment(@Valid
|
||||
public R<List<ModelImageCommentVo>> getComment(@Valid
|
||||
@NotNull(message = "图片id不能为空")
|
||||
@ApiParam(value = "评论id", required = true)
|
||||
Long imageId,
|
||||
@Valid
|
||||
@Valid
|
||||
@NotNull(message = "排序方式不能为空")
|
||||
@ApiParam(value = "排序方式 0最热 1最新", required = true)
|
||||
Integer sortType) {
|
||||
List<ModelImageCommentVo> modelImageCommentVoList = modelImageCommentService.getComment(imageId, sortType);
|
||||
return AjaxResult.success(modelImageCommentVoList);
|
||||
return R.ok(modelImageCommentVoList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,12 +93,12 @@ public class ModelImageCommentController {
|
|||
*/
|
||||
@ApiOperation(value = "获取图片评论数量")
|
||||
@GetMapping("/commentCount")
|
||||
public AjaxResult getCommentCount(@Valid
|
||||
public R<Integer> getCommentCount(@Valid
|
||||
@NotNull(message = "图片id不能为空")
|
||||
@ApiParam(value = "图片id", required = true)
|
||||
Long imageId) {
|
||||
Integer commentCount = modelImageCommentService.getCommentCount(imageId);
|
||||
return AjaxResult.success(commentCount);
|
||||
return R.ok(commentCount);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.mcwl.web.controller.resource;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.mcwl.common.annotation.RepeatSubmit;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
|
@ -56,9 +57,9 @@ public class ModelImageController {
|
|||
*/
|
||||
@ApiOperation(value = "图片详情")
|
||||
@GetMapping("/detail")
|
||||
public AjaxResult detail(@Valid @NotNull(message = "图片id不能为空") Long id) {
|
||||
public R<ModelImageVo> detail(@Valid @NotNull(message = "图片id不能为空") Long id) {
|
||||
ModelImageVo modelImageVo = modelImageService.getDetail(id);
|
||||
return AjaxResult.success(modelImageVo);
|
||||
return R.ok(modelImageVo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,9 +67,9 @@ public class ModelImageController {
|
|||
*/
|
||||
@ApiOperation(value = "图片删除")
|
||||
@GetMapping("/delete")
|
||||
public AjaxResult delete(@Valid @NotNull(message = "图片id不能为空") Long id) {
|
||||
public R<Object> delete(@Valid @NotNull(message = "图片id不能为空") Long id) {
|
||||
modelImageService.removeById(id);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,9 +77,9 @@ public class ModelImageController {
|
|||
*/
|
||||
@ApiOperation(value = "图片修改")
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@Valid @RequestBody ModelImageRes modelImageRes) {
|
||||
public R<Object> update(@Valid @RequestBody ModelImageRes modelImageRes) {
|
||||
modelImageService.updateById(modelImageRes);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -87,9 +88,9 @@ public class ModelImageController {
|
|||
*/
|
||||
@ApiOperation(value = "图片发布")
|
||||
@PostMapping("/publish")
|
||||
public AjaxResult publish(@Valid @RequestBody ModelImageRes modelImageRes) {
|
||||
public R<Object> publish(@Valid @RequestBody ModelImageRes modelImageRes) {
|
||||
modelImageService.publish(modelImageRes);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -98,9 +99,9 @@ public class ModelImageController {
|
|||
@ApiOperation(value = "图片点赞/取消")
|
||||
@RepeatSubmit
|
||||
@GetMapping("/imageLike")
|
||||
public AjaxResult like(@Valid @NotNull(message = "图片id不能为空") Long id) {
|
||||
public R<Object> like(@Valid @NotNull(message = "图片id不能为空") Long id) {
|
||||
modelImageLikeService.like(id);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -113,9 +114,9 @@ public class ModelImageController {
|
|||
*/
|
||||
@ApiOperation(value = "设置图片置顶状态")
|
||||
@GetMapping("/{id}/top")
|
||||
public AjaxResult setModelImageTop(@PathVariable Long id, @RequestParam boolean isTop) {
|
||||
public R<Object> setModelImageTop(@PathVariable Long id, @RequestParam boolean isTop) {
|
||||
modelImageLikeService.setModelImageTop(id, isTop);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -126,9 +127,9 @@ public class ModelImageController {
|
|||
*/
|
||||
@ApiOperation(value = "获取置顶的图片列表")
|
||||
@GetMapping
|
||||
public ResponseEntity<List<ModelImage>> fetchModelImagesSortedByTopStatus() {
|
||||
public R<List<ModelImage>> fetchModelImagesSortedByTopStatus() {
|
||||
List<ModelImage> models = modelImageLikeService.fetchModelImageSortedByTopStatus();
|
||||
return ResponseEntity.ok(models);
|
||||
return R.ok(models);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.web.controller.resource;
|
|||
|
||||
import com.mcwl.common.core.controller.BaseController;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.resource.domain.ModelVersion;
|
||||
import com.mcwl.resource.service.ModelVersionService;
|
||||
|
@ -35,7 +36,7 @@ public class ModelVersionController extends BaseController {
|
|||
* @return
|
||||
*/
|
||||
@GetMapping("/selectByModelId")
|
||||
public AjaxResult selectByModelId(@RequestParam Long modelId){
|
||||
public R<List<ModelVersion>> selectByModelId(@RequestParam Long modelId){
|
||||
|
||||
return modelVersionService.selectByModelId(modelId);
|
||||
}
|
||||
|
@ -52,42 +53,42 @@ public class ModelVersionController extends BaseController {
|
|||
|
||||
@ApiOperation(value = "模型版本详情")
|
||||
@GetMapping("finbyid")
|
||||
public AjaxResult finbyid(@RequestParam Long id)
|
||||
public R<ModelVersion> finbyid(@RequestParam Long id)
|
||||
{
|
||||
|
||||
|
||||
ModelVersion modelVersion1 = modelVersionService.getById(id);
|
||||
|
||||
return AjaxResult.success(modelVersion1);
|
||||
return R.ok(modelVersion1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "模型版本添加")
|
||||
@PostMapping("insert")
|
||||
public AjaxResult insert(@RequestBody ModelVersion modelVersion)
|
||||
public R<Object> insert(@RequestBody ModelVersion modelVersion)
|
||||
{
|
||||
modelVersionService.save(modelVersion);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "模型版本修改")
|
||||
@PostMapping("update")
|
||||
public AjaxResult update(@RequestBody ModelVersion modelVersion)
|
||||
public R<Object> update(@RequestBody ModelVersion modelVersion)
|
||||
{
|
||||
modelVersionService.updateById(modelVersion);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "模型版本删除")
|
||||
@PostMapping("delete")
|
||||
public AjaxResult delete(@RequestBody ModelVersion modelVersion)
|
||||
public R<Object> delete(@RequestBody ModelVersion modelVersion)
|
||||
{
|
||||
modelVersionService.removeById(modelVersion.getId());
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.mcwl.web.controller.resource;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.resource.domain.Report;
|
||||
import com.mcwl.resource.domain.vo.PageVo;
|
||||
import com.mcwl.resource.service.ReportService;
|
||||
|
@ -29,10 +31,10 @@ public class ReportController {
|
|||
*/
|
||||
@ApiOperation(value = "新增举报内容")
|
||||
@PostMapping("/addReport")
|
||||
public AjaxResult addReport(@RequestBody Report report){
|
||||
public R<Object> addReport(@RequestBody Report report){
|
||||
|
||||
reportService.addReport(report);
|
||||
return AjaxResult.success("举报成功");
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,7 +46,7 @@ public class ReportController {
|
|||
*/
|
||||
@ApiOperation(value = "查询举报列表")
|
||||
@PostMapping("/selectReport")
|
||||
public AjaxResult selectReport(@RequestBody PageVo pageVo){
|
||||
public R<Page<Report>> selectReport(@RequestBody PageVo pageVo){
|
||||
|
||||
|
||||
return reportService.selectReport(pageVo);
|
||||
|
@ -57,10 +59,10 @@ public class ReportController {
|
|||
*/
|
||||
@ApiOperation(value = "删除举报")
|
||||
@GetMapping("/deleteReport")
|
||||
public AjaxResult deleteReport(@RequestParam Long id){
|
||||
public R<Object> deleteReport(@RequestParam Long id){
|
||||
|
||||
reportService.deleteReport(id);
|
||||
return AjaxResult.success("删除成功");
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,10 +72,10 @@ public class ReportController {
|
|||
*/
|
||||
@ApiOperation(value = "修改状态")
|
||||
@GetMapping("/updateStatus")
|
||||
public AjaxResult updateStatus(@RequestParam Long id){
|
||||
public R<Object> updateStatus(@RequestParam Long id){
|
||||
|
||||
reportService.updateStatus(id);
|
||||
return AjaxResult.success("修改成功");
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.mcwl.web.controller.resource;
|
|||
import com.github.pagehelper.PageInfo;
|
||||
import com.mcwl.common.annotation.RepeatSubmit;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.resource.domain.SysUserInfo;
|
||||
import com.mcwl.resource.domain.vo.PageVo;
|
||||
|
@ -34,7 +35,7 @@ public class SysUserAttentionController {
|
|||
@ApiOperation(value = "添加/取消关注")
|
||||
@RepeatSubmit
|
||||
@GetMapping("/addAttention")
|
||||
public AjaxResult addAttention(@RequestParam Long userId) {
|
||||
public R<Boolean> addAttention(@RequestParam Long userId) {
|
||||
|
||||
return sysUserAttentionService.addAttention(userId);
|
||||
|
||||
|
@ -47,11 +48,11 @@ public class SysUserAttentionController {
|
|||
*/
|
||||
@ApiOperation(value = "查询是否关注用户")
|
||||
@GetMapping("/selectAttention")
|
||||
public AjaxResult selectAttention(@RequestParam Long userId) {
|
||||
public R<Boolean> selectAttention(@RequestParam Long userId) {
|
||||
|
||||
Boolean aBoolean = sysUserAttentionService.selectAttention(userId);
|
||||
|
||||
return AjaxResult.success(aBoolean);
|
||||
return R.ok(aBoolean);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,11 +61,11 @@ public class SysUserAttentionController {
|
|||
*/
|
||||
@ApiOperation(value = "查询个人粉丝,关注,下载量,喜欢")
|
||||
@GetMapping("/selectUserInfo")
|
||||
public AjaxResult selectUserInfo(){
|
||||
public R<SysUserInfo> selectUserInfo(){
|
||||
|
||||
SysUserInfo sysUserInfo = sysUserAttentionService.selectUserInfo();
|
||||
|
||||
return AjaxResult.success(sysUserInfo);
|
||||
return R.ok(sysUserInfo);
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,11 +75,11 @@ public class SysUserAttentionController {
|
|||
*/
|
||||
@ApiOperation(value = "查询关注列表")
|
||||
@PostMapping("/selectAttention")
|
||||
public AjaxResult selectAttention(PageVo pageVo){
|
||||
public R<PageInfo<SysUser>> selectAttention(PageVo pageVo){
|
||||
|
||||
PageInfo<SysUser> sysUserList = sysUserAttentionService.selectAttentionPage(pageVo);
|
||||
|
||||
return AjaxResult.success(sysUserList);
|
||||
return R.ok(sysUserList);
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,10 +89,10 @@ public class SysUserAttentionController {
|
|||
*/
|
||||
@ApiOperation(value = "查询粉丝列表")
|
||||
@PostMapping("/selectToAttention")
|
||||
public AjaxResult selectToAttention(PageVo pageVo){
|
||||
public R<PageInfo<SysUser>> selectToAttention(PageVo pageVo){
|
||||
|
||||
PageInfo<SysUser> sysUserList = sysUserAttentionService.selectToAttentionPage(pageVo);
|
||||
|
||||
return AjaxResult.success(sysUserList);
|
||||
return R.ok(sysUserList);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.web.controller.resource;
|
|||
|
||||
import com.mcwl.common.core.controller.BaseController;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.resource.domain.ToActivity;
|
||||
import com.mcwl.resource.service.ToActivityService;
|
||||
|
@ -46,41 +47,45 @@ public class ToActivityController extends BaseController {
|
|||
|
||||
@ApiOperation(value = "活动详情")
|
||||
@PostMapping("finById")
|
||||
public AjaxResult finById(@RequestBody ToActivity toActivity)
|
||||
public R<ToActivity> finById(@RequestBody ToActivity toActivity)
|
||||
{
|
||||
return AjaxResult.success(toActivityService.getById(toActivity.getId()));
|
||||
return R.ok(toActivityService.getById(toActivity.getId()));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "活动添加")
|
||||
@PostMapping("add")
|
||||
public AjaxResult add(@RequestBody ToActivity toActivity)
|
||||
public R<Object> add(@RequestBody ToActivity toActivity)
|
||||
{
|
||||
return AjaxResult.success(toActivityService.save(toActivity));
|
||||
toActivityService.save(toActivity);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "活动修改")
|
||||
@PostMapping("update")
|
||||
public AjaxResult update(@RequestBody ToActivity toActivity)
|
||||
public R<Object> update(@RequestBody ToActivity toActivity)
|
||||
{
|
||||
return AjaxResult.success(toActivityService.updateById(toActivity));
|
||||
toActivityService.updateById(toActivity);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "活动删除")
|
||||
@PostMapping("delete")
|
||||
public AjaxResult delete(@RequestBody ToActivity toActivity)
|
||||
public R<Object> delete(@RequestBody ToActivity toActivity)
|
||||
{
|
||||
return AjaxResult.success(toActivityService.removeById(toActivity));
|
||||
toActivityService.removeById(toActivity);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "活动批量删除")
|
||||
@PostMapping("deleteByIds")
|
||||
public AjaxResult deleteByIds(@RequestBody List<ToActivity> toActivity)
|
||||
public R<Object> deleteByIds(@RequestBody List<ToActivity> toActivity)
|
||||
{
|
||||
return AjaxResult.success(toActivityService.removeByIds(toActivity));
|
||||
toActivityService.removeByIds(toActivity);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.mcwl.web.controller.resource;
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.resource.domain.dto.WorkFlowCommentRes;
|
||||
import com.mcwl.resource.domain.vo.WorkFlowCommentVo;
|
||||
import com.mcwl.resource.service.WorkFlowCommentLikeService;
|
||||
|
@ -44,12 +45,12 @@ public class WorkFlowCommentController {
|
|||
*/
|
||||
@ApiOperation(value = "工作流点赞/取消")
|
||||
@GetMapping("/like")
|
||||
public AjaxResult like(@Valid
|
||||
public R<Object> like(@Valid
|
||||
@NotNull(message = "模型id不能为空")
|
||||
@ApiParam(value = "模型id", required = true)
|
||||
Long workFlowId) {
|
||||
workFlowLikeService.like(workFlowId);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,11 +59,11 @@ public class WorkFlowCommentController {
|
|||
*/
|
||||
@ApiOperation(value = "工作流评论发布")
|
||||
@PostMapping("/comment")
|
||||
public AjaxResult comment(@Valid
|
||||
public R<Object> comment(@Valid
|
||||
@RequestBody
|
||||
WorkFlowCommentRes workFlowCommentRes) {
|
||||
workFlowCommentService.comment(workFlowCommentRes);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,12 +71,12 @@ public class WorkFlowCommentController {
|
|||
*/
|
||||
@ApiOperation(value = "工作流评论点赞/取消")
|
||||
@GetMapping("/commentLike")
|
||||
public AjaxResult commentLike(@Valid
|
||||
public R<Object> commentLike(@Valid
|
||||
@NotNull(message = "评论id不能为空")
|
||||
@ApiParam(value = "评论id", required = true)
|
||||
Long commentId) {
|
||||
workFlowCommentLikeService.like(commentId);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -84,16 +85,16 @@ public class WorkFlowCommentController {
|
|||
*/
|
||||
@ApiOperation(value = "获取工作流评论")
|
||||
@GetMapping("/comment")
|
||||
public AjaxResult getComment(@Valid
|
||||
public R<List<WorkFlowCommentVo>> getComment(@Valid
|
||||
@NotNull(message = "模型id不能为空")
|
||||
@ApiParam(value = "模型id", required = true)
|
||||
Long commentId,
|
||||
@Valid
|
||||
@Valid
|
||||
@NotNull(message = "排序方式不能为空")
|
||||
@ApiParam(value = "排序方式 0最热 1最新", required = true)
|
||||
Integer sortType) {
|
||||
List<WorkFlowCommentVo> modelCommentList = workFlowCommentService.getComment(commentId, sortType);
|
||||
return AjaxResult.success(modelCommentList);
|
||||
return R.ok(modelCommentList);
|
||||
}
|
||||
|
||||
|
||||
|
@ -102,12 +103,12 @@ public class WorkFlowCommentController {
|
|||
*/
|
||||
@ApiOperation(value = "删除工作流评论")
|
||||
@GetMapping("/commentDelete")
|
||||
public AjaxResult commentDelete(@Valid
|
||||
public R<Object> commentDelete(@Valid
|
||||
@NotNull(message = "评论id不能为空")
|
||||
@ApiParam(value = "评论id", required = true)
|
||||
Long commentId) {
|
||||
workFlowCommentService.removeById(commentId);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -115,12 +116,12 @@ public class WorkFlowCommentController {
|
|||
*/
|
||||
@ApiOperation(value = "获取工作流评论数量")
|
||||
@GetMapping("/commentCount")
|
||||
public AjaxResult getCommentCount(@Valid
|
||||
public R<Integer> getCommentCount(@Valid
|
||||
@NotNull(message = "工作流id不能为空")
|
||||
@ApiParam(value = "工作流id", required = true)
|
||||
Long workFlowId) {
|
||||
Integer commentCount = workFlowCommentService.getCommentCount(workFlowId);
|
||||
return AjaxResult.success(commentCount);
|
||||
return R.ok(commentCount);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
package com.mcwl.web.controller.resource;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mcwl.common.core.controller.BaseController;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.resource.domain.WorkFlow;
|
||||
import com.mcwl.resource.domain.dto.AddRequestWorkFlow;
|
||||
import com.mcwl.resource.domain.request.RequestWorkFlow;
|
||||
import com.mcwl.resource.domain.vo.PageVo;
|
||||
import com.mcwl.resource.service.WorkFlowService;
|
||||
import com.mcwl.resource.service.impl.WorkFlowServiceImpl;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -21,6 +24,7 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* 工作流
|
||||
*
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.web.controller.resource
|
||||
|
@ -35,85 +39,90 @@ public class WorkFlowController extends BaseController {
|
|||
|
||||
|
||||
@Autowired
|
||||
private WorkFlowServiceImpl workFlowService;
|
||||
private WorkFlowService workFlowService;
|
||||
|
||||
|
||||
/**
|
||||
* 设置工作流的置顶状态
|
||||
*
|
||||
* @param id
|
||||
* @param isTop
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "设置工作流的置顶状态")
|
||||
@GetMapping("/{id}/top")
|
||||
public AjaxResult setWorkFlowTop(@PathVariable Long id, @RequestParam boolean isTop) {
|
||||
public R<Object> setWorkFlowTop(@PathVariable Long id, @RequestParam boolean isTop) {
|
||||
|
||||
workFlowService.setworkFlowTop(id, isTop);
|
||||
return AjaxResult.success();
|
||||
workFlowService.setworkFlowTop(id, isTop);
|
||||
return R.ok();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* 获取所有工作流,按照置顶状态排序
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取置顶的模型列表")
|
||||
@GetMapping
|
||||
public ResponseEntity<List<WorkFlow>> fetchWorkFlowSortedByTopStatus() {
|
||||
public R<List<WorkFlow>> fetchWorkFlowSortedByTopStatus() {
|
||||
List<WorkFlow> models = workFlowService.fetchWorkFlowSortedByTopStatus();
|
||||
return ResponseEntity.ok(models);
|
||||
return R.ok(models);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 添加工作流
|
||||
*
|
||||
* @param addRequestWorkFlow
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加工作流")
|
||||
@PostMapping("/addWorkFlow")
|
||||
public AjaxResult addWorkFlow(@Validated @RequestBody AddRequestWorkFlow addRequestWorkFlow){
|
||||
public R<Object> addWorkFlow(@Validated @RequestBody AddRequestWorkFlow addRequestWorkFlow) {
|
||||
|
||||
return workFlowService.addWorkFlow(addRequestWorkFlow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改工作流
|
||||
*
|
||||
* @param requestWorkFlow
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "修改工作流")
|
||||
@PostMapping("/updateWorkFlow")
|
||||
public AjaxResult updateWorkFlow(@RequestBody RequestWorkFlow requestWorkFlow){
|
||||
public R<Object> updateWorkFlow(@RequestBody RequestWorkFlow requestWorkFlow) {
|
||||
|
||||
workFlowService.updateWorkFlow(requestWorkFlow);
|
||||
|
||||
return AjaxResult.success("修改成功");
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除工作流
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除工作流")
|
||||
@GetMapping("/deleteWorkFlow")
|
||||
public AjaxResult deleteWorkFlow(@RequestParam @Valid @NotNull(message = "工作流id不能为空") Long id){
|
||||
public R<Object> deleteWorkFlow(@RequestParam @Valid @NotNull(message = "工作流id不能为空") Long id) {
|
||||
|
||||
workFlowService.deleteWorkFlow(id);
|
||||
return AjaxResult.success("删除成功");
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询工作流列表
|
||||
*
|
||||
* @param pageVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询工作流列表")
|
||||
@PostMapping("/selectWorkFlow")
|
||||
public AjaxResult selectWorkFlow(@RequestBody PageVo pageVo){
|
||||
public R<Page<WorkFlow>> selectWorkFlow(@RequestBody PageVo pageVo) {
|
||||
|
||||
return workFlowService.selectWorkFlow(pageVo);
|
||||
}
|
||||
|
@ -121,37 +130,40 @@ public class WorkFlowController extends BaseController {
|
|||
|
||||
/**
|
||||
* 查询工作流详情
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询工作流详情")
|
||||
@GetMapping("/selectWorkFlowById")
|
||||
public AjaxResult selectWorkFlowById(@RequestParam @Valid @NotNull(message = "工作流id不能为空") Long id){
|
||||
public R<WorkFlow> selectWorkFlowById(@RequestParam @Valid @NotNull(message = "工作流id不能为空") Long id) {
|
||||
|
||||
return workFlowService.selectWorkFlowById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验名字是否重复
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "校验名字是否重复")
|
||||
@GetMapping("/selectWorkFlowByName")
|
||||
public AjaxResult selectWorkFlowByName(@RequestParam String name){
|
||||
public R<Long> selectWorkFlowByName(@RequestParam String name) {
|
||||
|
||||
Long sign = workFlowService.selectWorkFlowByName(name);
|
||||
return AjaxResult.success(sign);
|
||||
return R.ok(sign);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 回显接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "工作流回显接口")
|
||||
@GetMapping("/selectWorkFlowVersionById")
|
||||
public AjaxResult selectWorkFlowVersionById(@RequestParam @Valid @NotNull(message = "图片id不能为空") Long id){
|
||||
public R<RequestWorkFlow> selectWorkFlowVersionById(@RequestParam @Valid @NotNull(message = "图片id不能为空") Long id) {
|
||||
|
||||
return workFlowService.selectWorkFlowVersionById(id);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package com.mcwl.web.controller.resource;
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.resource.domain.WorkFlowVersion;
|
||||
import com.mcwl.resource.service.WorkFlowVersionService;
|
||||
import com.mcwl.resource.service.impl.WorkFlowVersionServiceImpl;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -10,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工作流版本
|
||||
*
|
||||
|
@ -23,7 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
public class WorkFlowVersionController {
|
||||
|
||||
@Autowired
|
||||
private WorkFlowVersionServiceImpl workFlowVersionService;
|
||||
private WorkFlowVersionService workFlowVersionService;
|
||||
|
||||
/**
|
||||
* 查询工作流下的所有版本信息
|
||||
|
@ -33,7 +38,7 @@ public class WorkFlowVersionController {
|
|||
*/
|
||||
@ApiOperation(value = "查询工作流下的所有版本信息")
|
||||
@GetMapping("/selectVersionByWorkId")
|
||||
public AjaxResult selectVersionByWorkId(@RequestParam Long workId) {
|
||||
public R<List<WorkFlowVersion>> selectVersionByWorkId(@RequestParam Long workId) {
|
||||
|
||||
return workFlowVersionService.selectVersionByWorkId(workId);
|
||||
}
|
||||
|
|
|
@ -2,12 +2,15 @@ package com.mcwl.common.core.domain;
|
|||
|
||||
import java.io.Serializable;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 响应信息主体
|
||||
*
|
||||
* @author mcwl
|
||||
*/
|
||||
@ApiModel(value = "响应结果")
|
||||
public class R<T> implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -18,10 +21,13 @@ public class R<T> implements Serializable
|
|||
/** 失败 */
|
||||
public static final int FAIL = HttpStatus.ERROR;
|
||||
|
||||
@ApiModelProperty(value = "状态码")
|
||||
private int code;
|
||||
|
||||
@ApiModelProperty(value = "提示信息")
|
||||
private String msg;
|
||||
|
||||
@ApiModelProperty(value = "数据对象")
|
||||
private T data;
|
||||
|
||||
public static <T> R<T> ok()
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.communityCenter.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.Invite;
|
||||
|
@ -26,5 +27,5 @@ public interface InviteService extends IService<Invite> {
|
|||
* @param inviteCode 邀请码
|
||||
* @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);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.communityCenter.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.communityCenter.domain.dto.CommentDelRes;
|
||||
import com.mcwl.communityCenter.domain.dto.CommentDetailRes;
|
||||
import com.mcwl.communityCenter.domain.dto.CommentRes;
|
||||
|
@ -27,9 +28,9 @@ public interface PublishCommentService extends IService<PublishComment> {
|
|||
* @param commentDetailRes 评论详情参数
|
||||
* @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);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.communityCenter.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.Community;
|
||||
|
@ -23,7 +24,7 @@ public interface PublishService extends IService<Publish> {
|
|||
* 发布
|
||||
* @param publishRes 发布对象
|
||||
*/
|
||||
AjaxResult publish(PublishRes publishRes);
|
||||
R<Object> publish(PublishRes publishRes);
|
||||
|
||||
TableDataInfo getPublishList(PublishPageRes publishPageRes);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.communityCenter.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.Question;
|
||||
import com.mcwl.communityCenter.domain.QuestionComment;
|
||||
|
@ -12,9 +13,9 @@ import javax.validation.Valid;
|
|||
|
||||
public interface QuestionCommentService extends IService<QuestionComment> {
|
||||
|
||||
AjaxResult comment(@Valid QuestionCommentRes questionCommentRes);
|
||||
R<Object> comment(@Valid QuestionCommentRes questionCommentRes);
|
||||
|
||||
TableDataInfo listByPage(@Valid QuestionCommentPageRes questionCommentPageRes);
|
||||
|
||||
AjaxResult adopt(@Valid QuestionCommentAdoptRes questionCommentAdoptRes);
|
||||
R<Object> adopt(@Valid QuestionCommentAdoptRes questionCommentAdoptRes);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.communityCenter.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.Question;
|
||||
import com.mcwl.communityCenter.domain.dto.QuestionDetailRes;
|
||||
|
@ -19,7 +20,7 @@ public interface QuestionService extends IService<Question> {
|
|||
* 添加问题
|
||||
* @param questionRes 问题信息
|
||||
*/
|
||||
AjaxResult addQuestion(QuestionRes questionRes);
|
||||
R<Object> addQuestion(QuestionRes questionRes);
|
||||
|
||||
|
||||
TableDataInfo list(QuestionPageRes questionPageRes);
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.mcwl.communityCenter.service.impl;
|
|||
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.ShareCodeUtils;
|
||||
import com.mcwl.communityCenter.constant.InviteConstant;
|
||||
|
@ -61,17 +62,17 @@ public class InviteServiceImpl extends ServiceImpl<InviteMapper, Invite> impleme
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult acceptInvite(Long communityId, String inviteCode) {
|
||||
public R<Object> acceptInvite(Long communityId, String inviteCode) {
|
||||
|
||||
// 解析邀请码
|
||||
Long userId = ShareCodeUtils.codeToId(inviteCode);
|
||||
if (Objects.isNull(userId)) {
|
||||
return AjaxResult.error("邀请码有误");
|
||||
return R.fail("邀请码有误");
|
||||
}
|
||||
|
||||
// 判断是否是同一个人
|
||||
if (Objects.equals(userId, SecurityUtils.getUserId())) {
|
||||
return AjaxResult.error("不能邀请自己");
|
||||
return R.fail("不能邀请自己");
|
||||
}
|
||||
|
||||
// 查询邀请码
|
||||
|
@ -83,13 +84,13 @@ public class InviteServiceImpl extends ServiceImpl<InviteMapper, Invite> impleme
|
|||
.one();
|
||||
|
||||
if (Objects.isNull(inviteCodeMapping)) {
|
||||
return AjaxResult.error("没查询到该邀请码");
|
||||
return R.fail("没查询到该邀请码");
|
||||
}
|
||||
|
||||
// 判断是否已经邀请过
|
||||
Invite inv = inviteMapper.isInvite(userId, communityId, SecurityUtils.getUserId());
|
||||
if (Objects.nonNull(inv)) {
|
||||
return AjaxResult.error("不能重复邀请");
|
||||
return R.fail("不能重复邀请");
|
||||
}
|
||||
|
||||
|
||||
|
@ -103,6 +104,6 @@ public class InviteServiceImpl extends ServiceImpl<InviteMapper, Invite> impleme
|
|||
invite.setType(InviteConstant.INVITE_ADMIN);
|
||||
invite.setFeeType(InviteConstant.INVITE_FEE);
|
||||
baseMapper.insert(invite);
|
||||
return AjaxResult.success("邀请成功");
|
||||
return R.ok(null, "邀请成功");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.communityCenter.domain.Publish;
|
||||
|
@ -51,7 +52,7 @@ public class PublishCommentServiceImpl extends ServiceImpl<PublishCommentMapper,
|
|||
private final PublishMapper publishMapper;
|
||||
|
||||
@Override
|
||||
public AjaxResult getComment(CommentDetailRes commentDetailRes) {
|
||||
public R<Object> getComment(CommentDetailRes commentDetailRes) {
|
||||
Long tenantId = commentDetailRes.getTenantId();
|
||||
Long communityId = commentDetailRes.getCommunityId();
|
||||
Long operatorId = commentDetailRes.getOperatorId();
|
||||
|
@ -69,18 +70,18 @@ public class PublishCommentServiceImpl extends ServiceImpl<PublishCommentMapper,
|
|||
commentVo.setUserAvatar(sysUser.getAvatar());
|
||||
}
|
||||
|
||||
return AjaxResult.success(commentVoList);
|
||||
return R.ok(commentVoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult addComment(CommentRes commentRes) {
|
||||
public R<Object> addComment(CommentRes commentRes) {
|
||||
Long tenantId = commentRes.getTenantId();
|
||||
Long communityId = commentRes.getCommunityId();
|
||||
Long operatorId = commentRes.getOperatorId();
|
||||
|
||||
Publish publish = publishMapper.selectByIdAndTenantIdAndCommunityId(operatorId, tenantId, communityId);
|
||||
if (Objects.isNull(publish)) {
|
||||
return AjaxResult.error("评论失败,该内容不存在");
|
||||
return R.fail("评论失败,该内容不存在");
|
||||
}
|
||||
|
||||
PublishComment publishComment = new PublishComment();
|
||||
|
@ -91,11 +92,11 @@ public class PublishCommentServiceImpl extends ServiceImpl<PublishCommentMapper,
|
|||
|
||||
publishCommentMapper.insert(publishComment);
|
||||
|
||||
return AjaxResult.success("评论成功");
|
||||
return R.ok(null, "评论成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult removeCommentById(CommentDelRes commentDelRes) {
|
||||
public R<Object> removeCommentById(CommentDelRes commentDelRes) {
|
||||
Long id = commentDelRes.getId();
|
||||
Long tenantId = commentDelRes.getTenantId();
|
||||
Long communityId = commentDelRes.getCommunityId();
|
||||
|
@ -104,12 +105,12 @@ public class PublishCommentServiceImpl extends ServiceImpl<PublishCommentMapper,
|
|||
PublishComment publishComment = publishCommentMapper.selectByIdAndTenantIdAndCommunityIdAndOperatorId(id, tenantId, communityId, operatorId);
|
||||
|
||||
if (Objects.isNull(publishComment)) {
|
||||
return AjaxResult.error("删除失败,该评论不存在");
|
||||
return R.fail("删除失败,该评论不存在");
|
||||
}
|
||||
|
||||
publishCommentMapper.deleteByIdAndTenantIdAndCommunityIdAndOperatorId(id, tenantId, communityId, operatorId);
|
||||
|
||||
return AjaxResult.success("删除成功");
|
||||
return R.ok(null, "删除成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
|
@ -65,14 +66,14 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
|
|||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult publish(PublishRes publishRes) {
|
||||
public R<Object> publish(PublishRes publishRes) {
|
||||
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
|
||||
Community community = communityMapper.getByTenantIdAndCommunityId(publishRes.getTenantId(), publishRes.getCommunityId());
|
||||
|
||||
if (Objects.isNull(community)) {
|
||||
return AjaxResult.error(HttpStatus.ERROR, "用户社区未创建");
|
||||
return R.fail("用户社区未创建");
|
||||
}
|
||||
|
||||
|
||||
|
@ -82,7 +83,7 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
|
|||
if (!Objects.equals(userId, publishRes.getTenantId())) {
|
||||
// 判断用户是否被邀请
|
||||
if (invites.isEmpty() || !invites.contains(userId)) {
|
||||
return AjaxResult.error(HttpStatus.ERROR, "您没有被邀请");
|
||||
return R.fail("您没有被邀请");
|
||||
}
|
||||
}
|
||||
Publish publish = new Publish();
|
||||
|
@ -92,7 +93,7 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
|
|||
publish.setPublishTime(new Date());
|
||||
}
|
||||
baseMapper.insert(publish);
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
|
@ -38,7 +39,7 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
|
|||
private final ISysUserService sysUserService;
|
||||
|
||||
@Override
|
||||
public AjaxResult comment(QuestionCommentRes questionCommentRes) {
|
||||
public R<Object> comment(QuestionCommentRes questionCommentRes) {
|
||||
|
||||
Long tenantId = questionCommentRes.getTenantId();
|
||||
Long communityId = questionCommentRes.getCommunityId();
|
||||
|
@ -47,7 +48,7 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
|
|||
Question question = questionMapper.selectByIdAndTenantIdAndCommunityId(questionId, tenantId, communityId);
|
||||
|
||||
if (Objects.isNull(question)) {
|
||||
return AjaxResult.error("提问不存在");
|
||||
return R.fail("提问不存在");
|
||||
}
|
||||
|
||||
QuestionComment questionComment = new QuestionComment();
|
||||
|
@ -57,7 +58,7 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
|
|||
baseMapper.insert(questionComment);
|
||||
|
||||
|
||||
return AjaxResult.success("评论成功");
|
||||
return R.ok(null, "评论成功");
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,7 +89,7 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult adopt(QuestionCommentAdoptRes questionCommentAdoptRes) {
|
||||
public R<Object> adopt(QuestionCommentAdoptRes questionCommentAdoptRes) {
|
||||
|
||||
Long tenantId = questionCommentAdoptRes.getTenantId();
|
||||
Long communityId = questionCommentAdoptRes.getCommunityId();
|
||||
|
@ -97,25 +98,25 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
|
|||
|
||||
Question question = questionMapper.selectByIdAndTenantIdAndCommunityId(questionId, tenantId, communityId);
|
||||
if (Objects.isNull(question)) {
|
||||
return AjaxResult.error("提问不存在");
|
||||
return R.fail("提问不存在");
|
||||
}
|
||||
|
||||
if (question.getStatus() == 1) {
|
||||
return AjaxResult.error("该提问已解决");
|
||||
return R.fail("该提问已解决");
|
||||
}
|
||||
|
||||
QuestionComment questionComment = baseMapper.selectByIdAndTenantIdAndCommunityIdAndQuestionIdAndCommentId(tenantId, communityId, questionId, commentId);
|
||||
if (Objects.isNull(questionComment)) {
|
||||
return AjaxResult.error("评论不存在");
|
||||
return R.fail("评论不存在");
|
||||
}
|
||||
|
||||
if (questionComment.getIsAccept() == 1) {
|
||||
return AjaxResult.error("该评论已被采纳");
|
||||
return R.fail("该评论已被采纳");
|
||||
}
|
||||
|
||||
Long questionUserId = question.getQuestionUserId();
|
||||
if (questionComment.getUserId().equals(questionUserId)) {
|
||||
return AjaxResult.error("您不能采纳自己的评论");
|
||||
return R.fail("您不能采纳自己的评论");
|
||||
}
|
||||
|
||||
questionComment.setIsAccept(1);
|
||||
|
@ -135,7 +136,7 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
|
|||
sysUserService.updateUser(sysUser);
|
||||
|
||||
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
|
@ -58,7 +59,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult addQuestion(QuestionRes questionRes) {
|
||||
public R<Object> addQuestion(QuestionRes questionRes) {
|
||||
Long communityId = questionRes.getCommunityId();
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
|
||||
|
@ -68,7 +69,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|||
Community community = communityMapper.getByTenantIdAndCommunityId(tenantId, communityId);
|
||||
|
||||
if (Objects.isNull(community)) {
|
||||
return AjaxResult.error("租户或社区不存在");
|
||||
return R.fail("租户或社区不存在");
|
||||
}
|
||||
|
||||
// if (Objects.equals(tenantId, userId)) {
|
||||
|
@ -108,7 +109,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|||
// communityAdviceMapper.insert(communityAdvice);
|
||||
|
||||
|
||||
return AjaxResult.success();
|
||||
return R.ok();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import com.mcwl.memberCenter.enums.MemberEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
@ -16,42 +18,55 @@ import java.util.Date;
|
|||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("mem_member")
|
||||
@ApiModel(description = "会员表")
|
||||
public class Member extends BaseEntity {
|
||||
|
||||
@TableId
|
||||
@ApiModelProperty(value = "会员ID")
|
||||
private Long id;
|
||||
|
||||
// 用户ID
|
||||
@ApiModelProperty(value = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
// 会员等级ID
|
||||
@ApiModelProperty(value = "会员等级ID")
|
||||
private Long memberLevelId;
|
||||
|
||||
// 会员开始时间
|
||||
@ApiModelProperty(value = "会员开始时间")
|
||||
private Date startDate;
|
||||
|
||||
// 会员结束时间
|
||||
@ApiModelProperty(value = "会员结束时间")
|
||||
private Date endDate;
|
||||
|
||||
// 会员积分
|
||||
@ApiModelProperty(value = "会员积分")
|
||||
private Double points;
|
||||
|
||||
// 订阅状态 active(活跃,连续包月)、inactive(非活跃,不连续包月)、pending(待支付)和expired(过期)
|
||||
@ApiModelProperty(value = "订阅状态 active(活跃,连续包月)、inactive(非活跃,不连续包月)、pending(待支付)和expired(过期)")
|
||||
private MemberEnum subscriptionStatus;
|
||||
|
||||
// 支付方式
|
||||
@ApiModelProperty(value = "支付方式")
|
||||
private String paymentMethod;
|
||||
|
||||
// 上次支付时间
|
||||
@ApiModelProperty(value = "上次支付时间")
|
||||
private Date lastPaymentDate;
|
||||
|
||||
// 下次计费时间
|
||||
@ApiModelProperty(value = "下次计费时间")
|
||||
private Date nextBillingDate;
|
||||
|
||||
// 上次登录时间
|
||||
@ApiModelProperty(value = "上次登录时间")
|
||||
private Date lastLoginDate;
|
||||
|
||||
// 状态(0:正常 1:禁用)
|
||||
@ApiModelProperty(value = "状态(0:正常 1:禁用)")
|
||||
private String status;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
package com.mcwl.pay.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "支付返回对象")
|
||||
public class PayVo {
|
||||
|
||||
@ApiModelProperty(value = "二维码url")
|
||||
private String url;
|
||||
|
||||
@ApiModelProperty(value = "订单号")
|
||||
private String orderNo;
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.pay.service;
|
|||
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.pay.domain.OrderTradeDto;
|
||||
import com.mcwl.pay.domain.vo.PayVo;
|
||||
|
||||
|
@ -14,10 +15,10 @@ public interface AliPayService {
|
|||
|
||||
PayVo pointsPay(Double paymentAmount) throws Exception;
|
||||
|
||||
AjaxResult fetch(String outBizNo, String amount) throws AlipayApiException;
|
||||
R<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;
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.alipay.easysdk.payment.common.models.AlipayTradeQueryResponse;
|
|||
import com.alipay.easysdk.payment.facetoface.models.AlipayTradePrecreateResponse;
|
||||
import com.mcwl.common.JSONUtils;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.core.redis.RedisCache;
|
||||
import com.mcwl.common.exception.ServiceException;
|
||||
|
@ -279,11 +280,11 @@ public class AliPayServiceImpl implements AliPayService {
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult fetch(String outBizNo, String amount) throws AlipayApiException {
|
||||
public R<String> fetch(String outBizNo, String amount) throws AlipayApiException {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
if (sysUser.getWallet() < Double.parseDouble(amount)) {
|
||||
return AjaxResult.error("钱包余额不足");
|
||||
return R.fail("钱包余额不足");
|
||||
}
|
||||
|
||||
// 初始化SDK
|
||||
|
@ -315,9 +316,12 @@ public class AliPayServiceImpl implements AliPayService {
|
|||
.eq(SysUserPayAccount::getType, 0)
|
||||
.one();
|
||||
if (Objects.isNull(sysUserPayAccount)) {
|
||||
return AjaxResult.error("请先绑定支付宝账号");
|
||||
return R.fail("请先绑定支付宝账号");
|
||||
}
|
||||
|
||||
// 添加提现记录和修改用户钱包
|
||||
this.addLogAndUpdateUserWallet(sysUser, amount);
|
||||
|
||||
// 收款方信息
|
||||
Participant payeeInfo = new Participant();
|
||||
|
||||
|
@ -337,9 +341,7 @@ public class AliPayServiceImpl implements AliPayService {
|
|||
System.out.println(response.getBody());
|
||||
|
||||
if (response.isSuccess()) {
|
||||
// 记录日志和修改用户钱包
|
||||
this.addLogAndUpdateUserWallet(sysUser, amount);
|
||||
return AjaxResult.success("转账成功");
|
||||
return R.ok("提现成功");
|
||||
}
|
||||
|
||||
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);
|
||||
MailUtil.send(tos, "上海辰风互娱", content, false);
|
||||
throw new ServiceException("系统繁忙,请稍后重试");
|
||||
throw new ServiceException("网络连接出错,请稍后再试");
|
||||
}
|
||||
|
||||
throw new ServiceException("转账失败:" + response.getSubMsg());
|
||||
System.out.println("提现失败:" + response.getSubMsg());
|
||||
throw new ServiceException("提现失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult queryTradeStatus(String outTradeNo) throws Exception {
|
||||
public R<Object> queryTradeStatus(String outTradeNo) throws Exception {
|
||||
|
||||
// 查询redis中订单信息
|
||||
String orderTradeJson = redisCache.getCacheObject(outTradeNo);
|
||||
|
@ -365,7 +367,7 @@ public class AliPayServiceImpl implements AliPayService {
|
|||
}
|
||||
// 如果redis中存在该订单, 则直接返回该订单的支付状态
|
||||
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)) {
|
||||
return AjaxResult.error("订单不存在");
|
||||
return R.fail("订单不存在");
|
||||
}
|
||||
|
||||
|
||||
|
@ -396,7 +398,7 @@ public class AliPayServiceImpl implements AliPayService {
|
|||
// 获取订单后缀
|
||||
String suffix = code.substring(code.lastIndexOf("_") + 1);
|
||||
orderTradeService.orderHandler(orderTrade, suffix, params);
|
||||
return AjaxResult.success("查询成功", orderTrade.getOrderStatus());
|
||||
return R.ok(orderTrade.getOrderStatus());
|
||||
}
|
||||
long time = (System.currentTimeMillis() - orderTrade.getCreateTime().getTime()) / 1000 / 60;
|
||||
// time 超过15分钟,则删除redis中订单信息
|
||||
|
@ -408,7 +410,7 @@ public class AliPayServiceImpl implements AliPayService {
|
|||
}
|
||||
|
||||
redisCache.setCacheObject(outTradeNo, JSONUtil.toJsonStr(orderTrade), 4, TimeUnit.SECONDS);
|
||||
return AjaxResult.success("查询成功", orderTrade.getOrderStatus());
|
||||
return R.ok(orderTrade.getOrderStatus());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ public class WorkFlowCommentVo {
|
|||
/**
|
||||
* 是否点赞
|
||||
*/
|
||||
@ApiModelProperty(value = "评论点赞数")
|
||||
private Integer isLike;
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.mcwl.resource.service;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.domain.IdsParam;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
|
@ -29,12 +30,12 @@ public interface ModelService extends IService<ModelProduct> {
|
|||
|
||||
TableDataInfo listByPage(ModelImagePageRes imagePageRes);
|
||||
|
||||
AjaxResult addModel(RequestModel requestModel);
|
||||
R<String> addModel(RequestModel requestModel);
|
||||
|
||||
|
||||
void updaModel(RequestModel requestModel);
|
||||
|
||||
AjaxResult selectModelById(Long id);
|
||||
R<ModelProduct> selectModelById(Long id);
|
||||
|
||||
void setModelTop(Long id, boolean isTop);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.resource.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.resource.domain.ModelVersion;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -19,6 +20,6 @@ public interface ModelVersionService extends IService<ModelVersion> {
|
|||
|
||||
List<ModelVersion> selectLogininforList(ModelVersion modelVersion);
|
||||
|
||||
AjaxResult selectByModelId(Long modelId);
|
||||
R<List<ModelVersion>> selectByModelId(Long modelId);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.mcwl.resource.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.resource.domain.Report;
|
||||
import com.mcwl.resource.domain.vo.PageVo;
|
||||
|
||||
|
@ -15,7 +17,7 @@ import com.mcwl.resource.domain.vo.PageVo;
|
|||
public interface ReportService {
|
||||
void addReport(Report report);
|
||||
|
||||
AjaxResult selectReport(PageVo pageVo);
|
||||
R<Page<Report>> selectReport(PageVo pageVo);
|
||||
|
||||
void deleteReport(Long id);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.resource.service;
|
|||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.resource.domain.SysUserInfo;
|
||||
import com.mcwl.resource.domain.vo.PageVo;
|
||||
|
@ -14,7 +15,7 @@ import com.mcwl.resource.domain.vo.PageVo;
|
|||
*/
|
||||
|
||||
public interface SysUserAttentionService {
|
||||
AjaxResult addAttention(Long userId);
|
||||
R<Boolean> addAttention(Long userId);
|
||||
|
||||
Boolean selectAttention(Long userId);
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.mcwl.resource.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.resource.domain.WorkFlow;
|
||||
import com.mcwl.resource.domain.dto.AddRequestWorkFlow;
|
||||
|
@ -19,15 +21,15 @@ import java.util.List;
|
|||
*/
|
||||
|
||||
public interface WorkFlowService extends IService<WorkFlow> {
|
||||
AjaxResult addWorkFlow(AddRequestWorkFlow addRequestWorkFlo);
|
||||
R<Object> addWorkFlow(AddRequestWorkFlow addRequestWorkFlo);
|
||||
|
||||
void updateWorkFlow(RequestWorkFlow requestWorkFlow);
|
||||
|
||||
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);
|
||||
|
||||
|
@ -39,5 +41,5 @@ public interface WorkFlowService extends IService<WorkFlow> {
|
|||
|
||||
Long selectWorkFlowByName(String name);
|
||||
|
||||
AjaxResult selectWorkFlowVersionById(Long id);
|
||||
R<RequestWorkFlow> selectWorkFlowVersionById(Long id);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package com.mcwl.resource.service;
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.resource.domain.WorkFlowVersion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工作流版本 业务层
|
||||
|
@ -10,5 +14,5 @@ import com.mcwl.common.core.domain.AjaxResult;
|
|||
*/
|
||||
|
||||
public interface WorkFlowVersionService {
|
||||
AjaxResult selectVersionByWorkId(Long workId);
|
||||
R<List<WorkFlowVersion>> selectVersionByWorkId(Long workId);
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ public class ModelCommentServiceImpl extends ServiceImpl<ModelCommentMapper, Mod
|
|||
.isNull(ModelComment::getParentId);
|
||||
if (sortType == 0) {
|
||||
// 按点赞数降序,创建时间升序
|
||||
lqw.orderByAsc(ModelComment::getLikeNum)
|
||||
lqw.orderByDesc(ModelComment::getLikeNum)
|
||||
.orderByAsc(ModelComment::getCreateTime);
|
||||
} else {
|
||||
lqw.orderByDesc(ModelComment::getCreateTime);
|
||||
|
@ -121,6 +121,7 @@ public class ModelCommentServiceImpl extends ServiceImpl<ModelCommentMapper, Mod
|
|||
// 获取所模型父评论
|
||||
List<ModelComment> modelCommentList = baseMapper.selectList(
|
||||
new LambdaQueryWrapper<ModelComment>()
|
||||
.isNull(ModelComment::getParentId)
|
||||
.eq(ModelComment::getModelId, modelId));
|
||||
|
||||
// 获取所有父评论的ID
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.resource.domain.ModelComment;
|
||||
import com.mcwl.resource.domain.ModelImageComment;
|
||||
import com.mcwl.resource.domain.ModelImageCommentLike;
|
||||
import com.mcwl.resource.domain.WorkFlowComment;
|
||||
|
@ -64,7 +65,7 @@ public class ModelImageCommentServiceImpl extends ServiceImpl<ModelImageCommentM
|
|||
.isNull(ModelImageComment::getParentId);
|
||||
if (sortType == 0) {
|
||||
// 按点赞数降序,创建时间升序
|
||||
lqw.orderByAsc(ModelImageComment::getLikeNum)
|
||||
lqw.orderByDesc(ModelImageComment::getLikeNum)
|
||||
.orderByAsc(ModelImageComment::getCreateTime);
|
||||
} else {
|
||||
lqw.orderByDesc(ModelImageComment::getCreateTime);
|
||||
|
@ -108,6 +109,7 @@ public class ModelImageCommentServiceImpl extends ServiceImpl<ModelImageCommentM
|
|||
// 获取所有图片父评论
|
||||
List<ModelImageComment> modelImageCommentList = baseMapper.selectList(
|
||||
new LambdaQueryWrapper<ModelImageComment>()
|
||||
.isNull(ModelImageComment::getParentId)
|
||||
.eq(ModelImageComment::getModelImageId, imageId));
|
||||
|
||||
// 获取所有父评论的ID
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.mcwl.common.constant.DictConstants;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.core.redis.RedisCache;
|
||||
|
@ -184,7 +185,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult addModel(RequestModel requestModel) {
|
||||
public R<String> addModel(RequestModel requestModel) {
|
||||
//获取封面图
|
||||
String filePath = requestModel.getModelVersionList().get(0).getFilePath();
|
||||
String[] split = filePath.split(",");
|
||||
|
@ -204,7 +205,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
//执行审核方法
|
||||
audit(requestModel);
|
||||
|
||||
return AjaxResult.success("添加成功,等待审核");
|
||||
return R.ok("添加成功,等待审核");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -427,7 +428,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
|
||||
|
||||
@Override
|
||||
public AjaxResult selectModelById(Long id) {
|
||||
public R<ModelProduct> selectModelById(Long 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());
|
||||
}
|
||||
|
||||
return AjaxResult.success(modelProduct);
|
||||
return R.ok(modelProduct);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.constant.DictConstants;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.resource.domain.ModelVersion;
|
||||
import com.mcwl.resource.mapper.ModelVersionMapper;
|
||||
|
@ -54,7 +55,7 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo
|
|||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult selectByModelId(Long modelId) {
|
||||
public R<List<ModelVersion>> selectByModelId(Long modelId) {
|
||||
|
||||
//根据模型ID查询所有的版本信息
|
||||
LambdaQueryWrapper<ModelVersion> modelVersionLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -75,7 +76,7 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo
|
|||
|
||||
modelVersion.setHighList(arrayList);
|
||||
}
|
||||
return AjaxResult.success(modelVersions);
|
||||
return R.ok(modelVersions);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.mcwl.resource.service.impl;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.resource.domain.Report;
|
||||
import com.mcwl.resource.domain.vo.PageVo;
|
||||
|
@ -37,7 +38,7 @@ public class ReportServiceImpl implements ReportService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult selectReport(PageVo pageVo) {
|
||||
public R<Page<Report>> selectReport(PageVo pageVo) {
|
||||
|
||||
Page<Report> page = new Page<>(pageVo.getPageNumber(), pageVo.getPageSize());
|
||||
|
||||
|
@ -48,7 +49,7 @@ public class ReportServiceImpl implements ReportService {
|
|||
reportLambdaQueryWrapper.eq(Report::getStatus, 0);
|
||||
}
|
||||
|
||||
return AjaxResult.success(reportMapper.selectPage(page, reportLambdaQueryWrapper));
|
||||
return R.ok(reportMapper.selectPage(page, reportLambdaQueryWrapper));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.mcwl.resource.service.impl;
|
|||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.resource.domain.SysUserAttention;
|
||||
|
@ -48,14 +49,14 @@ public class SysUserAttentionServiceImpl implements SysUserAttentionService {
|
|||
private SysUserMapper sysUserMapper;
|
||||
|
||||
@Override
|
||||
public AjaxResult addAttention(Long userId) {
|
||||
public R<Boolean> addAttention(Long userId) {
|
||||
|
||||
//查看是否已关注
|
||||
Boolean aBoolean = selectAttention(userId);
|
||||
if (aBoolean == true) {
|
||||
//取关
|
||||
sysUserAttentionMapper.deleteByUserId(SecurityUtils.getUserId(), userId);
|
||||
return AjaxResult.success(false);
|
||||
return R.ok(false);
|
||||
}
|
||||
|
||||
//关注
|
||||
|
@ -65,7 +66,7 @@ public class SysUserAttentionServiceImpl implements SysUserAttentionService {
|
|||
.createTime(new Date())
|
||||
.build();
|
||||
sysUserAttentionMapper.insert(sysUserAttention);
|
||||
return AjaxResult.success(true);
|
||||
return R.ok(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,7 +39,7 @@ public class WorkFlowCommentLikeServiceImpl extends ServiceImpl<WorkFlowCommentL
|
|||
Long userId = SecurityUtils.getUserId();
|
||||
WorkFlowCommentLike workFlowCommentLike = baseMapper.getLikeComment(userId, commentId);
|
||||
if (Objects.nonNull(workFlowCommentLike)) {
|
||||
if (Objects.equals(workFlowComment.getDelFlag(), "0")) {
|
||||
if (Objects.equals(workFlowCommentLike.getDelFlag(), "0")) {
|
||||
workFlowCommentLike.setDelFlag("2");
|
||||
int likeNum = workFlowComment.getLikeNum() - 1;
|
||||
likeNum = Math.max(likeNum, 0);
|
||||
|
|
|
@ -69,7 +69,7 @@ public class WorkFlowCommentServiceImpl extends ServiceImpl<WorkFlowCommentMappe
|
|||
.isNull(WorkFlowComment::getParentId);
|
||||
if (sortType == 0) {
|
||||
// 按点赞数降序,创建时间升序
|
||||
lqw.orderByAsc(WorkFlowComment::getLikeNum)
|
||||
lqw.orderByDesc(WorkFlowComment::getLikeNum)
|
||||
.orderByAsc(WorkFlowComment::getCreateTime);
|
||||
} else {
|
||||
lqw.orderByDesc(WorkFlowComment::getCreateTime);
|
||||
|
@ -112,6 +112,7 @@ public class WorkFlowCommentServiceImpl extends ServiceImpl<WorkFlowCommentMappe
|
|||
// 获取所工作流父评论
|
||||
List<WorkFlowComment> modelCommentList = baseMapper.selectList(
|
||||
new LambdaQueryWrapper<WorkFlowComment>()
|
||||
.isNull(WorkFlowComment::getParentId)
|
||||
.eq(WorkFlowComment::getWorkFlowId, workFlowId));
|
||||
|
||||
// 获取所有父评论的ID
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.mcwl.common.constant.DictConstants;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
|
@ -74,7 +75,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
|||
|
||||
|
||||
@Override
|
||||
public AjaxResult addWorkFlow(AddRequestWorkFlow addRequestWorkFlo) {
|
||||
public R<Object> addWorkFlow(AddRequestWorkFlow addRequestWorkFlo) {
|
||||
|
||||
RequestWorkFlow requestWorkFlow = new RequestWorkFlow();
|
||||
BeanUtil.copyProperties(addRequestWorkFlo, requestWorkFlow);
|
||||
|
@ -99,7 +100,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
|||
audit(requestWorkFlow);
|
||||
|
||||
|
||||
return AjaxResult.success("添加成功,等待审核");
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
private void audit(RequestWorkFlow requestWorkFlow) {
|
||||
|
@ -349,7 +350,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
|||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult selectWorkFlow(PageVo pageVo) {
|
||||
public R<Page<WorkFlow>> selectWorkFlow(PageVo pageVo) {
|
||||
|
||||
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);
|
||||
|
||||
return AjaxResult.success(flowMapper.selectPage(page, lambdaQueryWrapper));
|
||||
return R.ok(flowMapper.selectPage(page, lambdaQueryWrapper));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult selectWorkFlowById(Long id) {
|
||||
public R<WorkFlow> selectWorkFlowById(Long id) {
|
||||
|
||||
//查询详情
|
||||
WorkFlow workFlow = flowMapper.selectById(id);
|
||||
if (workFlow == null) {
|
||||
return AjaxResult.error("工作流不存在");
|
||||
return R.fail("工作流不存在");
|
||||
}
|
||||
|
||||
//类别
|
||||
|
@ -393,7 +394,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
|||
if (sysUserAttention == null){
|
||||
workFlow.setIsAttention(1);
|
||||
}
|
||||
return AjaxResult.success(workFlow);
|
||||
return R.ok(workFlow);
|
||||
}
|
||||
|
||||
|
||||
|
@ -471,18 +472,18 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
|||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult selectWorkFlowVersionById(Long id) {
|
||||
public R<RequestWorkFlow> selectWorkFlowVersionById(Long id) {
|
||||
|
||||
RequestWorkFlow requestWorkFlow = new RequestWorkFlow();
|
||||
WorkFlow workFlow = baseMapper.selectById(id);
|
||||
if (workFlow == null){
|
||||
|
||||
return AjaxResult.error("数据不存在");
|
||||
return R.fail("数据不存在");
|
||||
}
|
||||
|
||||
if (workFlow.getDelFlag() == 2){
|
||||
|
||||
return AjaxResult.error("数据不存在");
|
||||
return R.fail("数据不存在");
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<WorkFlowVersion> workFlowVersionLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -491,7 +492,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
|||
List<WorkFlowVersion> workFlowVersions = workFlowVersionMapper.selectList(workFlowVersionLambdaQueryWrapper);
|
||||
requestWorkFlow.setWorkFlow(workFlow);
|
||||
requestWorkFlow.setWorkFlowVersionList(workFlowVersions);
|
||||
return AjaxResult.success(requestWorkFlow);
|
||||
return R.ok(requestWorkFlow);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.resource.service.impl;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.resource.domain.WorkFlowVersion;
|
||||
import com.mcwl.resource.mapper.WorkFlowVersionMapper;
|
||||
import com.mcwl.resource.service.WorkFlowVersionService;
|
||||
|
@ -24,7 +25,7 @@ public class WorkFlowVersionServiceImpl implements WorkFlowVersionService {
|
|||
private WorkFlowVersionMapper workFlowVersionMapper;
|
||||
|
||||
@Override
|
||||
public AjaxResult selectVersionByWorkId(Long workId) {
|
||||
public R<List<WorkFlowVersion>> selectVersionByWorkId(Long workId) {
|
||||
|
||||
LambdaQueryWrapper<WorkFlowVersion> workFlowVersionLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
|
@ -33,6 +34,6 @@ public class WorkFlowVersionServiceImpl implements WorkFlowVersionService {
|
|||
|
||||
List<WorkFlowVersion> workFlowVersions = workFlowVersionMapper.selectList(workFlowVersionLambdaQueryWrapper);
|
||||
|
||||
return AjaxResult.success(workFlowVersions);
|
||||
return R.ok(workFlowVersions);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue