diff --git a/build-docker.sh b/build-docker.sh index 9b1d64a..53217c8 100755 --- a/build-docker.sh +++ b/build-docker.sh @@ -21,8 +21,9 @@ elif [[ "$NATIVE_ARCH" == "arm64" ]] || [[ "$NATIVE_ARCH" == "aarch64" ]]; then NATIVE_ARCH="arm64" fi -# 处理命令行参数 -if [[ "$1" == "-h" || "$1" == "--help" ]]; then +# 处理命令行参数(兼容未提供参数时的 set -u) +ARG1="${1-}" +if [[ "$ARG1" == "-h" || "$ARG1" == "--help" ]]; then echo -e "${GREEN}PeiPei 后端 Docker 镜像构建脚本${NC}" echo "" echo -e "${YELLOW}用法:${NC}" @@ -51,7 +52,7 @@ if [[ "$1" == "-h" || "$1" == "--help" ]]; then exit 0 fi -TARGET_ARCH="${1:-$NATIVE_ARCH}" +TARGET_ARCH="${ARG1:-$NATIVE_ARCH}" # 验证架构参数 if [[ "$TARGET_ARCH" != "amd64" && "$TARGET_ARCH" != "arm64" ]]; then diff --git a/play-admin/pom.xml b/play-admin/pom.xml index 28e84ed..f538f2e 100644 --- a/play-admin/pom.xml +++ b/play-admin/pom.xml @@ -93,6 +93,19 @@ jave-core + + + ws.schild + jave-nativebin-linux64 + runtime + + + ws.schild + jave-nativebin-osxm1 + runtime + + com.github.binarywang weixin-java-pay @@ -191,4 +204,4 @@ - \ No newline at end of file + diff --git a/play-admin/src/main/java/com/starry/admin/modules/clerk/module/enums/ClerkDataType.java b/play-admin/src/main/java/com/starry/admin/modules/clerk/module/enums/ClerkDataType.java new file mode 100644 index 0000000..064bb45 --- /dev/null +++ b/play-admin/src/main/java/com/starry/admin/modules/clerk/module/enums/ClerkDataType.java @@ -0,0 +1,65 @@ +package com.starry.admin.modules.clerk.module.enums; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; + +/** + * 店员资料类型枚举 + * + * @author admin + * @since 2024-05-19 + */ +@ApiModel(value = "店员资料类型", description = "店员资料审核的数据类型枚举") +public enum ClerkDataType { + + NICKNAME("0", "昵称"), + AVATAR("1", "头像"), + PHOTO_ALBUM("2", "相册"), + RECORDING("3", "录音"); + + private final String code; + private final String description; + + ClerkDataType(String code, String description) { + this.code = code; + this.description = description; + } + + @JsonValue + public String getCode() { + return code; + } + + public String getDescription() { + return description; + } + + /** + * 根据代码获取枚举 + * @param code 代码 + * @return 枚举值 + */ + @JsonCreator + public static ClerkDataType fromCode(String code) { + if (code == null) { + return null; + } + for (ClerkDataType type : ClerkDataType.values()) { + if (type.code.equals(code)) { + return type; + } + } + throw new IllegalArgumentException("Unknown code: " + code); + } + + /** + * 根据代码获取描述 + * @param code 代码 + * @return 描述 + */ + public static String getDescriptionByCode(String code) { + ClerkDataType type = fromCode(code); + return type != null ? type.description : null; + } +} diff --git a/play-admin/src/main/java/com/starry/admin/modules/clerk/module/vo/PlayClerkDataReviewReturnVo.java b/play-admin/src/main/java/com/starry/admin/modules/clerk/module/vo/PlayClerkDataReviewReturnVo.java index 289edc8..57c1a1f 100644 --- a/play-admin/src/main/java/com/starry/admin/modules/clerk/module/vo/PlayClerkDataReviewReturnVo.java +++ b/play-admin/src/main/java/com/starry/admin/modules/clerk/module/vo/PlayClerkDataReviewReturnVo.java @@ -1,5 +1,7 @@ package com.starry.admin.modules.clerk.module.vo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.starry.admin.modules.clerk.module.enums.ClerkDataType; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.time.LocalDateTime; @@ -46,6 +48,12 @@ public class PlayClerkDataReviewReturnVo { @ApiModelProperty(value = "资料类型", example = "1", notes = "0:昵称;1:头像;2:相册;3:录音") private String dataType; + /** + * 资料类型枚举(新增字段,用于类型安全) + */ + @ApiModelProperty(value = "资料类型枚举", example = "AVATAR", notes = "NICKNAME:昵称, AVATAR:头像, PHOTO_ALBUM:相册, RECORDING:录音") + private ClerkDataType dataTypeEnum; + /** * 资料内容 */ @@ -88,4 +96,31 @@ public class PlayClerkDataReviewReturnVo { @ApiModelProperty(value = "备注", example = "资料清晰可见") private String remark; + // 自定义setter方法保持两个字段的同步 + public void setDataType(String dataType) { + this.dataType = dataType; + try { + this.dataTypeEnum = ClerkDataType.fromCode(dataType); + } catch (Exception e) { + this.dataTypeEnum = null; + } + } + + public void setDataTypeEnum(ClerkDataType dataTypeEnum) { + this.dataTypeEnum = dataTypeEnum; + this.dataType = dataTypeEnum != null ? dataTypeEnum.getCode() : null; + } + + public ClerkDataType getDataTypeEnum() { + // 如果枚举字段为null但字符串字段有值,尝试从字符串转换 + if (dataTypeEnum == null && dataType != null) { + try { + dataTypeEnum = ClerkDataType.fromCode(dataType); + } catch (Exception e) { + // 转换失败时保持null + } + } + return dataTypeEnum; + } + }