1
1
package no .nav .dolly .bestilling .pensjonforvalter ;
2
2
3
3
import com .fasterxml .jackson .databind .ObjectMapper ;
4
+ import com .sun .jna .Function ;
4
5
import lombok .extern .slf4j .Slf4j ;
5
6
import no .nav .dolly .bestilling .ConsumerStatus ;
6
7
import no .nav .dolly .bestilling .pensjonforvalter .command .AnnullerSamboerCommand ;
19
20
import no .nav .dolly .bestilling .pensjonforvalter .command .PensjonHentVedtakCommand ;
20
21
import no .nav .dolly .bestilling .pensjonforvalter .command .SletteAfpOffentligCommand ;
21
22
import no .nav .dolly .bestilling .pensjonforvalter .command .SlettePensjonsavtaleCommand ;
23
+ import no .nav .dolly .bestilling .pensjonforvalter .command .SlettePoppInntektCommand ;
22
24
import no .nav .dolly .bestilling .pensjonforvalter .command .SletteTpForholdCommand ;
23
25
import no .nav .dolly .bestilling .pensjonforvalter .domain .AfpOffentligRequest ;
24
26
import no .nav .dolly .bestilling .pensjonforvalter .domain .AlderspensjonRequest ;
@@ -69,30 +71,30 @@ public PensjonforvalterConsumer(
69
71
.build ();
70
72
}
71
73
72
- @ Timed (name = "providers" , tags = { "operation" , "pen_getMiljoer" })
74
+ @ Timed (name = "providers" , tags = {"operation" , "pen_getMiljoer" })
73
75
public Mono <Set <String >> getMiljoer () {
74
76
75
77
return tokenService .exchange (serverProperties )
76
78
.flatMap (token -> new HentMiljoerCommand (webClient , token .getTokenValue ()).call ());
77
79
}
78
80
79
- @ Timed (name = "providers" , tags = { "operation" , "popp_lagreInntekt" })
81
+ @ Timed (name = "providers" , tags = {"operation" , "popp_lagreInntekt" })
80
82
public Flux <PensjonforvalterResponse > lagreInntekter (PensjonPoppInntektRequest pensjonPoppInntektRequest ) {
81
83
82
84
return tokenService .exchange (serverProperties )
83
85
.flatMapMany (token -> new LagrePoppInntektCommand (webClient , token .getTokenValue (),
84
86
pensjonPoppInntektRequest ).call ());
85
87
}
86
88
87
- @ Timed (name = "providers" , tags = { "operation" , "popp_lagreGenerertInntekt" })
89
+ @ Timed (name = "providers" , tags = {"operation" , "popp_lagreGenerertInntekt" })
88
90
public Flux <PensjonforvalterResponse > lagreGenererteInntekter (PensjonPoppGenerertInntektRequest pensjonPoppGenerertInntektRequest ) {
89
91
90
92
return tokenService .exchange (serverProperties )
91
93
.flatMapMany (token -> new LagreGenerertPoppInntektCommand (webClient , token .getTokenValue (),
92
94
pensjonPoppGenerertInntektRequest ).call ());
93
95
}
94
96
95
- @ Timed (name = "providers" , tags = { "operation" , "pen_opprettPerson" })
97
+ @ Timed (name = "providers" , tags = {"operation" , "pen_opprettPerson" })
96
98
public Flux <PensjonforvalterResponse > opprettPerson (PensjonPersonRequest pensjonPersonRequest ,
97
99
Set <String > miljoer ) {
98
100
@@ -102,15 +104,15 @@ public Flux<PensjonforvalterResponse> opprettPerson(PensjonPersonRequest pensjon
102
104
.doOnNext (response -> log .info ("Opprettet person for {}: {}" , pensjonPersonRequest .getFnr (), response ));
103
105
}
104
106
105
- @ Timed (name = "providers" , tags = { "operation" , "pen_hentSamboer" })
107
+ @ Timed (name = "providers" , tags = {"operation" , "pen_hentSamboer" })
106
108
public Flux <PensjonSamboerResponse > hentSamboer (String ident , String miljoe ) {
107
109
108
110
return tokenService .exchange (serverProperties )
109
111
.flatMapMany (token -> new HentSamboerCommand (webClient , ident , miljoe , token .getTokenValue ()).call ())
110
112
.doOnNext (response -> log .info ("Pensjon samboer for {} i {} hentet {}" , ident , miljoe , response ));
111
113
}
112
114
113
- @ Timed (name = "providers" , tags = { "operation" , "pen_opprettSamboer" })
115
+ @ Timed (name = "providers" , tags = {"operation" , "pen_opprettSamboer" })
114
116
public Flux <PensjonforvalterResponse > lagreSamboer (PensjonSamboerRequest pensjonSamboerRequest ,
115
117
String miljoe ) {
116
118
log .info ("Oppretter samboerskap i pensjon: {}" , pensjonSamboerRequest );
@@ -119,36 +121,36 @@ public Flux<PensjonforvalterResponse> lagreSamboer(PensjonSamboerRequest pensjon
119
121
.flatMapMany (token -> new LagreSamboerCommand (webClient , pensjonSamboerRequest , miljoe , token .getTokenValue ()).call ());
120
122
}
121
123
122
- @ Timed (name = "providers" , tags = { "operation" , "pen_opprettSamboer" })
124
+ @ Timed (name = "providers" , tags = {"operation" , "pen_opprettSamboer" })
123
125
public Flux <PensjonforvalterResponse > annullerSamboer (String periodeId , String miljoe ) {
124
126
125
127
return tokenService .exchange (serverProperties )
126
128
.flatMapMany (token -> new AnnullerSamboerCommand (webClient , periodeId , miljoe , token .getTokenValue ()).call ());
127
129
}
128
130
129
- @ Timed (name = "providers" , tags = { "operation" , "pen_lagreAlderspensjon" })
131
+ @ Timed (name = "providers" , tags = {"operation" , "pen_lagreAlderspensjon" })
130
132
public Flux <PensjonforvalterResponse > lagreAlderspensjon (AlderspensjonRequest request ) {
131
133
132
134
return tokenService .exchange (serverProperties )
133
135
.flatMapMany (token ->
134
136
new LagreAlderspensjonCommand (webClient , token .getTokenValue (), request ).call ());
135
137
}
136
138
137
- @ Timed (name = "providers" , tags = { "operation" , "pen_lagreUforetrygd" })
139
+ @ Timed (name = "providers" , tags = {"operation" , "pen_lagreUforetrygd" })
138
140
public Flux <PensjonforvalterResponse > lagreUforetrygd (PensjonUforetrygdRequest request ) {
139
141
140
142
return tokenService .exchange (serverProperties )
141
143
.flatMapMany (token -> new LagreUforetrygdCommand (webClient , token .getTokenValue (), request ).call ());
142
144
}
143
145
144
- @ Timed (name = "providers" , tags = { "operation" , "pen_lagreTpForhold" })
146
+ @ Timed (name = "providers" , tags = {"operation" , "pen_lagreTpForhold" })
145
147
public Flux <PensjonforvalterResponse > lagreTpForhold (PensjonTpForholdRequest pensjonTpForholdRequest ) {
146
148
147
149
return tokenService .exchange (serverProperties )
148
150
.flatMapMany (token -> new LagreTpForholdCommand (webClient , token .getTokenValue (), pensjonTpForholdRequest ).call ());
149
151
}
150
152
151
- @ Timed (name = "providers" , tags = { "operation" , "pen_sletteTpForhold" })
153
+ @ Timed (name = "providers" , tags = {"operation" , "pen_sletteTpForhold" })
152
154
public void sletteTpForhold (List <String > identer ) {
153
155
154
156
tokenService .exchange (serverProperties )
@@ -160,21 +162,21 @@ public void sletteTpForhold(List<String> identer) {
160
162
.subscribe (response -> log .info ("Slettet mot PESYS (tp) i alle miljoer" ));
161
163
}
162
164
163
- @ Timed (name = "providers" , tags = { "operation" , "pen_lagreTpYtelse" })
165
+ @ Timed (name = "providers" , tags = {"operation" , "pen_lagreTpYtelse" })
164
166
public Flux <PensjonforvalterResponse > lagreTpYtelse (PensjonTpYtelseRequest pensjonTpYtelseRequest ) {
165
167
166
168
return tokenService .exchange (serverProperties )
167
169
.flatMapMany (token -> new LagreTpYtelseCommand (webClient , token .getTokenValue (), pensjonTpYtelseRequest ).call ());
168
170
}
169
171
170
- @ Timed (name = "providers" , tags = { "operation" , "pen_lagrePensjpnsavtale" })
172
+ @ Timed (name = "providers" , tags = {"operation" , "pen_lagrePensjpnsavtale" })
171
173
public Flux <PensjonforvalterResponse > lagrePensjonsavtale (PensjonsavtaleRequest pensjonsavtaleRequest ) {
172
174
173
175
return tokenService .exchange (serverProperties )
174
176
.flatMapMany (token -> new LagrePensjonsavtaleCommand (webClient , pensjonsavtaleRequest , token .getTokenValue ()).call ());
175
177
}
176
178
177
- @ Timed (name = "providers" , tags = { "operation" , "pen_slettePensjpnsavtale" })
179
+ @ Timed (name = "providers" , tags = {"operation" , "pen_slettePensjpnsavtale" })
178
180
public void slettePensjonsavtale (List <String > identer ) {
179
181
180
182
tokenService .exchange (serverProperties )
@@ -184,7 +186,18 @@ public void slettePensjonsavtale(List<String> identer) {
184
186
.subscribe (resultat -> log .info ("Slettet pensjonsavtaler (PEN), alle miljøer" ));
185
187
}
186
188
187
- @ Timed (name = "providers" , tags = { "operation" , "pen_hentVedtak" })
189
+ @ Timed (name = "providers" , tags = {"operation" , "pen_slettePoppinntekt" })
190
+ public void slettePoppinntekt (List <String > identer ) {
191
+
192
+ tokenService .exchange (serverProperties )
193
+ .flatMap (token -> Flux .from (new HentMiljoerCommand (webClient , token .getTokenValue ()).call ())
194
+ .flatMap (miljoer -> Flux .fromIterable (identer )
195
+ .flatMap (ident -> new SlettePoppInntektCommand (webClient , ident , miljoer , token .getTokenValue ()).call ()))
196
+ .collectList ())
197
+ .subscribe (resultat -> log .info ("Slettet POPP-inntekt, alle miljøer" ));
198
+ }
199
+
200
+ @ Timed (name = "providers" , tags = {"operation" , "pen_hentVedtak" })
188
201
public Flux <PensjonVedtakResponse > hentVedtak (String ident , String miljoe ) {
189
202
190
203
return tokenService .exchange (serverProperties )
@@ -193,14 +206,14 @@ public Flux<PensjonVedtakResponse> hentVedtak(String ident, String miljoe) {
193
206
ident , miljoe , response ));
194
207
}
195
208
196
- @ Timed (name = "providers" , tags = { "operation" , "pen_lagreAfpOffentlig" })
209
+ @ Timed (name = "providers" , tags = {"operation" , "pen_lagreAfpOffentlig" })
197
210
public Flux <PensjonforvalterResponse > lagreAfpOffentlig (AfpOffentligRequest afpOffentligRequest , String ident , String miljoe ) {
198
211
199
212
return tokenService .exchange (serverProperties )
200
213
.flatMapMany (token -> new LagreAfpOffentligCommand (webClient , afpOffentligRequest , ident , miljoe , token .getTokenValue ()).call ());
201
214
}
202
215
203
- @ Timed (name = "providers" , tags = { "operation" , "pen_sletteAfpOffentlig" })
216
+ @ Timed (name = "providers" , tags = {"operation" , "pen_sletteAfpOffentlig" })
204
217
public void sletteAfpOffentlig (List <String > identer ) {
205
218
206
219
tokenService .exchange (serverProperties )
0 commit comments