2
2
3
3
import lombok .RequiredArgsConstructor ;
4
4
import lombok .extern .slf4j .Slf4j ;
5
- import ma .glasnost .orika .MapperFacade ;
6
5
import no .nav .dolly .bestilling .ClientFuture ;
7
6
import no .nav .dolly .bestilling .ClientRegister ;
8
7
import no .nav .dolly .bestilling .personservice .PersonServiceConsumer ;
15
14
import no .nav .dolly .domain .resultset .dolly .DollyPerson ;
16
15
import no .nav .dolly .errorhandling .ErrorStatusDecoder ;
17
16
import no .nav .dolly .util .TransactionHelperService ;
18
- import no .nav .testnav .libs .data .tpsmessagingservice .v1 .SpraakDTO ;
19
17
import no .nav .testnav .libs .data .tpsmessagingservice .v1 .TpsMeldingResponseDTO ;
20
18
import no .nav .testnav .libs .reactivecore .utils .WebClientFilter ;
21
19
import org .apache .commons .lang3 .StringUtils ;
24
22
import reactor .core .publisher .Mono ;
25
23
26
24
import java .time .Duration ;
25
+ import java .time .LocalDate ;
26
+ import java .time .LocalDateTime ;
27
27
import java .util .Collection ;
28
28
import java .util .List ;
29
29
import java .util .Map ;
37
37
import static no .nav .dolly .bestilling .kontoregisterservice .util .BankkontoGenerator .tilfeldigUtlandskBankkonto ;
38
38
import static no .nav .dolly .errorhandling .ErrorStatusDecoder .getInfoVenter ;
39
39
import static org .apache .commons .lang3 .BooleanUtils .isTrue ;
40
- import static org .apache .commons .lang3 .StringUtils .isNotBlank ;
41
40
42
41
@ Slf4j
43
42
@ Service
@@ -49,7 +48,6 @@ public class TpsMessagingClient implements ClientRegister {
49
48
private static final String TPS_MESSAGING = "TPS" ;
50
49
51
50
private final TpsMessagingConsumer tpsMessagingConsumer ;
52
- private final MapperFacade mapperFacade ;
53
51
private final PersonServiceConsumer personServiceConsumer ;
54
52
private final TransactionHelperService transactionHelperService ;
55
53
private final MiljoerConsumer miljoerConsumer ;
@@ -91,8 +89,6 @@ public Flux<ClientFuture> gjenopprett(RsDollyUtvidetBestilling bestilling, Dolly
91
89
.flatMap (this ::getPersonData )
92
90
.collectList ()
93
91
.flatMapMany (personer -> Flux .concat (
94
- sendSpraakkode (bestilling , dollyPerson .getIdent ())
95
- .map (respons -> Map .of ("SpråkKode" , respons )),
96
92
sendBankkontonummerNorge (bestilling , dollyPerson .getIdent ())
97
93
.map (respons -> Map .of ("NorskBankkonto" , respons )),
98
94
sendBankkontonummerUtenland (bestilling , dollyPerson .getIdent ())
@@ -126,10 +122,7 @@ private Flux<String> getError(Throwable error, List<String> miljoer) {
126
122
127
123
private boolean isTpsMessage (RsDollyUtvidetBestilling bestilling ) {
128
124
129
- return (nonNull (bestilling .getTpsMessaging ()) &&
130
- isNotBlank (bestilling .getTpsMessaging ().getSpraakKode ())) ||
131
-
132
- nonNull (bestilling .getBankkonto ()) ||
125
+ return nonNull (bestilling .getBankkonto ()) ||
133
126
nonNull (bestilling .getSkjerming ()) ||
134
127
135
128
(nonNull (bestilling .getPdldata ()) &&
@@ -183,17 +176,6 @@ private Flux<PdlPersonBolk.PersonBolk> getPersonData(List<String> identer) {
183
176
.filter (personBolk -> nonNull (personBolk .getPerson ()));
184
177
}
185
178
186
- private Mono <List <TpsMeldingResponseDTO >> sendSpraakkode (RsDollyUtvidetBestilling bestilling , String ident ) {
187
-
188
- return nonNull (bestilling .getTpsMessaging ()) && nonNull (bestilling .getTpsMessaging ().getSpraakKode ()) ?
189
-
190
- tpsMessagingConsumer .sendSpraakkodeRequest (ident , null ,
191
- mapperFacade .map (bestilling .getTpsMessaging ().getSpraakKode (), SpraakDTO .class ))
192
- .collectList () :
193
-
194
- Mono .just (emptyList ());
195
- }
196
-
197
179
private Mono <List <TpsMeldingResponseDTO >> sendEgenansattSlett (RsDollyUtvidetBestilling bestilling ,
198
180
String ident ) {
199
181
@@ -211,7 +193,7 @@ private Mono<List<TpsMeldingResponseDTO>> sendEgenansatt(RsDollyUtvidetBestillin
211
193
return nonNull (SkjermingUtil .getEgenansattDatoFom (bestilling )) ?
212
194
213
195
tpsMessagingConsumer .sendEgenansattRequest (ident , null ,
214
- SkjermingUtil .getEgenansattDatoFom (bestilling ). toLocalDate ( ))
196
+ toLocalDate ( SkjermingUtil .getEgenansattDatoFom (bestilling )))
215
197
.collectList () :
216
198
217
199
Mono .just (emptyList ());
@@ -257,4 +239,9 @@ private Mono<List<TpsMeldingResponseDTO>> sendBankkontonummerUtenland(RsDollyUtv
257
239
return Mono .just (emptyList ());
258
240
}
259
241
}
242
+
243
+ private LocalDate toLocalDate (LocalDateTime datoOgTid ) {
244
+
245
+ return nonNull (datoOgTid ) ? datoOgTid .toLocalDate () : null ;
246
+ }
260
247
}
0 commit comments