Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Interfaçage - OILHI] Envoi de dossier relevant du RSD #2112

Merged
merged 6 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ WIDGET_SIGNALEMENT_TERRITOIRE_CACHE_EXPIRED_AFTER=30 #second
WIDGET_ESABORA_EVENTS_CACHE_EXPIRED_AFTER=3600 #second
FEATURE_ASK_VISITE_ENABLE=0
FEATURE_NEW_FORM_ENABLE=0
FEATURE_OILHI_ENABLE=1
CRON_ENABLE=1
MAIL_ENABLE=1
ESABORA_CRON_CLOCK_SLEEP_INTERVAL=60 #second
Expand Down
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ HISTOLOGE_URL=http://localhost:8080
WIREMOCK_HOSTNAME=histologe_wiremock
WIREMOCK_PORT=8080
FEATURE_NEW_FORM_ENABLE=1
FEATURE_OILHI_ENABLE=1
CRON_ENABLE=1
MAIL_ENABLE=1
ESABORA_CRON_CLOCK_SLEEP_INTERVAL=60 #second
Expand Down
1 change: 1 addition & 0 deletions config/packages/messenger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ framework:
# Symfony\Component\Mailer\Messenger\SendEmailMessage: sync
App\Messenger\Message\Esabora\DossierMessageSCHS: async
App\Messenger\Message\Esabora\DossierMessageSISH: async
App\Messenger\Message\Oilhi\DossierMessage: async
App\Messenger\Message\PdfExportMessage: async


Expand Down
1 change: 1 addition & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ parameters:
mail_enable: '%env(bool:MAIL_ENABLE)%'
feature_ask_visite: '%env(FEATURE_ASK_VISITE_ENABLE)%'
feature_new_form: '%env(bool:FEATURE_NEW_FORM_ENABLE)%'
feature_oilhi_enable: '%env(bool:FEATURE_OILHI_ENABLE)%'
platform_name: 'Histologe'
matomo_enable: '%env(bool:MATOMO_ENABLE)%'
matomo_site_id: '%env(resolve:MATOMO_SITE_ID)%'
Expand Down
4 changes: 2 additions & 2 deletions src/Command/PushEsaboraDossierCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace App\Command;

use App\Entity\Enum\PartnerType;
use App\Messenger\EsaboraBus;
use App\Messenger\InterconnectionBus;
use App\Repository\AffectationRepository;
use App\Repository\TerritoryRepository;
use Symfony\Component\Console\Attribute\AsCommand;
Expand All @@ -26,7 +26,7 @@ class PushEsaboraDossierCommand extends Command
public function __construct(
private AffectationRepository $affectationRepository,
private TerritoryRepository $territoryRepository,
private EsaboraBus $esaboraBus,
private InterconnectionBus $esaboraBus,
#[Autowire(param: 'kernel.environment')]
private string $env
) {
Expand Down
6 changes: 3 additions & 3 deletions src/Command/PushFailedEsaboraDossierCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use App\Entity\Affectation;
use App\Entity\Enum\PartnerType;
use App\Entity\JobEvent;
use App\Factory\Esabora\DossierMessageSISHFactory;
use App\Messenger\EsaboraBus;
use App\Factory\Interconnection\Esabora\DossierMessageSISHFactory;
use App\Messenger\InterconnectionBus;
use App\Repository\AffectationRepository;
use App\Repository\JobEventRepository;
use App\Repository\SignalementRepository;
Expand Down Expand Up @@ -35,7 +35,7 @@ public function __construct(
private readonly SignalementRepository $signalementRepository,
private readonly EsaboraSISHService $esaboraSISHService,
private readonly DossierAdresseServiceHandler $dossierAdresseServiceHandler,
private readonly EsaboraBus $esaboraBus,
private readonly InterconnectionBus $esaboraBus,
) {
parent::__construct();
}
Expand Down
14 changes: 8 additions & 6 deletions src/Controller/Back/AffectationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
use App\Entity\Suivi;
use App\Entity\User;
use App\Event\AffectationAnsweredEvent;
use App\Factory\Interconnection\Oilhi\DossierMessageFactory;
use App\Manager\AffectationManager;
use App\Manager\SignalementManager;
use App\Manager\SuiviManager;
use App\Manager\UserManager;
use App\Messenger\EsaboraBus;
use App\Messenger\InterconnectionBus;
use App\Repository\AffectationRepository;
use App\Repository\PartnerRepository;
use App\Repository\SuiviRepository;
Expand All @@ -31,8 +32,9 @@ public function __construct(
private SignalementManager $signalementManager,
private AffectationManager $affectationManager,
private PartnerRepository $partnerRepository,
private EsaboraBus $esaboraBus,
private InterconnectionBus $interconnectionBus,
private EventDispatcherInterface $eventDispatcher,
private DossierMessageFactory $dossierMessageFactory
) {
}

Expand Down Expand Up @@ -61,7 +63,7 @@ public function toggleAffectationSignalement(
);
if ($affectation instanceof Affectation) {
$this->affectationManager->persist($affectation);
$this->dispatchDossierEsabora($affectation);
$this->dispatchDossier($affectation);
}
}
$this->affectationManager->removeAffectationsFrom($signalement, $postedPartner, $partnersIdToRemove);
Expand Down Expand Up @@ -170,13 +172,13 @@ private function dispatchAffectationAnsweredEvent(
}
}

