refactor: 统一错误消息返回格式
parent
ec0c8aa32a
commit
2ad2c4eb96
|
@ -1,6 +1,7 @@
|
|||
package com.mcwl.web.controller.communityCenter;
|
||||
|
||||
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
|
@ -44,7 +45,7 @@ public class InviteController {
|
|||
// 获取邀请码链接
|
||||
String inviteCode = inviteService.getInviteCode(communityId);
|
||||
if (StringUtils.isBlank(inviteCode)) {
|
||||
return R.fail("获取邀请码失败");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"获取邀请码失败");
|
||||
}
|
||||
return R.ok(inviteCode);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.mcwl.web.controller.communityCenter;
|
||||
|
||||
|
||||
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.page.TableDataInfo;
|
||||
|
@ -49,7 +50,7 @@ public class PublishController {
|
|||
|
||||
PublishVo publishVo = publishService.getDetail(publishDetailRes);
|
||||
if (Objects.isNull(publishVo)) {
|
||||
return R.fail("获取详情失败");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"获取详情失败");
|
||||
}
|
||||
return R.ok(publishVo);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.mcwl.web.controller.communityCenter;
|
||||
|
||||
|
||||
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;
|
||||
|
@ -51,7 +52,7 @@ public class QuestionController {
|
|||
|
||||
// 类型为1时,付费金额不能为空
|
||||
if (Objects.equals(type, 1) && Objects.isNull(amount)) {
|
||||
return R.fail("付费金额不能为空");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"付费金额不能为空");
|
||||
}
|
||||
|
||||
// 付费类型为1时,判断钱包余额是否充足
|
||||
|
@ -60,7 +61,7 @@ public class QuestionController {
|
|||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
Double wallet = sysUser.getWallet();
|
||||
if (wallet < amount) {
|
||||
return R.fail("钱包余额不足");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"钱包余额不足");
|
||||
}
|
||||
} else {
|
||||
questionRes.setAmount(0.0);
|
||||
|
@ -99,7 +100,7 @@ public class QuestionController {
|
|||
public R<QuestionVo> getQuestionDetail(@RequestBody @Valid QuestionDetailRes questionDetailRes) {
|
||||
QuestionVo questionVo = questionService.getDetail(questionDetailRes);
|
||||
if (Objects.isNull(questionVo)) {
|
||||
return R.fail("获取详情失败");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"获取详情失败");
|
||||
}
|
||||
return R.ok(questionVo);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.mcwl.web.controller.memberCenter;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
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;
|
||||
|
@ -65,17 +66,17 @@ public class MemberController {
|
|||
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
if (!Optional.ofNullable(sysUser).isPresent()) {
|
||||
return R.fail("用户不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"用户不存在");
|
||||
}
|
||||
|
||||
MemberLevel memberLevel = memberLevelService.getById(memberLevelId);
|
||||
if (!Optional.ofNullable(memberLevel).isPresent()) {
|
||||
return R.fail("会员等级不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"会员等级不存在");
|
||||
}
|
||||
|
||||
Member member = memberService.createUserMember(userId, memberLevelId, paymentMethod, promotionId);
|
||||
if (!Optional.ofNullable(member).isPresent()) {
|
||||
return R.fail("创建会员失败");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"创建会员失败");
|
||||
}
|
||||
|
||||
return R.ok(member);
|
||||
|
@ -128,14 +129,14 @@ public class MemberController {
|
|||
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
if (!Optional.ofNullable(sysUser).isPresent()) {
|
||||
return R.fail("用户不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"用户不存在");
|
||||
}
|
||||
|
||||
Member member = memberService.rechargePoints(userId, amount * 100);
|
||||
|
||||
// 返回充值积分
|
||||
if (!Optional.ofNullable(member).isPresent()) {
|
||||
return R.fail("充值积分失败");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"充值积分失败");
|
||||
}
|
||||
|
||||
return R.ok();
|
||||
|
@ -150,7 +151,7 @@ public class MemberController {
|
|||
public R<Object> consumePoints(@PathVariable Double consumePoints) {
|
||||
|
||||
if (consumePoints == null || consumePoints <= 0) {
|
||||
return R.fail("消费积分不能为空或小于0");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"消费积分不能为空或小于0");
|
||||
}
|
||||
|
||||
memberService.consumePoints(consumePoints);
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.web.controller.memberCenter;
|
|||
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
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.page.PageDomain;
|
||||
|
@ -54,7 +55,7 @@ public class PromotionController {
|
|||
Date startTime = promotionDto.getStartTime();
|
||||
Date endTime = promotionDto.getEndTime();
|
||||
if (startTime.after(endTime)) {
|
||||
return R.fail("活动开始时间不能大于结束时间");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"活动开始时间不能大于结束时间");
|
||||
}
|
||||
Promotion promotion = new Promotion();
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.mcwl.web.controller.myInvitation;
|
||||
|
||||
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.myInvitation.domain.CommissionRatio;
|
||||
|
@ -55,7 +56,7 @@ public class CommissionRatioController {
|
|||
public R<CommissionRatioVo> detail(@Valid @NotNull(message = "提成比例id不能为空") Long id) {
|
||||
CommissionRatioVo detail = commissionRatioService.detail(id);
|
||||
if (detail == null) {
|
||||
return R.fail("提成比例不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"提成比例不存在");
|
||||
}
|
||||
return R.ok(detail);
|
||||
}
|
||||
|
@ -74,12 +75,12 @@ public class CommissionRatioController {
|
|||
Double ratio) {
|
||||
|
||||
if (ratio < 0 || ratio > 1) {
|
||||
return R.fail("提成比例必须在0-1之间");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"提成比例必须在0-1之间");
|
||||
}
|
||||
|
||||
CommissionRatioVo detail = commissionRatioService.updateRatio(id, ratio);
|
||||
if (detail == null) {
|
||||
return R.fail("提成比例不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"提成比例不存在");
|
||||
}
|
||||
|
||||
return R.ok(detail);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.mcwl.web.controller.myInvitation;
|
||||
|
||||
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
|
@ -50,7 +51,7 @@ public class InvitationController {
|
|||
Long userId = SecurityUtils.getUserId();
|
||||
String invitationCode = invitationService.getInvitationCode(userId);
|
||||
if (StringUtils.isEmpty(invitationCode)) {
|
||||
return R.fail("获取邀请码失败");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"获取邀请码失败");
|
||||
}
|
||||
return R.ok("操作成功", invitationCode);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import cn.hutool.extra.qrcode.QrCodeUtil;
|
|||
import com.alipay.api.domain.AlipayAccount;
|
||||
import com.alipay.easysdk.factory.Factory;
|
||||
import com.mcwl.common.annotation.Anonymous;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.controller.BaseController;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
|
@ -167,7 +168,7 @@ public class AliPayController extends BaseController {
|
|||
|
||||
if ("member".equalsIgnoreCase(type)) {
|
||||
if (!Optional.ofNullable(orderTradeDto.getProductId()).isPresent()) {
|
||||
return R.fail("商品id不能为空");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"商品id不能为空");
|
||||
}
|
||||
payVo = aliPayService.memberPay(orderTradeDto);
|
||||
// QrCodeUtil.generate(payVo.getUrl(), 300, 300, "png", response.getOutputStream());
|
||||
|
@ -177,12 +178,12 @@ public class AliPayController extends BaseController {
|
|||
} else if ("wallet".equalsIgnoreCase(type)) {
|
||||
// 充值金额只能是整数
|
||||
if (orderTradeDto.getAmount() % 1 != 0) {
|
||||
return R.fail("充值金额只能是整数");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"充值金额只能是整数");
|
||||
}
|
||||
payVo = aliPayService.walletPay(orderTradeDto.getAmount());
|
||||
// QrCodeUtil.generate(payVo.getUrl(), 300, 300, "png", response.getOutputStream());
|
||||
} else {
|
||||
return R.fail("订单类型错误");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"订单类型错误");
|
||||
}
|
||||
|
||||
return R.ok(payVo);
|
||||
|
@ -206,12 +207,12 @@ public class AliPayController extends BaseController {
|
|||
.one();
|
||||
|
||||
if (Objects.isNull(sysUserPayAccount)) {
|
||||
return R.fail("请先绑定支付宝");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"请先绑定支付宝");
|
||||
}
|
||||
|
||||
|
||||
if (Double.parseDouble(amount) < 0.1) {
|
||||
return R.fail("提现金额最小为0.1");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"提现金额最小为0.1");
|
||||
}
|
||||
|
||||
return aliPayService.fetch(amount.toString());
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.alipay.easysdk.payment.common.models.AlipayTradeCancelResponse;
|
|||
import com.alipay.easysdk.payment.common.models.AlipayTradeCloseResponse;
|
||||
import com.alipay.easysdk.payment.common.models.AlipayTradeQueryResponse;
|
||||
import com.mcwl.common.JSONUtils;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.controller.BaseController;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
|
@ -87,7 +88,7 @@ public class OrderTradeController extends BaseController {
|
|||
// 获取当前用户
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
if (userId == null) {
|
||||
return R.fail("用户未登录");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"用户未登录");
|
||||
}
|
||||
orderTrade.setUserId(userId);
|
||||
return R.ok(orderTradeService.insertMallProduct(orderTrade));
|
||||
|
@ -102,7 +103,7 @@ public class OrderTradeController extends BaseController {
|
|||
// 获取当前用户
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
if (userId == null) {
|
||||
return R.fail("用户未登录");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"用户未登录");
|
||||
}
|
||||
orderTrade.setUserId(userId);
|
||||
orderTradeService.updateMallProduct(orderTrade);
|
||||
|
|
|
@ -4,6 +4,8 @@ import java.util.ArrayList;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
|
|
@ -2,6 +2,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.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
|
@ -67,12 +68,12 @@ public class InviteServiceImpl extends ServiceImpl<InviteMapper, Invite> impleme
|
|||
// 解析邀请码
|
||||
Long userId = ShareCodeUtils.codeToId(inviteCode);
|
||||
if (Objects.isNull(userId)) {
|
||||
return R.fail("邀请码有误");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"邀请码有误");
|
||||
}
|
||||
|
||||
// 判断是否是同一个人
|
||||
if (Objects.equals(userId, SecurityUtils.getUserId())) {
|
||||
return R.fail("不能邀请自己");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"不能邀请自己");
|
||||
}
|
||||
|
||||
// 查询邀请码
|
||||
|
@ -84,13 +85,13 @@ public class InviteServiceImpl extends ServiceImpl<InviteMapper, Invite> impleme
|
|||
.one();
|
||||
|
||||
if (Objects.isNull(inviteCodeMapping)) {
|
||||
return R.fail("没查询到该邀请码");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"没查询到该邀请码");
|
||||
}
|
||||
|
||||
// 判断是否已经邀请过
|
||||
Invite inv = inviteMapper.isInvite(userId, communityId, SecurityUtils.getUserId());
|
||||
if (Objects.nonNull(inv)) {
|
||||
return R.fail("不能重复邀请");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"不能重复邀请");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.mcwl.communityCenter.service.impl;
|
|||
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.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
|
@ -81,7 +82,7 @@ public class PublishCommentServiceImpl extends ServiceImpl<PublishCommentMapper,
|
|||
|
||||
Publish publish = publishMapper.selectByIdAndTenantIdAndCommunityId(operatorId, tenantId, communityId);
|
||||
if (Objects.isNull(publish)) {
|
||||
return R.fail("评论失败,该内容不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"评论失败,该内容不存在");
|
||||
}
|
||||
|
||||
PublishComment publishComment = new PublishComment();
|
||||
|
@ -105,7 +106,7 @@ public class PublishCommentServiceImpl extends ServiceImpl<PublishCommentMapper,
|
|||
PublishComment publishComment = publishCommentMapper.selectByIdAndTenantIdAndCommunityIdAndOperatorId(id, tenantId, communityId, operatorId);
|
||||
|
||||
if (Objects.isNull(publishComment)) {
|
||||
return R.fail("删除失败,该评论不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"删除失败,该评论不存在");
|
||||
}
|
||||
|
||||
publishCommentMapper.deleteByIdAndTenantIdAndCommunityIdAndOperatorId(id, tenantId, communityId, operatorId);
|
||||
|
|
|
@ -73,7 +73,7 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
|
|||
Community community = communityMapper.getByTenantIdAndCommunityId(publishRes.getTenantId(), publishRes.getCommunityId());
|
||||
|
||||
if (Objects.isNull(community)) {
|
||||
return R.fail("用户社区未创建");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"用户社区未创建");
|
||||
}
|
||||
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
|
|||
if (!Objects.equals(userId, publishRes.getTenantId())) {
|
||||
// 判断用户是否被邀请
|
||||
if (invites.isEmpty() || !invites.contains(userId)) {
|
||||
return R.fail("您没有被邀请");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"您没有被邀请");
|
||||
}
|
||||
}
|
||||
Publish publish = new Publish();
|
||||
|
|
|
@ -48,7 +48,7 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
|
|||
Question question = questionMapper.selectByIdAndTenantIdAndCommunityId(questionId, tenantId, communityId);
|
||||
|
||||
if (Objects.isNull(question)) {
|
||||
return R.fail("提问不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"提问不存在");
|
||||
}
|
||||
|
||||
QuestionComment questionComment = new QuestionComment();
|
||||
|
@ -98,25 +98,25 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
|
|||
|
||||
Question question = questionMapper.selectByIdAndTenantIdAndCommunityId(questionId, tenantId, communityId);
|
||||
if (Objects.isNull(question)) {
|
||||
return R.fail("提问不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"提问不存在");
|
||||
}
|
||||
|
||||
if (question.getStatus() == 1) {
|
||||
return R.fail("该提问已解决");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"该提问已解决");
|
||||
}
|
||||
|
||||
QuestionComment questionComment = baseMapper.selectByIdAndTenantIdAndCommunityIdAndQuestionIdAndCommentId(tenantId, communityId, questionId, commentId);
|
||||
if (Objects.isNull(questionComment)) {
|
||||
return R.fail("评论不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"评论不存在");
|
||||
}
|
||||
|
||||
if (questionComment.getIsAccept() == 1) {
|
||||
return R.fail("该评论已被采纳");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"该评论已被采纳");
|
||||
}
|
||||
|
||||
Long questionUserId = question.getQuestionUserId();
|
||||
if (questionComment.getUserId().equals(questionUserId)) {
|
||||
return R.fail("您不能采纳自己的评论");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"您不能采纳自己的评论");
|
||||
}
|
||||
|
||||
questionComment.setIsAccept(1);
|
||||
|
|
|
@ -69,7 +69,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|||
Community community = communityMapper.getByTenantIdAndCommunityId(tenantId, communityId);
|
||||
|
||||
if (Objects.isNull(community)) {
|
||||
return R.fail("租户或社区不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"租户或社区不存在");
|
||||
}
|
||||
|
||||
// if (Objects.equals(tenantId, userId)) {
|
||||
|
|
|
@ -153,21 +153,21 @@ public class PromotionServiceImpl extends ServiceImpl<PromotionMapper, Promotion
|
|||
Promotion promotion = baseMapper.selectById(promotionId);
|
||||
|
||||
if (!Optional.ofNullable(promotion).isPresent()) {
|
||||
return R.fail(HttpStatus.WARN,"活动不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"活动不存在");
|
||||
}
|
||||
|
||||
if (promotion.getStartTime().after(new Date())) {
|
||||
return R.fail(HttpStatus.WARN,"活动未开始");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"活动未开始");
|
||||
}
|
||||
|
||||
// 活动是否过期
|
||||
if (promotion.getEndTime().before(new Date())) {
|
||||
return R.fail(HttpStatus.WARN,"活动已过期");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"活动已过期");
|
||||
}
|
||||
|
||||
// 获取当前用户是否参与过该活动
|
||||
if (isJoinPromotion(userId, promotionId)) {
|
||||
return R.fail(HttpStatus.WARN,"您已参与过该活动");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"您已参与过该活动");
|
||||
}
|
||||
|
||||
// 是否在活动期间内订阅或续订会员
|
||||
|
@ -180,7 +180,7 @@ public class PromotionServiceImpl extends ServiceImpl<PromotionMapper, Promotion
|
|||
|
||||
String memberLevelIds = promotion.getMemberLevelIds();
|
||||
if (!memberLevelIds.contains(memberLevelId)) {
|
||||
return R.fail(HttpStatus.WARN,"会员等级不够,无法参与该活动,请查看活动条件");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"会员等级不够,无法参与该活动,请查看活动条件");
|
||||
}
|
||||
MemberPromotion memberPromotion = getMemberPromotion(userId, promotionId);
|
||||
memberPromotionService.save(memberPromotion);
|
||||
|
|
|
@ -30,6 +30,7 @@ import com.alipay.easysdk.payment.common.models.AlipayTradeCancelResponse;
|
|||
import com.alipay.easysdk.payment.facetoface.models.AlipayTradePrecreateResponse;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.mcwl.common.JSONUtils;
|
||||
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;
|
||||
|
@ -336,7 +337,7 @@ public class AliPayServiceImpl implements AliPayService {
|
|||
Long userId = SecurityUtils.getUserId();
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
if (sysUser.getWallet() < Double.parseDouble(amount)) {
|
||||
return R.fail("钱包余额不足");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"钱包余额不足");
|
||||
}
|
||||
|
||||
// 初始化SDK
|
||||
|
@ -367,7 +368,7 @@ public class AliPayServiceImpl implements AliPayService {
|
|||
.eq(SysUserPayAccount::getType, 0)
|
||||
.one();
|
||||
if (Objects.isNull(sysUserPayAccount)) {
|
||||
return R.fail("请先绑定支付宝账号");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"请先绑定支付宝账号");
|
||||
}
|
||||
|
||||
// 收款方信息
|
||||
|
@ -429,7 +430,7 @@ public class AliPayServiceImpl implements AliPayService {
|
|||
|
||||
// 如果数据库中不存在该订单, 则返回订单不存在
|
||||
if (Objects.isNull(orderTrade)) {
|
||||
return R.fail("订单不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"订单不存在");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,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.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
|
@ -133,6 +134,6 @@ public class DownloadRecordServiceImpl implements DownloadRecordService {
|
|||
return R.ok();
|
||||
}
|
||||
|
||||
return R.fail("请选择要删除的数据");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"请选择要删除的数据");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -495,7 +495,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
ModelProduct modelProduct = postMapper.selectById(id);
|
||||
if (modelProduct == null){
|
||||
|
||||
return R.fail("该模型不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"该模型不存在");
|
||||
}
|
||||
|
||||
//翻译属性 垂类
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.mcwl.resource.service.impl;
|
|||
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.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
|
@ -123,11 +124,11 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo
|
|||
ModelVersion modelVersion = modelVersionMapper.selectById(id);
|
||||
|
||||
if (modelVersion == null){
|
||||
return R.fail("文件为空");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"文件为空");
|
||||
}
|
||||
|
||||
if (modelVersion.getAllowDownloadImage().equals(0)){
|
||||
return R.fail("此文件不可下载");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"此文件不可下载");
|
||||
}
|
||||
|
||||
if (modelVersion.getIsEncrypt() == 1){
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.mcwl.resource.service.impl;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
|
@ -57,7 +58,7 @@ public class SysUserAttentionServiceImpl extends ServiceImpl<SysUserAttentionMap
|
|||
|
||||
if (userId.equals(SecurityUtils.getUserId())) {
|
||||
|
||||
return R.fail("不能对自己操作");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"不能对自己操作");
|
||||
}
|
||||
|
||||
//查看是否已关注
|
||||
|
|
|
@ -354,7 +354,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
|||
//查询详情
|
||||
WorkFlow workFlow = flowMapper.selectById(id);
|
||||
if (workFlow == null) {
|
||||
return R.fail("工作流不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"工作流不存在");
|
||||
}
|
||||
|
||||
//类别
|
||||
|
@ -466,12 +466,12 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
|
|||
WorkFlow workFlow = baseMapper.selectById(id);
|
||||
if (workFlow == null) {
|
||||
|
||||
return R.fail("数据不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"数据不存在");
|
||||
}
|
||||
|
||||
if (workFlow.getDelFlag() == 2) {
|
||||
|
||||
return R.fail("数据不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"数据不存在");
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<WorkFlowVersion> workFlowVersionLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.mcwl.resource.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.resource.domain.Collect;
|
||||
|
@ -67,12 +68,12 @@ public class WorkFlowVersionServiceImpl implements WorkFlowVersionService {
|
|||
//查找数据
|
||||
WorkFlowVersion workFlowVersion = workFlowVersionMapper.selectById(id);
|
||||
if (workFlowVersion == null) {
|
||||
return R.fail("文件不存在");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"文件不存在");
|
||||
}
|
||||
|
||||
WorkFlow workFlow = workFlowMapper.selectById(workFlowVersion.getWorkFlowId());
|
||||
if (workFlow.getDownload().equals(1)) {
|
||||
return R.fail("该文件不允许下载");
|
||||
return R.fail(HttpStatus.SHOW_ERROR_MSG,"该文件不允许下载");
|
||||
}
|
||||
|
||||
return R.ok(workFlowVersion.getFilePath(), workFlowVersion.getFileName());
|
||||
|
|
Loading…
Reference in New Issue