mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、登出系统token删除优化;2、生产单查询、菜单增改接口入参检查完善;
This commit is contained in:
+6
-2
@@ -1,11 +1,11 @@
|
||||
package com.cf.imes.module.executor.controller.admin.order.vo.order;
|
||||
|
||||
import com.cf.imes.module.executor.validation.order.OrderStatusValid;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -46,21 +46,25 @@ public class OrderPageReqVO extends PageParam {
|
||||
private Integer dataType;
|
||||
|
||||
@Schema(description = "订单状态,订单状态,0空订单1新单2生产中3生产完成", example = "1")
|
||||
@OrderStatusValid
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "自定义单号")
|
||||
@Length(max = 32, message = "自定义单号长度不能超过32")
|
||||
private String customOrderNo;
|
||||
|
||||
@Schema(description = "客户")
|
||||
private String customer;
|
||||
|
||||
@Schema(description = "客户地址")
|
||||
@Length(max = 255, message = "收货地址长度不能超过255")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "客户电话")
|
||||
private String phoneNumber;
|
||||
|
||||
@Schema(description = "经销商")
|
||||
@Length(max = 255, message = "经销商长度不能超过255")
|
||||
private String dealer;
|
||||
|
||||
@Schema(description = "经销商电话")
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.cf.imes.module.executor.validation.order;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 订单状态校验注解
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/18 16:37
|
||||
*/
|
||||
@Target({
|
||||
ElementType.FIELD,
|
||||
ElementType.PARAMETER
|
||||
})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Constraint(
|
||||
validatedBy = {OrderStatusValidator.class}
|
||||
)
|
||||
public @interface OrderStatusValid {
|
||||
String message() default "订单状态不合法,请检查";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.cf.imes.module.executor.validation.order;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.module.executor.enums.OrderStatusEnum;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 订单状态校验器
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/18 16:38
|
||||
*/
|
||||
public class OrderStatusValidator implements ConstraintValidator<OrderStatusValid, Integer> {
|
||||
@Override
|
||||
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
||||
if (ObjectUtil.isNull(value)) {
|
||||
return true;
|
||||
}
|
||||
for (OrderStatusEnum statusEnum : OrderStatusEnum.values()) {
|
||||
if (Objects.equals(statusEnum.getStatus(), value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+2
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.system.controller.admin.permission.vo.menu;
|
||||
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.menu.MenuTypeValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -27,6 +28,7 @@ public class MenuSaveVO {
|
||||
|
||||
@Schema(description = "类型,参见 MenuTypeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "菜单类型不能为空")
|
||||
@MenuTypeValid
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "显示顺序不能为空", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
|
||||
+5
-7
@@ -131,15 +131,13 @@ public class OAuth2TokenServiceImpl implements OAuth2TokenService {
|
||||
@Override
|
||||
public OAuth2AccessTokenDO removeAccessToken(String accessToken) {
|
||||
// 删除访问令牌
|
||||
OAuth2AccessTokenDO accessTokenDO = oauth2AccessTokenMapper.selectByAccessToken(accessToken);
|
||||
if (accessTokenDO == null) {
|
||||
OAuth2AccessTokenDO oauth2AccessTokenDO = oauth2AccessTokenRedisDAO.get(accessToken);
|
||||
if (ObjectUtil.isNotNull(oauth2AccessTokenDO)) {
|
||||
oauth2AccessTokenRedisDAO.delete(accessToken);
|
||||
return oauth2AccessTokenDO;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
oauth2AccessTokenMapper.deleteById(accessTokenDO.getId());
|
||||
oauth2AccessTokenRedisDAO.delete(accessToken);
|
||||
// 删除刷新令牌
|
||||
oauth2RefreshTokenMapper.deleteByRefreshToken(accessTokenDO.getRefreshToken());
|
||||
return accessTokenDO;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.cf.imes.module.system.validation.menu;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 菜单类型校验注解
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/21 11:25
|
||||
*/
|
||||
@Target({
|
||||
ElementType.PARAMETER,
|
||||
ElementType.FIELD,
|
||||
})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Constraint(
|
||||
validatedBy = {MenuTypeValidator.class}
|
||||
)
|
||||
public @interface MenuTypeValid {
|
||||
String message() default "菜单类型不合法";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.cf.imes.module.system.validation.menu;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.module.system.enums.permission.MenuTypeEnum;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
/**
|
||||
* 菜单类型校验器
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/21 11:26
|
||||
*/
|
||||
public class MenuTypeValidator implements ConstraintValidator<MenuTypeValid, Integer> {
|
||||
@Override
|
||||
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
||||
if (ObjectUtil.isNull(value)) {
|
||||
return true;
|
||||
}
|
||||
for (MenuTypeEnum typeEnum : MenuTypeEnum.values()) {
|
||||
if (ObjectUtil.equal(typeEnum.getType(), value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user