统一 boot 和 cloud 代码

This commit is contained in:
YunaiV 2023-10-24 20:45:01 +08:00
parent e10f325843
commit 80edb0e808
18 changed files with 108 additions and 129 deletions

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.framework.common.enums;
import cn.hutool.core.util.ObjUtil;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
@ -34,4 +35,12 @@ public enum CommonStatusEnum implements IntArrayValuable {
return ARRAYS;
}
public static boolean isEnable(Integer status) {
return ObjUtil.equal(ENABLE.status, status);
}
public static boolean isDisable(Integer status) {
return ObjUtil.equal(DISABLE.status, status);
}
}

View File

@ -1,4 +1,4 @@
import { defHttp } from '@/utils/http/axios'
import {defHttp} from '@/utils/http/axios'
#set ($baseURL = "/${table.moduleName}/${simpleClassName_strikeCase}")
// 查询${table.classComment}列表
@ -28,5 +28,5 @@ export function delete${simpleClassName}(id: number) {
// 导出${table.classComment} Excel
export function export${simpleClassName}(params) {
return defHttp.download({ url: '${baseURL}/export-excel', params }, '${table.classComment}.xls')
return defHttp.download({ url: '${baseURL}/export-excel', params }, '${table.classComment}.xls')
}

View File

@ -1,6 +1,6 @@
import type { BasicColumn, FormSchema } from '@/components/Table'
import { useRender } from '@/components/Table'
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
import type {BasicColumn, FormSchema} from '@/components/Table'
import {useRender} from '@/components/Table'
import {DICT_TYPE, getDictOptions} from '@/utils/dict'
export const columns: BasicColumn[] = [
#foreach($column in $columns)
@ -50,7 +50,7 @@ export const searchFormSchema: FormSchema[] = [
field: '${javaField}',
#if ($column.htmlType == "input")
component: 'Input',
#elseif ($column.htmlType == "select" || $column.htmlType == "radio")
#elseif ($column.htmlType == "select")
component: 'Select',
componentProps: {
#if ("" != $dictType)## 设置了 dictType 数据字典的情况
@ -59,6 +59,15 @@ export const searchFormSchema: FormSchema[] = [
options: [],
#end
},
#elseif ($column.htmlType == "radio")
component: 'Radio',
componentProps: {
#if ("" != $dictType)## 设置了 dictType 数据字典的情况
options: getDictOptions(DICT_TYPE.$dictType.toUpperCase()),
#else## 未设置 dictType 数据字典的情况
options: [],
#end
},
#elseif($column.htmlType == "datetime")
component: 'RangePicker',
#end
@ -181,7 +190,8 @@ export const updateFormSchema: FormSchema[] = [
fileType: 'file',
maxCount: 1,
},
#elseif($column.htmlType == "editor")## 文本编辑器component: 'Editor',
#elseif($column.htmlType == "editor")## 文本编辑器
component: 'Editor',
#elseif($column.htmlType == "select")## 下拉框
component: 'Select',
componentProps: {

View File

@ -1,12 +1,10 @@
<script lang="ts" setup>
import ${ simpleClassName }Modal from './${simpleClassName}Modal.vue'
import { columns, searchFormSchema } from './${classNameVar}.data'
import { useI18n } from '@/hooks/web/useI18n'
import { useMessage } from '@/hooks/web/useMessage'
import { useModal } from '@/components/Modal'
import { IconEnum } from '@/enums/appEnum'
import { BasicTable, useTable, TableAction } from '@/components/Table'
import { delete${ simpleClassName }, export${ simpleClassName }, get${ simpleClassName } Page } from '@/api/${table.moduleName}/${classNameVar}'
import {columns, searchFormSchema} from './'
import {useI18n} from '@/hooks/web/useI18n'
import {useMessage} from '@/hooks/web/useMessage'
import {useModal} from '@/components/Modal'
import {useTable} from '@/components/Table'
import { delete${ simpleClassName }, export${ simpleClassName }, get${ simpleClassName } Page } from '@/api/${table.moduleName}/${classNameVar}'
defineOptions({ name: '${table.className}' })
@ -62,7 +60,7 @@ async function handleDelete(record: Recordable) {
<a-button type="primary" v-auth="['${permissionPrefix}:create']" :preIcon="IconEnum.ADD" @click="handleCreate">
{{ t('action.create') }}
</a-button>
<a-button type="warning" v-auth="['${permissionPrefix}:export']" :preIcon="IconEnum.EXPORT" @click="handleExport">
<a-button v-auth="['${permissionPrefix}:export']" :preIcon="IconEnum.EXPORT" @click="handleExport">
{{ t('action.export') }}
</a-button>
</template>

View File

@ -23,7 +23,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - Banner 管理")
@RestController
@RequestMapping("/market/banner")
@RequestMapping("/promotion/banner")
@Validated
public class BannerController {
@ -32,14 +32,14 @@ public class BannerController {
@PostMapping("/create")
@Operation(summary = "创建 Banner")
@PreAuthorize("@ss.hasPermission('market:banner:create')")
@PreAuthorize("@ss.hasPermission('promotion:banner:create')")
public CommonResult<Long> createBanner(@Valid @RequestBody BannerCreateReqVO createReqVO) {
return success(bannerService.createBanner(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新 Banner")
@PreAuthorize("@ss.hasPermission('market:banner:update')")
@PreAuthorize("@ss.hasPermission('promotion:banner:update')")
public CommonResult<Boolean> updateBanner(@Valid @RequestBody BannerUpdateReqVO updateReqVO) {
bannerService.updateBanner(updateReqVO);
return success(true);
@ -48,7 +48,7 @@ public class BannerController {
@DeleteMapping("/delete")
@Operation(summary = "删除 Banner")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('market:banner:delete')")
@PreAuthorize("@ss.hasPermission('promotion:banner:delete')")
public CommonResult<Boolean> deleteBanner(@RequestParam("id") Long id) {
bannerService.deleteBanner(id);
return success(true);
@ -57,7 +57,7 @@ public class BannerController {
@GetMapping("/get")
@Operation(summary = "获得 Banner")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('market:banner:query')")
@PreAuthorize("@ss.hasPermission('promotion:banner:query')")
public CommonResult<BannerRespVO> getBanner(@RequestParam("id") Long id) {
BannerDO banner = bannerService.getBanner(id);
return success(BannerConvert.INSTANCE.convert(banner));
@ -65,7 +65,7 @@ public class BannerController {
@GetMapping("/page")
@Operation(summary = "获得 Banner 分页")
@PreAuthorize("@ss.hasPermission('market:banner:query')")
@PreAuthorize("@ss.hasPermission('promotion:banner:query')")
public CommonResult<PageResult<BannerRespVO>> getBannerPage(@Valid BannerPageReqVO pageVO) {
PageResult<BannerDO> pageResult = bannerService.getBannerPage(pageVO);
return success(BannerConvert.INSTANCE.convertPage(pageResult));

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.promotion.controller.admin.banner.vo;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.promotion.enums.banner.BannerPositionEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -29,6 +30,7 @@ public class BannerBaseVO {
@Schema(description = "position", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "position 不能为空")
@InEnum(BannerPositionEnum.class)
private Integer position;
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED)

View File

@ -4,6 +4,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - Banner Response VO")
@Data
@ToString(callSuper = true)
@ -12,4 +14,7 @@ public class BannerRespVO extends BannerBaseVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED)
private Long id;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2022-07-01 23:59:59")
private LocalDateTime createTime;
}

View File

@ -5,8 +5,6 @@ import cn.iocoder.yudao.module.promotion.controller.app.banner.vo.AppBannerRespV
import cn.iocoder.yudao.module.promotion.convert.banner.BannerConvert;
import cn.iocoder.yudao.module.promotion.dal.dataobject.banner.BannerDO;
import cn.iocoder.yudao.module.promotion.service.banner.BannerService;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -14,11 +12,9 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.time.Duration;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.cache.CacheUtils.buildAsyncReloadingCache;
@RestController
@RequestMapping("/promotion/banner")
@ -26,20 +22,6 @@ import static cn.iocoder.yudao.framework.common.util.cache.CacheUtils.buildAsync
@Validated
public class AppBannerController {
// TODO @puhui999这个目前不缓存也没问题因为首页没用到
/**
* {@link AppBannerRespVO} 缓存通过它异步刷新 {@link #getBannerList0(Integer)} 所要的首页数据
*/
private final LoadingCache<Integer, List<AppBannerRespVO>> bannerListCache = buildAsyncReloadingCache(Duration.ofSeconds(10L),
new CacheLoader<Integer, List<AppBannerRespVO>>() {
@Override
public List<AppBannerRespVO> load(Integer position) {
return getBannerList0(position);
}
});
@Resource
private BannerService bannerService;
@ -47,12 +29,8 @@ public class AppBannerController {
@Operation(summary = "获得 banner 列表")
@Parameter(name = "position", description = "Banner position", example = "1")
public CommonResult<List<AppBannerRespVO>> getBannerList(@RequestParam("position") Integer position) {
return success(bannerListCache.getUnchecked(position));
}
private List<AppBannerRespVO> getBannerList0(Integer position) {
List<BannerDO> bannerList = bannerService.getBannerListByPosition(position);
return BannerConvert.INSTANCE.convertList01(bannerList);
return success(BannerConvert.INSTANCE.convertList01(bannerList));
}
@PutMapping("/add-browse-count")

View File

@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.promotion.convert.coupon;
import cn.hutool.core.map.MapUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponTemplateRespDTO;
import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.CouponTemplateCreateReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.CouponTemplatePageReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.CouponTemplateRespVO;
@ -59,6 +58,4 @@ public interface CouponTemplateConvert {
}
}
List<CouponTemplateRespDTO> convertList(List<CouponTemplateDO> list);
}

View File

@ -6,13 +6,12 @@ import cn.iocoder.yudao.module.promotion.enums.banner.BannerPositionEnum;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
// TODO @puhui999表名改成 promotion_banner然后有序加下另外sql 给我下哈还有那个 position 字典嘿嘿
/**
* banner DO
*
* @author xia
*/
@TableName("market_banner")
@TableName("promotion_banner")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)

View File

@ -147,8 +147,8 @@ public class DiscountActivityServiceImpl implements DiscountActivityService {
@Override
public void deleteDiscountActivity(Long id) {
// 校验存在
DiscountActivityDO discountActivity = validateDiscountActivityExists(id);
if (!discountActivity.getStatus().equals(CommonStatusEnum.ENABLE.getStatus())) { // 未关闭的活动不能删除噢
DiscountActivityDO activity = validateDiscountActivityExists(id);
if (CommonStatusEnum.isEnable(activity.getStatus())) { // 未关闭的活动不能删除噢
throw exception(DISCOUNT_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED);
}

View File

@ -12,8 +12,7 @@ import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
@ -44,31 +43,32 @@ public interface MemberSignInRecordConvert {
AppMemberSignInRecordRespVO coverRecordToAppRecordVo(MemberSignInRecordDO memberSignInRecordDO);
default MemberSignInRecordDO convert(Long userId, MemberSignInRecordDO firstRecord, List<MemberSignInConfigDO> signInConfigs) {
// 1. 计算今天是第几天签到
long day = ChronoUnit.DAYS.between(firstRecord.getCreateTime(), LocalDateTime.now());
// 2. 初始化签到信息
// TODO @puhui999signInRecord=record
MemberSignInRecordDO signInRecord = new MemberSignInRecordDO().setUserId(userId)
.setDay(Integer.parseInt(Long.toString(day))) // 设置签到天数 TODO @puhui999day 应该跟着第几天签到走不是累加哈另外 long int应该 (int) day 就可以了
.setPoint(0) // 设置签到积分默认为
.setExperience(0); // 设置签到经验默认为 0
// 3. 获取签到对应的积分数
MemberSignInConfigDO lastConfig = signInConfigs.get(signInConfigs.size() - 1); // 最大签到天数
if (day > lastConfig.getDay()) { // 超出范围按第一天的经验计算
// TODO @puhui999不能直接取 0万一它 day 不匹配哈就是第一天没奖励
signInRecord.setPoint(signInConfigs.get(0).getPoint());
signInRecord.setExperience(signInConfigs.get(0).getExperience());
return signInRecord;
default MemberSignInRecordDO convert(Long userId, MemberSignInRecordDO lastRecord, List<MemberSignInConfigDO> configs) {
// 1. 计算是第几天签到
configs.sort(Comparator.comparing(MemberSignInConfigDO::getDay));
MemberSignInConfigDO lastConfig = CollUtil.getLast(configs); // 最大签到天数配置
// 1.2. 计算今天是第几天签到
int day = 1;
// TODO @puhui999要判断是不是昨天签到的是否是昨天的判断可以抽个方法到 util
if (lastRecord != null) {
day = lastRecord.getDay() + 1;
}
// TODO @puhui999signInConfig 可以改成 config
MemberSignInConfigDO signInConfig = CollUtil.findOne(signInConfigs, config -> ObjUtil.equal(config.getDay(), day));
if (signInConfig == null) {
return signInRecord;
// 1.3 判断是否超出了最大签到配置
if (day > lastConfig.getDay()) {
day = 1; // 超过最大配置的天数重置到第一天(也就是说开启下一轮签到)
}
signInRecord.setPoint(signInConfig.getPoint());
signInRecord.setExperience(signInConfig.getExperience());
return signInRecord;
// 2.1 初始化签到信息
MemberSignInRecordDO record = new MemberSignInRecordDO().setUserId(userId)
.setDay(day).setPoint(0).setExperience(0);
// 2.2 获取签到对应的积分
MemberSignInConfigDO config = CollUtil.findOne(configs, item -> ObjUtil.equal(item.getDay(), record.getDay()));
if (config == null) {
return record;
}
record.setPoint(config.getPoint());
record.setExperience(config.getExperience());
return record;
}
}

View File

@ -35,50 +35,31 @@ public interface MemberSignInRecordMapper extends BaseMapperX<MemberSignInRecord
.orderByDesc(MemberSignInRecordDO::getId));
}
// TODO @puhui999 2 个方法是不是一个 first一个 last 就可以了
/**
* 获取用户最近的签到记录信息根据签到时间倒序
*
* @param userId 用户编号
* @return 签到记录列表
*/
default MemberSignInRecordDO selectLastRecordByUserIdDesc(Long userId) {
default MemberSignInRecordDO selectLastRecordByUserId(Long userId) {
return selectOne(new QueryWrapper<MemberSignInRecordDO>()
.eq("user_id", userId)
.orderByDesc("create_time")
.last("limit 1"));
}
/**
* 获取用户最早的签到记录信息,根据签到时间倒序
*
* @param userId 用户编号
* @return 签到记录列表
*/
default MemberSignInRecordDO selectLastRecordByUserIdAsc(Long userId) {
return selectOne(new QueryWrapper<MemberSignInRecordDO>()
.eq("user_id", userId)
.orderByAsc("create_time")
.last("limit 1"));
}
default Long selectCountByUserId(Long userId) {
// TODO @puhui999可以使用 selectCount 里面允许传递字段的方法
return selectCount(new LambdaQueryWrapperX<MemberSignInRecordDO>()
.eq(MemberSignInRecordDO::getUserId, userId));
return selectCount(MemberSignInRecordDO::getUserId, userId);
}
/**
* 获取用户的签到记录列表信息,根据签到时间倒序
* 获取用户的签到记录列表信息
*
* @param userId 用户编号
* @return 签到记录信息
*/
// TODO @puhui999这个排序可以交给 service
default List<MemberSignInRecordDO> selectListByUserId(Long userId) {
return selectList(new LambdaQueryWrapperX<MemberSignInRecordDO>()
.eq(MemberSignInRecordDO::getUserId, userId)
.orderByDesc(MemberSignInRecordDO::getCreateTime));
return selectList(MemberSignInRecordDO::getUserId, userId);
}
}

View File

@ -58,36 +58,38 @@ public class MemberSignInRecordServiceImpl implements MemberSignInRecordService
@Override
public AppMemberSignInRecordSummaryRespVO getSignInRecordSummary(Long userId) {
// 1. 初始化默认返回信息
// TODO @puhui999这里 vo 改成 summary 会更好理解
AppMemberSignInRecordSummaryRespVO vo = new AppMemberSignInRecordSummaryRespVO();
vo.setTotalDay(0);
vo.setContinuousDay(0);
vo.setTodaySignIn(false);
AppMemberSignInRecordSummaryRespVO summary = new AppMemberSignInRecordSummaryRespVO();
summary.setTotalDay(0);
summary.setContinuousDay(0);
summary.setTodaySignIn(false);
// 2. 获取用户签到的记录数
Long signCount = signInRecordMapper.selectCountByUserId(userId);
if (ObjUtil.equal(signCount, 0L)) {
return vo;
return summary;
}
vo.setTotalDay(signCount.intValue()); // 设置总签到天数
summary.setTotalDay(signCount.intValue()); // 设置总签到天数
// 3. 校验当天是否有签到
// TODO @puhui999是不是 signInRecord 可以精简成 record 另外Desc 貌似可以去掉哈最后一条了
MemberSignInRecordDO signInRecord = signInRecordMapper.selectLastRecordByUserIdDesc(userId);
if (signInRecord == null) {
return vo;
MemberSignInRecordDO lastRecord = signInRecordMapper.selectLastRecordByUserId(userId);
if (lastRecord == null) {
return summary;
}
vo.setTodaySignIn(DateUtils.isToday(signInRecord.getCreateTime()));
summary.setTodaySignIn(DateUtils.isToday(lastRecord.getCreateTime()));
// 4. 校验今天是否签到没有签到则直接返回
if (!vo.getTodaySignIn()) {
return vo;
if (!summary.getTodaySignIn()) {
return summary;
}
// 4.1. 判断连续签到天数
// TODO @puhui999连续签到可以基于 signInRecord day 和当前时间判断呀
// TODO @puhui999连续签到可以基于 lastRecord day 和当前时间判断呀 day 统计连续签到天数可能不准确
// 1. day 只是记录第几天签到的有可能不连续比如第一次签到是周一第二次签到是周三这样 lastRecord day 2 但是并不是连续的两天
// 2. day 超出签到规则的最大天数会重置到从第一天开始签到我理解为开始下一轮类似一周签到七天七天结束下周又从周一开始签到
// 1. 回复周三签到day 要归 1 连续签到哈
List<MemberSignInRecordDO> signInRecords = signInRecordMapper.selectListByUserId(userId);
vo.setContinuousDay(calculateConsecutiveDays(signInRecords));
return vo;
signInRecords.sort(Comparator.comparing(MemberSignInRecordDO::getCreateTime).reversed()); // 根据签到时间倒序
summary.setContinuousDay(calculateConsecutiveDays(signInRecords));
return summary;
}
/**
@ -144,17 +146,14 @@ public class MemberSignInRecordServiceImpl implements MemberSignInRecordService
@Transactional(rollbackFor = Exception.class)
public MemberSignInRecordDO createSignRecord(Long userId) {
// 1. 获取当前用户最近的签到
MemberSignInRecordDO lastRecord = signInRecordMapper.selectLastRecordByUserIdDesc(userId);
MemberSignInRecordDO lastRecord = signInRecordMapper.selectLastRecordByUserId(userId);
// 1.1. 判断是否重复签到
validateSigned(lastRecord);
// 2. 获取当前用户最早的一次前端记录用于计算今天是第几天签到
MemberSignInRecordDO firstRecord = signInRecordMapper.selectLastRecordByUserIdAsc(userId);
// 2.1. 获取所有的签到规则
List<MemberSignInConfigDO> signInConfigs = signInConfigService.getSignInConfigList(CommonStatusEnum.ENABLE.getStatus());
signInConfigs.sort(Comparator.comparing(MemberSignInConfigDO::getDay));
// 2.2. 组合数据
MemberSignInRecordDO record = MemberSignInRecordConvert.INSTANCE.convert(userId, firstRecord, signInConfigs);
MemberSignInRecordDO record = MemberSignInRecordConvert.INSTANCE.convert(userId, lastRecord, signInConfigs);
// 3. 插入签到记录
signInRecordMapper.insert(record);

View File

@ -8,8 +8,10 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import javax.validation.Valid;
@ -23,9 +25,9 @@ public interface PayRefundApi {
@Operation(summary = "创建退款单")
CommonResult<Long> createRefund(@Valid @RequestBody PayRefundCreateReqDTO reqDTO);
@PostMapping(PREFIX + "/get")
@GetMapping(PREFIX + "/get")
@Operation(summary = "获得退款单")
@Parameter(name = "id", description = "退款单编号", example = "1", required = true)
CommonResult<PayRefundRespDTO> getRefund(Long id);
CommonResult<PayRefundRespDTO> getRefund(@RequestParam("id") Long id);
}

View File

@ -23,10 +23,10 @@ import cn.iocoder.yudao.module.system.service.member.MemberService;
import cn.iocoder.yudao.module.system.service.oauth2.OAuth2TokenService;
import cn.iocoder.yudao.module.system.service.social.SocialUserService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.google.common.annotations.VisibleForTesting;
import com.xingyuv.captcha.model.common.ResponseModel;
import com.xingyuv.captcha.model.vo.CaptchaVO;
import com.xingyuv.captcha.service.CaptchaService;
import com.google.common.annotations.VisibleForTesting;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -85,7 +85,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
throw exception(AUTH_LOGIN_BAD_CREDENTIALS);
}
// 校验是否禁用
if (ObjectUtil.notEqual(user.getStatus(), CommonStatusEnum.ENABLE.getStatus())) {
if (CommonStatusEnum.isDisable(user.getStatus())) {
createLoginLog(user.getId(), username, logTypeEnum, LoginResultEnum.USER_DISABLED);
throw exception(AUTH_LOGIN_USER_DISABLED);
}

View File

@ -119,7 +119,7 @@ public class OAuth2ClientServiceImpl implements OAuth2ClientService {
if (client == null) {
throw exception(OAUTH2_CLIENT_NOT_EXISTS);
}
if (ObjectUtil.notEqual(client.getStatus(), CommonStatusEnum.ENABLE.getStatus())) {
if (CommonStatusEnum.isDisable(client.getStatus())) {
throw exception(OAUTH2_CLIENT_DISABLE);
}

View File

@ -26,7 +26,6 @@ import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.regex.Pattern;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -140,7 +139,7 @@ public class SmsTemplateServiceImpl implements SmsTemplateService {
if (channelDO == null) {
throw exception(SMS_CHANNEL_NOT_EXISTS);
}
if (!Objects.equals(channelDO.getStatus(), CommonStatusEnum.ENABLE.getStatus())) {
if (CommonStatusEnum.isDisable(channelDO.getStatus())) {
throw exception(SMS_CHANNEL_DISABLE);
}
return channelDO;