Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.iflytek.astron.console.hub.enums;

/**
* Personality configuration scene type enumeration
*/
public enum PersonalitySceneTypeEnum {
SPACE(1, "Companionship Scene"),
ENTERPRISE(2, "Training Scene");

private final Integer code;
private final String desc;

PersonalitySceneTypeEnum(Integer code, String desc) {
this.code = code;
this.desc = desc;
}

public static PersonalitySceneTypeEnum getByCode(Integer code) {
for (PersonalitySceneTypeEnum value : values()) {
if (value.code.equals(code)) {
return value;
}
}
return null;
}

public Integer getCode() {
return code;
}

public String getDesc() {
return desc;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.iflytek.astron.console.hub.enums.ConfigTypeEnum;
import com.iflytek.astron.console.commons.exception.BusinessException;
import com.iflytek.astron.console.hub.entity.personality.PersonalityRole;
import com.iflytek.astron.console.hub.enums.PersonalitySceneTypeEnum;
import com.iflytek.astron.console.hub.mapper.personality.PersonalityCategoryMapper;
import com.iflytek.astron.console.hub.mapper.personality.PersonalityConfigMapper;
import com.iflytek.astron.console.commons.util.I18nUtil;
Expand Down Expand Up @@ -122,7 +123,7 @@ public boolean checkPersonalityConfig(PersonalityConfigDto personalityConfigDto)
}

if (personalityConfigDto.getSceneType() != null) {
return ConfigTypeEnum.fromValue(personalityConfigDto.getSceneType()) == null
return PersonalitySceneTypeEnum.getByCode(personalityConfigDto.getSceneType()) == null
|| StringUtils.isBlank(personalityConfigDto.getSceneInfo()) || personalityConfigDto.getSceneInfo().length() > 1000;
} else {
// scene type is null, scene info must be null
Expand Down
Loading