| | |
| | | new LinkedHashSet<>(Arrays.asList("left", "center", "right")) |
| | | ); |
| | | |
| | | private static final Set<String> SUPPORTED_DOCUMENT_LOGO_POSITIONS = Collections.unmodifiableSet( |
| | | new LinkedHashSet<>(Arrays.asList("left", "right")) |
| | | ); |
| | | |
| | | @Override |
| | | public List<OrderPrintTemplate> listCurrentTenantTemplates(String type) { |
| | | String normalizedType = normalizeTemplateType(type); |
| | |
| | | ensureNumber(page, "marginBottom", "下边距"); |
| | | ensureNumber(page, "marginLeft", "左边距"); |
| | | |
| | | if (root.getBooleanValue("showLogo")) { |
| | | String logoSrc = normalizeText(root.getString("logoSrc")); |
| | | if (logoSrc.isEmpty()) { |
| | | throw new CoolException("启用Logo时必须上传Logo图片"); |
| | | } |
| | | String logoPosition = normalizeText(root.getString("logoPosition")); |
| | | if (!logoPosition.isEmpty() && !SUPPORTED_DOCUMENT_LOGO_POSITIONS.contains(logoPosition)) { |
| | | throw new CoolException("Logo位置仅支持 left 或 right"); |
| | | } |
| | | getPositiveNumber(root, "logoWidth", "Logo宽度"); |
| | | } |
| | | |
| | | validateDocumentFields(root.getJSONArray("headerFields"), "页头字段", false); |
| | | validateDocumentFields(root.getJSONArray("tableColumns"), "明细列", true); |
| | | validateDocumentFields(root.getJSONArray("footerFields"), "页尾字段", false); |