mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 05:42:06 +08:00
1、新增贴皮管理增删改、上传图片、分页/单个查询接口;2、整理对应参数校验国际化;
This commit is contained in:
+2
@@ -28,6 +28,8 @@ public @interface InEnum {
|
|||||||
|
|
||||||
String message() default "inEnum.message";
|
String message() default "inEnum.message";
|
||||||
|
|
||||||
|
String fieldName() default "";
|
||||||
|
|
||||||
Class<?>[] groups() default {};
|
Class<?>[] groups() default {};
|
||||||
|
|
||||||
Class<? extends Payload>[] payload() default {};
|
Class<? extends Payload>[] payload() default {};
|
||||||
|
|||||||
+4
-1
@@ -18,8 +18,11 @@ public class InEnumValidator implements ConstraintValidator<InEnum, Integer> {
|
|||||||
|
|
||||||
private List<Integer> values;
|
private List<Integer> values;
|
||||||
|
|
||||||
|
private String fieldName;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(InEnum annotation) {
|
public void initialize(InEnum annotation) {
|
||||||
|
fieldName = annotation.fieldName();
|
||||||
IntArrayValuable[] values = annotation.value().getEnumConstants();
|
IntArrayValuable[] values = annotation.value().getEnumConstants();
|
||||||
if (values.length == 0) {
|
if (values.length == 0) {
|
||||||
this.values = Collections.emptyList();
|
this.values = Collections.emptyList();
|
||||||
@@ -44,7 +47,7 @@ public class InEnumValidator implements ConstraintValidator<InEnum, Integer> {
|
|||||||
|
|
||||||
// 校验不通过,自定义提示语句(因为,注解上的 value 是枚举类,无法获得枚举类的实际值)
|
// 校验不通过,自定义提示语句(因为,注解上的 value 是枚举类,无法获得枚举类的实际值)
|
||||||
context.disableDefaultConstraintViolation(); // 禁用默认的 message 的值
|
context.disableDefaultConstraintViolation(); // 禁用默认的 message 的值
|
||||||
context.buildConstraintViolationWithTemplate(defaultConstraintMessageTemplate).addConstraintViolation(); // 重新添加错误提示语句
|
context.buildConstraintViolationWithTemplate(fieldName + defaultConstraintMessageTemplate).addConstraintViolation(); // 重新添加错误提示语句
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.cf.imes.module.system.enums.common;
|
package com.cf.imes.framework.excel.core.enums;
|
||||||
|
|
||||||
import com.cf.imes.framework.excel.core.convert.BaseBoolValEnum;
|
import com.cf.imes.framework.excel.core.convert.BaseBoolValEnum;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.cf.imes.module.system.enums.common;
|
package com.cf.imes.framework.excel.core.enums;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
+4
@@ -168,4 +168,8 @@ public class ErrorCodeConstants {
|
|||||||
public static final ErrorCode PLATE_GOODS_ID_NOT_SAME = new ErrorCode(1_003_008_005, "板材商品编号存在,请重新命名商品编号");
|
public static final ErrorCode PLATE_GOODS_ID_NOT_SAME = new ErrorCode(1_003_008_005, "板材商品编号存在,请重新命名商品编号");
|
||||||
public static final ErrorCode PLATE_IS_SOURCE = new ErrorCode(1_003_008_006, "小板:{} 为源小板,无法删除");
|
public static final ErrorCode PLATE_IS_SOURCE = new ErrorCode(1_003_008_006, "小板:{} 为源小板,无法删除");
|
||||||
public static final ErrorCode PLATE_ATTR_GROUP_EXISTS = new ErrorCode(1_003_008_007, "当前名称、材质、颜色、厚度、品牌的组合已存在,请检查后提交");
|
public static final ErrorCode PLATE_ATTR_GROUP_EXISTS = new ErrorCode(1_003_008_007, "当前名称、材质、颜色、厚度、品牌的组合已存在,请检查后提交");
|
||||||
|
|
||||||
|
//=========== 贴皮管理 1-003-009-000 ============
|
||||||
|
public static final ErrorCode VENEER_NOT_EXIST = new ErrorCode(1_003_009_000, "veneer.not.exist");
|
||||||
|
public static final ErrorCode VENEER_NO_EXIST = new ErrorCode(1_003_009_001, "veneer.no.exist");
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ import lombok.Getter;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum CategoryEnum implements ObjectEnum{
|
public enum CategoryEnum implements ObjectEnum {
|
||||||
|
|
||||||
ASSEMBLY("组件"),
|
ASSEMBLY("组件"),
|
||||||
HARDWARE("五金"),
|
HARDWARE("五金"),
|
||||||
|
|||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
package com.cf.imes.module.executor.enums.manage.parts;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum WhetherEnum implements ObjectEnum {
|
|
||||||
|
|
||||||
TRUE("是"),
|
|
||||||
FALSE("否");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 类别名称
|
|
||||||
*/
|
|
||||||
private final String value;
|
|
||||||
}
|
|
||||||
+82
@@ -0,0 +1,82 @@
|
|||||||
|
package com.cf.imes.module.executor.controller.admin.veneer;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
|
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.veneer.vo.VeneerPageReqVO;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.veneer.vo.VeneerRespVO;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.veneer.vo.VeneerSaveReqVO;
|
||||||
|
import com.cf.imes.module.executor.service.veneer.VeneerService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestPart;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||||
|
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.CREATE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2026/1/4 14:26
|
||||||
|
*/
|
||||||
|
@Tag(name = "生产管理 - 贴皮管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/executor/veneer")
|
||||||
|
@Validated
|
||||||
|
public class VeneerController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private VeneerService veneerService;
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "分页查询")
|
||||||
|
public CommonResult<PageResult<VeneerRespVO>> getVeneerPage(@Valid VeneerPageReqVO pageReqVO) {
|
||||||
|
return success(veneerService.getPage(pageReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
@Operation(summary = "根据id获取贴皮")
|
||||||
|
public CommonResult<VeneerRespVO> getVeneer(@PathVariable Long id) {
|
||||||
|
return success(veneerService.get(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("")
|
||||||
|
@Operation(summary = "创建贴皮")
|
||||||
|
public CommonResult<Long> createVeneer(@Valid @RequestBody VeneerSaveReqVO reqVO) {
|
||||||
|
return success(veneerService.create(reqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("")
|
||||||
|
@Operation(summary = "编辑贴皮")
|
||||||
|
public CommonResult<Boolean> updateVeneer(@Valid @RequestBody VeneerSaveReqVO reqVO) {
|
||||||
|
return success(veneerService.update(reqVO) == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
@Operation(summary = "删除贴皮")
|
||||||
|
public CommonResult<Boolean> deleteVeneer(@PathVariable Long id) {
|
||||||
|
return success(veneerService.delete(id) == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/pic")
|
||||||
|
@Operation(summary = "上传贴皮照片")
|
||||||
|
@OperateLog(logArgs = false, type = CREATE)
|
||||||
|
public CommonResult<Long> uploadVeneerPic(@RequestPart(value = "file") MultipartFile file) throws IOException {
|
||||||
|
return success(veneerService.uploadPic(file));
|
||||||
|
}
|
||||||
|
}
|
||||||
+92
@@ -0,0 +1,92 @@
|
|||||||
|
package com.cf.imes.module.executor.controller.admin.veneer.vo;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.pojo.PageParam;
|
||||||
|
import com.cf.imes.framework.common.validation.InEnum;
|
||||||
|
import com.cf.imes.module.executor.enums.veneer.VeneerProductLevelEnum;
|
||||||
|
import com.cf.imes.module.executor.enums.veneer.VeneerStatusEnum;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2026/1/4 17:56
|
||||||
|
*/
|
||||||
|
@Schema(description = "生产管理 - 贴皮分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class VeneerPageReqVO extends PageParam {
|
||||||
|
@Schema(description = "贴皮编号")
|
||||||
|
@Length(max = 32, message = "{veneer.save.veneerNo.length.max}")
|
||||||
|
private String veneerNo;
|
||||||
|
|
||||||
|
@Schema(description = "批次号")
|
||||||
|
@Length(max = 32, message = "{veneer.save.batchNo.length.max}")
|
||||||
|
private String batchNo;
|
||||||
|
|
||||||
|
@Schema(description = "分类名称")
|
||||||
|
private String classificationName;
|
||||||
|
|
||||||
|
@Schema(description = "贴皮名称")
|
||||||
|
@Length(max = 64, message = "{veneer.save.veneerName.length.max}")
|
||||||
|
private String veneerName;
|
||||||
|
|
||||||
|
@Schema(description = "产品等级,0:A类、1:B类、2:C类")
|
||||||
|
@InEnum(value = VeneerProductLevelEnum.class, fieldName = "productLevel")
|
||||||
|
private Integer productLevel;
|
||||||
|
|
||||||
|
@Schema(description = "颜色")
|
||||||
|
@Length(max = 32, message = "{veneer.save.color.length.max}")
|
||||||
|
private String color;
|
||||||
|
|
||||||
|
@Schema(description = "材质")
|
||||||
|
@Length(max = 64, message = "{veneer.save.material.length.max}")
|
||||||
|
private String material;
|
||||||
|
|
||||||
|
@Schema(description = "宽")
|
||||||
|
private BigDecimal[] width;
|
||||||
|
|
||||||
|
@Schema(description = "长")
|
||||||
|
private BigDecimal[] length;
|
||||||
|
|
||||||
|
@Schema(description = "厚")
|
||||||
|
private BigDecimal[] thickness;
|
||||||
|
|
||||||
|
@Schema(description = "规格")
|
||||||
|
@Length(max = 64, message = "{veneer.save.spec.length.max}")
|
||||||
|
private String spec;
|
||||||
|
|
||||||
|
@Schema(description = "厂家")
|
||||||
|
@Length(max = 128, message = "{veneer.save.factory.length.max}")
|
||||||
|
private String factory;
|
||||||
|
|
||||||
|
@Schema(description = "数量")
|
||||||
|
private Integer[] num;
|
||||||
|
|
||||||
|
@Schema(description = "瑕疵")
|
||||||
|
private Boolean defect;
|
||||||
|
|
||||||
|
@Schema(description = "备注")
|
||||||
|
@Length(max = 255, message = "{veneer.save.remark.length.max}")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "余料")
|
||||||
|
private Boolean remain;
|
||||||
|
|
||||||
|
@Schema(description = "源排单号")
|
||||||
|
private Long sourcePlanNo;
|
||||||
|
|
||||||
|
@Schema(description = "使用排单号")
|
||||||
|
private Long planNo;
|
||||||
|
|
||||||
|
@Schema(description = "状态,0:未使用、1:已使用")
|
||||||
|
@InEnum(value = VeneerStatusEnum.class, fieldName = "status")
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
+99
@@ -0,0 +1,99 @@
|
|||||||
|
package com.cf.imes.module.executor.controller.admin.veneer.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.cf.imes.framework.excel.core.annotations.EnumFormat;
|
||||||
|
import com.cf.imes.framework.excel.core.convert.EnumBoolValConvert;
|
||||||
|
import com.cf.imes.framework.excel.core.convert.EnumConvert;
|
||||||
|
import com.cf.imes.framework.excel.core.enums.WhetherEnum;
|
||||||
|
import com.cf.imes.module.executor.enums.veneer.VeneerProductLevelEnum;
|
||||||
|
import com.cf.imes.module.executor.enums.veneer.VeneerStatusEnum;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2026/1/5 8:59
|
||||||
|
*/
|
||||||
|
@Schema(description = "生产管理 - 贴皮管理分页 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class VeneerRespVO {
|
||||||
|
@Schema(description = "贴皮id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "贴皮编号")
|
||||||
|
@ExcelProperty("veneer.export.head.veneerNo")
|
||||||
|
private String veneerNo;
|
||||||
|
|
||||||
|
@Schema(description = "分类名称")
|
||||||
|
@ExcelProperty("veneer.export.head.classificationName")
|
||||||
|
private String classificationName;
|
||||||
|
|
||||||
|
@Schema(description = "贴皮名称")
|
||||||
|
@ExcelProperty("veneer.export.head.veneerName")
|
||||||
|
private String veneerName;
|
||||||
|
|
||||||
|
@Schema(description = "产品等级,0:A类、1:B类、2:C类")
|
||||||
|
@ExcelProperty(value = "veneer.export.head.productLevel", converter = EnumConvert.class)
|
||||||
|
@EnumFormat(value = VeneerProductLevelEnum.class)
|
||||||
|
private Integer productLevel;
|
||||||
|
|
||||||
|
@Schema(description = "批次号")
|
||||||
|
@ExcelProperty("veneer.export.head.batchNo")
|
||||||
|
private String batchNo;
|
||||||
|
|
||||||
|
@Schema(description = "颜色")
|
||||||
|
@ExcelProperty("veneer.export.head.color")
|
||||||
|
private String color;
|
||||||
|
|
||||||
|
@Schema(description = "材质")
|
||||||
|
@ExcelProperty("veneer.export.head.material")
|
||||||
|
private String material;
|
||||||
|
|
||||||
|
@Schema(description = "宽")
|
||||||
|
@ExcelProperty("veneer.export.head.width")
|
||||||
|
private BigDecimal width;
|
||||||
|
|
||||||
|
@Schema(description = "长")
|
||||||
|
@ExcelProperty("veneer.export.head.length")
|
||||||
|
private BigDecimal length;
|
||||||
|
|
||||||
|
@Schema(description = "厚")
|
||||||
|
@ExcelProperty("veneer.export.head.thickness")
|
||||||
|
private BigDecimal thickness;
|
||||||
|
|
||||||
|
@Schema(description = "品牌")
|
||||||
|
@ExcelProperty("veneer.export.head.brand")
|
||||||
|
private String brand;
|
||||||
|
|
||||||
|
@Schema(description = "规格")
|
||||||
|
@ExcelProperty("veneer.export.head.spec")
|
||||||
|
private String spec;
|
||||||
|
|
||||||
|
@Schema(description = "厂家")
|
||||||
|
@ExcelProperty("veneer.export.head.factory")
|
||||||
|
private String factory;
|
||||||
|
|
||||||
|
@Schema(description = "数量")
|
||||||
|
@ExcelProperty("veneer.export.head.num")
|
||||||
|
private Integer num;
|
||||||
|
|
||||||
|
@Schema(description = "瑕疵")
|
||||||
|
@ExcelProperty(value = "veneer.export.head.defect", converter = EnumBoolValConvert.class)
|
||||||
|
@EnumFormat(value = WhetherEnum.class)
|
||||||
|
private Boolean defect;
|
||||||
|
|
||||||
|
@Schema(description = "备注")
|
||||||
|
@ExcelProperty("veneer.export.head.remark")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "状态,0:未使用、1:已使用")
|
||||||
|
@ExcelProperty(value = "veneer.export.head.status", converter = EnumConvert.class)
|
||||||
|
@EnumFormat(value = VeneerStatusEnum.class)
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
+90
@@ -0,0 +1,90 @@
|
|||||||
|
package com.cf.imes.module.executor.controller.admin.veneer.vo;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.validation.InEnum;
|
||||||
|
import com.cf.imes.module.executor.enums.veneer.VeneerProductLevelEnum;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2026/1/4 14:26
|
||||||
|
*/
|
||||||
|
@Schema(description = "生产管理 - 贴皮管理 新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class VeneerSaveReqVO {
|
||||||
|
@Schema(description = "贴皮id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "贴皮编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotBlank(message = "{veneer.save.veneerNo.not.null}")
|
||||||
|
@Length(max = 32, message = "{veneer.save.veneerNo.length.max}")
|
||||||
|
private String veneerNo;
|
||||||
|
|
||||||
|
@Schema(description = "批次号")
|
||||||
|
@Length(max = 32, message = "{veneer.save.batchNo.length.max}")
|
||||||
|
private String batchNo;
|
||||||
|
|
||||||
|
@Schema(description = "分类名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotBlank(message = "{veneer.save.classificationName.not.null}")
|
||||||
|
private String classificationName;
|
||||||
|
|
||||||
|
@Schema(description = "产品等级,0:A类、1:B类、2:C类", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "{veneer.save.productLevel.not.null}")
|
||||||
|
@InEnum(value = VeneerProductLevelEnum.class, fieldName = "productLevel")
|
||||||
|
private Integer productLevel;
|
||||||
|
|
||||||
|
@Schema(description = "贴皮名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotBlank(message = "{veneer.save.veneerName.not.null}")
|
||||||
|
@Length(max = 64, message = "{veneer.save.veneerName.length.max}")
|
||||||
|
private String veneerName;
|
||||||
|
|
||||||
|
@Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "{veneer.save.num.not.null}")
|
||||||
|
private Integer num;
|
||||||
|
|
||||||
|
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "{veneer.save.width.not.null}")
|
||||||
|
private BigDecimal width;
|
||||||
|
|
||||||
|
@Schema(description = "长度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "{veneer.save.length.not.null}")
|
||||||
|
private BigDecimal length;
|
||||||
|
|
||||||
|
@Schema(description = "厚度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "{veneer.save.thickness.not.null}")
|
||||||
|
private BigDecimal thickness;
|
||||||
|
|
||||||
|
@Schema(description = "颜色")
|
||||||
|
@Length(max = 32, message = "{veneer.save.color.length.max}")
|
||||||
|
private String color;
|
||||||
|
|
||||||
|
@Schema(description = "材料")
|
||||||
|
@Length(max = 64, message = "{veneer.save.material.length.max}")
|
||||||
|
private String material;
|
||||||
|
|
||||||
|
@Schema(description = "规格")
|
||||||
|
@Length(max = 64, message = "{veneer.save.spec.length.max}")
|
||||||
|
private String spec;
|
||||||
|
|
||||||
|
@Schema(description = "品牌")
|
||||||
|
@Length(max = 64, message = "{veneer.save.brand.length.max}")
|
||||||
|
private String brand;
|
||||||
|
|
||||||
|
@Schema(description = "厂家")
|
||||||
|
@Length(max = 128, message = "{veneer.save.factory.length.max}")
|
||||||
|
private String factory;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "备注")
|
||||||
|
@Length(max = 255, message = "{veneer.save.remark.length.max}")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "贴皮照片文件id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private Long fileId;
|
||||||
|
}
|
||||||
+153
@@ -0,0 +1,153 @@
|
|||||||
|
package com.cf.imes.module.executor.dal.dataobject.veneer;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 贴皮表 veneers_{N} DO
|
||||||
|
*
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2026/1/4 14:10
|
||||||
|
*/
|
||||||
|
@TableName("veneers")
|
||||||
|
@KeySequence("veneers_n_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class VeneerDO extends BaseDO {
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 贴皮编号
|
||||||
|
*/
|
||||||
|
private String veneerNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批次号
|
||||||
|
*/
|
||||||
|
@TableField(updateStrategy = FieldStrategy.ALWAYS)
|
||||||
|
private String batchNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织ID
|
||||||
|
*/
|
||||||
|
private Long organId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分类名称
|
||||||
|
*/
|
||||||
|
private String classificationName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 贴皮名称
|
||||||
|
*/
|
||||||
|
private String veneerName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品等级
|
||||||
|
*/
|
||||||
|
private Integer productLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品牌
|
||||||
|
*/
|
||||||
|
@TableField(updateStrategy = FieldStrategy.ALWAYS)
|
||||||
|
private String brand;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规格
|
||||||
|
*/
|
||||||
|
@TableField(updateStrategy = FieldStrategy.ALWAYS)
|
||||||
|
private String spec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 材质
|
||||||
|
*/
|
||||||
|
@TableField(updateStrategy = FieldStrategy.ALWAYS)
|
||||||
|
private String material;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 颜色
|
||||||
|
*/
|
||||||
|
@TableField(updateStrategy = FieldStrategy.ALWAYS)
|
||||||
|
private String color;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 厂家
|
||||||
|
*/
|
||||||
|
@TableField(updateStrategy = FieldStrategy.ALWAYS)
|
||||||
|
private String factory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
|
private Integer num;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否有瑕疵:0否 1是
|
||||||
|
*/
|
||||||
|
private Boolean defect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否余料:0否 1是
|
||||||
|
*/
|
||||||
|
private Boolean remain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 源排单号
|
||||||
|
*/
|
||||||
|
private Long sourcePlanNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用排单号
|
||||||
|
*/
|
||||||
|
private Long planNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态:0未使用 1已使用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 宽
|
||||||
|
*/
|
||||||
|
private BigDecimal width;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 长
|
||||||
|
*/
|
||||||
|
private BigDecimal length;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 厚
|
||||||
|
*/
|
||||||
|
private BigDecimal thickness;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@TableField(updateStrategy = FieldStrategy.ALWAYS)
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 贴皮文件ID
|
||||||
|
*/
|
||||||
|
private Long fileId;
|
||||||
|
}
|
||||||
+47
@@ -0,0 +1,47 @@
|
|||||||
|
package com.cf.imes.module.executor.dal.mysql.veneer;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
|
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.veneer.vo.VeneerPageReqVO;
|
||||||
|
import com.cf.imes.module.executor.dal.dataobject.veneer.VeneerDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 贴皮 Mapper
|
||||||
|
*
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2026/1/4 14:14
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface VeneerMapper extends BaseMapperX<VeneerDO> {
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
* @param reqVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
default PageResult<VeneerDO> selectPage(VeneerPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<VeneerDO>()
|
||||||
|
.eqIfPresent(VeneerDO::getVeneerNo, reqVO.getVeneerNo())
|
||||||
|
.eqIfPresent(VeneerDO::getBatchNo, reqVO.getBatchNo())
|
||||||
|
.eqIfPresent(VeneerDO::getClassificationName, reqVO.getClassificationName())
|
||||||
|
.eqIfPresent(VeneerDO::getVeneerName, reqVO.getVeneerName())
|
||||||
|
.eqIfPresent(VeneerDO::getProductLevel, reqVO.getProductLevel())
|
||||||
|
.eqIfPresent(VeneerDO::getColor, reqVO.getColor())
|
||||||
|
.eqIfPresent(VeneerDO::getMaterial, reqVO.getMaterial())
|
||||||
|
.betweenIfPresent(VeneerDO::getLength, reqVO.getLength())
|
||||||
|
.betweenIfPresent(VeneerDO::getWidth, reqVO.getWidth())
|
||||||
|
.betweenIfPresent(VeneerDO::getThickness, reqVO.getThickness())
|
||||||
|
.eqIfPresent(VeneerDO::getSpec, reqVO.getSpec())
|
||||||
|
.eqIfPresent(VeneerDO::getFactory, reqVO.getFactory())
|
||||||
|
.betweenIfPresent(VeneerDO::getNum, reqVO.getNum())
|
||||||
|
.eqIfPresent(VeneerDO::getDefect, reqVO.getDefect())
|
||||||
|
.likeIfPresent(VeneerDO::getRemark, reqVO.getRemark())
|
||||||
|
.eqIfPresent(VeneerDO::getRemain, reqVO.getRemain())
|
||||||
|
.eqIfPresent(VeneerDO::getSourcePlanNo, reqVO.getSourcePlanNo())
|
||||||
|
.eqIfPresent(VeneerDO::getPlanNo, reqVO.getPlanNo())
|
||||||
|
.eqIfPresent(VeneerDO::getStatus, reqVO.getStatus())
|
||||||
|
.orderByDesc(VeneerDO::getId));
|
||||||
|
}
|
||||||
|
}
|
||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
package com.cf.imes.module.executor.enums.veneer;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.core.IntArrayValuable;
|
||||||
|
import com.cf.imes.framework.excel.core.convert.BaseEnum;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 贴皮产品等级枚举
|
||||||
|
*
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2026/1/4 15:29
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Getter
|
||||||
|
public enum VeneerProductLevelEnum implements IntArrayValuable, BaseEnum {
|
||||||
|
A(0,"A类"),
|
||||||
|
B(1,"B类"),
|
||||||
|
C(2,"C类");
|
||||||
|
|
||||||
|
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(VeneerProductLevelEnum::getCode).toArray();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] array() {
|
||||||
|
return ARRAYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 枚举值
|
||||||
|
*/
|
||||||
|
private final Integer code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态名
|
||||||
|
*/
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
}
|
||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
package com.cf.imes.module.executor.enums.veneer;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.core.IntArrayValuable;
|
||||||
|
import com.cf.imes.framework.excel.core.convert.BaseEnum;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 贴皮状态枚举
|
||||||
|
*
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2026/1/5 11:22
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Getter
|
||||||
|
public enum VeneerStatusEnum implements IntArrayValuable, BaseEnum {
|
||||||
|
NOT_USE(0, "未使用"),
|
||||||
|
USED(1, "已使用");
|
||||||
|
|
||||||
|
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(VeneerStatusEnum::getCode).toArray();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] array() {
|
||||||
|
return ARRAYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 枚举值
|
||||||
|
*/
|
||||||
|
private final Integer code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态名
|
||||||
|
*/
|
||||||
|
private final String desc;
|
||||||
|
}
|
||||||
+32
-2
@@ -2,10 +2,11 @@ package com.cf.imes.module.executor.service.manage.parts;
|
|||||||
|
|
||||||
import com.alibaba.excel.context.AnalysisContext;
|
import com.alibaba.excel.context.AnalysisContext;
|
||||||
import com.alibaba.nacos.common.utils.StringUtils;
|
import com.alibaba.nacos.common.utils.StringUtils;
|
||||||
|
import com.cf.imes.framework.excel.core.convert.BaseBoolValEnum;
|
||||||
|
import com.cf.imes.framework.excel.core.enums.WhetherEnum;
|
||||||
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsImportExcelVO;
|
import com.cf.imes.module.executor.controller.admin.manage.parts.vo.PartsImportExcelVO;
|
||||||
import com.cf.imes.module.executor.enums.manage.parts.CategoryEnum;
|
import com.cf.imes.module.executor.enums.manage.parts.CategoryEnum;
|
||||||
import com.cf.imes.module.executor.enums.manage.parts.ObjectEnum;
|
import com.cf.imes.module.executor.enums.manage.parts.ObjectEnum;
|
||||||
import com.cf.imes.module.executor.enums.manage.parts.WhetherEnum;
|
|
||||||
import com.cf.imes.module.executor.util.file.ExcelListener;
|
import com.cf.imes.module.executor.util.file.ExcelListener;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@@ -92,6 +93,35 @@ public final class PartsExcelListener extends ExcelListener<PartsImportExcelVO>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 非空判断,并判断枚举值是否正确
|
||||||
|
private <T extends Enum<T> & BaseBoolValEnum> void isEmptyAndBoolEnumAdd(Supplier<String> getter, Consumer<String> setter, String msg, Class<T> enumClass) {
|
||||||
|
String value = getter.get();
|
||||||
|
if (StringUtils.isEmpty(value)) {
|
||||||
|
setter.accept(msg + "不可为空");
|
||||||
|
this.flag = false;
|
||||||
|
} else {
|
||||||
|
isNotEmptyToBoolEnum(getter, setter, msg, enumClass);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 不为空,判断枚举值是否正确
|
||||||
|
private <T extends Enum<T> & BaseBoolValEnum> void isNotEmptyToBoolEnum(Supplier<String> getter, Consumer<String> setter, String msg, Class<T> enumClass) {
|
||||||
|
String value = getter.get();
|
||||||
|
if (!StringUtils.isEmpty(value)) {
|
||||||
|
boolean isValid = false;
|
||||||
|
for (BaseBoolValEnum enumValue : enumClass.getEnumConstants()) {
|
||||||
|
if (Objects.equals(enumValue.getDesc(), value)) {
|
||||||
|
isValid = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isValid) {
|
||||||
|
setter.accept(msg + "请使用规范标识填写表格");
|
||||||
|
this.flag = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 非空时判断字符串是否可以转换为Double,并判断整数位与小数位是否符合长度要求
|
// 非空时判断字符串是否可以转换为Double,并判断整数位与小数位是否符合长度要求
|
||||||
private void isEmptyAndDoubleAdd(Supplier<String> getter, Consumer<String> setter, String msg, int integerLength, int decimalLength) {
|
private void isEmptyAndDoubleAdd(Supplier<String> getter, Consumer<String> setter, String msg, int integerLength, int decimalLength) {
|
||||||
String value = getter.get();
|
String value = getter.get();
|
||||||
@@ -170,7 +200,7 @@ public final class PartsExcelListener extends ExcelListener<PartsImportExcelVO>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 三,存在则判断是否符合
|
// 三,存在则判断是否符合
|
||||||
isNotEmptyToEnum(data::getIsComposite, data::setResult, setResult(data.getResult(), "是否复合部件"), WhetherEnum.class);
|
isEmptyAndBoolEnumAdd(data::getIsComposite, data::setResult, setResult(data.getResult(), "是否复合部件"), WhetherEnum.class);
|
||||||
isNotEmptyAndAdd(data::getType, data::setResult, setResult(data.getResult(), "子类型"), 64);
|
isNotEmptyAndAdd(data::getType, data::setResult, setResult(data.getResult(), "子类型"), 64);
|
||||||
isNotEmptyAndAdd(data::getModel, data::setResult, setResult(data.getResult(), "型号"), 64);
|
isNotEmptyAndAdd(data::getModel, data::setResult, setResult(data.getResult(), "型号"), 64);
|
||||||
isNotEmptyAndAdd(data::getColor, data::setResult, setResult(data.getResult(), "颜色"), 64);
|
isNotEmptyAndAdd(data::getColor, data::setResult, setResult(data.getResult(), "颜色"), 64);
|
||||||
|
|||||||
+66
@@ -0,0 +1,66 @@
|
|||||||
|
package com.cf.imes.module.executor.service.veneer;
|
||||||
|
|
||||||
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.veneer.vo.VeneerPageReqVO;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.veneer.vo.VeneerRespVO;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.veneer.vo.VeneerSaveReqVO;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 贴皮管理 Service接口
|
||||||
|
*
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2026/1/4 14:24
|
||||||
|
*/
|
||||||
|
public interface VeneerService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增贴皮
|
||||||
|
*
|
||||||
|
* @param reqVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Long create(VeneerSaveReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑贴皮
|
||||||
|
*
|
||||||
|
* @param reqVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int update(VeneerSaveReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除贴皮
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int delete(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传贴皮照片
|
||||||
|
*
|
||||||
|
* @param file
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Long uploadPic(MultipartFile file) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询贴皮
|
||||||
|
*
|
||||||
|
* @param pageReqVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PageResult<VeneerRespVO> getPage(VeneerPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id查询贴皮数据
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
VeneerRespVO get(Long id);
|
||||||
|
}
|
||||||
+176
@@ -0,0 +1,176 @@
|
|||||||
|
package com.cf.imes.module.executor.service.veneer;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
|
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||||
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
|
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.veneer.vo.VeneerPageReqVO;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.veneer.vo.VeneerRespVO;
|
||||||
|
import com.cf.imes.module.executor.controller.admin.veneer.vo.VeneerSaveReqVO;
|
||||||
|
import com.cf.imes.module.executor.dal.dataobject.veneer.VeneerDO;
|
||||||
|
import com.cf.imes.module.executor.dal.mysql.veneer.VeneerMapper;
|
||||||
|
import com.cf.imes.module.infra.api.file.FileApi;
|
||||||
|
import com.cf.imes.module.system.api.organ.OrganApi;
|
||||||
|
import com.cf.imes.module.system.api.organ.dto.OrganizationDTO;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import static cn.hutool.core.date.DatePattern.PURE_DATETIME_PATTERN;
|
||||||
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.VENEER_NOT_EXIST;
|
||||||
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.VENEER_NO_EXIST;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 贴皮管理ServiceImpl 实现类
|
||||||
|
*
|
||||||
|
* @author Gqr
|
||||||
|
* @since 2026/1/4 14:24
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class VeneerServiceImpl implements VeneerService {
|
||||||
|
@Resource
|
||||||
|
private FileApi fileApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OrganApi organApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private VeneerMapper veneerMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long create(VeneerSaveReqVO reqVO) {
|
||||||
|
// 1、校验贴皮编号
|
||||||
|
boolean validateVeneerNoOnly = validateVeneerNoOnly(reqVO.getVeneerNo(), reqVO.getId());
|
||||||
|
if(!validateVeneerNoOnly) {
|
||||||
|
throw new ServiceException(VENEER_NO_EXIST);
|
||||||
|
}
|
||||||
|
|
||||||
|
//2、贴皮数据入库
|
||||||
|
VeneerDO veneerDO = BeanUtil.copyProperties(reqVO, VeneerDO.class);
|
||||||
|
veneerMapper.insert(veneerDO);
|
||||||
|
|
||||||
|
return veneerDO.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int update(VeneerSaveReqVO reqVO) {
|
||||||
|
Long id = reqVO.getId();
|
||||||
|
|
||||||
|
// 1、校验贴皮是否存在
|
||||||
|
if (ObjectUtil.isNull(id) || ObjectUtil.isNull(validateExist(id))) {
|
||||||
|
throw new ServiceException(VENEER_NOT_EXIST);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2、校验贴皮编号
|
||||||
|
boolean validateVeneerNoOnly = validateVeneerNoOnly(reqVO.getVeneerNo(), id);
|
||||||
|
if(!validateVeneerNoOnly) {
|
||||||
|
throw new ServiceException(VENEER_NO_EXIST);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//3、贴皮数据入库
|
||||||
|
VeneerDO veneerDO = BeanUtil.copyProperties(reqVO, VeneerDO.class);
|
||||||
|
return veneerMapper.updateById(veneerDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int delete(Long id) {
|
||||||
|
// 1、校验贴皮是否存在
|
||||||
|
if (ObjectUtil.isNull(validateExist(id))) {
|
||||||
|
throw new ServiceException(VENEER_NOT_EXIST);
|
||||||
|
}
|
||||||
|
|
||||||
|
//2、删除贴皮
|
||||||
|
return veneerMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long uploadPic(MultipartFile file) throws IOException {
|
||||||
|
Long organId = SecurityFrameworkUtils.getUserOrganId();
|
||||||
|
|
||||||
|
// 获取组织名称
|
||||||
|
OrganizationDTO organizationDTO;
|
||||||
|
CommonResult<OrganizationDTO> details = organApi.getOrganDetails(organId);
|
||||||
|
if (details.isError()) {
|
||||||
|
throw new ServiceException(details.getCode(), details.getMsg());
|
||||||
|
} else {
|
||||||
|
organizationDTO = details.getData();
|
||||||
|
}
|
||||||
|
return fileApi.createFileAndReturnId(file.getBytes(), String.format("%s-veneer-pic-file-%s.%s", organizationDTO.getName(), LocalDateTimeUtil.format(LocalDateTime.now(), PURE_DATETIME_PATTERN), getFileExtension(file.getOriginalFilename())));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<VeneerRespVO> getPage(VeneerPageReqVO pageReqVO) {
|
||||||
|
PageResult<VeneerDO> veneerDOPageResult = veneerMapper.selectPage(pageReqVO);
|
||||||
|
|
||||||
|
PageResult<VeneerRespVO> pageResult = new PageResult<>();
|
||||||
|
if (veneerDOPageResult.getTotal() != 0) {
|
||||||
|
pageResult.setList(BeanUtil.copyToList(veneerDOPageResult.getList(), VeneerRespVO.class));
|
||||||
|
pageResult.setTotal(veneerDOPageResult.getTotal());
|
||||||
|
}
|
||||||
|
return pageResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VeneerRespVO get(Long id) {
|
||||||
|
// 1、校验贴皮是否存在
|
||||||
|
VeneerDO veneerDO = validateExist(id);
|
||||||
|
if (ObjectUtil.isNull(veneerDO)) {
|
||||||
|
throw new ServiceException(VENEER_NOT_EXIST);
|
||||||
|
}
|
||||||
|
return BeanUtil.copyProperties(veneerDO, VeneerRespVO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验贴皮是否存在
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return true:存在、false:不存在
|
||||||
|
*/
|
||||||
|
private VeneerDO validateExist(Long id) {
|
||||||
|
return veneerMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验贴皮编号是否组织唯一
|
||||||
|
*
|
||||||
|
* @param veneerNo
|
||||||
|
* @param id
|
||||||
|
* @return true:唯一、false:不唯一
|
||||||
|
*/
|
||||||
|
private boolean validateVeneerNoOnly(String veneerNo, Long id) {
|
||||||
|
return veneerMapper.selectCount(new LambdaQueryWrapperX<VeneerDO>()
|
||||||
|
.eq(VeneerDO::getVeneerNo, veneerNo)
|
||||||
|
.neIfPresent(VeneerDO::getId, id)) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 截取文件类型
|
||||||
|
*
|
||||||
|
* @param fileName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getFileExtension(String fileName) {
|
||||||
|
if (StringUtils.isEmpty(fileName)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
int lastDotIndex = fileName.lastIndexOf('.');
|
||||||
|
if (lastDotIndex < 0 || lastDotIndex == fileName.length() - 1) {
|
||||||
|
// 没有点号,或者点号在最后一位(例如 "file.")
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 截取后缀部分并转小写
|
||||||
|
return "." + fileName.substring(lastDotIndex + 1).toLowerCase(Locale.ROOT);
|
||||||
|
}
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
veneer.save.batchNo.length.max=批次号不能超过32个字符
|
||||||
|
veneer.save.brand.length.max=品牌不能超过64个字符
|
||||||
|
veneer.save.classificationName.not.null=分类名称不能为空
|
||||||
|
veneer.save.color.length.max=颜色不能超过32个字符
|
||||||
|
veneer.save.factory.length.max=厂家不能超过128个字符
|
||||||
|
veneer.save.length.not.null=长度不能为空
|
||||||
|
veneer.save.material.length.max=材料不能超过64个字符
|
||||||
|
veneer.save.num.not.null=数量不能为空
|
||||||
|
veneer.save.productLevel.not.null=产品等级不能为空
|
||||||
|
veneer.save.remark.length.max=备注不能超过255个字符
|
||||||
|
veneer.save.spec.length.max=规格不能超过64个字符
|
||||||
|
veneer.save.thickness.not.null=厚度不能为空
|
||||||
|
veneer.save.veneerNo.length.max=贴皮编号不能超过32个字符
|
||||||
|
veneer.save.veneerNo.not.null=贴皮编号不能为空
|
||||||
|
veneer.save.width.not.null=宽度不能为空
|
||||||
|
veneer.save.veneerName.not.null=贴皮名称不能为空
|
||||||
|
veneer.save.veneerName.length.max=贴皮名称不能超过64个字符
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
veneer.save.batchNo.length.max=批次號不能超過32個字元
|
||||||
|
veneer.save.brand.length.max=品牌不能超過64個字元
|
||||||
|
veneer.save.classificationName.not.null=分類名稱不能為空
|
||||||
|
veneer.save.color.length.max=顏色不能超過32個字元
|
||||||
|
veneer.save.factory.length.max=廠家不能超過128個字元
|
||||||
|
veneer.save.length.not.null=長度不能為空
|
||||||
|
veneer.save.material.length.max=材質不能超過64個字元
|
||||||
|
veneer.save.num.not.null=數量不能為空
|
||||||
|
veneer.save.productLevel.not.null=产品等级不能為空
|
||||||
|
veneer.save.remark.length.max=備註不能超過255個字元
|
||||||
|
veneer.save.spec.length.max=規格不能超過64個字元
|
||||||
|
veneer.save.thickness.not.null=厚度不能為空
|
||||||
|
veneer.save.veneerNo.length.max=貼皮編號不能超過32個字元
|
||||||
|
veneer.save.veneerNo.not.null=貼皮編號不能為空
|
||||||
|
veneer.save.width.not.null=寬度不能為空
|
||||||
|
veneer.save.veneerName.not.null=貼皮名稱不能為空
|
||||||
|
veneer.save.veneerName.length.max=貼皮名稱不能超过64个字符
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
veneer.save.batchNo.length.max=batch no length cannot exceed 32 characters
|
||||||
|
veneer.save.brand.length.max=brand length cannot exceed 64 characters
|
||||||
|
veneer.save.classificationName.not.null=classification name cannot be empty
|
||||||
|
veneer.save.color.length.max=color length cannot exceed 32 characters
|
||||||
|
veneer.save.factory.length.max=factory length cannot exceed 128 characters
|
||||||
|
veneer.save.length.not.null=length cannot be empty
|
||||||
|
veneer.save.material.length.max=material length cannot exceed 64 characters
|
||||||
|
veneer.save.num.not.null=num cannot be empty
|
||||||
|
veneer.save.productLevel.not.null=product level cannot be empty
|
||||||
|
veneer.save.remark.length.max=remark length cannot exceed 255 characters
|
||||||
|
veneer.save.spec.length.max=spec length cannot exceed 64 characters
|
||||||
|
veneer.save.thickness.not.null=thickness cannot be empty
|
||||||
|
veneer.save.veneerNo.length.max=veener no length cannot exceed 32 characters
|
||||||
|
veneer.save.veneerNo.not.null=veener no cannot be empty
|
||||||
|
veneer.save.width.not.null=width cannot be empty
|
||||||
|
veneer.save.veneerName.not.null=veneer name cannot be empty
|
||||||
|
veneer.save.veneerName.length.max=veneer name length cannot exceed 64 characters
|
||||||
+19
-1
@@ -1,2 +1,20 @@
|
|||||||
inEnum.message=必须在指定范围 {0}
|
inEnum.message=必须在指定范围 {0}
|
||||||
inScope.message={0}不合法
|
inScope.message={0}不合法
|
||||||
|
|
||||||
|
veneer.export.head.veneerNo=贴皮编号
|
||||||
|
veneer.export.head.classificationName=分类名称
|
||||||
|
veneer.export.head.veneerName=贴皮名称
|
||||||
|
veneer.export.head.productLevel=产品等级
|
||||||
|
veneer.export.head.batchNo=批次号
|
||||||
|
veneer.export.head.color=颜色
|
||||||
|
veneer.export.head.material=材质
|
||||||
|
veneer.export.head.width=宽
|
||||||
|
veneer.export.head.length=长
|
||||||
|
veneer.export.head.thickness=厚
|
||||||
|
veneer.export.head.brand=品牌
|
||||||
|
veneer.export.head.spec=规格
|
||||||
|
veneer.export.head.factory=厂家
|
||||||
|
veneer.export.head.num=数量
|
||||||
|
veneer.export.head.defect=瑕疵
|
||||||
|
veneer.export.head.remark=备注
|
||||||
|
veneer.export.head.status=状态
|
||||||
+19
-1
@@ -1,2 +1,20 @@
|
|||||||
inEnum.message=必須在指定範圍 {0}
|
inEnum.message=必須在指定範圍 {0}
|
||||||
inScope.message={0}不合法
|
inScope.message={0}不合法
|
||||||
|
|
||||||
|
veneer.export.head.veneerNo=貼皮編號
|
||||||
|
veneer.export.head.classificationName=分類名稱
|
||||||
|
veneer.export.head.veneerName=貼皮名稱
|
||||||
|
veneer.export.head.productLevel=產品等級
|
||||||
|
veneer.export.head.batchNo=批次號
|
||||||
|
veneer.export.head.color=顏色
|
||||||
|
veneer.export.head.material=材質
|
||||||
|
veneer.export.head.width=寬
|
||||||
|
veneer.export.head.length=長
|
||||||
|
veneer.export.head.thickness=厚
|
||||||
|
veneer.export.head.brand=品牌
|
||||||
|
veneer.export.head.spec=規格
|
||||||
|
veneer.export.head.factory=廠家
|
||||||
|
veneer.export.head.num=數量
|
||||||
|
veneer.export.head.defect=瑕疵
|
||||||
|
veneer.export.head.remark=備註
|
||||||
|
veneer.export.head.status=狀態
|
||||||
+19
-1
@@ -1,2 +1,20 @@
|
|||||||
inEnum.message=Must be within the specified range {0}
|
inEnum.message=Must be within the specified range {0}
|
||||||
inScope.message={0} is illegal
|
inScope.message={0} is illegal
|
||||||
|
|
||||||
|
veneer.export.head.veneerNo=veneerNo
|
||||||
|
veneer.export.head.classificationName=classificationName
|
||||||
|
veneer.export.head.veneerName=veneerName
|
||||||
|
veneer.export.head.productLevel=productLevel
|
||||||
|
veneer.export.head.batchNo=batchNo
|
||||||
|
veneer.export.head.color=color
|
||||||
|
veneer.export.head.material=material
|
||||||
|
veneer.export.head.width=width
|
||||||
|
veneer.export.head.length=length
|
||||||
|
veneer.export.head.thickness=thickness
|
||||||
|
veneer.export.head.brand=brand
|
||||||
|
veneer.export.head.spec=spec
|
||||||
|
veneer.export.head.factory=factory
|
||||||
|
veneer.export.head.num=num
|
||||||
|
veneer.export.head.defect=defect
|
||||||
|
veneer.export.head.remark=remark
|
||||||
|
veneer.export.head.status=status
|
||||||
+4
-1
@@ -11,4 +11,7 @@ global.error.no.permission.to.visit.org=您无权访问该组织的数据
|
|||||||
global.error.request.organId.notExist=请求的组织标识未传递,请进行排查
|
global.error.request.organId.notExist=请求的组织标识未传递,请进行排查
|
||||||
global.org.product.not.exist=账号登录异常,套餐信息不存在,请重新登陆
|
global.org.product.not.exist=账号登录异常,套餐信息不存在,请重新登陆
|
||||||
global.org.product.expired=组织产品套餐已过期,请续费后继续使用
|
global.org.product.expired=组织产品套餐已过期,请续费后继续使用
|
||||||
global.not.login=账号未登录
|
global.not.login=账号未登录
|
||||||
|
|
||||||
|
veneer.not.exist=贴皮不存在
|
||||||
|
veneer.no.exist=贴皮编号已存在
|
||||||
+4
-1
@@ -11,4 +11,7 @@ global.error.no.permission.to.visit.org=您無權訪問該組織的數據
|
|||||||
global.error.request.organId.notExist=請求的組織標識未傳遞,請進行排查
|
global.error.request.organId.notExist=請求的組織標識未傳遞,請進行排查
|
||||||
global.org.product.not.exist=帳號登入異常,套餐資訊不存在,請重新登入
|
global.org.product.not.exist=帳號登入異常,套餐資訊不存在,請重新登入
|
||||||
global.org.product.expired=組織產品套餐已過期,請續費後繼續使用
|
global.org.product.expired=組織產品套餐已過期,請續費後繼續使用
|
||||||
global.not.login=賬號未登錄
|
global.not.login=賬號未登錄
|
||||||
|
|
||||||
|
veneer.not.exist=貼皮不存在
|
||||||
|
veneer.no.exist=貼皮編號已存在
|
||||||
+4
-1
@@ -11,4 +11,7 @@ global.error.no.permission.to.visit.org=You do not have permission to access thi
|
|||||||
global.error.request.organId.notExist=The requested organization ID was not provided, please check
|
global.error.request.organId.notExist=The requested organization ID was not provided, please check
|
||||||
global.org.product.not.exist=Account login exception: product package does not exist, please log in again
|
global.org.product.not.exist=Account login exception: product package does not exist, please log in again
|
||||||
global.org.product.expired=The organization's product package has expired, please renew before continuing to use the service
|
global.org.product.expired=The organization's product package has expired, please renew before continuing to use the service
|
||||||
global.not.login=The account is not logged in
|
global.not.login=The account is not logged in
|
||||||
|
|
||||||
|
veneer.not.exist=veneer not exist
|
||||||
|
veneer.no.exist=veneer no already exists
|
||||||
+1
-1
@@ -5,7 +5,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
|||||||
import com.cf.imes.framework.excel.core.annotations.EnumFormat;
|
import com.cf.imes.framework.excel.core.annotations.EnumFormat;
|
||||||
import com.cf.imes.framework.excel.core.convert.EnumBoolValConvert;
|
import com.cf.imes.framework.excel.core.convert.EnumBoolValConvert;
|
||||||
import com.cf.imes.framework.excel.core.convert.EnumConvert;
|
import com.cf.imes.framework.excel.core.convert.EnumConvert;
|
||||||
import com.cf.imes.module.system.enums.common.WhetherEnum;
|
import com.cf.imes.framework.excel.core.enums.WhetherEnum;
|
||||||
import com.cf.imes.module.system.enums.pay.DurationUnitEnum;
|
import com.cf.imes.module.system.enums.pay.DurationUnitEnum;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user