mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
岗位、余料查询修改
This commit is contained in:
+2
@@ -1,6 +1,7 @@
|
||||
package com.cf.imes.module.manage.controller.admin.plate.vo.plate;
|
||||
|
||||
import com.cf.imes.module.manage.validation.length.ValidLength;
|
||||
import com.cf.imes.module.manage.validation.longConvert.ValidLong;
|
||||
import com.cf.imes.module.manage.validation.texture.ValidBoolean;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
@@ -70,5 +71,6 @@ public class PlateSaveReqVO {
|
||||
@Size(max = 255, message = "备注长度不能超过255个字符")
|
||||
private String remark;
|
||||
|
||||
@ValidLong
|
||||
private Long organId;
|
||||
}
|
||||
+7
-3
@@ -2,6 +2,7 @@ package com.cf.imes.module.manage.controller.admin.plate.vo.remain;
|
||||
|
||||
import com.cf.imes.module.manage.validation.common.ValidCommonStatus;
|
||||
import com.cf.imes.module.manage.validation.length.ValidLength;
|
||||
import com.cf.imes.module.manage.validation.nonZero.ValidNonZero;
|
||||
import com.cf.imes.module.manage.validation.placeStyle.ValidPlaceStyle;
|
||||
import com.cf.imes.module.manage.validation.type.ValidTypeField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -11,7 +12,7 @@ import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 生产单余料板表 order_remain_plate_{N}新增/修改 Request VO")
|
||||
@Schema(description = "管理后台 - 生产单余料板表 Request VO")
|
||||
@Data
|
||||
public class RemainPlateSaveReqVO {
|
||||
|
||||
@@ -35,7 +36,7 @@ public class RemainPlateSaveReqVO {
|
||||
@NotNull(message = "是否为开料添加,0否,1是")
|
||||
private Boolean isCutting;
|
||||
|
||||
@Schema(description = "使用类型,0核销,1排单,2补板", example = "0")
|
||||
@Schema(description = "使用类型,0核销,1排单,2补板", example = "1")
|
||||
@ValidTypeField
|
||||
private Integer useType;
|
||||
|
||||
@@ -63,23 +64,26 @@ public class RemainPlateSaveReqVO {
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "宽度不能为空")
|
||||
@ValidLength
|
||||
@ValidNonZero
|
||||
private BigDecimal width;
|
||||
|
||||
@Schema(description = "长度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "长度不能为空")
|
||||
@ValidLength
|
||||
@ValidNonZero
|
||||
private BigDecimal length;
|
||||
|
||||
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "厚度不能为空")
|
||||
@ValidLength
|
||||
@ValidNonZero
|
||||
private BigDecimal thickness;
|
||||
|
||||
@Schema(description = "品牌")
|
||||
@Size(max = 50, message = "品牌长度不能超过50个字符")
|
||||
private String brand;
|
||||
|
||||
@Schema(description = "放置样式,0正面,1正面右转,2正面后转,3正面左转,4反面,5反面右转,6反面后转,7反面左转")
|
||||
@Schema(description = "放置样式,0正面,1正面右转,2正面后转,3正面左转,4反面,5反面右转,6反面后转,7反面左转", example = "0")
|
||||
@ValidPlaceStyle
|
||||
private Integer placeStyle;
|
||||
|
||||
|
||||
+8
@@ -1,5 +1,6 @@
|
||||
package com.cf.imes.module.manage.dal.mysql.plate;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
@@ -81,4 +82,11 @@ public interface PlateMapper extends BaseMapperX<PlateDO> {
|
||||
default Boolean isByGoodID(String goodId , Long organId) {
|
||||
return selectList(PlateDO::getGoodsId, goodId, PlateDO::getOrganId, organId).size() > 0;
|
||||
}
|
||||
|
||||
default Boolean isByGoodIDAndId(String goodId , Long organId , Long id) {
|
||||
return selectCount(new LambdaQueryWrapper<PlateDO>()
|
||||
.ne(PlateDO::getId, id)
|
||||
.eq(PlateDO::getGoodsId, goodId)
|
||||
.eq(PlateDO::getOrganId, organId)) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -71,11 +71,11 @@ public class PlateServiceImpl implements PlateService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updatePlate(PlateSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validatePlateExists(updateReqVO.getId(),
|
||||
validatePlateExists(Long.valueOf(updateReqVO.getId()),
|
||||
getOrganId(BASE_PLATE_UPDATE_PERMISSION, getLoginUser().getId(), updateReqVO.getOrganId()));
|
||||
PlateDO updateObj = BeanUtils.toBean(updateReqVO, PlateDO.class);
|
||||
// 校验板材goods_id是否相同
|
||||
if (plateMapper.isByGoodID(updateReqVO.getGoodsId(), getLoginUser().getId())) {
|
||||
if (plateMapper.isByGoodIDAndId(updateReqVO.getGoodsId(), getLoginUser().getId(), Long.valueOf(updateReqVO.getId()))) {
|
||||
throw exception(PLATE_GOODS_ID_NOT_SAME);
|
||||
}
|
||||
plateMapper.updateById(updateObj);
|
||||
|
||||
+1
-1
@@ -10,6 +10,6 @@ public class CommonStatusValidator implements ConstraintValidator<ValidCommonSta
|
||||
|
||||
@Override
|
||||
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
||||
return value != null && (value == 0 || value == 1);
|
||||
return value == null || (value == 0 || value == 1);
|
||||
}
|
||||
}
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.cf.imes.module.manage.validation.longConvert;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
public class LongValidator implements ConstraintValidator<ValidLong, String> {
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||
if (value == null) {
|
||||
return true; // 允许 null 值
|
||||
}
|
||||
try {
|
||||
Long.parseLong(value);
|
||||
return true;
|
||||
} catch (NumberFormatException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.cf.imes.module.manage.validation.longConvert;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
|
||||
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Constraint(validatedBy = LongValidator.class)
|
||||
@Documented
|
||||
public @interface ValidLong {
|
||||
|
||||
String message() default "ID参数类型有误";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.cf.imes.module.manage.validation.nonZero;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 数值大于0校验
|
||||
*/
|
||||
public class NonNegativeValidator implements ConstraintValidator<ValidNonZero, BigDecimal> {
|
||||
|
||||
@Override
|
||||
public boolean isValid(BigDecimal value, ConstraintValidatorContext context) {
|
||||
return value == null || value.signum() >= 0;
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.cf.imes.module.manage.validation.nonZero;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 数值大于0校验注解
|
||||
*/
|
||||
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Constraint(validatedBy = NonNegativeValidator.class)
|
||||
@Documented
|
||||
public @interface ValidNonZero {
|
||||
|
||||
String message() default "长度数值必须大于等于0";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
||||
+1
-1
@@ -10,7 +10,7 @@ public class PlaceStyleValidator implements ConstraintValidator<ValidPlaceStyle,
|
||||
|
||||
@Override
|
||||
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
||||
return value != null && (value == 0 || value == 1 || value == 2 || value == 3
|
||||
return value == null || (value == 0 || value == 1 || value == 2 || value == 3
|
||||
|| value == 4 || value == 5 || value == 6 || value == 7);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import java.lang.annotation.*;
|
||||
/**
|
||||
* 放置样式校验注解
|
||||
*/
|
||||
@Target({ElementType.FIELD, ElementType.PARAMETER})
|
||||
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Constraint(validatedBy = PlaceStyleValidator.class)
|
||||
@Documented
|
||||
|
||||
+9
-3
@@ -6,10 +6,16 @@ import javax.validation.ConstraintValidatorContext;
|
||||
/**
|
||||
* 纹理校验
|
||||
*/
|
||||
public class BooleanTypeValidator implements ConstraintValidator<ValidBoolean, Object> {
|
||||
public class BooleanTypeValidator implements ConstraintValidator<ValidBoolean, String> {
|
||||
|
||||
@Override
|
||||
public boolean isValid(Object value, ConstraintValidatorContext context) {
|
||||
return value instanceof Boolean;
|
||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||
if (value == null) {
|
||||
return true; // 允许 null 值
|
||||
}
|
||||
return value.equalsIgnoreCase("true") ||
|
||||
value.equalsIgnoreCase("false") ||
|
||||
value.equals("0") ||
|
||||
value.equals("1");
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@ import java.lang.annotation.*;
|
||||
/**
|
||||
* 纹理校验注解
|
||||
*/
|
||||
@Target({ElementType.FIELD, ElementType.PARAMETER})
|
||||
@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Constraint(validatedBy = BooleanTypeValidator.class)
|
||||
@Documented
|
||||
|
||||
+1
-1
@@ -10,6 +10,6 @@ public class TypeFieldValidator implements ConstraintValidator<ValidTypeField, I
|
||||
|
||||
@Override
|
||||
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
||||
return value != null && (value == 0 || value == 1 || value == 2);
|
||||
return value == null || (value == 0 || value == 1 || value == 2);
|
||||
}
|
||||
}
|
||||
+4
@@ -26,6 +26,10 @@ public class UserPageReqVO extends PageParam {
|
||||
@Size(max = 30, message = "用户昵称长度不能超过30个字符")
|
||||
private String nickname;
|
||||
|
||||
@Schema(description = "用户账号")
|
||||
@Size(max = 30, message = "用户账号长度不能超过30个字符")
|
||||
private String username;
|
||||
|
||||
@Schema(description = "手机号码,模糊匹配", example = "chenfeng")
|
||||
@Mobile
|
||||
@Size(max = 11, message = "手机号码长度不能超过11个字符")
|
||||
|
||||
+11
-1
@@ -34,11 +34,21 @@ public interface PostMapper extends BaseMapperX<PostDO> {
|
||||
}else{
|
||||
lambdaQueryWrapperX.eqIfPresent(PostDO::getOrganId, loginUser.getOrganId());
|
||||
}
|
||||
return selectPage(reqVO, lambdaQueryWrapperX
|
||||
// 获取分页结果
|
||||
PageResult<PostDO> pageResult = selectPage(reqVO, lambdaQueryWrapperX
|
||||
.likeIfPresent(PostDO::getCode, reqVO.getCode())
|
||||
.likeIfPresent(PostDO::getName, reqVO.getName())
|
||||
.eqIfPresent(PostDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(PostDO::getId));
|
||||
|
||||
// 重新设置 id 值
|
||||
List<PostDO> records = pageResult.getList();
|
||||
for (int i = 0; i < records.size(); i++) {
|
||||
PostDO postDO = records.get(i);
|
||||
postDO.setId((long) (i + 1));
|
||||
}
|
||||
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
default PostDO selectByName(String name) {
|
||||
|
||||
+3
@@ -393,6 +393,9 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
if (StringUtils.isNotBlank(reqVO.getNickname())) {
|
||||
reqVO.setPyFirstChar(PinYinUtils.convertFirstChar(reqVO.getNickname()));
|
||||
reqVO.setPyAll(PinYinUtils.convertToPinyin(reqVO.getNickname()).replace(" ", ""));
|
||||
} else if (StringUtils.isNotBlank((reqVO.getUsername()))) {
|
||||
reqVO.setPyFirstChar(PinYinUtils.convertFirstChar(reqVO.getUsername()));
|
||||
reqVO.setPyAll(PinYinUtils.convertToPinyin(reqVO.getUsername()).replace(" ", ""));
|
||||
} else {
|
||||
// 避免name为空外部传入拼音查询字段
|
||||
reqVO.setPyFirstChar(null);
|
||||
|
||||
Reference in New Issue
Block a user