44import cn .cordys .aspectj .constants .LogModule ;
55import cn .cordys .aspectj .constants .LogType ;
66import cn .cordys .aspectj .context .OperationLogContext ;
7+ import cn .cordys .aspectj .dto .LogContextInfo ;
78import cn .cordys .aspectj .dto .LogDTO ;
89import cn .cordys .common .constants .BusinessModuleField ;
910import cn .cordys .common .constants .FormKey ;
@@ -593,14 +594,17 @@ public ResourceTabEnableDTO getTabEnableConfig(String userId, String orgId) {
593594 * @param request
594595 * @param userId
595596 */
597+ @ OperationLog (module = LogModule .CONTRACT_INDEX , type = LogType .UPDATE , resourceId = "{#request.id}" )
596598 public void updateStage (ContractStageRequest request , String userId , String orgId ) {
597599 Contract contract = contractMapper .selectByPrimaryKey (request .getId ());
598600 if (contract == null ) {
599601 throw new GenericException (Translator .get ("contract.not.exist" ));
600602 }
601603
602- Map <String , String > oldMap = new HashMap <>();
603- oldMap .put ("contractStage" , Translator .get ("contract.stage." + contract .getStage ().toLowerCase ()));
604+ List <StageConfigResponse > stageConfigList = extContractStageConfigMapper .getStageConfigList (orgId );
605+
606+ Map <String , String > stageMap = stageConfigList .stream ()
607+ .collect (Collectors .toMap (StageConfigResponse ::getId , StageConfigResponse ::getName ));
604608
605609 contract .setStage (request .getStage ());
606610 if (StringUtils .isNotBlank (request .getVoidReason ())) {
@@ -613,20 +617,25 @@ public void updateStage(ContractStageRequest request, String userId, String orgI
613617
614618 updateStatusSnapshot (request .getId (), request .getStage (), null );
615619
616- LogDTO logDTO = new LogDTO (orgId , request .getId (), userId , LogType .UPDATE , LogModule .CONTRACT_INDEX , contract .getName ());
617- Map <String , String > newMap = new HashMap <>();
618- newMap .put ("contractStage" , Translator .get ("contract.stage." + request .getStage ().toLowerCase ()));
619- logDTO .setOriginalValue (oldMap );
620- logDTO .setModifiedValue (newMap );
621- logService .add (logDTO );
622-
623620 if (Strings .CI .equals (request .getStage (), ContractStage .VOID .name ()) || Strings .CI .equals (request .getStage (), ContractStage .ARCHIVED .name ())) {
624621 String event = Strings .CI .equals (request .getStage (), ContractStage .VOID .name ()) ?
625622 NotificationConstants .Event .CONTRACT_VOID : NotificationConstants .Event .CONTRACT_ARCHIVED ;
626623 Customer customer = customerBaseMapper .selectByPrimaryKey (contract .getCustomerId ());
627624 sendNotice (contract , userId , orgId , event , customer .getName ());
628625 }
629626
627+ final Map <String , String > originalVal = new HashMap <>(1 );
628+ originalVal .put ("contractStage" , stageMap .get (contract .getStage ()));
629+ final Map <String , String > modifiedVal = new HashMap <>(1 );
630+ modifiedVal .put ("contractStage" , stageMap .get (request .getStage ()));
631+ OperationLogContext .setContext (
632+ LogContextInfo .builder ()
633+ .resourceName (contract .getName ())
634+ .originalValue (originalVal )
635+ .modifiedValue (modifiedVal )
636+ .build ()
637+ );
638+
630639 }
631640
632641 /**
0 commit comments