private function dispatchDossierEsabora(Affectation $affectation): void
private function dispatchDossier(Affectation $affectation): void
{
$partner = $affectation->getPartner();
if ($partner->getEsaboraToken() && $partner->getEsaboraUrl() && $partner->isEsaboraActive()) {
if ($partner->canSyncWithEsabora() || $partner->canSyncWithOilhi()) {
$affectation->setIsSynchronized(true);
$this->affectationManager->save($affectation);
$this->esaboraBus->dispatch($affectation);
$this->interconnectionBus->dispatch($affectation);
}
}
}
7 changes: 7 additions & 0 deletions src/DataFixtures/Files/Affectation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,10 @@ affectations:
answered_by: "admin-03@histologe.fr"
affected_by: "admin-03@histologe.fr"
territory: "Bouches-du-Rhône"
-
signalement: 2024-01
partner: "partenaire-62-01@histologe.fr"
statut: 0
answered_by: "admin-01@histologe.fr"
affected_by: "admin-01@histologe.fr"
territory: "Pas-de-Calais"
22 changes: 22 additions & 0 deletions src/DataFixtures/Files/Intervention.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,25 @@ interventions:
user: "user-69-05@histologe.fr"
partner: "partenaire-05-69@histologe.fr"
status: 'PLANNED'
-
signalement: "2024-01"
partner: "partenaire-62-01@histologe.fr"
user: "user-62-01@histologe.fr"
scheduled_at: '2023-07-01 10:00:00'
status: 'DONE'
documents: [ 'blank-64969c273a28a.jpg' ]
details: "<p>dossier envoyé pour manquement sanitaire</p>"
conclude_procedure: [ 'RSD']
occupant_present: 1
proprietaire_present: 0
-
signalement: "2024-02"
partner: "partenaire-62-01@histologe.fr"
user: "user-62-01@histologe.fr"
scheduled_at: '2023-07-01 10:00:00'
status: 'DONE'
documents: [ 'blank-64969c273a28a.jpg' ]
details: "<p>dossier envoyé pour manquement sanitaire</p>"
conclude_procedure: [ 'RSD' ]
occupant_present: 1
proprietaire_present: 0
89 changes: 88 additions & 1 deletion src/DataFixtures/Files/NewSignalement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,91 @@ signalements:
- "desordres_logement_securite_sol_dangereux_pieces_piece_a_vivre"
- "desordres_logement_securite_balcons_pieces_salle_de_bain"
- "desordres_logement_securite_plomb_pieces_salle_de_bain_diagnostique_oui"

