Skip to content

Commit

Permalink
[SELC-5176] feat: Updated mapper to set city, county and zipCode (#214)
Browse files Browse the repository at this point in the history
Co-authored-by: [email protected] <Aiap1955?^@#>
  • Loading branch information
pierpaolodidato89 and [email protected] authored Jul 15, 2024
1 parent 523c0ce commit 3e773a7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import javax.xml.bind.annotation.XmlTransient;

@Data
public class PDNDImpresa {

@JsonProperty("ProgressivoImpresa")
private long progressivoImpresa;

Expand Down Expand Up @@ -38,7 +37,6 @@ public class PDNDImpresa {
private String digitalAddress;


@XmlTransient
public String getAddress() {
return businessAddress.getToponimoSede() + " " + businessAddress.getViaSede() + " " + businessAddress.getNcivicoSede();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
@Mapper(componentModel = "spring")
public interface PDNDBusinessMapper {

@Mapping(source = "getAddress", target = "address")
@Mapping(source = "city", target = "businessAddress.city")
@Mapping(source = "county", target = "businessAddress.county")
@Mapping(source = "zipCode", target = "businessAddress.zipCode")
List<PDNDBusiness> toPDNDBusinesses(List<PDNDImpresa> pdndImpresaList);

@Mapping(target = "city", source = "businessAddress.city")
@Mapping(target = "county", source = "businessAddress.county")
@Mapping(target = "zipCode", source = "businessAddress.zipCode")
PDNDBusiness toPDNDBusiness(PDNDImpresa pdndImpresa);

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public PDNDInfoCamereController(PDNDInfoCamereService pdndInfoCamereService, PDN
notes = "${swagger.api.infocamere-pdnd.institutions.notes}")
@GetMapping("/institutions")
public ResponseEntity<List<PDNDBusinessResource>> institutionsPdndByDescription(@ApiParam("${swagger.model.institution.description}")
@RequestParam String description) {
@RequestParam String description) {
List<PDNDBusiness> businessList = pdndInfoCamereService.retrieveInstitutionsPdndByDescription(description);
return ResponseEntity.ok().body(pdndBusinessMapper.toResources(businessList));
}
Expand All @@ -44,7 +44,7 @@ public ResponseEntity<List<PDNDBusinessResource>> institutionsPdndByDescription(
notes = "${swagger.api.infocamere-pdnd.institution.notes}")
@GetMapping("/institution/{taxCode}")
public ResponseEntity<PDNDBusinessResource> institutionPdndByTaxCode(@ApiParam("${swagger.model.institution.taxCode}")
@PathVariable String taxCode) {
@PathVariable String taxCode) {
PDNDBusiness business = pdndInfoCamereService.retrieveInstitutionPdndByTaxCode(taxCode);
return ResponseEntity.ok().body(pdndBusinessMapper.toResource(business));
}
Expand Down

0 comments on commit 3e773a7

Please sign in to comment.