Standardize code formatting and improve validation checks.

- Applied consistent spacing in `PreCalculationCheckService` for better readability.
- Enhanced `materialCheck` logic to handle `tariffUnlocked` scenarios and provide detailed error messages.
- Adjusted frontend tooltip logic in `BulkOperation.vue` to handle cases where `operation.error` is null.
This commit is contained in:
Jan 2025-12-07 17:31:56 +01:00
parent 2fcba02227
commit 767964b20f
2 changed files with 14 additions and 14 deletions

View file

@ -11,9 +11,10 @@
</div>
<div class="bulk-operation-status">
<div v-if="operation.state === 'EXCEPTION'">
<tooltip min-width="500px" :text="shortend(operation.error.message)" position="left">
<tooltip v-if="operation.error" min-width="500px" :text="shortend(operation.error?.message)" position="left">
<basic-badge variant="exception">ERROR</basic-badge>
</tooltip>
<basic-badge v-else variant="exception">ERROR</basic-badge>
</div>
<basic-badge v-else-if="operation.state === 'COMPLETED'">COMPLETED</basic-badge>
<basic-badge v-else-if="operation.state === 'SCHEDULED'" variant="skeleton">SCHEDULED</basic-badge>

View file

@ -136,7 +136,6 @@ public class PreCalculationCheckService {
private void periodCheck(ValidityPeriod period, PropertySet set) {
if (set == null)
throw new PremiseValidationError("There are no system properties for the given date. Please contact your administrator.");
@ -325,14 +324,14 @@ public class PreCalculationCheckService {
private void materialCheck(Premise premise) {
if (premise.getTariffUnlocked()) {
if (premise.getHsCode() == null || premise.getHsCode().length() < 10)
throw new PremiseValidationError("Invalid HS code.");
throw new PremiseValidationError("Invalid HS code (10 digits expected).");
var isDeclarable = eUTaxationResolverService.validate(premise.getHsCode());
if (!isDeclarable)
throw new PremiseValidationError("Invalid HS code.");
if (!isDeclarable) throw new PremiseValidationError("Invalid HS code (not declarable).");
}
if (premise.getTariffRate() == null) {
throw new PremiseValidationError("Tariff rate not entered.");