-
territory: "Pas-de-Calais"
uuid: "00000000-0000-0000-2024-000000000002"
reference: "2024-02"
details: "Ma maison avait l'air bien, mais en fait c'est une véritable passoire."
is_proprio_averti: 1
is_allocataire: "0"
nature_logement: "maison"
type_logement: "MAISON"
superficie: 67
loyer: null
date_entree: "2020-12-01"
nom_proprio: "Habitat-PDC"
is_logement_social: 0
nom_occupant: "Mamère"
prenom_occupant: "Nawell"
hmeneuvrier marked this conversation as resolved.
Show resolved Hide resolved
tel_occupant: "+330240556677"
phone_number: "+330240556677"
mail_occupant: "nawell@yopmail.com"
adresse_occupant: "47 Rue du Général Chanzy"
cp_occupant: "62100"
ville_occupant: "Calais"
statut: 1
geoloc: "{\"lat\": 50.94877, \"lng\": 1.85867}"
mode_contact_proprio: "[]"
insee_occupant: "62193"
nb_pieces_logement: 5
nb_occupants_logement: 4
score: 35.194711538462
created_from_uuid: '00000000-0000-0000-2023-locataire003'
profile_declarant: "LOCATAIRE"
civilite_occupant: "mme"
type_composition_logement: "{\"bail_dpe_dpe\": \"oui\", \"bail_dpe_bail\": \"oui\", \"type_logement_rdc\": null, \"type_logement_nature\": \"maison\", \"bail_dpe_etat_des_lieux\": \"oui\", \"bail_dpe_date_emmenagement\": \"2019-12-01\", \"type_logement_commodites_wc\": \"oui\", \"type_logement_dernier_etage\": null, \"composition_logement_enfants\": \"oui\", \"composition_logement_hauteur\": \"oui\", \"composition_logement_nb_pieces\": \"5\", \"composition_logement_superficie\": \"67\", \"type_logement_commodites_cuisine\": \"oui\", \"composition_logement_piece_unique\": \"plusieurs_pieces\", \"type_logement_commodites_wc_cuisine\": \"non\", \"type_logement_sous_sol_sans_fenetre\": null, \"composition_logement_nombre_personnes\": \"4\", \"type_logement_commodites_salle_de_bain\": \"oui\", \"type_logement_commodites_wc_collective\": null, \"type_logement_sous_comble_sans_fenetre\": null, \"type_logement_commodites_piece_a_vivre_9m\": \"oui\", \"type_logement_commodites_cuisine_collective\": null, \"type_logement_commodites_salle_de_bain_collective\": null}"
situation_foyer: "{\"logement_social_allocation\": \"non\", \"logement_social_date_naissance\": null, \"logement_social_allocation_caisse\": null, \"travailleur_social_accompagnement\": \"non\", \"logement_social_demande_relogement\": \"non\", \"logement_social_montant_allocation\": null, \"logement_social_numero_allocataire\": null, \"travailleur_social_quitte_logement\": \"non\", \"travailleur_social_accompagnement_declarant\": null}"
information_procedure: "{\"utilisation_service_ok_visite\": true, \"info_procedure_bailleur_prevenu\": \"oui\", \"info_procedure_reponse_assurance\": null, \"info_procedure_assurance_contactee\": \"non\", \"info_procedure_depart_apres_travaux\": \"oui\", \"utilisation_service_ok_demande_logement\": true, \"utilisation_service_ok_prevenir_bailleur\": true}"
information_complementaire: "{\"informations_complementaires_logement_montant_loyer\": null, \"informations_complementaires_logement_nombre_etages\": null, \"informations_complementaires_logement_annee_construction\": null, \"informations_complementaires_situation_bailleur_revenu_fiscal\": null, \"informations_complementaires_situation_occupants_loyers_payes\": null, \"informations_complementaires_situation_bailleur_date_naissance\": null, \"informations_complementaires_situation_occupants_date_naissance\": null, \"informations_complementaires_situation_occupants_preavis_depart\": null, \"informations_complementaires_situation_bailleur_beneficiaire_fsl\": null, \"informations_complementaires_situation_bailleur_beneficiaire_rsa\": null, \"informations_complementaires_situation_occupants_beneficiaire_fsl\": null, \"informations_complementaires_situation_occupants_beneficiaire_rsa\": null, \"informations_complementaires_situation_occupants_date_emmenagement\": null, \"informations_complementaires_situation_occupants_demande_relogement\": null}"
score_logement: 13.990384615385
score_batiment: 50
created_at: "2024-01-11 14:00"
desordre_categorie:
- "Usage / entretien"
- "Etanchéité / isolation"
- "Sécurite risques particuliers"
- "Structure du bâti"
- "Aération / humidité"
- "Chauffage / confort"
desordre_critere:
- "desordres_batiment_proprete_interieur"
- "desordres_batiment_proprete_facades"
- "desordres_batiment_isolation_murs"
- "desordres_batiment_isolation_porte_fenetres"
- "desordres_batiment_isolation_dernier_etage_toit"
- "desordres_batiment_isolation_infiltration_eau"
- "desordres_batiment_maintenance_petites_reparations"
- "desordres_batiment_securite_elements_toit"
- "desordres_batiment_securite_toit"
- "desordres_batiment_securite_murs_fissures"
- "desordres_batiment_securite_balcons"
- "desordres_batiment_incendie_odeur_gaz"
- "desordres_logement_aeration_aucune_aeration"
- "desordres_logement_chauffage_details_fenetres_permeables"
- "desordres_logement_chauffage_details_difficultes_chauffage"
desordre_precision:
- "desordres_batiment_proprete_interieur"
- "desordres_batiment_proprete_facades"
- "desordres_batiment_isolation_murs"
- "desordres_batiment_isolation_porte_fenetres"
- "desordres_batiment_isolation_dernier_etage_toit_sous_toit_oui"
- "desordres_batiment_isolation_infiltration_eau_au_sol_oui"
- "desordres_batiment_maintenance_petites_reparations"
- "desordres_batiment_securite_elements_toit"
- "desordres_batiment_securite_toit"
- "desordres_batiment_securite_murs_fissures_details_mur_porteur_oui"
- "desordres_batiment_securite_balcons"
- "desordres_batiment_incendie_odeur_gaz"
- "desordres_logement_aeration_aucune_aeration_pieces_salle_de_bain"
- "desordres_logement_chauffage_details_fenetres_permeables_pieces_cuisine"
- "desordres_logement_chauffage_details_difficultes_chauffage_pieces_piece_a_vivre"
- "desordres_logement_chauffage_details_difficultes_chauffage_pieces_cuisine"
- "desordres_logement_humidite_piece_a_vivre_details_machine_non"
- "desordres_logement_humidite_piece_a_vivre_details_moisissure_apres_nettoyage_oui"
- "desordres_logement_humidite_piece_a_vivre_details_fuite_non"
- "desordres_logement_securite_sol_dangereux_pieces_piece_a_vivre"
- "desordres_logement_securite_balcons_pieces_salle_de_bain"
- "desordres_logement_securite_plomb_pieces_salle_de_bain_diagnostique_oui"
qualifications:
- "RSD"
- "NON_DECENCE"
13 changes: 13 additions & 0 deletions src/DataFixtures/Files/Partner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -436,3 +436,16 @@ partners:
insee: "[\"\"]"
territory: "Isère"
type: "DDT_M"
-
nom: "Partenaire 62-01"
email: "partenaire-62-01@histologe.fr"
is_archive: 0
insee: "[\"\"]"
hmeneuvrier marked this conversation as resolved.
Show resolved Hide resolved
territory: "Pas-de-Calais"
type: "COMMUNE_SCHS"
competence:
- 'ACCOMPAGNEMENT_SOCIAL'
- 'ACCOMPAGNEMENT_TRAVAUX'
- 'FSL'
- 'VISITES'
sfinx13 marked this conversation as resolved.
Show resolved Hide resolved
- 'RSD'
38 changes: 38 additions & 0 deletions src/DataFixtures/Files/Signalement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1707,3 +1707,41 @@ signalements:
type_energie_logement: "Electrique"
mode_contact_proprio: "[\"\",\"t\\u00e9l\\u00e9phone\"]"
is_imported: true
-
uuid: "00000000-0000-0000-2024-000000000001"
details: "Actuellement locataire, j'attire votre attention sur certaines conditions de non-décence et de confort qui affectent ma qualité de vie quotidienne."
is_proprio_averti: 1
is_logement_social: 0
nb_adultes: "2"
nb_enfants_m6: "0"
nb_enfants_p6: "2"
is_allocataire: ""
nature_logement: "maison"
superficie: 100
phone_number: 0621127286
adresse_occupant: "12 Ruelle du Touquet"
cp_occupant: "62157"
ville_occupant: "ALLOUAGNE"
statut: 2
reference: "2024-01"
geoloc: "{\"lng\":\"50.532118\", \"lat\":\"2.51608\"}"
created_at: "2024-01-01 16:06:33"
score: 0
insee_occupant: "62023"
is_rsa: 0
nb_occupants_logement: 4
territory: "Pas-de-Calais"
mode_contact_proprio: "[\"\",\"t\\u00e9l\\u00e9phone\"]"
situations:
- "le confort du logement"
criteres:
- "De l’air s’infiltre dans mon logement."
- "Mes factures de chauffage sont anormalement élevées."
- "Mon logement est mal isolé."
criticites:
- "Infiltration ou fuite d'air dans plus de deux des éléments suivants : toit, charpente, façades, murs extérieurs. Sensation de courant d'air régulière ou très fréquente."
- "Ma facture est trop élevée et le chauffage est limité dans le logement."
- "Le DPE indique une étiquette énergie F ou G ou n’a pas été fait. J’ai tout le temps la sensation d'avoir froid en hiver et/ou très chaud en été."
qualifications:
- "RSD"
- "NON_DECENCE"
8 changes: 7 additions & 1 deletion src/DataFixtures/Files/SignalementDraft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ signalements_draft:
email_declarant: 'locataire-03@histologe.fr'
payload: 'locataire.json'
status: 'EN_SIGNALEMENT'
-
uuid: '00000000-0000-0000-2024-locataire001'
profile_declarant: 'LOCATAIRE'
email_declarant: 'locataire-03@histologe.fr'
payload: 'locataire.json'
status: 'EN_SIGNALEMENT'
-
uuid: '00000000-0000-0000-2023-bailleuroc01'
profile_declarant: 'BAILLEUR_OCCUPANT'
Expand Down Expand Up @@ -54,4 +60,4 @@ signalements_draft:
uuid: '00000000-0000-0000-2023-secours00002'
profile_declarant: 'SERVICE_SECOURS'
email_declarant: 'service_secours-02@histologe.fr'
payload: 'step/validation_signalement/service_secours.json'
payload: 'step/validation_signalement/service_secours.json'
2 changes: 1 addition & 1 deletion src/DataFixtures/Files/Territory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ territories:
-
zip: "62"
name: "Pas-de-Calais"
is_active: 0
is_active: 1
sfinx13 marked this conversation as resolved.
Show resolved Hide resolved
bbox: "{\"n\":\"51.006774\",\"s\":\"50.01976\",\"e\":\"3.188186\",\"w\":\"1.555598\"}"
-
zip: "63"
Expand Down
16 changes: 16 additions & 0 deletions src/DataFixtures/Files/User.yml
Original file line number Diff line number Diff line change
Expand Up @@ -364,3 +364,19 @@ users:
statut: 1
is_generique: 0
is_mailing_active: 0
-
email: admin-territoire-62-01@histologe.fr
roles: "[\"ROLE_ADMIN_TERRITORY\"]"
partner: "Partenaire 62-01"
statut: 1
is_generique: 0
is_mailing_active: 1
territory: "Pas-de-Calais"
-
email: user-62-01@histologe.fr
roles: "[\"ROLE_USER_PARTNER\"]"
partner: "Partenaire 62-01"
statut: 1
is_generique: 0
is_mailing_active: 1
territory: "Pas-de-Calais"
10 changes: 9 additions & 1 deletion src/DataFixtures/Loader/LoadPartnerData.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ public function loadPartner(ObjectManager $manager, array $row): void
}

if (isset($row['competence'])) {
$partner->setCompetence([Qualification::tryFrom($row['competence'])]);
$competences = [];
if (\is_array($row['competence'])) {
foreach ($row['competence'] as $competence) {
$competences[] = Qualification::tryFrom($competence);
}
} else {
$competences[] = Qualification::tryFrom($row['competence']);
}
$partner->setCompetence($competences);
}

$manager->persist($partner);
Expand Down
Loading
Loading