| | |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | { |
| | | private static final String NORMAL = "0"; |
| | | private static final String DISABLED = "1"; |
| | | private static final String TEXT = "text"; |
| | | private static final Set<String> SUPPORTED_FIELD_TYPES = Set.of("text", "number", "time", "remark"); |
| | | |
| | | @Autowired |
| | | private TBatteryGroupFieldMapper batteryGroupFieldMapper; |
| | |
| | | { |
| | | throw new ServiceException("字段类型不能为空"); |
| | | } |
| | | if (!TEXT.equals(field.getFieldType())) |
| | | if (!SUPPORTED_FIELD_TYPES.contains(field.getFieldType())) |
| | | { |
| | | throw new ServiceException("字段类型仅支持text(文字)"); |
| | | throw new ServiceException("字段类型仅支持text、number、time或remark"); |
| | | } |
| | | if (field.getRemark() != null && field.getRemark().length() > 500) |
| | | { |